Nextiva / Blog / VoIP

Voice over Internet Protocol (VoIP) VoIP February 14, 2024

What Are VoIP Codecs & How Do They Affect Call Sound Quality?

How VoIP audio codecs work
Deciding which audio codec to go with for your VoIP phone system? We discuss the main types of VoIP codecs and the pros and cons of using each one.
Jeremiah Zerby
Author

Jeremiah Zerby

How VoIP audio codecs work

Thanks to Voice over Internet Protocol (VoIP), today’s phone calls are crystal-clear and only need an internet connection. It’s all possible because of VoIP codecs.

Read along as we discuss what a codec means and how you can select the right codec for your VoIP phone system.

What Are VoIP Codecs?

A VoIP codec is a technology that determines the audio quality, bandwidth, and compression of Voice over Internet Protocol (VoIP) phone calls. VoIP codecs use either proprietary or open-source algorithms. The word codec is a portmanteau of two terms: Compression and Decompression. 

Codecs are the reason why you can download a movie in minutes, not hours. Practical examples of codecs include image capture (JPEG), encryption software (AES), streaming media (H.264), and music and audio recording software (MP3). 

For instance, codecs determine the quality and bandwidth you need to watch videos on YouTube or Netflix. In the case of a VoIP codec, it converts analog voice signals into digital packets or a compressed digital form for transmission and then back into an uncompressed audio signal. 

VoIP codecs determine the call quality and latency in a conversation since the call takes place through the internet. You might encounter some VoIP problems since calls travel over the internet. 

If your VoIP provider has multiple data centers, reliability is a non-issue for a vast majority of phone calls.

YouTube Video

Key Components of VoIP Codecs

While the overall process of capturing, converting, transmitting, and playing back voice involves multiple components in a VoIP system, the codec itself has several key aspects to consider:

1. Sampling rate

It’s the frequency at which the analog voice signal is sampled and converted into digital data. Higher sampling rates capture more detail and lead to better audio quality, but also require more bandwidth. Common sampling rates in VoIP codecs are 8 kHz, 16 kHz, and 48 kHz.

2. Bit depth

This determines the precision of each sample, similar to the resolution of an image. Higher bit depth provides a more nuanced representation of the sound wave but also increases data size. Typical bit depths used are 8-bit and 16-bit.

Audio bitrates (the amount of data transferred into audio) capture more sound information per second. Generally, a higher bitrate indicates better sound quality.

3. Compression algorithm

This is the heart of the codec that reduces the data size for efficient transmission. Different algorithms achieve varying levels of compression with trade-offs in audio quality and processing complexity.

Common compression methods include:

4. Packet size

The compressed data is divided into packets for transmission over the network. This process is known as packetization.

Packet size affects delay and jitter, influencing real-time communication quality. Jitter buffers smooth out the variability in packet arrival times by buffering a certain amount of voice packets before playout. This compensates for network jitter.

Choosing an optimal size balances efficient transmission while minimizing delays.

Network Jitter Illustrated Example
When packets arrive at unexpected times, VoIP calls can be interrupted.

5. Error correction & concealment

Networks aren’t perfect, and packets can be lost or corrupted. The codec can incorporate error correction or concealment mechanisms to mitigate these issues.

Error correction attempts to recover lost data, while concealment attempts to mask missing information by using surrounding samples.

How Do VoIP Codecs Work?

VoIP codecs encode and decode voice signals to transmit voice over IP networks. Here’s a quick overview of how they work:

Analog to digital conversion

A codec first digitizes an analog voice signal from a microphone into a digital signal. This process samples the voice signal at regular intervals and stores the amplitudes of the voice waveform at each sample in a digital format.

Common sampling rates are 8,000 samples or 16,000 per second.

Encoding

The codec then compresses or encodes the raw digital voice data to optimize it for transmission over packet networks.

Many voice coding/decoding algorithms (codecs) use compression techniques like audio spectral analysis, prediction, and differential coding. Some popular codecs are G.711, G.729, Speex, and OPUS.

Packetizing

The encoded voice data is then chopped up and packaged into small packets with address and control data attached to them. These voice packets can then be transmitted over the IP network.

Decoding

When the packets reach the recipient device, the codec unpacks them, puts the digital voice information back together in the right order, and decodes the compressed voice data to reconstruct the original digital audio signal.

Digital to analog conversion

Finally, the digital signal is converted back into an analog waveform so it can be played out through a speaker. This is done by a DAC (digital-to-analog converter).

Types of VoIP Codecs

As there are plenty of codec choices, choosing a specific one can be tricky. Below, we’ve listed a few individual codecs to consider.

Types of VoIP codecs
Via GL Communications

1. Narrowband codecs

Narrowband codecs are audio codecs designed to operate at low bitrates, typically below 16 kbps. They’re optimized for encoding speech audio at the expense of music/wideband audio quality and exploit the relatively narrow frequency range of human speech (about 300-3400 Hz).

Narrowband codecs focus specifically on compressing human voice at the cost of bandwidth and general audio quality. Their constraints inform applications like phone calls, meeting software, and call centers, where bandwidth is limited but clear voice communication is paramount.

Here are a few common ones.

2. Wideband codecs

Wideband codecs refer to audio codecs that can encode higher-fidelity audio signals beyond the limitations of traditional narrowband telephony codecs. They can encode and decode frequencies up to around 7-8 kHz, over double the maximum frequency range of narrowband codecs like G.711 (~3.4 kHz).

What are some common ones?

