Class OpusDecoder

A class that decodes Opus packet to 16-bit signed integer or floating point PCM.

Constructors

Methods

Constructors

  • Create an opus decoder.

    Parameters

    • sampleRate: number

      Sample rate to decode at (Hz). This must be one of 8000, 12000, 16000, 24000, or 48000.

    • channels: number

      Number of channels (1 or 2) to decode.

    Returns OpusDecoder

Methods

  • Decodes an Opus packet to 16-bit signed integer PCM.

    Parameters

    • data: Buffer

      The data of the opus packet to decode.

    • frameSize: number

      Number of samples per channel in the opus packet. This must be an Opus frame size for the encoder's sampling rate.

    Returns Buffer

    The output signal in 16-bit signed integer PCM.

  • Decodes an Opus packet to floating point PCM.

    Parameters

    • data: Buffer

      The data of the opus packet to decode.

    • frameSize: number

      Number of samples per channel in the opus packet. This must be an Opus frame size for the encoder's sampling rate.

    Returns Buffer

    The output signal in floating point PCM.