e-speak

Engineering Criteria for Forcing Opus into Narrowband Mode

By Nadia Ferrante

The Opus audio codec, standardized in RFC 6716, was designed to operate across an acoustic range spanning from 4 kHz (narrowband) to 20 kHz (fullband). In most real-time voice architectures, operators leave Opus configured in its default adaptive mode, allowing the internal adaptation logic of libopus to negotiate and scale bandwidth dynamically based on bitrate constraints.

Allowing the encoder to automatically manage bandwidth is acceptable on unmanaged consumer networks with ample bandwidth. In carrier interconnects, cellular satellite backhaul, constrained embedded platforms, and legacy public switched telephone network (PSTN) gateways, dynamic adaptation introduces non-deterministic degradation. Forcing the encoder into narrowband mode (an effective audio bandwidth of 4 kHz, operating on an internal 8 kHz sample rate) is an intentional architectural trade-off. This document outlines the mechanisms for enforcing narrowband mode, the network regimes where it is required, and the trade-offs involved.

The Mechanics of Bandwidth Control in Opus

Opus does not use an external signal to announce mid-stream bandwidth changes. Instead, bandwidth is encoded within the Table of Contents (TOC) byte at the start of every Opus packet. If an operator wants to constrain Opus to narrowband, they must understand how signaling parameters interact with the underlying codec implementation.

"The codec can operate with 5 different audio bandwidths: narrowband (4 kHz audio bandwidth), mediumband (6 kHz audio bandwidth), wideband (8 kHz audio bandwidth), super-wideband (12 kHz audio bandwidth), and fullband (20 kHz audio bandwidth)."

— RFC 6716, Section 2

Encoder Controls vs. Signaling Constraints

At the library level within libopus, bandwidth is manipulated via two specific opus_encoder_ctl() requests: OPUS_SET_BANDWIDTH and OPUS_SET_MAX_BANDWIDTH.

1. OPUS_SET_BANDWIDTH(OPUS_BANDWIDTH_NARROWBAND): Forces the internal encoder to exclusively emit frames using the narrowband mode of the Linear Predictive Coding (LPC) based SILK layer. The internal downsampler decimates any input signal to 8 kHz prior to analysis. The mode will not scale upward, even if given an excessive target bitrate like 32 kbps. 2. OPUS_SET_MAX_BANDWIDTH(OPUS_BANDWIDTH_NARROWBAND): Establishes a ceiling. The encoder may drop to narrower bandwidths if the configured bitrate drops to extreme lows (e.g., below 6 kbps), but it cannot transition to mediumband (12 kHz sampling) or wideband (16 kHz sampling).

Signaling these constraints over Session Description Protocol (SDP) is governed by RFC 7587, which defines the media subtype for Opus. The parameters maxplaybackrate and sprop-maxcapturerate are the primary levers:

`text a=rtpmap:111 opus/48000/2 a=fmtp:111 maxplaybackrate=8000;sprop-maxcapturerate=8000 `

Setting maxplaybackrate=8000 is an advisory instruction sent to the remote peer stating that the local receiver will downsample or cannot reproduce acoustic frequencies above 4 kHz. RFC 7587 does not strictly require the remote encoder to cap its transmission based on maxplaybackrate, but standard implementations like libopus treat this parameter as a cap matching OPUS_SET_MAX_BANDWIDTH.

The parameter sprop-maxcapturerate=8000 is informational: it tells the remote end that the sender will never emit audio above 8 kHz sampling rate. If an implementation ignores maxplaybackrate—which occurs in poorly tested third-party WebRTC gateways—the only reliable mitigation is enforcing OPUS_SET_BANDWIDTH locally on the encoder instance or passing media through a transcoding b2bua.

The 48 kHz RTP Timestamp Invariant

A common bug in voice engines transitioning to narrowband Opus involves RTP timestamp generation. Engineers accustomed to G.711 (RFC 3551) expect an 8 kHz codec to advance the RTP timestamp by 160 units per 20 ms frame.

This breaks Opus completely. RFC 7587 mandates that regardless of the operating mode, audio bandwidth, or internal sampling rate (whether 8 kHz, 12 kHz, 16 kHz, 24 kHz, or 48 kHz), the RTP timestamp clock rate must always advance at 48000 Hz. For a standard 20 ms audio frame, the timestamp must advance by exactly 960 units. If an engineer generates timestamps using an 8000 Hz clock, the receiving jitter buffer will calculate packet transit delays incorrectly, perceive extreme late-arrival jitter, and discard up to 100% of the audio frames.

Network Regimes and Bitrate Floors

Opus relies on two distinct internal engines: SILK for human speech and CELT for music and transient precision. In narrowband mode, Opus runs strictly on SILK. SILK operates using linear prediction, which model-matches the human vocal tract. At lower bitrates, SILK significantly outperforms transform-based codecs like CELT.

Bandwidth Starvation in Constrained Links

When bandwidth is restricted to extreme limits (such as tactical radios, congested satellite terminals, or shared IoT channels), permitting Opus to run in wideband or fullband mode results in aggressive perceptual audio artifacts.

At a transmission bitrate of 8 kbps:

When the target bit budget falls below 9 kbps, wideband mode should be disabled. The transition zone sits between 9 kbps and 12 kbps: here, wideband speech is intelligible, but packet loss will rapidly destroy it. Above 12 kbps, wideband SILK is perceptually superior and narrowband should not be forced unless other architectural limits apply.

