Professional Documents
Culture Documents
By:
Dr. Ahmed A. Khalifa
Agenda
• Introduction
2
Audio Frequencies
• Humans have limited capabilities in terms of hearing and
generating sounds
• Human ear can hear frequencies (20Hz to 20KHz)
3
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Introduction to Speech Compression and
Codecs
4
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Introduction to Speech Compression and
Codecs (Cont.)
• Many advanced codecs can have variable bit rates which may be used
for adaptive VoIP applications to improve voice quality or QoE
• Some VoIP tools can allow speech codecs used to be changed during
a VoIP session, making it possible to select the most suitable codec for a
given network condition
Remember:
• Voice codecs or speech codecs are based on different speech
compression techniques which aim to:
• Remove redundancy from the speech signal to achieve compression
• Reduce transmission and storage costs
6
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Introduction to Speech Compression and
Codecs (Cont.)
• Speech compression codecs are compared with the 64 kb/s PCM codec as the
reference for all speech codecs
• Speech codecs with the lowest data rates (e.g., 2.4 or 1.2 kb/s Vocoder) are
used mainly in secure communications
• With compression ratios of about 26.6 or 53.3 (compared to PCM) and still
maintain intelligibility, but with speech quality that is somewhat
‘mechanical’
• Most of speech codecs operate in the range of 4.8 kb/s to 16 kb/s are mainly used
in bandwidth resource limited mobile/wireless applications
• Have good speech quality and reasonable compression ratio
• In general, the higher the speech bit rate, the higher the speech quality and the
greater the bandwidth and storage requirements
• In practice, it is always a trade-off between:
7
Bandwidth utilization & Speech quality
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Speech Signal Digitization
8
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Speech Signal Digitization (Cont.)
• Sampling: periodic measurement of an analog signal and
changes a continuous-time signal into a discrete-time signal
9
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Speech Signal Digitization (Cont.)
- Waveform with sample times
•The trick with the samples is
to take enough of them to
provide an accurate
reproduction of the original
while not sampling too much
11
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Speech Signal Digitization (Cont.)
- Quantizing the samples
• Quantization Error: Difference
between the quantized amplitude
and actual signal amplitude
13
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Speech Signal Digitization (Cont.)
• Coding : convert discrete-amplitude signal into a series of
binary bits (or bitstream) for transmission and storage
• Non-uniform quantisation has been applied in Pulse Coding
Modulation (PCM), the most simple and commonly used speech
codec
• PCM explores non-uniform quantisation by using a logarithm
companding method to provide fine quantisation for low speech
and coarse quantisation for high speech signal
• For G.711 PCM, each sample is assigned a value based on
eight bits
• This provides for 256 possible values, which means that a signal
could have as many as 256 possible lines of resolution
• The capacity of the channel or data rate:
8000 samples × 8 bits per sample = 64000 bit per second
14
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Speech waveform and Spectrum
• Speech waveform: time-domain representation of
digitized speech signal.
• Speech spectrum: representation of the speech
signal in the frequency-domain
15
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Speech Compression and Coding
• Three basic speech compression techniques:
16
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Waveform Compression Coding
• Mainly to:
– Remove redundancy in the speech waveform (remove waveform
correlation between speech samples to achieve speech compression)
18
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Waveform Compression Coding -
ADPCM
• ADPCM proposed by Jayant in 1974 at Bell Labs
• ADPCM was developed to further compress PCM codec based on
correlation between adjacent speech samples
• ADPCM Consists of adaptive quantiser and adaptive predictor
• At the encoder side:
• ADPCM first converts 8 bit PCM signal (A-law or μ-law) to 16 bit linear PCM
signal
• The adaptive predictor will predict or estimate the current speech signal
based on previously received (reconstructed) N speech signal samples
˜s(n) as given in
e(n) < PCM input signal less coding bits are needed to represent ADPCM
sample
•Decoder at receiver side will use the same prediction algorithm to reconstruct the
20
speech sample
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Waveform Compression Coding -
ADPCM (Cont.)
Examples:
The higher the ADPCM bit rate, the higher the numbers of the quantization levels,
the lower the quantization error, and thus the better the voice quality
• High in implementation complexity - better compression ratio – low quality, with mechanic
sound, but with reasonable intelligibility
• Codec : Linear Prediction Coding (LPC) vocoder (bit rate from 1.2 to 4.8 kb/s)
• Used in: secure wireless communications systems when transmission bandwidth is very
22
limited
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Parametric Compression Coding (Cont.)
- Speech generation mathematical model
Speech generation mathematical model
• If we can:
• Detect whether a segment of speech is voiced or unvoiced
(e.g., 20 ms of speech, which corresponds to 160 samples at 8 kHz sampling rate)
• Estimate its LPC filter parameters, pitch period (for voiced signal) and
its gain (power) via speech signal analysis
• We can then:
• just encode and send these parameters to the channel/network
& then
• synthesize the speech based on the received parameters at the
decoder
• This process is repeated for each speech frame
24
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Parametric Compression Coding (Cont.)-
Linear Prediction Coding (LPC) Encoder
• Encoder Key Components:
• Pitch estimation (to estimate the pitch period
of the speech segment)
• Voicing decision (to decide whether it is a
voiced or unvoiced frame)
• Gain calculation (to calculate the power of
the speech segment)
• LPC filter analysis (to predict the LPC filter
coefficients for this segment of speech)
Parameters/coefficients are quantized, coded and
packetized appropriately before they are sent to the
channel
• Parameters and coded bits from the LPC encoder:
• Pitch period (T): for example, coded in 7 bits as in LPC-10 (together with voicing
decision)
• Voiced/unvoiced decision: to indicate whether it is voiced or unvoiced segment.
• Gain (G) or signal power: coded in 5 bits as in LPC-10
• Vocal tract model coefficients: or LPC filter coefficients, normally in 10-order, i.e. a1,
25
a2, . . . , a10, coded in 41 bits in LPC-10
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Parametric Compression Coding (Cont.)-
Linear Prediction Coding (LPC) Decoder
• Packetised LPC-bitstream are unpacked and
sent to the relevant decoder components :
• LPC decoder to retrieve the LPC
coefficients
• For every 22.5 ms, 54 coded binary bits from the encoder are sent to the channel
• The encoder bit rate = Number of coded bits per frame / Frame duration
= 54 bits/22.5 ms = 2400 bit/s or 2.4 kb/s
• The compression ratio (when compared with 64 kb/s PCM) = 64/2.4 = 26.7
27
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Hybrid Compression Coding
• Combine the features of both waveform-based and parametric-
based coding
30
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Standardised Narrowband to Fullband
Speech/Audio Codecs
31
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Standardised Narrowband to Fullband
Speech/Audio Codecs
32
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Standardised Narrowband to Fullband
Speech/Audio Codecs
33
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Codec Selection and Performance
34
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
Codec Selection and Performance
35
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
IllustrativeWorked Examples
Question 1
• Determine the input and output data rates (in
kb/s) and hence the compression ratio for a
G.711 codec
• Assumptions:
• The input speech signal is first sampled at
8 kHz & that each sample is then
converted to 14-bit linear code before
being compressed into 8-bit non-linear
PCM by the G.711 codec
36
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
IllustrativeWorked Examples
Solution 1
• For the input data:
• Input speech signal is sampled at 8 kHz i.e. 8000 samples
per second
• Each sample is coded using 14
• Thus the input data rate is:
8000×14 = 112,000 (bit/s) = 112 (kb/s)
• Thus, using 5 bits to code each quantized difference signal will create an
ADPCM bit steam operating at 40 kb/s
• Similarly, for 32, 24 and 16 kb/s, the required bits for each quantized
difference signal is 4 bits, 3 bits and 2 bits, respectively
• For the compression ratio for 40 kb/s ADPCM when compared with 64 kb/s
PCM, it is 64/40 = 1.6
• For 32, 24 and 16 kb/s ADPCM, the compression ratio is 2, 2.67, 4,
respectively
39
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
IllustrativeWorked Examples
Question 3
• For the G.723.1 codec, it is known that the
transmission bit rates can operate at either
5.3 or 6.3 kb/s
40
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
IllustrativeWorked Examples
Solution 3
• For the G.723.1 codec, the frame size is 30 ms
• As G.723.1 is narrowband codec, the sampling rate is 8
kHz
Frame duration = Number of samples / Sampling rate
• The number of speech samples in a speech frame is:
30 (ms)×8000 (samples/s) = 240 (samples)
Encoder bit rate = Number of coded bits per frame / Frame duration
• For 5.3 kb/s G.723.1, the number of parameters bits is:
30 (ms)×5.3 (kb/s) = 159 (bits)
• For 6.3 kb/s G.723.1, the number of parameters bits is:
30 (ms)×6.3 (kb/s) = 189 (bits)
41
Overview of VoIP VoIP Trend Requirements & Factors affects QoS Speech Compression and Codecs
References
42
Thank you!
43
Questions
44