Documentation ¶
Overview ¶
Much of the magic here provided by https://github.com/brettbuddin/shaden/blob/master/unit/adsr.go
Index ¶
Constants ¶
const ( StageOff stage = iota StageAttack StageDecay StageSustain StageRelease )
These stages represent the different envelope stages.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock struct { Tempo *core.Knob // In beats per minute. // contains filtered or unexported fields }
A Clock synchronizes all modules connected to it by emitting a steady stream of ticks (96 ticks per beat).
type Envelope ¶
type Envelope struct {
// Knobs
CurveRatio, Attack, Decay, Sustain, Release *core.Knob
Trigger core.Signal
// contains filtered or unexported fields
}
An Envelope represents an ADSR envelope.
type Filter ¶
type Filter struct { Cutoff *core.Knob Input core.Signal Type FilterType // contains filtered or unexported fields }
func NewFilter ¶
func NewFilter(filterType FilterType) *Filter
type LFO ¶
type LFO struct { Osc Oscillator Shape WaveShape // contains filtered or unexported fields }
An LFO is a Low-Frequency Oscillator. It differs from the actual oscillator in that it allows for setting a floor and a ceiling.
type MIDIInput ¶
type MIDIInput struct { VolumeControl *constantStreamer FrequencyControl *constantStreamer }
A MIDIInput allows for live control of the synthesizer
func (*MIDIInput) UpdateFrequency ¶
UpdateFrequency returns the current oscillator frequency
func (*MIDIInput) UpdateVolume ¶
UpdateVolume returns the current oscillator volume
type Modulator ¶
type Modulator struct { Attenuator *core.Knob // From 0 to 1. InitialAmount *core.Knob ModulationRange *core.Knob }
The Modulator applies a modulation range to a signal. Returns InitialAmount + (Attenuator * ModulationRange).
func NewModulator ¶
NewModulator returns a new modulation source.
type Oscillator ¶
type Oscillator struct { Frequency *core.Knob // Note frequency (in Hz). Sine, Square, Saw, Triangle core.Signal // From -1 to 1 // contains filtered or unexported fields }
An Oscillator is a simple wave generator
type Sequencer ¶
type Sequencer struct { Clock core.Signal BeatsPerStep *core.Knob Gate *Gate Trigger *Trigger Sequence []float64 GateSequence []float64 // contains filtered or unexported fields }
A Sequencer loops through a frequency sequence at a pace dictated by the clock and outputs the corresponding frequencies.
type Trigger ¶
type Trigger struct {
ShouldTrigger bool
}
func NewTrigger ¶
func NewTrigger() *Trigger