audio

package
v0.8.17 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 11 Imported by: ? modules, 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 AudioFramesFromFile added in v0.0.15

func AudioFramesFromFile(path string, options AudioFramesFromFileOptions) ([]*model.AudioFrame, error)

func CalculateAudioDuration added in v0.0.15

func CalculateAudioDuration(frames []*model.AudioFrame) float64

func CalculateFrameDuration added in v0.0.15

func CalculateFrameDuration(frame *model.AudioFrame) float64

func ResampleAudioFrame added in v0.0.30

func ResampleAudioFrame(frame *model.AudioFrame, outputRate uint32) (*model.AudioFrame, error)

func SilenceFrame added in v0.0.15

func SilenceFrame(duration float64, sampleRate uint32, numChannels uint32) *model.AudioFrame

func SilenceFrameLike added in v0.0.15

func SilenceFrameLike(frame *model.AudioFrame) *model.AudioFrame

Types

type AudioArrayBuffer added in v0.0.15

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

func NewAudioArrayBuffer added in v0.0.15

func NewAudioArrayBuffer(bufferSize int, sampleRate uint32) *AudioArrayBuffer

func (*AudioArrayBuffer) Len added in v0.0.15

func (b *AudioArrayBuffer) Len() int

func (*AudioArrayBuffer) PushFrame added in v0.0.15

func (b *AudioArrayBuffer) PushFrame(frame *model.AudioFrame) (int, error)

func (*AudioArrayBuffer) Read added in v0.0.15

func (b *AudioArrayBuffer) Read() []int16

func (*AudioArrayBuffer) Reset added in v0.0.15

func (b *AudioArrayBuffer) Reset()

func (*AudioArrayBuffer) Shift added in v0.0.15

func (b *AudioArrayBuffer) Shift(size int)

type AudioByteStream

type AudioByteStream struct {
	SampleRate        uint32
	NumChannels       uint32
	SamplesPerChannel uint32
	// contains filtered or unexported fields
}

AudioByteStream groups small audio frames into larger ones for processing

func NewAudioByteStream

func NewAudioByteStream(sampleRate, numChannels, samplesPerChannel uint32) *AudioByteStream

func NewAudioByteStreamWithOptions added in v0.0.15

func NewAudioByteStreamWithOptions(sampleRate, numChannels, samplesPerChannel uint32, options AudioByteStreamOptions) *AudioByteStream

func (*AudioByteStream) Clear added in v0.0.15

func (s *AudioByteStream) Clear()

func (*AudioByteStream) Flush

func (s *AudioByteStream) Flush() []*model.AudioFrame

func (*AudioByteStream) Push

func (s *AudioByteStream) Push(data []byte) []*model.AudioFrame

func (*AudioByteStream) Write added in v0.0.15

func (s *AudioByteStream) Write(data []byte) []*model.AudioFrame

type AudioByteStreamOptions added in v0.0.15

type AudioByteStreamOptions struct {
	Progressive bool
}

type AudioFrame added in v0.0.15

type AudioFrame = model.AudioFrame

type AudioFramesFromFileOptions added in v0.0.15

type AudioFramesFromFileOptions struct {
	SampleRate  int
	NumChannels int
	DecoderType codecs.DecoderType
}

type FrameProcessor added in v0.4.6

type FrameProcessor interface {
	Process(ctx context.Context, frame *model.AudioFrame) ([]*model.AudioFrame, error)

	Reset()

	Close() error
}

type StreamingResampler added in v0.4.2

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

StreamingResampler preserves interpolation state across frame boundaries. Create one per continuous audio segment and call Flush at the segment end.

func NewStreamingResampler added in v0.4.2

func NewStreamingResampler(inputRate, outputRate, channels uint32) (*StreamingResampler, error)

func (*StreamingResampler) Flush added in v0.4.2

func (r *StreamingResampler) Flush() *model.AudioFrame

func (*StreamingResampler) Push added in v0.4.2

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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