Encoder
Encodes raw PCM audio frames into Opus packets.
The encoder state is an opaque libopus pointer that persists across calls - do not create a new Encoder per frame. One Encoder instance per audio stream is the correct usage.
Call destroy when the encoder is no longer needed to free the native state.
Summary
Properties
Section titled “Properties”handle
Section titled “handle” Encoder.handle :: FFIPointer
sampleRate
Section titled “sampleRate”channels
Section titled “channels”application
Section titled “application”Methods
Section titled “Methods”encode
Section titled “encode”Encoder : encode ( pcmFrame ) -> buffer
Encodes a raw PCM frame into an Opus packet. The frame must be exactly one Opus frame duration of samples.
Parameters
| pcmFrame: buffer |
Returns
| buffer |
destroy
Section titled “destroy”Encoder : destroy ( ) -> ()
Frees the native encoder state. No-op if already destroyed.
Functions
Section titled “Functions”Encoder . new ( sampleRate , channels , application ) -> Encoder
Responsible for constructing this class.