transcoder

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPassThrough

func NewPassThrough(chunks <-chan pkg.AudioChunk) text_to_speech.Transcoder

Types

type Linear16ToOpus

type Linear16ToOpus struct {
	// contains filtered or unexported fields
}

Linear16ToOpus converts Linear16 (little‑endian 16‑bit PCM) to Opus in real time. Pointers returned by Packets() remain valid only until the next read — copy if you need to keep them.

func (*Linear16ToOpus) Chunks

func (s *Linear16ToOpus) Chunks() <-chan pkg.AudioChunk

Chunks yields encoded Opus packets. Close when Run() returns.

func (*Linear16ToOpus) Clear

func (s *Linear16ToOpus) Clear()

func (*Linear16ToOpus) Err

func (s *Linear16ToOpus) Err() <-chan error

Err returns a channel with the first terminal error.

type Linear16ToOpusBuilder

type Linear16ToOpusBuilder struct {
	// contains filtered or unexported fields
}

func NewLinear16ToOpusBuilder

func NewLinear16ToOpusBuilder(sampleRate, channels int, opts *Linear16ToOpusOptions) (*Linear16ToOpusBuilder, error)

NewLinear16ToOpusBuilder builds a transcoder builder.

func (*Linear16ToOpusBuilder) BuildAndRunTranscoder

func (b *Linear16ToOpusBuilder) BuildAndRunTranscoder(src <-chan pkg.AudioChunk) text_to_speech.Transcoder

BuildAndRunTranscoder starts transcoding and blocks until ctx.Done() or a fatal error.

type Linear16ToOpusOptions

type Linear16ToOpusOptions struct {
	FrameDuration time.Duration
	BufferMillis  int
	Application   opus.Application
}

Linear16ToOpusOptions tweaks behaviour. Zero values are sensible.

  • FrameDuration — Opus frame size (2.5‑60 ms). 20 ms is good for VoIP.
  • BufferMillis — depth of the internal jitter buffer in milliseconds.
  • Application — opus.AppVoIP (default), opus.AppAudio, opus.AppRestrictedLowDelay.

type PassThrough

type PassThrough struct {
	// contains filtered or unexported fields
}

func (*PassThrough) Chunks

func (t *PassThrough) Chunks() <-chan pkg.AudioChunk

func (*PassThrough) Clear

func (t *PassThrough) Clear()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL