Presentation is loading. Please wait.

Presentation is loading. Please wait.

Speech Coding EE 516 Spring 2009 Alex Acero. Acknowledgments Thanks to Allen Gersho for some slides…

Similar presentations


Presentation on theme: "Speech Coding EE 516 Spring 2009 Alex Acero. Acknowledgments Thanks to Allen Gersho for some slides…"— Presentation transcript:

1 Speech Coding EE 516 Spring 2009 Alex Acero

2 Acknowledgments Thanks to Allen Gersho for some slides…

3 Outline Quality vs Bit rate Types of speech coders Waveform Coding Speech production and vocoders Analysis by Synthesis VoIP

4 Voice Quality Bandwidth is easily quantified –Voice quality is subjective MOS, Mean Opinion Score –ITU-T Recommendation P.800 Excellent – 5 Good – 4 Fair – 3 Poor – 2 Bad – 1 –A minimum of 30 people –Listen to voice samples or in conversations

5 Voice Quality P.800 recommendation –The selection of participants –The test environment –Explanations to listeners –Analysis of results Toll quality –A MOS of 4.0 or higher

6 Quality Measurements Subjective and objective quality-testing techniques PSQM – Perceptual Speech Quality Measurement –ITU-T P.861 –faithfully represent human judgement and perception –algorithmic comparison between the output signal and a know input –type of speaker, loudness, delay, active/silence frames, clipping, environmental noise

7 Eurospeech Bit Rate (kb/s) Speech Quality Excellent Good Fair Poor Bad Evolution of Speech Coder Performance ITU Recommendations Cellular Standards Secure Telephony 1980 Profile 1990 Profile 2000 Profile North American TDMA

8 Speech Coding (Telephony) More complicated than Moore’s Law –Many Dimensions: Bit Rate, Quality, Complexity and Delay –Quality ceiling (imposed by telephone standards) Easy to reach the ceiling at high bit rates (≥ 8 kb/s) More room for progress at low bit rates (≤ 8 kb/s) Ceili ng

9 Speech Coding (Telephony) More complicated than Moore’s Law –Many Dimensions: Bit Rate, Quality, Complexity and Delay –Quality ceiling (imposed by telephone standards) Easy to reach the ceiling at high bit rates (≥ 8 kb/s) More room for progress at low bit rates (≤ 8 kb/s) Moore’s Law Time Constant –Bit rates half every decade (≤ 8 kb/s) –Relatively slow by Moore’s Law standards (not hyper-inflation) Performance doubles every decade Like disk seek or money in the bank (normal inflation) –Limited more by physics than investment Ceili ng

10 Speech Coding (Telephony) More complicated than Moore’s Law –Many Dimensions: Bit Rate, Quality, Complexity and Delay –Quality ceiling (imposed by telephone standards) Easy to reach the ceiling at high bit rates (≥ 8 kb/s) More room for progress at low bit rates (≤ 8 kb/s) Moore’s Law Time Constant –Bit rates half every decade (≤ 8 kb/s) –Relatively slow by Moore’s Law standards (not hyper-inflation) Performance doubles every decade Like disk seek or money in the bank (normal inflation) –Limited more by physics than investment Potential compression opportunity –At most 10x: 8 kb/s  2 kb/s  1 kb/s (?)  50 bits per sec (??) Speech (2 kb/s) >> text (2 bits/char): times more bits –Speech coding will not close this gap for foreseeable future Ceili ng

11 Speech Coding (Telephony) More complicated than Moore’s Law –Many Dimensions: Bit Rate, Quality, Complexity and Delay –Quality ceiling (imposed by telephone standards) Easy to reach the ceiling at high bit rates (≥ 8 kb/s) More room for progress at low bit rates (≤ 8 kb/s) Moore’s Law Time Constant –Bit rates half every decade (≤ 8 kb/s) –Relatively slow by Moore’s Law standards (not hyper-inflation) Performance doubles every decade Like disk seek or money in the bank (normal inflation) –Limited more by physics than investment Potential compression opportunity –At most 10x: 8 kb/s  2 kb/s  1 kb/s (?) Speech (2 kb/s) >> text (2 bits/char): times more bits –Speech coding will not close this gap for foreseeable future Ceili ng

