audio

package
v0.0.0-...-3c2d035 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: Apache-2.0 Imports: 9 Imported by: 31

Documentation

Overview

Package audio implements the Sigourney audio engine.

Index

Constants

View Source
const (
	FrameLength = 256 * nChannels
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Clip

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

func NewClip

func NewClip() *Clip

func (*Clip) Input

func (s *Clip) Input(name string, p Processor)

func (*Clip) Inputs

func (s *Clip) Inputs() []string

func (*Clip) Process

func (c *Clip) Process(s []Sample)

type Delay

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

func NewDelay

func NewDelay() *Delay

func (*Delay) Input

func (s *Delay) Input(name string, p Processor)

func (*Delay) Inputs

func (s *Delay) Inputs() []string

func (*Delay) Process

func (d *Delay) Process(s []Sample)

type Dup

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

Dup splits a Processor into multiple audio streams.

func NewDup

func NewDup(src Processor) *Dup

func (*Dup) Output

func (d *Dup) Output() *Output

Output creates and returns a new Output Processor. Each Output should be Closed when it is no longer in use.

func (*Dup) SetSource

func (d *Dup) SetSource(p Processor)

SetSource changes the source Processor.

func (*Dup) Tick

func (d *Dup) Tick()

type Engine

type Engine struct {
	sync.Mutex // Must be held while mutating the Processor graph.
	// contains filtered or unexported fields
}

Engine implements the root of an Processor graph.

func NewEngine

func NewEngine() *Engine

func (*Engine) AddTicker

func (e *Engine) AddTicker(t Ticker)

func (*Engine) Input

func (s *Engine) Input(name string, p Processor)

func (*Engine) Inputs

func (s *Engine) Inputs() []string

func (*Engine) Process

func (e *Engine) Process() []Sample

func (*Engine) RemoveTicker

func (e *Engine) RemoveTicker(t Ticker)

func (*Engine) Render

func (e *Engine) Render(frames int) []Sample

func (*Engine) Start

func (e *Engine) Start() error

func (*Engine) Stop

func (e *Engine) Stop() error

type Env

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

func NewEnv

func NewEnv() *Env

func (*Env) Input

func (s *Env) Input(name string, p Processor)

func (*Env) Inputs

func (s *Env) Inputs() []string

func (*Env) Process

func (e *Env) Process(s []Sample)

type Filter

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

func NewFilter

func NewFilter() *Filter

func (*Filter) Input

func (s *Filter) Input(name string, p Processor)

func (*Filter) Inputs

func (s *Filter) Inputs() []string

func (*Filter) Process

func (f *Filter) Process(s []Sample)

type Mul

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

func NewMul

func NewMul() *Mul

func (*Mul) Input

func (s *Mul) Input(name string, p Processor)

func (*Mul) Inputs

func (s *Mul) Inputs() []string

func (*Mul) Process

func (a *Mul) Process(s []Sample)

type MulSum

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

func NewMulSum

func NewMulSum() *MulSum

func (*MulSum) Input

func (s *MulSum) Input(name string, p Processor)

func (*MulSum) Inputs

func (s *MulSum) Inputs() []string

func (*MulSum) Process

func (m *MulSum) Process(s []Sample)

type Noise

type Noise struct {
}

func NewNoise

func NewNoise() *Noise

func (*Noise) Process

func (p *Noise) Process(s []Sample)

type Output

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

An Output is a Processor endpoint provided by Dup.

func (*Output) Close

func (o *Output) Close()

func (*Output) Process

func (o *Output) Process(p []Sample)

type Processor

type Processor interface {
	Process(buffer []Sample)
}

Processor implements an audio source.

As with io.Reader, the caller passes a buffer (or "frame") to the Processor and the Processor populates the buffer with sample data. Unlike io.Reader, the Processor must populate the entire buffer.

While audio is being generated and the Processor is active, its Process method will be called for each audio frame in the stream, so the Processor may use on the number of Process calls to maintain its internal state.

type Quant

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

func NewQuant

func NewQuant() *Quant

func (*Quant) Input

func (s *Quant) Input(name string, p Processor)

func (*Quant) Inputs

func (s *Quant) Inputs() []string

func (*Quant) Process

func (q *Quant) Process(s []Sample)

type Rand

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

func NewRand

func NewRand() *Rand

func (*Rand) Input

func (s *Rand) Input(name string, p Processor)

func (*Rand) Inputs

func (s *Rand) Inputs() []string

func (*Rand) Process

func (r *Rand) Process(s []Sample)

type Sample

type Sample float64

A Sample is a single frame of audio.

type Sin

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

func NewSin

func NewSin() *Sin

func (*Sin) Input

func (s *Sin) Input(name string, p Processor)

func (*Sin) Inputs

func (s *Sin) Inputs() []string

func (*Sin) Process

func (o *Sin) Process(s []Sample)

type Sink

type Sink interface {
	// Input attaches the given Processor to the specified named input.
	Input(name string, p Processor)

	// Inputs enumerates the Sink's named inputs.
	Inputs() []string
}

A Sink is a consumer of audio data with one or more named inputs.

type Skip

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

func NewSkip

func NewSkip() *Skip

func (*Skip) Input

func (s *Skip) Input(name string, p Processor)

func (*Skip) Inputs

func (s *Skip) Inputs() []string

func (*Skip) Process

func (s *Skip) Process(b []Sample)

type Step

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

func NewStep

func NewStep() *Step

func (*Step) Input

func (s *Step) Input(name string, p Processor)

func (*Step) Inputs

func (s *Step) Inputs() []string

func (*Step) Process

func (s *Step) Process(b []Sample)

type Sum

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

func NewSum

func NewSum() *Sum

func (*Sum) Input

func (s *Sum) Input(name string, p Processor)

func (*Sum) Inputs

func (s *Sum) Inputs() []string

func (*Sum) Process

func (s *Sum) Process(a []Sample)

type TableOsc

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

func NewBandLimitedSaw

func NewBandLimitedSaw() *TableOsc

func NewBandLimitedSquare

func NewBandLimitedSquare() *TableOsc

func NewBandLimitedTriangle

func NewBandLimitedTriangle() *TableOsc

func NewTableOsc

func NewTableOsc(table []float64) *TableOsc

func (*TableOsc) Input

func (s *TableOsc) Input(name string, p Processor)

func (*TableOsc) Inputs

func (s *TableOsc) Inputs() []string

func (*TableOsc) Process

func (w *TableOsc) Process(s []Sample)

type Ticker

type Ticker interface {
	Tick()
}

A Ticker is a Processor whose Tick method is called once per audio frame.

Each Ticker should be registered with the Engine using AddTicker on creation, and similarly removed with RemoveTicker on destruction.

type Value

type Value Sample

func (Value) Process

func (v Value) Process(s []Sample)

Jump to

Keyboard shortcuts

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