Table of Contents

Struct AudioFormat

Namespace
DSharpPlus.VoiceNext
Assembly
DSharpPlus.VoiceNext.dll

Defines the format of PCM data consumed or produced by Opus.

public readonly struct AudioFormat

Constructors

AudioFormat(int, int, VoiceApplication)

Creates a new audio format for use with Opus encoder.

Properties

AllowedChannelCounts

Gets the collection of channel counts the Opus encoder can use.

AllowedSampleDurations

Gets the collection of sample durations (in ms) the Opus encoder can use.

AllowedSampleRates

Gets the collection of sampling rates (in Hz) the Opus encoder can use.

ChannelCount

Gets the audio channel count.

Default

Gets the default audio format. This is a format configured for 48kHz sampling rate, 2 channels, with music quality preset.

SampleRate

Gets the audio sampling rate in Hz.

VoiceApplication

Gets the voice application, which dictates the quality preset.

Methods

CalculateSampleSize(int)

Calculates a sample size in bytes.

GetMaximumBufferSize()

Gets the maximum buffer size for decoding. This method should be called when decoding Opus data to PCM, to ensure sufficient buffer size.