12 Outline Quality vs Bit rate Types of speech coders Waveform Coding Speech production and vocoders Analysis by Synthesis VoIP

13 Type of Speech Coders Waveform codecs –Sample and code –High-quality and not complex –Large amount of bandwidth Source codecs (vocoders) –Match the incoming signal to a math model –Linear-predictive filter model of the vocal tract –A voiced/unvoiced flag for the excitation –The information is sent rather than the signal –Low bit rates, but sounds synthetic –Higher bit rates do not improve much

14 Type of Speech Coders Hybrid codecs –Attempt to provide the best of both –Perform a degree of waveform matching –Utilize the sound production model –Quite good quality at low bit rate

15 Outline Quality vs Bit rate Types of speech coders Waveform Coding Speech production and vocoders Analysis by Synthesis VoIP

16 Waveform coders High quality, high bitrate Pulse Code Modulation (PCM) –Sample input waveform –Quantization Differential PCM –Sample input waveform –Encode difference between adjacent samples Adaptive DPCM –Adapt step size for quantization based on speech statistics

17 Voice Sampling A-to-D –discrete samples of the waveform and represent each sample by some number of bits –A signal can be reconstructed if it is sampled at a minimum of twice the maximum frequency (Nyquist Theorem) Human speech – Hz –8000 samples per second time Each sample is encoded into an 8-bit PCM code word (e.g ) => 8000 x 8 bit/s

18 Quantization How many bits is used to represent Quantization noise –The difference between the actual level of the input analog signal More bits to reduce –Diminishing returns Uniform quantization levels –Louder talkers sound better

19 Non-uniform quantization % quantization error is larger for smaller values of x(t) Goal: create a set of smaller % error at small signal values and similarly at large ones. This process is called “companding” at the source encoding end and “decompanding” at the decoding (D/A) end. The net effect is to make the sum of the quantization errors smaller and more uniform percentage-wise. Logarithmic scaling (A-law in Europe and µ-law in US)

20 Non-uniform quantization Smaller quantization steps at smaller signal levels Spread signal-to-noise ratio more evenly

21 G.711 The most commonplace codec –Used in circuit-switched telephone network –PCM, Pulse-Code Modulation If uniform quantization –12 bits * 8 k/sec = 96 kbps Non-uniform quantization –64 kbps DS0 rate –mu-law North America –A-law Other countries, a little friendlier to lower signal levels –An MOS of about 4.3

22 DPCM DPCM, Differential PCM –Only transmit the difference between the predicated value and the actual value –Voice changes relatively slowly –It is possible to predict the value of a sample base on the values of previous samples –The receiver perform the same prediction –The simplest form No prediction No algorithmic delay

23 ADPCM (Adaptive DPCM) Predicts sample values based on –Past samples –Factoring in some knowledge of how speech varies over time The error is quantized and transmitted –Fewer bits required G.721 –32 kbps G.726 –A-law/mu-law PCM -> 16, 24, 32, 40 kbps –An MOS of about 4.0 at 32 kbps

24 Subjective quality metrics for speech METRICBASIS (better-worse) RANGE FOR TOLL RANGE FOR SYNTHETIC Mean Opinion Score – Diagnostic Rhyme Test (consonants) 100~ 95~ 90 Diagnostic Acceptability Measure 100~ 73~ 54

25 Common Waveform Coders TypeQuality MOS –DRT DAM Kbit/secMIPS Complexity PCMToll96Very low log PCM4.3 – ADM/CVSDToll40Low

26 Outline Quality vs Bit rate Types of speech coders Waveform Coding Speech production and vocoders Analysis by Synthesis VoIP

27 Information rate of speech Phonetic content at a rate of about 72 bits/second: –6 bits sufficient for different phonemes –Average speaking rate is about 12 phonemes/second This neglects: –Intonation (no pitch transmitted) –Emotion –Individual characterization of speech (the ability to recognize the speaker) –Phone durations are different

