G.711 is a narrowband audio codec originally designed for use in telephony that provides toll-quality audio at 64 kbit/s. It is an ITU-T standard (Recommendation) for audio encoding, titled Pulse code modulation (PCM) of voice frequencies released for use in 1972.
G.711 passes audio signals in the frequency band of 300–3400 Hz and samples them at the rate of 8000 Hz, with the tolerance on that rate of 50 parts per million (ppm).
It uses one of two different logarithmic companding algorithms: μ-law, which is used primarily in North America and Japan, and A-law, which is in use in most other countries outside North America. Each companded sample is quantized as 8 bits, resulting in a 64 kbit/s bit rate.
G.711 is a required standard in many technologies, such as in the H.320 and H.323 standards. It can also be used for fax communication over IP networks (as defined in T.38 specification).
Two enhancements to G.711 have been published: G.711.0 utilizes lossless data compression to reduce the bandwidth usage and G.711.1 increases audio quality by increasing bandwidth.
Features
- 8 kHz sampling frequency
- 64 kbit/s bitrate (8 kHz sampling frequency × 8 bits per sample)
- Typical algorithmic delay is 0.125 ms, with no look-ahead delay
- G.711 is a waveform speech coder
- G.711 Appendix I defines a packet loss concealment (PLC) algorithm to help hide transmission losses in a packetized network
- G.711 Appendix II defines a discontinuous transmission (DTX) algorithm which uses voice activity detection (VAD) and comfort noise generation (CNG) to reduce bandwidth usage during silence periods
- PSQM testing under ideal conditions yields mean opinion scores of 4.45 for G.711 μ-law, 4.45 for G.711 A-law
- PSQM testing under network stress yields mean opinion scores of 4.13 for G.711 μ-law, 4.11 for G.711 A-law
Types
G.711 defines two main companding algorithms, the μ-law algorithm and A-law algorithm. Both are logarithmic, but A-law was specifically designed to be simpler for a computer to process. The standard also defines a sequence of repeating code values which defines the power level of 0 dB.
The μ-law and A-law algorithms encode 14-bit and 13-bit signed linear PCM samples (respectively) to logarithmic 8-bit samples. Thus, the G.711 encoder will create a 64 kbit/s bitstream for a signal sampled at 8 kHz.
A-law
A-law encoding thus takes a 13-bit signed linear audio sample as input and converts it to an 8 bit value as follows:
{| class="wikitable" style="text-align:left"
|-
! Linear input code<br>
! Compressed code<br>XOR 01010101
! Linear output code<br>
|-
| <code>s0000000abcdx</code> || <code>000abcd</code> || <code>s0000000abcd1</code>
|-
| <code>s0000001abcdx</code> || <code>001abcd</code> || <code>s0000001abcd1</code>
|-
| <code>s000001abcdxx</code> || <code>010abcd</code> || <code>s000001abcd10</code>
|-
| <code>s00001abcdxxx</code> || <code>011abcd</code> || <code>s00001abcd100</code>
|-
| <code>s0001abcdxxxx</code> || <code>100abcd</code> || <code>s0001abcd1000</code>
|-
| <code>s001abcdxxxxx</code> || <code>101abcd</code> || <code>s001abcd10000</code>
|-
| <code>s01abcdxxxxxx</code> || <code>110abcd</code> || <code>s01abcd100000</code>
|-
| <code>s1abcdxxxxxxx</code> || <code>111abcd</code> || <code>s1abcd1000000</code>
|}
defines the algorithm for decoding as follows (it puts the decoded values in the 13 most significant bits of the 16-bit output data type).
<syntaxhighlight lang="c">
void alaw_expand(lseg, logbuf, linbuf)
long lseg;
short *linbuf;
short *logbuf;
{
short ix, mant, iexp;
long n;
for (n = 0; n < lseg; n++)
{
ix = logbuf[n] ^ (0x0055); /* re-toggle toggled bits */
ix &= (0x007F); /* remove sign bit */
iexp = ix >> 4; /* extract exponent */
mant = ix & (0x000F); /* now get mantissa */
if (iexp > 0)
mant = mant + 16; /* add leading '1', if exponent > 0 */
mant = (mant << 4) + (0x0008); /* now mantissa left justified and */
/* 1/2 quantization step added */
if (iexp > 1) /* now left shift according exponent */
mant = mant << (iexp - 1);
linbuf[n] = logbuf[n] > 127 /* invert, if negative sample */
? mant
: -mant;
}
}
</syntaxhighlight>
See also "ITU-T Software Tool Library 2009 User's manual" that can be found at.
μ-law
The μ-law (sometimes referred to as ulaw, G.711Mu, or G.711μ) encoding takes a 14-bit signed linear audio sample in two's complement representation as input, inverts all bits after the sign bit if the value is negative, adds 33 (binary 100001) and converts it to an 8 bit value as follows:
{| class="wikitable" style="text-align:left"
|-
! Linear input value<br>
! Compressed code<br>XOR 11111111
! Linear output value<br>
|-
| <code>s00000001abcdx</code> || <code>s000abcd</code> || <code>s00000001abcd1</code>
|-
| <code>s0000001abcdxx</code> || <code>s001abcd</code> || <code>s0000001abcd10</code>
|-
| <code>s000001abcdxxx</code> || <code>s010abcd</code> || <code>s000001abcd100</code>
|-
| <code>s00001abcdxxxx</code> || <code>s011abcd</code> || <code>s00001abcd1000</code>
|-
| <code>s0001abcdxxxxx</code> || <code>s100abcd</code> || <code>s0001abcd10000</code>
|-
| <code>s001abcdxxxxxx</code> || <code>s101abcd</code> || <code>s001abcd100000</code>
|-
| <code>s01abcdxxxxxxx</code> || <code>s110abcd</code> || <code>s01abcd1000000</code>
|-
| <code>s1abcdxxxxxxxx</code> || <code>s111abcd</code> || <code>s1abcd10000000</code>
|}
The Lossless compression of G.711 pulse code modulation standard was approved by ITU-T in September 2009.
G.711.1
G.711.1 "Wideband embedded extension for G.711 pulse code modulation" is a higher-fidelity extension to G.711, ratified in 2008 and further extended in 2012.
G.711.1 allows a series of enhancement layers on top of a raw G.711 core stream (Layer 0): Layer 1 codes 16-bit audio in the same 4kHz narrowband, and Layer 2 allows 8kHz wideband using MDCT; each uses a fixed 16 kbps in addition to the 64 kbps core. They may be used together or singly, and each encodes the differences from the previous layer. Ratified in 2012, Layer 3 extends Layer 2 to 16kHz "superwideband," allowing another 16 kbps for the highest frequencies, while retaining layer independence. Peak bitrate becomes 96 kbps in original G.711.1, or 112 kbps with superwideband. No internal method of identifying or separating the layers is defined, leaving it to the implementation to packetize or signal them.
A decoder that doesn't understand any set of fidelity layers may ignore or drop non-core packets without affecting it, enabling graceful degradation across any G.711 (or original G.711.1) telephony system with no changes.
Also ratified in 2012 was G.711.0 lossless extended to the new fidelity layers. Like G.711.0, full G.711 backward compatibility is sacrificed for efficiency, though a G.711.0 aware node may still ignore or drop layer packets it doesn't understand.
Licensing
The patents for G.711, released in 1972, have expired, so it may be used without the need for a license.