Wideband codecs build on narrowband codecs to support near-high-fidelity voice and audio quality. This comes at the cost of higher bitrates. But with modern networks, wideband codecs are commonly employed to deliver richer voice communication and media experiences.

How Codecs Improve Call Quality

VoIP relies on audio codecs to encode and decode voice signals for transmission over the internet. These codecs compress the audio to reduce bandwidth requirements but can impact call quality if not properly optimized.

VoIP phone services use wideband codecs like G.722 to support higher audio frequencies up to 7 kHz, compared to narrowband codecs like G.711, which only support up to 3.4 kHz. This allows wideband codecs to more accurately represent the human voice, which ranges from 80 Hz to 14 kHz. The additional high-frequency information better conveys nuances like emotion and articulation.

Wideband codecs sample the audio signal at least 16,000 times per second to sufficiently capture this larger frequency range. Advanced codecs like Opus are even able to dynamically adjust the bitrate to balance bandwidth efficiency with audio quality.

Additionally, VoIP platforms use mechanisms like packet loss concealment and acoustic echo cancellation to minimize background noise and interference that can further degrade call quality.

By supporting wider frequency ranges and optimizing real-time performance, modern VoIP codecs can transmit clearer, richer voice signals resulting in a more natural conversational experience comparable to speaking face-to-face.

Choosing the Right Codec

Cloud VoIP phone systems determine which codecs are available for your hardware. Codecs compress and decompress audio signals to transmit voice data efficiently over IP networks.

VoIP providers transmit the data packets over the internet, while IP phones need to compress and decompress the audio effectively on the endpoints using codecs.

The caller and the called phones negotiate the proper codec whenever there is a call connection attempt. Both the caller and receiver phones have a prioritized list of supported codecs to agree on the optimal one to use.

When it comes time to select the best codec for your phone system, opt for the one that works best given your needs. Think about your team’s real-world bandwidth capabilities and average concurrent call volumes.

If call quality is a top priority, you should place the wideband codec G.722 first in your preference list and then G.711. G.722 provides exceptional voice quality but uses more bandwidth. However, if lower bandwidth utilization is your primary concern due to network constraints, set the low-bitrate codec G.729 ahead of G.711.

Here’s a table comparing the popular codecs.

FeatureG.711G.722G.729Opus
Bitrate (kbps)6448/56/6488-512
Audio qualityHighHigh (HD)GoodExcellent
Bandwidth requirementHighHighLowVariable
LatencyLowLowModerateVariable
Processing powerLowLowModerateModerate
CostFreeRoyalty-freeRoyalty-freeOpen-source
Supported devicesMost widely usedWide rangePopularGrowing
StrengthsSimple, low latencyHD audio, natural soundLow bandwidth, error-tolerantVersatile, high quality
WeaknessesHigh bandwidth, less detailHigh bandwidth, limited devicesModerate quality, higher latencyVariable quality, complex

Since almost all VoIP phones and providers still accept G.711, the newer G.722 codec likely has more limited compatibility.

IT professionals often prefer the G.722 codec for remarkably clear voice conversations without placing an excessive burden on the local area network.

Pick the Right VoIP System for Better Codecs

VoIP phone systems enhance your business productivity by enabling seamless voice communication between your team members, partners, and customers.

Advanced audio compression algorithms called codecs make it possible to transmit high-quality voice over IP networks without the complexity of traditional telecom equipment.

You don’t need to stress over the technical details of VoIP codecs. When you select an industry-leading cloud phone system provider like Nextiva, you leverage its engineering expertise to handle optimizations behind the scenes.

Nextiva recognizes crystal clear call quality as essential to your operations and customer satisfaction. We proactively ensure optimal codec selection and performance tuning, prioritizing HD codecs for natural sound while balancing bandwidth constraints.

Nextiva’s voice infrastructure and networks are engineered to unlock the full potential of VoIP audio — so you can focus on business goals rather than technical protocols under the hood.

Better call quality is just the start.
Take care of your phone system once and for all.

VoIP Codecs FAQs

How do devices negotiate which codec to use during a VoIP call?

Devices exchange information about their supported codecs during call setup and agree on the best commonly supported codec given bandwidth and other conditions.

How do network conditions impact the performance of codecs used in VoIP calls?

Packet loss and jitter can degrade the audio quality of a VoIP call. Some codecs like G.711 are more sensitive while others like Opus are more resilient to these network impairments.

How to fix issues with codecs in VoIP systems

— Check codec compatibility between devices. If the VoIP phones/gateways support different codecs, calls may fail or have quality issues. Ensure compatible codecs on all devices.
— Disable low bandwidth codecs. If you notice choppy audio or dropped calls, disable bandwidth-intensive codecs like G.729 in favor of G.711.
— Enable codec resiliency settings. Some codecs like Opus have mechanisms to mitigate packet loss. Enable these settings to maintain call quality on poor networks.
— Reboot VoIP devices. Issues with codec negotiation or audio pathways can often be fixed by rebooting phones, gateways, and other VoIP devices to reset settings.
— Prioritize VoIP traffic. Use Quality of Service (QoS) configurations on your routers/switches to prioritize VoIP/RTP packets to minimize latency, jitter, and packet loss which lower call quality.
— Monitor codec use. Check codec statistics on your VoIP server/SBC to see which codecs are being used. This can help identify if a certain codec is problematic.
— Update firmware and software. Outdated firmware or software, especially audio codec libraries, can introduce codec compatibility issues. Update to current versions.

See Nextiva in action.
Quick, on-demand demos.