Documentation ¶
Index ¶
- Constants
- Variables
- type AllForOne
- type Clip
- type Concat
- type Empty
- type File
- type Gain
- type HighPass
- type HoldModulator
- type Hz
- type LinearModulator
- type Loop
- type LowPass
- type Mix
- type Modulator
- type Mute
- type Node
- func (n Node) AddAllForOne() AllForOne
- func (n Node) AddClip(low float32, high float32) Clip
- func (n Node) AddConcat() Concat
- func (n Node) AddEmpty() Empty
- func (n Node) AddFile(path string) File
- func (n Node) AddGain(lvl float32) Gain
- func (n Node) AddHighPass(freq float32, q float32) HighPass
- func (n Node) AddLoop() Loop
- func (n Node) AddLowPass(freq float32, q float32) LowPass
- func (n Node) AddMix() Mix
- func (n Node) AddMute() Mute
- func (n Node) AddNoise(seed int) Noise
- func (n Node) AddPan(lvl float32) Pan
- func (n Node) AddPause() Pause
- func (n Node) AddSawtooth(freq Hz, phase float32) Sawtooth
- func (n Node) AddSine(freq Hz, phase float32) Sine
- func (n Node) AddSquare(freq Hz, phase float32) Square
- func (n Node) AddSwap() Swap
- func (n Node) AddTakeLeft() TakeLeft
- func (n Node) AddTakeRight() TakeRight
- func (n Node) AddTrackPosition() TrackPosition
- func (n Node) AddTriangle(freq Hz, phase float32) Triangle
- func (n Node) AddZero() Zero
- func (n Node) Clear()
- func (n Node) Reset()
- func (n Node) ResetAll()
- type Noise
- type Pan
- type Pause
- type Samples
- type Sawtooth
- type Sine
- type SineModulator
- type Square
- type Swap
- type TakeLeft
- type TakeRight
- type TrackPosition
- type Triangle
- type Zero
Constants ¶
const ( // C0, MIDI note #12. C0 = Hz(16.351) CS0 = Hz(17.324) D0 = Hz(18.354) DS0 = Hz(19.445) E0 = Hz(20.601) F0 = Hz(21.827) FS0 = Hz(23.124) G0 = Hz(24.499) GS0 = Hz(25.956) // A0, the lowest note of a piano. A0 = Hz(27.5) AS0 = Hz(29.135) // B0, the lowest note of a 5 string bass. B0 = Hz(30.868) // C1, the lowest note of double bass with C extension. C1 = Hz(32.703) CS1 = Hz(34.648) D1 = Hz(36.708) DS1 = Hz(38.891) // E1, the lowest note of a bass. E1 = Hz(41.203) F1 = Hz(43.654) FS1 = Hz(46.249) G1 = Hz(48.999) GS1 = Hz(51.913) A1 = Hz(55.) AS1 = Hz(58.27) B1 = Hz(61.735) C2 = Hz(65.406) CS2 = Hz(69.296) D2 = Hz(73.416) DS2 = Hz(77.782) // E2, the lowest note of a guitar. E2 = Hz(82.407) F2 = Hz(87.307) FS2 = Hz(92.499) G2 = Hz(97.999) GS2 = Hz(103.826) A2 = Hz(110.) AS2 = Hz(116.541) B2 = Hz(123.471) C3 = Hz(130.813) CS3 = Hz(138.591) D3 = Hz(146.832) DS3 = Hz(155.563) E3 = Hz(164.814) F3 = Hz(174.614) FS3 = Hz(184.997) // G3, the lowest note of a violin. G3 = Hz(195.998) GS3 = Hz(207.652) A3 = Hz(220.) AS3 = Hz(233.082) B3 = Hz(246.942) // C4, the "middle C". C4 = Hz(261.626) CS4 = Hz(277.183) D4 = Hz(293.665) DS4 = Hz(311.127) E4 = Hz(329.628) F4 = Hz(349.228) FS4 = Hz(369.994) G4 = Hz(391.995) GS4 = Hz(415.305) // A4, the tuning reference note. A4 = Hz(440.) AS4 = Hz(466.164) B4 = Hz(493.883) C5 = Hz(523.251) CS5 = Hz(554.365) D5 = Hz(587.33) DS5 = Hz(622.254) E5 = Hz(659.255) F5 = Hz(698.456) FS5 = Hz(739.989) G5 = Hz(783.991) GS5 = Hz(830.609) A5 = Hz(880.) AS5 = Hz(932.328) B5 = Hz(987.767) C6 = Hz(1046.502) CS6 = Hz(1108.731) D6 = Hz(1174.659) DS6 = Hz(1244.508) E6 = Hz(1318.51) F6 = Hz(1396.913) FS6 = Hz(1479.978) G6 = Hz(1567.982) GS6 = Hz(1661.219) A6 = Hz(1760.) AS6 = Hz(1864.655) B6 = Hz(1975.533) C7 = Hz(2093.005) CS7 = Hz(2217.461) D7 = Hz(2349.318) DS7 = Hz(2489.016) E7 = Hz(2637.021) F7 = Hz(2793.826) FS7 = Hz(2959.955) G7 = Hz(3135.964) GS7 = Hz(3322.438) A7 = Hz(3520.) AS7 = Hz(3729.31) B7 = Hz(3951.066) // C8, the highest note of a piano. C8 = Hz(4186.009) CS8 = Hz(4434.922) D8 = Hz(4698.636) DS8 = Hz(4978.032) E8 = Hz(5274.042) F8 = Hz(5587.652) FS8 = Hz(5919.91) G8 = Hz(6271.928) GS8 = Hz(6644.876) A8 = Hz(7040.) AS8 = Hz(7458.62) B8 = Hz(7902.132) C9 = Hz(8372.018) CS9 = Hz(8869.844) D9 = Hz(9397.272) DS9 = Hz(9956.064) E9 = Hz(10548.084) F9 = Hz(11175.304) FS9 = Hz(11839.82) G9 = Hz(12543.856) // G#9, MIDI note #128, the top of the MIDI tuning range. GS9 = Hz(13289.752) A9 = Hz(14080.) AS9 = Hz(14917.24) // B9. For most of adults, it is already beyond the hearing range. B9 = Hz(15804.264) )
const SampleRate = 44_100
Variables ¶
var Out = Node{0}
Functions ¶
This section is empty.
Types ¶
type Clip ¶
type Clip struct{ Node }
An audio node created by Node.AddClip.
func (Clip) ModulateBoth ¶
Modulate the low cut amplitude and adjust the high amplitude to keep the gap.
In other words, the difference between low and high cut points will stay the same.
type HighPass ¶
type HighPass struct{ Node }
An audio node created by Node.AddHighPass.
func (HighPass) ModulateFreq ¶
Modulate the cut-off frequency.
type HoldModulator ¶
Hold envelope.
It looks like this: `⎽│⎺` or `⎺│⎽`.
The value before `time` is `before` and the value after `time` is `after`. Equivalent to [`LinearModulator`] with `start_at` being equal to `end_at`.
func (HoldModulator) Modulate ¶
func (m HoldModulator) Modulate(nodeID uint32, param uint32)
type LinearModulator ¶
Linear (ramp up or down) envelope.
It looks like this: `⎽╱⎺` or `⎺╲⎽`.
The value before `start_at` is `start`, the value after `end_at` is `end`, and the value between `start_at` and `end_at` changes linearly from `start` to `end`.
func (LinearModulator) Modulate ¶
func (m LinearModulator) Modulate(nodeID uint32, param uint32)
type LowPass ¶
type LowPass struct{ Node }
An audio node created by Node.AddLowPass.
func (LowPass) ModulateFreq ¶
Modulate the cut-off frequency.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (Node) AddAllForOne ¶
Add mixer node that stops if any of the sources stops.
func (Node) AddConcat ¶
Add a node that plays the inputs one after the other, in the order as they added.
func (Node) AddHighPass ¶
Add highpass filter node.
func (Node) AddLowPass ¶
Add lowpass filter node.
func (Node) AddPan ¶
Add node panning the audio to the left (0.), right (1.), or something in between.
func (Node) AddSawtooth ¶
Add sawtooth wave oscillator source (`╱│`).
func (Node) AddTakeLeft ¶
Add node converting stereo to mono by taking the left channel.
func (Node) AddTakeRight ¶
Add node converting stereo to mono by taking the right channel.
func (Node) AddTrackPosition ¶
func (n Node) AddTrackPosition() TrackPosition
Add node tracking the elapsed playback time.
func (Node) AddTriangle ¶
Add triangle wave oscillator source (`╱╲`).
func (Node) Clear ¶
func (n Node) Clear()
Remove all child nodes.
After it is called, you should make sure to discard all references to the old child nodes.
type SineModulator ¶
Sine wave low-frequency oscillator.
It looks like this: `∿`.
`low` is the lowest produced value, `high` is the highest.
func (SineModulator) Modulate ¶
func (m SineModulator) Modulate(nodeID uint32, param uint32)
type TrackPosition ¶
type TrackPosition struct{ Node }
An audio node created by Node.AddTrackPosition.