pcm

package
v0.0.0-...-03c8f45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

package pcm converts beween 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

Constants

This section is empty.

Variables

This section is empty.

Functions

func F32LEBytesToS16LEBytes

func F32LEBytesToS16LEBytes(in []byte) []byte

S16LEtoF32 converts a slice of int16 bytes to a slice of float32 bytes. This is useful for converting from S16LE to F32LE.

func F32ToS16

func F32ToS16(f float32) int16

F32ToS16 converts a float32 in range -1, 1 to an int16 in range -32768, 32767.

func F32toS16LE

func F32toS16LE(in []float32) []int16

F32toS16LE converts a slice of float32 to a slice of int16. This is useful for converting from F32LE to S16LE.

func F32toS16LEBytes

func F32toS16LEBytes(in []float32) []byte

F32toS16LEBytes converts a slice of float32 to a slice of bytes. This is useful for converting from F32LE to S16LE.

func S16LEBytesToF32LE

func S16LEBytesToF32LE(in []byte) []float32

S16LEBytesToF32 converts a slice of bytes to a slice of float32. This is useful for converting from S16LE to F32LE.

func S16LEToF32LE

func S16LEToF32LE(in []int16) []float32

S16LEToF32LE converts a slice of int16 to a slice of float32. This is useful for converting from S16LE to F32LE.

func S16ToF32

func S16ToF32(s int16) float32

S16ToF32 converts an int16 in range -32768, 32767 to a float32 in range -1, 1.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL