Documentation ¶
Overview ¶
Package synth provides functions for audio synthesis.
Stream ¶
Most functions return a Stream, which is a contained channel that is closable, so consumers may end the signal generation. Typical stream usage may look like:
// Function that returns a stream stream := synth.Func(...) // Process frames from the stream for i := 0; i < 128; i++ { processSample(stream.Next()) } // We're done here stream.Close()
References ¶
Mostly based in audiolazy © Copyright 2012-2016 Danilo de Jesus da Silva Bellini.
https://github.com/danilobellini/audiolazy
Index ¶
- type Frequency
- type Lag
- type SampleRate
- type Stream
- func FadeIn(duration int64) *Stream
- func FadeOut(duration int64) *Stream
- func Fixed(duration int64, value float64) *Stream
- func FixedOnes(duration int64) *Stream
- func FixedZeros(duration int64) *Stream
- func GaussianNoise(duration int64, mu, sigma float64) *Stream
- func Impulse(duration int64, dit, dat float64) *Stream
- func Line(duration int64, begin, end float64) *Stream
- func LinearADSR(duration, attack, decay int64, sustain float64, release int64) *Stream
- func LinearAttack(attack, decay int64, sustain float64) *Stream
- func NewStream(buffer int) *Stream
- func Sinusoid(frequency float64, phase float64) *Stream
- func WhiteNoise(duration int64, low, high float64) *Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Frequency ¶
type Frequency float64
Frequency in Hz
func (Frequency) Lag ¶
Lag (number of samples) for the frequency (rad/sample).
type SampleRate ¶
type SampleRate uint64
SampleRate samples per second
func (SampleRate) SHz ¶
func (r SampleRate) SHz() (float64, Frequency)
SHz returns the second and HZ unit (samples and radians per sample).
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream contains a channel of streamed samples.
func Fixed ¶
Fixed returns a fixed stream of samples.
func Line ¶
Line produces a streamar finite stream with a straight stream.
func LinearADSR ¶
LinearADSR is a streamar ADSR envelope
func LinearAttack ¶
LinearAttack is a streaming ADS fading attack generator.
func NewStream ¶
NewStream with an optional buffer size. Set to 0 to create an unbuffered stream.