Documentation ¶
Overview ¶
Package unit provides built-in units for synthesis.
Index ¶
- func Builders() map[string]Builder
- func Patch(g *graph.Graph, out Output, in *In) error
- func PrepareBuilders(builders map[string]IOBuilder) map[string]Builder
- func Unpatch(g *graph.Graph, in *In) error
- type Builder
- type CondProcessor
- type Config
- type FrameProcessor
- type IO
- func (io *IO) ExposeOutputProcessor(o OutputProcessor)
- func (io *IO) NewIn(name string, v dsp.Valuer) *In
- func (io *IO) NewOut(name string) *Out
- func (io *IO) NewOutWithFrame(name string, f []float64) *Out
- func (io *IO) NewProp(name string, v interface{}, setter func(*Prop, interface{}) error) *Prop
- type IOBuilder
- type In
- func (in *In) Couple(out Output)
- func (in *In) ExternalNeighborCount() int
- func (in *In) Fill(v dsp.Valuer)
- func (in *In) HasSource() bool
- func (in *In) Read(i int) float64
- func (in *In) ReadSlow(i int, f func(float64) float64) float64
- func (in *In) ReadSlowInt(i int, f func(float64) int) int
- func (in *In) Reset()
- func (in *In) String() string
- func (in *In) Write(i int, v float64)
- type InMode
- type InvalidPropValueError
- type Out
- type OutRef
- type Output
- type OutputProcessor
- type Prop
- type PropSetterFunc
- type Rate
- type SampleProcessor
- type Unit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Patch ¶
Patch connects a one Unit's Out to another's In. It also creates an edge on a graph to track the connection.
func PrepareBuilders ¶
PrepareBuilders converts a set of IOBuilders to a set of Builders.
Types ¶
type CondProcessor ¶
type CondProcessor interface {
IsProcessable() bool
}
CondProcessor informs another party whether or not it should be processed.
type FrameProcessor ¶
type FrameProcessor interface {
ProcessFrame(n int)
}
FrameProcessor processes a block of samples of a given size.
type IO ¶
type IO struct {
ID, Type string
Prop map[string]*Prop
In map[string]*In
Out map[string]Output
// contains filtered or unexported fields
}
IO is the registry of inputs, outputs and properties for a Module
func (*IO) ExposeOutputProcessor ¶
func (io *IO) ExposeOutputProcessor(o OutputProcessor)
ExposeOutputProcessor registers a new output that is also a Processor
func (*IO) NewOutWithFrame ¶
NewOutWithFrame registers a new output that has a specific frame
type IOBuilder ¶
IOBuilder provides an IO, containing identifying information, for a Unit to be constructed around.
type In ¶
In is a unit input
func (*In) Couple ¶
Couple assigns the internal frame of this input to the frame of an output; binding them together. This in-of-itself does not define the connection. That is controlled by the the Nodes and Graph.
func (*In) ExternalNeighborCount ¶
ExternalNeighborCount returns the count of neighboring nodes outside of the parent Unit
func (*In) ReadSlowInt ¶
ReadSlowInt reads a specific sample from the input frame at a slow rate
type InvalidPropValueError ¶
type InvalidPropValueError struct { Prop *Prop Value interface{} }
InvalidPropValueError is an error that indicates a Prop cannot handle a value that's been given to it
func (InvalidPropValueError) Error ¶
func (e InvalidPropValueError) Error() string
type Out ¶
type Out struct { Name string // contains filtered or unexported fields }
Out is a unit output
func (*Out) DestinationCount ¶
DestinationCount returns the number of outbound connections to this output
func (*Out) ExternalNeighborCount ¶
ExternalNeighborCount returns the count of neighboring nodes outside of the parent Unit
type Output ¶
type Output interface {
Out() *Out
}
Output is an abstract Out provider. Allows us to wrap an Out in some other behavior if we choose to. Out itself implements this interface.
type OutputProcessor ¶
type OutputProcessor interface { Output SampleProcessor FrameProcessor }
OutputProcessor is an output that can be ticked by the engine.
type Prop ¶
type Prop struct {
// contains filtered or unexported fields
}
Prop is a module property
type PropSetterFunc ¶
PropSetterFunc is a function that will be used when setting the value of a Prop. It provides Modules a point a control for the values that are given to its Props.
type SampleProcessor ¶
type SampleProcessor interface {
ProcessSample(i int)
}
SampleProcessor processes a single sample of signal.
type Unit ¶
type Unit struct { *IO SampleProcessor // contains filtered or unexported fields }
Unit is a synthesizer unit
func NewUnit ¶
func NewUnit(io *IO, p SampleProcessor) *Unit
NewUnit creates a new Unit that defaults to audio rate.
func (*Unit) Close ¶
Close closes the Processor if it is an io.Closer. It also closes any Outs that it has.
func (*Unit) ExternalNeighborCount ¶
ExternalNeighborCount returns the count of neighboring nodes outside of the Unit
func (*Unit) IsProcessable ¶
IsProcessable determines whether or not this Unit's ProcessFrame method should be called by the engine
func (*Unit) ProcessFrame ¶
ProcessFrame calculates a block of samples.
Source Files ¶
- adjust.go
- adsr.go
- binary.go
- builders.go
- center.go
- chance.go
- chebyshev.go
- clip.go
- clock.go
- clock_div.go
- clock_mult.go
- cluster.go
- cond.go
- count.go
- crossfade.go
- crossfeed.go
- debug.go
- decimate.go
- delay.go
- demux.go
- dynamics.go
- euclid.go
- filter.go
- fold.go
- gate.go
- gate_mix.go
- gate_series.go
- gen.go
- graph.go
- in.go
- interpolate.go
- io.go
- lag.go
- latch.go
- logic.go
- low_gen.go
- midi_to_hz.go
- mix.go
- morph.go
- mux.go
- out.go
- overload.go
- pan.go
- pan_mix.go
- pitch.go
- prop.go
- quantize.go
- random_series.go
- rcd.go
- reverb.go
- shift.go
- slope.go
- smooth.go
- stages.go
- switch.go
- toggle.go
- transpose.go
- transpose_interval.go
- unary.go
- unit.go
- val_to_gate.go
- wav_sample.go