audio

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: MIT Imports: 9 Imported by: 1

README

Audio

PkgGoDev Go Report Card Test codecov

Package audio provides higher-level abstractions for audio signal manipulations.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDifferentSampleRates is returned when signals with different
	// sample rates are sinked into mixer.
	ErrDifferentSampleRates = errors.New("sinking different sample rates")
	// ErrDifferentChannels is returned when signals with different number
	// of channels are sinked into mixer.
	ErrDifferentChannels = errors.New("sinking different channels")
)

Functions

func Source

Source implements signal source for any signal type.

Types

type Asset

type Asset struct {
	signal.Signal
	// contains filtered or unexported fields
}

Asset is a sink which uses a regular buffer as underlying storage. It can be used to slice signal data and use it as processing input. It's possible to use an arbitrary signal type as a buffer. Float64 is used by default.

func (*Asset) SampleRate

func (a *Asset) SampleRate() signal.Frequency

SampleRate returns a sample rate of the asset.

func (*Asset) Sink

func (a *Asset) Sink() (result pipe.SinkAllocatorFunc)

Sink uses signal.Floating buffer to store signal data.

type Mixer

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

Mixer summs up multiple signals. It has multiple sinks and a single source.

func (*Mixer) Sink

func (m *Mixer) Sink() pipe.SinkAllocatorFunc

Sink provides mixer sink allocator. Mixer sink receives a signal for mixing. Multiple sinks per mixer is allowed.

func (*Mixer) Source

func (m *Mixer) Source() pipe.SourceAllocatorFunc

Source provides mixer source allocator. Mixer source outputs mixed signal. Only single source per mixer is allowed. Must be called after Sink, otherwise will panic.

type Repeater

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

Repeater sinks the signal and sources it to multiple pipelines.

func (*Repeater) Sink

func (r *Repeater) Sink() pipe.SinkAllocatorFunc

Sink must be called once per repeater.

func (*Repeater) Source

func (r *Repeater) Source() pipe.SourceAllocatorFunc

Source must be called at least once per repeater.

type Track

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

Track is a sequence of pipes which are executed one after another.

func (*Track) AddClip

func (t *Track) AddClip(at int, data signal.Signal)

AddClip to the track. If clip has no asset or zero length, it won't be added to the track. Overlapped clips are realigned.

func (*Track) Source

func (t *Track) Source(sampleRate signal.Frequency, start, end int) pipe.SourceAllocatorFunc

Source implements track source with a sequence of not overlapped clips.

Directories

Path Synopsis
fileformat module
flac module
mp3 module
portaudio module
vst2 module
wav module

Jump to

Keyboard shortcuts

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