DSP and CPU Budget Constraints

In multi-channel telephony platforms, running 1,000 to 10,000 simultaneous channels on a single server or embedded DSP exposes computational scaling problems. The complexity of the SILK analysis loop scales with the sampling rate and bandwidth:

1. Narrowband requires vector calculations over an 8 kHz signal (160 samples per 20 ms frame). 2. Wideband processes a 16 kHz signal (320 samples per 20 ms frame). 3. Fullband processes a 48 kHz signal (960 samples per 20 ms frame), requiring a hybrid SILK/CELT mode if operating at speech bitrates.

Running Opus locked to narrowband reduces the complexity of auto-correlation and linear predictive coding calculations. In embedded deployments, selecting narrowband mode with opus_encoder_ctl(enc, OPUS_SET_COMPLEXITY(1)) or (2) allows high-density concurrency on low-power ARM Cortex-M or MIPS cores where wideband auto-adaptation would exhaust execution cycles.

Transport Impairments and Egress Topologies

Deciding whether to force narrowband mode is often determined by the destination architecture and network stability rather than the client itself.

The Behavior of Packet Loss and High Jitter

When network paths deteriorate, dynamic bandwidth adaptation creates pathological failure modes. Under conditions of 15% to 25% random packet loss combined with jitter variance exceeding 60 ms, wideband and fullband modes fail noticeably. At bitrates under 14 kbps, an Opus wideband frame contains zero redundant headroom; enabling in-band Forward Error Correction (FEC) through OPUS_SET_INBAND_FEC(1) requires the encoder to spend a fraction of the already starved bit budget on a secondary low-bitrate representation of the prior frame. In wideband, this secondary frame is so heavily quantized that packet loss concealment (PLC) algorithms produce harsh robotic noise bursts when synthesising missing audio.

Conversely, when narrowband is enforced, the LPC synthesis filter requires half the prediction coefficients (typically 10 to 12 coefficients instead of 16). At 9.6 kbps with 20% packet loss, a narrowband SILK frame retains enough headroom to transmit effective in-band FEC data within a standard 20 ms or 40 ms packet. When an unrecoverable packet drop occurs, the receiver's PLC generates an extrapolation across a narrow 4 kHz spectral band, which the human ear perceives as natural, muffled attenuation rather than high-frequency metallic distortion.

Interoperability with TDM and PSTN Networks

A common architectural error occurs in WebRTC-to-PSTN gateways. An incoming SIP call from a browser typically arrives with wideband or superwideband Opus. If this call is routed to a classic SS7 or ISDN trunk using G.711 µ-law or A-law, it will be transcoded to 8 kHz PCM.

`text [WebRTC Client] --Opus Fullband (48 kHz)--> [SBC / Transcoder] --G.711 (8 kHz)--> [PSTN] `

If the edge gateway does not mandate narrowband Opus at the SDP level: 1. The remote WebRTC endpoint captures at 48 kHz, allocates 32 kbps to 40 kbps of bandwidth, and transmits superwideband or fullband audio over the ingress WAN. 2. The Session Border Controller (SBC) receives this stream, executes a computational downsampling and decoding pipeline from 48 kHz Opus to linear PCM, and then applies a low-pass filter at 3.4 kHz to fit into standard G.711 64 kbps framing. 3. Every bit sent between 4 kHz and 20 kHz over the ingress WAN is discarded by the gateway's filter.

In this topology, failing to signal maxplaybackrate=8000 is pure waste. It consumes access bandwidth, increases transcoding CPU overhead, and expands jitter buffer memory requirements on the SBC, without any acoustic benefit reaching the PSTN ear.

Framing Overhead Considerations

When using 20 ms frame sizes, the transport overhead of the IP/UDP/RTP wrapper is 40 bytes for IPv4 (20 bytes IP, 8 bytes UDP, 12 bytes RTP) and 60 bytes for IPv6. Transmitting 50 packets per second with a 40-byte header means the network overhead alone is 16 kbps (IPv4) or 24 kbps (IPv6), independent of payload size.

If an operator forces narrowband mode to cope with extreme network limits, running 20 ms frames is counter-productive. Opus supports 40 ms, 60 ms, 80 ms, 100 ms, and 120 ms frame sizes. I would check the specific client implementations before deploying frame sizes greater than 60 ms, as several WebRTC and SIP stacks possess poorly tested jitter buffers that fail to reconstruct frames exceeding 60 ms correctly.

Pairing narrowband mode with 60 ms frames lowers the packet rate from 50 packets per second to roughly 16.6 packets per second. This cuts the IPv4 transport overhead from 16 kbps down to 5.3 kbps. Operating at 60 ms frames at 8 kbps narrowband SILK fits an entire voice stream—inclusive of all network headers—into approximately 13.3 kbps, allowing stable transmission over satellite, low-power microwave links, or degraded cell towers.

The practical rule is simple: Force Opus into narrowband mode if the available audio bitrate is below 10 kbps, if the call will terminate on an 8 kHz TDM gateway that must downsample anyway, or if the media processor cannot spare the CPU cycles to calculate LPC coefficients above 8 kHz. In all other scenarios, leave bandwidth adaptation unlocked and let the codec negotiate wideband or fullband.