Documentation
¶
Overview ¶
Package pcm converts between different representations of PCM audio data. Ideally the only representations we would need would be []float32 for F32LE and []int16 for S16LE. Sadly, many modules require us to provide raw byte arrays, so we also need conversion functions for []byte.
Index ¶
- func F32AdjustVolume(samples []float32, volume float64) []float32
- func F32LEBytesToS16LEBytes(in []byte) []byte
- func F32ToS16(f float32) int16
- func F32toS16LE(in []float32) []int16
- func F32toS16LEBytes(in []float32) []byte
- func S16LEBytesToF32LE(in []byte) []float32
- func S16LEToF32LE(in []int16) []float32
- func S16ToF32(s int16) float32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func F32AdjustVolume ¶ added in v1.7.0
F32AdjustVolume multiplies each sample in the F32LE PCM data by the given volume factor. A volume of 1.0 leaves the audio unchanged, and values below 1.0 reduce volume.
func F32LEBytesToS16LEBytes ¶
F32LEBytesToS16LEBytes converts a slice of int16 bytes to a slice of float32 bytes. This is useful for converting from S16LE to F32LE.
func F32toS16LE ¶
F32toS16LE converts a slice of float32 to a slice of int16. This is useful for converting from F32LE to S16LE.
func F32toS16LEBytes ¶
F32toS16LEBytes converts a slice of float32 to a slice of bytes. This is useful for converting from F32LE to S16LE.
func S16LEBytesToF32LE ¶
S16LEBytesToF32LE converts a slice of bytes to a slice of float32. This is useful for converting from S16LE to F32LE.
func S16LEToF32LE ¶
S16LEToF32LE converts a slice of int16 to a slice of float32. This is useful for converting from S16LE to F32LE.
Types ¶
This section is empty.