Documentation
¶
Overview ¶
Package pcm contains stateful, provider-neutral PCM stream utilities.
Index ¶
- func DecodeALaw(encoded []byte) []byte
- func DecodeALawSample(value byte) int16
- func DecodeMuLaw(encoded []byte) []byte
- func DecodeMuLawSample(value byte) int16
- func EncodeALaw(pcm16le []byte) []byte
- func EncodeALawSample(sample int16) byte
- func EncodeMuLaw(pcm16le []byte) []byte
- func EncodeMuLawSample(sample int16) byte
- type Resampler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeALaw ¶ added in v0.2.0
DecodeALaw expands A-law bytes to little-endian 16-bit mono PCM.
func DecodeALawSample ¶ added in v0.2.0
DecodeALawSample expands one A-law byte.
func DecodeMuLaw ¶ added in v0.2.0
DecodeMuLaw expands µ-law bytes to little-endian 16-bit mono PCM.
func DecodeMuLawSample ¶ added in v0.2.0
DecodeMuLawSample expands one µ-law byte.
func EncodeALaw ¶ added in v0.2.0
EncodeALaw compands little-endian 16-bit mono PCM.
func EncodeALawSample ¶ added in v0.2.0
EncodeALawSample compands one 16-bit sample.
func EncodeMuLaw ¶ added in v0.2.0
EncodeMuLaw compands little-endian 16-bit mono PCM. A trailing odd byte is ignored: it is not a sample.
func EncodeMuLawSample ¶ added in v0.2.0
EncodeMuLawSample compands one 16-bit sample.
Types ¶
type Resampler ¶
type Resampler struct {
// contains filtered or unexported fields
}
Resampler incrementally converts mono signed 16-bit little-endian PCM with linear interpolation. A Resampler is stateful and must be used by one stream at a time. Push never invents a right-hand sample at a frame boundary; Finalize supplies the terminal hold sample and fixes the exact output length. This makes output independent of how input is partitioned into frames.
func NewResampler ¶
NewResampler creates a mono PCM16 stream resampler.
func (*Resampler) OutputRate ¶
OutputRate returns the immutable destination sample rate.