A codec, short for coder-decoder, does two basic operations −
First, it converts an analog voice signal to its equivalent digital form so that it can be easily transmitted.
Thereafter, it converts the compressed digital signal back to its original analog form so that it can be replayed.
There are many codecs available in the market – some are free while others require licensing. Codecs vary in the sound quality and vary in bandwidth accordingly.
Hardware devices such as phones and gateways support several different codecs. While talking to each other, they negotiate which codec they will use.
Here, in this chapter, we will discuss a few popular SIP audio codecs that are widely used.
G.711 is a codec that was introduced by ITU in 1972 for use in digital telephony. The codec has two variants: A-Law is being used in Europe and in international telephone links, uLaw is used in the U.S.A. and Japan.
G.711 uses a logarithmic compression. It squeezes each 16-bit sample to 8 bits, thus it achieves a compression ratio of 1:2.
The bitrate is 64 kbit/s for one direction, so a call consumes 128 kbit/s.
G.711 is the same codec used by the PSTN network, hence it provides the best voice quality. However it consumes more bandwidth than other codecs.
It works best in local area networks where we have a lot of bandwidth available.
G.729 is a codec with low bandwidth requirements; it provides good audio quality.
The codec encodes audio in frames of 10 ms long. Given a sampling frequency of 8 kHz, a 10 ms frame contains 80 audio samples.
The codec algorithm encodes each frame into 10 bytes, so the resulting bitrate is 8 kbit/s in one direction.
G.729 is a licensed codec. End-users who want to use this codec should buy a hardware that implements it (be it a VoIP phone or gateway).
A frequently used variant of G.729 is G.729a. It is wire-compatible with the original codec but has lower CPU requirements.
G.723.1 is the result of a competition that ITU announced with the aim to design a codec that would allow calls over 28.8 and 33 kbit/s modem links.
We have two variants of G.723.1. They both operate on audio frames of 30 ms (i.e. 240 samples), but the algorithms differ.
The bitrate of the first variant is 6.4 kbit/s, while for the second variant, it is 5.3 kbit/s.
The encoded frames for the two variants are 24 and 20 bytes long, respectively.
GSM 06.10 is a codec designed for GSM mobile networks. It is also known as GSM Full Rate.
This variant of the GSM codec can be freely used, so you will often find it in open source VoIP applications.
The codec operates on audio frames 20 ms long (i.e. 160 samples) and it compresses each frame to 33 bytes, so the resulting bitrate is 13 kbit/.