Documentation ¶
Overview ¶
Package g711 implements encoding and decoding of G711 PCM sound data. G.711 is an ITU-T standard for audio companding.
For usage details please see the code snippets in the cmd folder.
Index ¶
- Constants
- func Alaw2Ulaw(alaw []byte) []byte
- func Alaw2UlawFrame(frame uint8) uint8
- func DecodeAlaw(pcm []byte) []byte
- func DecodeAlawFrame(frame uint8) int16
- func DecodeUlaw(pcm []byte) []byte
- func DecodeUlawFrame(frame uint8) int16
- func EncodeAlaw(lpcm []byte) []byte
- func EncodeAlawFrame(frame int16) uint8
- func EncodeUlaw(lpcm []byte) []byte
- func EncodeUlawFrame(frame int16) uint8
- func Ulaw2Alaw(ulaw []byte) []byte
- func Ulaw2AlawFrame(frame uint8) uint8
- type Decoder
- type Encoder
Constants ¶
const ( // Input and output formats Alaw = iota // Alaw G711 encoded PCM data Ulaw // Ulaw G711 encoded PCM data Lpcm // Lpcm 16bit signed linear data )
Variables ¶
This section is empty.
Functions ¶
func Alaw2UlawFrame ¶
Alaw2UlawFrame directly converts an A-law frame to u-law
func DecodeAlaw ¶
DecodeAlaw decodes A-law PCM data to 16bit LPCM
func DecodeAlawFrame ¶
DecodeAlawFrame decodes an A-law PCM frame to 16bit LPCM
func DecodeUlaw ¶
DecodeUlaw decodes u-law PCM data to 16bit LPCM
func DecodeUlawFrame ¶
DecodeUlawFrame decodes a u-law PCM frame to 16bit LPCM
func EncodeAlaw ¶
EncodeAlaw encodes 16bit LPCM data to G711 A-law PCM
func EncodeAlawFrame ¶
EncodeAlawFrame encodes a 16bit LPCM frame to G711 A-law PCM
func EncodeUlaw ¶
EncodeUlaw encodes 16bit LPCM data to G711 u-law PCM
func EncodeUlawFrame ¶
EncodeUlawFrame encodes a 16bit LPCM frame to G711 u-law PCM
func Ulaw2AlawFrame ¶
Ulaw2AlawFrame directly converts a u-law frame to A-law
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder reads G711 PCM data and decodes it to 16bit 8000Hz LPCM
func NewAlawDecoder ¶
NewAlawDecoder returns a pointer to a Decoder that implements an io.Reader. It takes as input the source data Reader.
func NewUlawDecoder ¶
NewUlawDecoder returns a pointer to a Decoder that implements an io.Reader. It takes as input the source data Reader.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder encodes 16bit 8000Hz LPCM data to G711 PCM or directly transcodes between A-law and u-law
func NewAlawEncoder ¶
NewAlawEncoder returns a pointer to an Encoder that implements an io.Writer. It takes as input the destination data Writer and the input encoding format.
func NewUlawEncoder ¶
NewUlawEncoder returns a pointer to an Encoder that implements an io.Writer. It takes as input the destination data Writer and the input encoding format.