style: add comments to the public methods and members in the root package.

This commit is contained in:
vsariola
2021-08-30 20:34:56 +03:00
parent 60e4518230
commit a9b90c4db8
12 changed files with 162 additions and 9 deletions

View File

@ -7,6 +7,11 @@ import (
"math"
)
// 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.
//
// 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
func Wav(buffer []float32, pcm16 bool) ([]byte, error) {
buf := new(bytes.Buffer)
wavHeader(len(buffer), pcm16, buf)
@ -17,6 +22,11 @@ func Wav(buffer []float32, 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.
//
// If pcm16 is set to true, the samples will be 16-bit signed integers;
// otherwise the samples will be 32-bit floats
func Raw(buffer []float32, pcm16 bool) ([]byte, error) {
buf := new(bytes.Buffer)
err := rawToBuffer(buffer, pcm16, buf)