Voice

Codecs

A codec (coder-decoder) turns speech samples into a compact bitstream and back again. In telephony the choice of codec sets bandwidth, HD capability, DTMF robustness, and how a call sounds after loss.

Updated August 27, 2026

Uncompressed telephone speech at 8 kHz, 16-bit linear PCM is 128 kbit/s before headers. Networks do not carry that raw stream. A codec compresses the signal using knowledge of speech (and sometimes of music). On the PSTN the historic standard is G.711 at 64 kbit/s. On VoIP and WebRTC the menu is longer, and the wrong choice shows up as distortion, not as a setup failure.

Codecs are negotiated in SDP during SIP or JSEP offer/answer. Both ends (and every transcoding middlebox) must share a payload type. If they do not, the call may still connect with a fallback such as PCMU, or it may fail with a SIP 488 Not Acceptable Here.

What a codec does

At the sender, analog voltage from a microphone is sampled, filtered, and fed to the encoder. The encoder emits frames (often 20 ms). RTP packetizes those frames. At the receiver, the decoder produces samples that a jitter buffer plays out. Some codecs are sample-based (G.711 is essentially a companding law on each sample). Others are frame-based CELP or hybrid (G.729, AMR, Opus) and hide loss less gracefully if a whole frame disappears.

Transcoding is decoding one codec and encoding another. It is common at PSTN borders and in recording servers. Each transcode adds delay and quantization noise. Two transcodes (G.722 to G.711 to AMR) are audible. Avoiding transcoding is a primary reason to align codec lists on phones, SBCs, and carriers.

Narrowband workhorses

G.711 μ-law and A-law

ITU-T G.711 (1972) is 8-bit log PCM at 8 kHz, 64 kbit/s. μ-law (PCMU, payload type 0) is used in North America and Japan. A-law (PCMA, payload type 8) is used in Europe and most of the rest of the world. MOS in clean conditions is typically about 4.1. It is the interoperability codec: if nothing else matches, G.711 usually does. In-band DTMF survives G.711. It does not provide HD Voice.

G.729

ITU-T G.729 is 8 kbit/s CS-ACELP, designed for low-bandwidth WAN links. MOS is lower than G.711 (often cited around 3.7-3.9). Annexes add discontinuous transmission and other modes. Essential patents expired around 2017, so licensing is no longer the blocker it was. G.729 handles music-on-hold and in-band DTMF poorly. Prefer RFC 4733 telephone-event when using it. See DTMF.

Wideband and fullband

  • G.722 (ITU-T): 16 kHz SB-ADPCM, typically 64 kbit/s. The classic SIP-phone HD codec. Passband about 50-7000 Hz.
  • AMR-WB / G.722.2 (3GPP / ITU-T): 6.60-23.85 kbit/s, 16 kHz. Mobile HD Voice on UMTS and VoLTE when the network allows it.
  • Opus (IETF RFC 6716): 6-510 kbit/s, 8-48 kHz, SILK+CELT. Royalty-free. Default in WebRTC. Can operate narrowband through fullband.

EVS (Enhanced Voice Services) is the 3GPP codec for VoLTE/VoNR beyond AMR-WB, including super-wideband modes. It appears on mobile-to-mobile paths more often than on business SIP trunks.

Codec comparison

MOS figures are typical laboratory listening scores, not a guarantee on a lossy path. Payload plus IP/UDP/RTP headers add 40 bytes per packet on IPv4, which matters more at 8 kbit/s than at 64.
CodecBitrate (typical)BandHD?Quality (clean MOS, approx.)License / notes
G.711 μ-law / A-law64 kbit/sNarrowNo~4.1Royalty-free. PSTN and SIP baseline.
G.7298 kbit/sNarrowNo~3.7-3.9Patents expired. Poor in-band DTMF.
G.72264 kbit/s (48/56 options)WideYes~4.1-4.5ITU-T. Common on desk phones.
AMR-WB (G.722.2)6.6-23.85 kbit/sWideYesMode-dependent, HD when high modes3GPP. Mobile HD Voice.
OpusOften 16-64 kbit/s voiceNB to fullbandYes (WB+)Highest when fullband and lossless networkRFC 6716, royalty-free. WebRTC default.

How codec choice is negotiated

SDP lists codecs in preference order. The answerer picks a common codec (offer/answer rules in RFC 3264). An SBC may strip or reorder the list to enforce a policy (for example, G.711 only toward a carrier). WebRTC browsers prefer Opus but still offer G.711 for PSTN gateways.

Packet interval is part of the negotiation. 20 ms is the usual voice ptime. 10 ms lowers latency and raises header overhead. 40 ms does the reverse and worsens loss concealment. Match ptime across a trunk; a mismatch forces transcoding or produces ptime warnings.

Quality, loss, and DTMF

Waveform codecs (G.711, G.722) degrade more gracefully with occasional loss; you hear a click. CELP codecs (G.729, AMR) can produce longer artifacts when a frame is missing, though they include packet-loss concealment. Opus is built for lossy internet paths and generally outperforms older codecs at the same bitrate. None of this replaces a jitter buffer and QoS. See call quality.

If you must send DTMF through a compressed codec, use RFC 4733 named events, not in-band tones. IVR systems still fail in production when a G.729 hop sits between the phone and the menu.