Documentation
¶
Overview ¶
Package voicecodec provides the portable audio codecs used by voice.v1.
Index ¶
Constants ¶
const ( FrameDurationMilliseconds = 20 MaxPacketBytes = 1275 )
Variables ¶
This section is empty.
Functions ¶
func SupportsFormat ¶
SupportsFormat reports whether raw Opus can represent the PCM format without resampling or remixing it.
Types ¶
type OpusDecoder ¶
type OpusDecoder struct {
// contains filtered or unexported fields
}
OpusDecoder converts raw Opus packets into PCM16LE. It owns state and must not be used concurrently.
func NewOpusDecoder ¶
func NewOpusDecoder(sampleRate, channels int) (*OpusDecoder, error)
NewOpusDecoder creates a decoder for one negotiated PCM output format.
type OpusEncoder ¶
type OpusEncoder struct {
// contains filtered or unexported fields
}
OpusEncoder converts exact 20 ms PCM16LE frames into raw Opus packets. It owns state and must not be used concurrently.
func NewOpusEncoder ¶
func NewOpusEncoder(sampleRate, channels, bitrate int) (*OpusEncoder, error)
NewOpusEncoder creates a speech-tuned constrained-VBR encoder.
func (*OpusEncoder) Encode ¶
func (e *OpusEncoder) Encode(pcm []byte) ([]byte, error)
Encode converts one exact 20 ms PCM16LE frame into a caller-owned packet.
func (*OpusEncoder) FrameBytes ¶
func (e *OpusEncoder) FrameBytes() int
FrameBytes returns the exact PCM16LE byte count accepted by Encode.