Table of Contents

Class Opus

Namespace
NetCord.Gateway.Voice
Assembly
NetCord.dll
public static class Opus
Inheritance
Opus
Inherited Members

Fields

DefaultFrameDuration

public const float DefaultFrameDuration = 20

Field Value

float

MaxBitrate

public const int MaxBitrate = 510000

Field Value

int

MaxFrameDuration

public const float MaxFrameDuration = 120

Field Value

float

SamplingRate

public const int SamplingRate = 48000

Field Value

int

Methods

GetFrameBufferSize(int, PcmFormat, VoiceChannels)

Calculates the required buffer size, in bytes, for a PCM audio frame.

public static int GetFrameBufferSize(int samplesPerChannel, PcmFormat format, VoiceChannels channels)

Parameters

samplesPerChannel int

The number of samples per channel.

format PcmFormat

The PCM format to use.

channels VoiceChannels

The number of channels to use.

Returns

int

The size of the buffer, in bytes, required to store the audio frame for the given duration, format, and channel count.

GetMaxOpusFrameSize(float)

Calculates the maximum possible size, in bytes, of an Opus audio frame.

public static int GetMaxOpusFrameSize(float frameDuration)

Parameters

frameDuration float

The duration of the Opus frame, in milliseconds. Allowed values are 2.5, 5, 10, 20, 40, 60 and 120 (the last one is only allowed for Mono).

Returns

int

The maximum number of bytes that an Opus frame of the specified duration can occupy.

GetSamplesPerChannel(float)

Calculates the number of samples per channel in an Opus audio frame.

public static int GetSamplesPerChannel(float frameDuration)

Parameters

frameDuration float

Frame duration in milliseconds. Allowed values are 2.5, 5, 10, 20, 40, 60 and 120 (the last one is only allowed for Mono).

Returns

int