28 Redundancies in speech Our sampling frequency Fs is >> than vocal tract rate of change (with the exception of closures ) F0 (or perceived pitch) changes slowly as compared to windowing rate Adjacent windows correlate rather well Spectral waveform changes slowly and most of the energy is at the low end of frequencies so it changes even more slowly there (important part of speech) It is possible to model phones as periodic/noisy filtered excitation and still obtain reasonable quality Speech parameters may be weighted since they occur nonuniformly (different probabilities) The ear is insensitive to phase so it can be discarded

29 Average power spectrum of speech Notice that the frequency scale is logarithmic in this figure. Speech has in general higher power at the lower frequencies for sonorants and less power above 3.3kHz, as shown here.

30 Human Speech Production System Air flow forced from lungs to vocal tract –short-term correlations –Filter with resonances (called formants) Speech sound classes –Voiced sounds Voice cord vibration Long-term periodicity –Unvoiced sounds Constriction in the vocal tract No long-term periodicity –Plosive sounds Release of air pressure behind mouth

31 A Little About Speech Speech –Air pushed from the lungs past the vocal cords and along the vocal tract –The basic vibrations – vocal cords –The sound is altered by the disposition of the vocal tract ( tongue and mouth) Model the vocal tract as a filter –The shape changes relatively slowly The vibrations at the vocal cords –The excitation signal

32 Voiced Speech The vocal cords vibrate open and close Interrupt the air flow Quasi-periodic pluses of air The rate of the opening and closing – the pitch A high degree of periodicity at the pitch period –2-20 ms

33 Voiced Speech Voiced speech Power spectrum density

34 Unvoiced Speech Forcing air at high velocities through a constriction The glottis is held open Noise-like turbulence Show little long-term periodicity Short-term correlations still present

35 Unvoiced Speech unvoiced speech Power spectrum density

36 Stops Plosive sounds –A complete closure in the vocal tract –Air pressure is built up and released suddenly A vast array of sounds –The speech signal is relatively predictable over time –The reduction of transmission bandwidth can be significant

37 Linear predictive Coding (LPC) Predict current sample as linear combination of past samples An all-pole model: Minimize squared error Orthogonality principle Solution

38 Vocoders (source coders) Linear prediction model for human voice system Medium quality, low bitrate

39 Vector Quantization Example Key challenge –Given a source distribution, how to select codebook (*) and partitions (---) to result in smallest average distortion Solution: –Divide and conquer –Two codes  four  eight …

40 Outline Quality vs Bit rate Types of speech coders Waveform Coding Speech production and vocoders Analysis by Synthesis VoIP

41 Analysis-by-Synthesis (AbS) Codecs Hybrid method –Vocoder’s linear prediction model –Careful selection of excitation signal to reconstruct original waveform –High quality, low bitrate! The most successful and commonly used Time-domain AbS codecs –Not a simple two-state, voiced/unvoiced –Different excitation signals are attempted –Closest to the original waveform is selected Types: –MPE, Multi-Pulse Excited –RPE, Regular-Pulse Excited –CELP, Code-Excited Linear Predictive

42 Linear-Prediction-based Analysis-by-Synthesis How it works –Segment speech into frames (typically 20ms long) –Find filter parameter for each frame –Find excitation whose that minimizes prediction error Perceptual weighting More accuracy where speech energy is low –Transmit the filter parameter and excitation signal Vector quantization

43 LPAS Classification Three classes –Multi-Pulse Excited (MPE) –Regular-Pulse Excited (RPE) –Code-Excited Linear Predictive (CELP) Difference lies in representation of excitation signal

44 Multi-Pulse Excited (MPE) Excitation is given by a fixed number of pulses Position and amplitude of the pulses are computed to minimize error and transmitted to decoder Finding the best match is theoretically possible but not practical Suboptimal estimations are given Typically about 4 pulses per 5 ms are used

45 Regular-Pulse Excited (RPE) Multiple pulses used like in MPE Regularly spaced at fixed period Only needs to transmit first pulse’s position and all pulses amplitude –More pulses are allowed for better quality at same bitrate –Around 10 pulses per 5 ms

46 Code-Excited Linear Predictive (CELP) Excitation is given by –an entry from a large vector quantizer codebook –A gain term for its power (amplitude) Key challenge –Searching for the right excitation entries in realtime –Solution: restructure the codebook optimized for searching (such as a tree) Performance –4.8kbps or lower bitrate with good quality

