pub enum Bandwidth {
Narrowband = 1_101,
Mediumband = 1_102,
Wideband = 1_103,
Superwideband = 1_104,
Fullband = 1_105,
}Expand description
The audio bandwidth a packet carries, which is what Opus varies instead of the sample rate.
An Opus decoder always produces audio at the rate it was created with; a narrowband packet is not a slower stream, it is one whose upper spectrum was never coded. Each name gives the audio bandwidth, and the sample rate that would be needed to represent it: 4 kHz of audio needs 8 kHz of sampling.
The encoder chooses this per packet from the bitrate, and a caller normally
leaves it alone. To constrain it, prefer
max_bandwidth, which caps the
automatic choice, over
force_bandwidth, which overrides it
and can spend bits on spectrum the rate cannot afford.
The discriminants are libopus’s OPUS_BANDWIDTH_* values.
Variants§
Narrowband = 1_101
4 kHz of audio, as an 8 kHz sample rate would carry.
Mediumband = 1_102
6 kHz of audio (12 kHz sampling). Retained because it appears in the bitstream and a decoder must handle it, but libopus’s encoder no longer selects it automatically and neither does this one.
Wideband = 1_103
8 kHz of audio (16 kHz sampling), the usual top of speech coding.
Superwideband = 1_104
12 kHz of audio (24 kHz sampling). Hybrid and CELT only.
Fullband = 1_105
20 kHz of audio (48 kHz sampling), the full audible range. Hybrid and CELT only.