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 (
|
||||
// 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
|
||||
// right
|
||||
// sample represented by [2]float32. [0] is left channel, [1] is right
|
||||
AudioBuffer [][2]float32
|
||||
|
||||
// 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
|
||||
// divisible by 2) into a valid WAV-file, returned as a []byte array.
|
||||
// Wav converts an AudioBuffer into a valid WAV-file, returned as a []byte
|
||||
// array.
|
||||
//
|
||||
// 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
|
||||
@ -47,8 +46,8 @@ func (buffer AudioBuffer) Wav(pcm16 bool) ([]byte, error) {
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
// Raw converts a stereo signal of 32-bit floats (L R L R..., length should be
|
||||
// divisible by 2) into a raw audio file, returned as a []byte array.
|
||||
// Raw converts an AudioBuffer into a raw audio file, returned as a []byte
|
||||
// array.
|
||||
//
|
||||
// If pcm16 is set to true, the samples will be 16-bit signed integers;
|
||||
// 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
|
||||
}
|
||||
|
||||
// Play plays the Song using a given Synther, returning the stereo audio
|
||||
// buffer and the sync buffer as a result (and possible errors). Passing
|
||||
// 'release' as true means that all the notes are released when the synth is
|
||||
// created. The default behaviour during runtime rendering is to leave them
|
||||
// playing, meaning that envelopes start attacking right away unless an explicit
|
||||
// note release is put to every track.
|
||||
// Play plays the Song by first compiling the patch with the given Synther,
|
||||
// returning the stereo audio buffer and the sync buffer as a result (and
|
||||
// possible errors). Passing 'release' as true means that all the notes are
|
||||
// released when the synth is created. The default behaviour during runtime
|
||||
// rendering is to leave them playing, meaning that envelopes start attacking
|
||||
// right away unless an explicit note release is put to every track.
|
||||
func Play(synther Synther, song Song, release bool) (AudioBuffer, error) {
|
||||
err := song.Validate()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user