mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
docs: update comments
This commit is contained in:
parent
0a67129a0c
commit
ccd283d2ea
11
audio.go
11
audio.go
@ -9,8 +9,7 @@ import (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
// AudioBuffer is a buffer of stereo audio samples of variable length, each
|
// AudioBuffer is a buffer of stereo audio samples of variable length, each
|
||||||
// sample represented by a slice of [2]float32. [0] is left channel, [1] is
|
// sample represented by [2]float32. [0] is left channel, [1] is right
|
||||||
// right
|
|
||||||
AudioBuffer [][2]float32
|
AudioBuffer [][2]float32
|
||||||
|
|
||||||
// AudioOutput represents something where we can send audio e.g. audio output.
|
// AudioOutput represents something where we can send audio e.g. audio output.
|
||||||
@ -32,8 +31,8 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// Wav converts a stereo signal of 32-bit floats (L R L R..., length should be
|
// Wav converts an AudioBuffer into a valid WAV-file, returned as a []byte
|
||||||
// divisible by 2) into a valid WAV-file, returned as a []byte array.
|
// array.
|
||||||
//
|
//
|
||||||
// If pcm16 is set to true, the samples in the WAV-file will be 16-bit signed
|
// If pcm16 is set to true, the samples in the WAV-file will be 16-bit signed
|
||||||
// integers; otherwise the samples will be 32-bit floats
|
// integers; otherwise the samples will be 32-bit floats
|
||||||
@ -47,8 +46,8 @@ func (buffer AudioBuffer) Wav(pcm16 bool) ([]byte, error) {
|
|||||||
return buf.Bytes(), nil
|
return buf.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Raw converts a stereo signal of 32-bit floats (L R L R..., length should be
|
// Raw converts an AudioBuffer into a raw audio file, returned as a []byte
|
||||||
// divisible by 2) into a raw audio file, returned as a []byte array.
|
// array.
|
||||||
//
|
//
|
||||||
// If pcm16 is set to true, the samples will be 16-bit signed integers;
|
// If pcm16 is set to true, the samples will be 16-bit signed integers;
|
||||||
// otherwise the samples will be 32-bit floats
|
// otherwise the samples will be 32-bit floats
|
||||||
|
12
synth.go
12
synth.go
@ -53,12 +53,12 @@ func Render(synth Synth, buffer AudioBuffer) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play plays the Song using a given Synther, returning the stereo audio
|
// Play plays the Song by first compiling the patch with the given Synther,
|
||||||
// buffer and the sync buffer as a result (and possible errors). Passing
|
// returning the stereo audio buffer and the sync buffer as a result (and
|
||||||
// 'release' as true means that all the notes are released when the synth is
|
// possible errors). Passing 'release' as true means that all the notes are
|
||||||
// created. The default behaviour during runtime rendering is to leave them
|
// released when the synth is created. The default behaviour during runtime
|
||||||
// playing, meaning that envelopes start attacking right away unless an explicit
|
// rendering is to leave them playing, meaning that envelopes start attacking
|
||||||
// note release is put to every track.
|
// right away unless an explicit note release is put to every track.
|
||||||
func Play(synther Synther, song Song, release bool) (AudioBuffer, error) {
|
func Play(synther Synther, song Song, release bool) (AudioBuffer, error) {
|
||||||
err := song.Validate()
|
err := song.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user