47 Further Improvements on CELP Representation of pitch period –Adaptive Long-term prediction + short-term adjustment Coding of LP filter –Vector quantization of filter representation Multimode coding –Dynamic bit allocation between excitation, LP filter and pitch

48 G.728 LD-CELP CELP codecs –A filter; its characteristics change over time –A codebook of acoustic vectors A vector = a set of elements representing various char. of the excitation –Transmit Filter coefficients, gain, a pointer to the vector chosen Low Delay CELP –Backward-adaptive coder Use previous samples to determine filter coefficients Operates on five samples at a time –Delay < 1 ms Only the pointer is transmitted

49 G.728 LD-CELP 1024 vectors in the code book 10-bit pointer (index) 16 kbps LD-CELP encoder –Minimize a frequency-weighted mean-square error

50 G.728 LD-CELP –MOS score of about 3.9 –One-quarter of G.711 bandwidth (16kbps) –30 MIPSMIPS –2 kilobytes of RAM is needed for codebookskilobytesRAM –50th order LPC filter.LPC –Lower delays are obtained by making the excitation vectors very short (~5 samples or ms)

51 Algebraic CELP (ACELP) Algebraic CELP (ACELP) the residual samples are not VQ-ed but derived directly from an algebraic computation to be used in exciting the LP synthesizer accelerating the search for optimal excitation Main advantage is algebraic codebook can be very large (> 50 bits) without running into storage or CPU time problems. A 16-bit algebraic codebook is used in the innovative codebook search, the aim of which is to find the best innovation and gain parameters The innovation vector contains, at most, four non-zero pulses. In ACELP a block of N speech samples is synthesized by filtering an appropriate innovation sequence from a codebook, scaled by a gain factor, through two time varying filters, one a long-term or pitch, synthesis filter and the other a shorter term synthesis filter. Conjugate Structure ACELP yields toll-quality with a 10th order LPC

52 G ACELP 6.3 or 5.3 kbps –Both mandatory –Can change from one to another during a conversation The coder –A band-limited input speech signal –Sampled at 8 KHz, 16-bit uniform PCM quantization –Operate on blocks of 240 samples at a time –A look-ahead of 7.5 ms –A total algorithmic delay of 37.5 ms + other delays –A high-pass filter to remove any DC component

53 G ACELP Various operations to determine the appropriate filter coefficients 5.3 kbps, Algebraic Code-Excited Linear Prediction 6.3 kbps, Multi-pulse Maximum Likelihood Quantization The transmission –Linear predication coefficients –Gain parameters –Excitation codebook index –24-octet frames at 6.3 kbps, 20-octet frames at 5.3 kbps

54 G ACELP G Annex A –Silence Insertion Description (SID) frames of size four octets The two lsbs of the first octet –006.3kbps24 octets/frame –015.3kbps20 –10SID frame 4 An MOS of about 3.8 –At least 27.5 ms delay

55 G kbps Input frames of 10 ms, 80 samples for 8 KHz sampling rate 5 ms look-ahead –Algorithmic delay of 15 ms An 80-bit frame for 10 ms of speech A complex codec –G.729.A (Annex A), a number of simplifications –Same frame structure –Encoder/decoder, G.729/G.729.A –Slightly lower quality

56 G.729 G.729.B –VAD, Voice Activity Detection Based on analysis of several parameters of the input The current frames plus two preceding frames –DTX, Discontinuous Transmission Send nothing or send an SID frame SID frame contains information to generate comfort noise –CNG, Comfort Noise Generation G.729, an MOS of about 4.0 G.729A an MOS of about 3.7

57 G.729 G.729 Annex D –a lower-rate extension –6.4 kbps; 10 ms speech samples, 64 bits/frame –MOS  6.3 kbps G G.729 Annex E –a higher bit rate enhancement –the linear prediction filter of G.729 has 10 coef. –that of G.729 Annex E has 30 coef. –the codebook of G.729 has 35 bits –that of G.729 Annex E has 44 bits –118 bits/frame; 11.8 kbps

