Documentation
¶
Index ¶
- func Combine(readers ...io.Reader) io.Reader
- func NewSineWave(sampleRate int, freq float64, duration time.Duration) io.Reader
- func NewSquareWave(sampleRate int, freq float64, duration time.Duration) io.Reader
- func Plot(r io.Reader, caption string, scale float64) string
- func Sustain(r io.Reader, percentage float64) io.Reader
- type CombinedReader
- type SineWave
- type SquareWave
- type SustainedReader
- type WaveGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Combine ¶
Combine takes an arbitrary number of Readers that return int16 samples, and returns a Reader that combines those samples into one single sample value
func NewSineWave ¶
NewSineWave returns a SineWave io.Reader. The Reader returns int16 samples of a sine wave with maximum amplitude. Byte ordering is little endian. The format is:
[sample 0 byte 0] [sample 0 byte 1] [sample 1 byte 0] [sample 1 byte 1]...
func NewSquareWave ¶
NewSquareWave returns a SquareWave io.Reader. The Reader returns int16 samples of a square wave with maximum amplitude. Byte ordering is little endian. The format is:
[sample 0 byte 0] [sample 0 byte 1] [sample 1 byte 0] [sample 1 byte 1]...
Types ¶
type CombinedReader ¶
type CombinedReader struct {
// contains filtered or unexported fields
}
CombinedReader takes an arbitrary number of Readers that return int16 samples, and combines those samples into one single sample value
type SineWave ¶
type SineWave struct {
// contains filtered or unexported fields
}
SineWave is an io.Reader that returns int16 samples. The Reader returns int16 samples of a sine wave with maximum amplitude. Byte ordering is little endian. The format is:
[sample 0 byte 0] [sample 0 byte 1] [sample 1 byte 0] [sample 1 byte 1]...
type SquareWave ¶
type SquareWave struct {
// contains filtered or unexported fields
}
SquareWave is an io.Reader that returns int16 samples. The Reader returns int16 samples of a square wave with maximum amplitude. Byte ordering is little endian. The format is:
[sample 0 byte 0] [sample 0 byte 1] [sample 1 byte 0] [sample 1 byte 1]...
type SustainedReader ¶
type SustainedReader struct {
// contains filtered or unexported fields
}
SustainedReader takes a Reader that returns int16 samples, and multiplies each value by the given percentage. The percentage must be a value between 0 and 1
type WaveGenerator ¶
A WaveGenerator returns an io.Reader. The Reader returns int16 samples of a wave with maximum amplitude. Byte ordering is little endian. The format is:
[sample 0 byte 0] [sample 0 byte 1] [sample 1 byte 0] [sample 1 byte 1]...