58 CDMA QCELP (IS-733) Variable-rate coder Two most common rates –The high rate, 13.3 kbps –A lower rate, 6.2 kbps Silence suppression For use with RTP, RFC 2658

59 GSM Enhanced Full-Rate (EFR) GSM An enhanced version of GSM Full-Rate ACELP-based codec The same bit rate and the same overall packing structure –12.2 kbps Support discontinuous transmission For use with RTP, RFC 1890

60 GSM Adaptive Multi-Rate (AMR) 20 ms coding delay Eight different modes 4.75 kbps to 12.2 kbps 12.2 kbps, GSM EFR 7.4 kbps, IS-641 (TDMA cellular systems) Change the mode at any time Offer discontinuous transmission –The SID (Silence Descriptor) is sent in every 8 th frame and is 5 bytes in size The coding choice of many 3G wireless networks

61 VSELP Vector-Sum-Excited Linear Prediction: –In IS-54 standard TDMA cell phones in US and a variation in Japan –In the first version of RealAudio for audio over the Internet Data rate: –Data rate of 7.95 kbit/s: 20 ms of speech into 159-bit frames –In an actual TDMA cell phone, the vocoder output is packaged with error correction and signaling information, resulting in an over-the-air data rate of 16.2 kbit/s –For internet audio, each 159-bit frame is stored in 20 bytes, leaving 1 bit unused. The resulting file thus has a data rate of exactly 8 kbit/s Limited ability to encode non-speech sounds –Performs poorly in the presence of background noise

62 References Human voice model –http://cnx.rice.edu/content/m0049/latest/http://cnx.rice.edu/content/m0049/latest/ Speech Compression –http://www.data-compression.com/speech.shtmlhttp://www.data-compression.com/speech.shtml Speech coding tutorial –http://www-mobile.ecs.soton.ac.uk/speech_codecs/http://www-mobile.ecs.soton.ac.uk/speech_codecs/ Standard codecs –http://www.ittiam.com/pages/products/g711.htmhttp://www.ittiam.com/pages/products/g711.htm Spanias, AS, “Speech coding, a tutorial review”, 1994

63 Outline Quality vs Bit rate Types of speech coders Waveform Coding Speech production and vocoders Analysis by Synthesis VoIP

64 Effects of packetization

65 Advantages of VoIP Cost savings: –Avoid the need for separate voice and data networks –Conference calling, IVR, call forwarding, automatic redial, and caller ID features (traditional telcos normally charge extra) –While regular telephone calls are billed by the minute or second, VoIP calls are billed per megabyte Flexibility: –Simple way to add an extra telephone line to a home or office. –Secure calls using standardized protocols (such as Secure Real-time Transport Protocol)Secure Real-time Transport Protocol –Location independence: call center agents using VoIP phones can work from anywhere –Integration with other services available over the Internet, including video conversation, message or data file exchange in parallel with the conversation, audio conferencing, managing address books Potential quality improvements: –Break legacy 8kHz => 16kHz, stereo, 5.1

66 Challenges with VoIP Quality of Service (QoS) –Latency –Packet loss Play silence? Audio “healing” –Transcoding leads to quality degradations Susceptibility to power failure 911 calls Security: hackers in your phone

67 DTX and Comfort Noise DTX is Discontinuous Transmission Voice activity detector (VAD) detects if there is active speech or not. When there is no active speech different DTX procedures can be used: –No Transmission at all –Comfort Noise (CN) using RFC 3389 –Codec built CN in like AMR SID (Silence Descriptor) Frequency of Comfort Noise packets varies but is usually some fraction of normal packet rate

68 Tones, Signal, and DTMF Digits The hybrid codecs are optimized for human speech –Other data may need to be transmitted –Tones: fax tones, dialing tone, busy tone –DTMF digits for two-stage dialing or voic G.711 is OK G and G.729 can be unintelligible The ingress gateway needs to intercept –The tones and DTMF digits –Use an external signaling system


Download ppt "Speech Coding EE 516 Spring 2009 Alex Acero. Acknowledgments Thanks to Allen Gersho for some slides…"

Similar presentations


Ads by Google