Lecture 7: Audio Compression and Coding

Lecture 7: Audio Compression and Coding

EE E6820: Speech & Audio Processing & Recognition Lecture 7: Audio compression and coding Dan Ellis <[email protected]> Michael Mandel <[email protected]> Columbia University Dept. of Electrical Engineering http://www.ee.columbia.edu/∼dpwe/e6820 March 31, 2009 1 Information, Compression & Quantization 2 Speech coding 3 Wide-Bandwidth Audio Coding E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 1 / 37 Outline 1 Information, Compression & Quantization 2 Speech coding 3 Wide-Bandwidth Audio Coding E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 2 / 37 Compression & Quantization How big is audio data? What is the bitrate? I Fs frames/second (e.g. 8000 or 44100) x C samples/frame (e.g. 1 or 2 channels) x B bits/sample (e.g. 8 or 16) ! Fs · C · B bits/second (e.g. 64 Kbps or 1.4 Mbps) CD Audio 1.4 Mbps 32 bits / frame 8 Mobile 8000 44100 !13 Kbps frames / sec Telephony 64 Kbps How to reduce? I lower sampling rate ! less bandwidth (muffled) I lower channel count ! no stereo image I lower sample size ! quantization noise Or: use data compression E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 3 / 37 Data compression: Redundancy vs. Irrelevance Two main principles in compression: I remove redundant information I remove irrelevant information Redundant information is implicit in remainder I e.g. signal bandlimited to 20kHz, but sample at 80kHz ! can recover every other sample by interpolation: In a bandlimited signal, the red samples can be exactly recovered by interpolating the blue samples sample time Irrelevant info is unique but unnecessary I e.g. recording a microphone signal at 80 kHz sampling rate E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 4 / 37 Irrelevant data in audio coding For coding of audio signals, irrelevant means perceptually insignificant I an empirical property Compact Disc standard is adequate: I 44 kHz sampling for 20 kHz bandwidth I 16 bit linear samples for ∼ 96 dB peak SNR Reflect limits of human sensitivity: I 20 kHz bandwidth, 100 dB intensity I sinusoid phase, detail of noise structure I dynamic properties - hard to characterize Problem: separating salient & irrelevant E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 5 / 37 Quantization Represent waveform with discrete levels 5 4 6 3 Q[x[n]] x[n] 2 4 1 2 Q[x] 0 -1 0 -2 -3 -2 -4 error e[n] = x[n] - Q[x[n]] -5 0 5 10 15 20 25 30 35 40 -5 -4 -3 -2 -1 0 1 2 3 4 5 x Equivalent to adding error e[n]: x[n] = Q [x[n]] + e[n] e[n] ∼ uncorrelated, uniform white noise p(e[n]) 2 D2 ! variance σe = 12 -D +D /2 /2 E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 6 / 37 Quantization noise (Q-noise) Uncorrelated noise has flat spectrum With a B bit word and a quantization step D B−1 B−1 I max signal range (x) = −(2 ) · D ::: (2 − 1) · D I quantization noise( e) = −D=2 ::: D=2 ! Best signal-to-noise ratio (power) SNR = E[x2]=E[e2] = (2B )2 .. or, in dB, 20 · log10 2 · B ≈ 6 · B dB 0 Quantized at 7 bits -20 -40 level / dB -60 -80 0 1000 2000 3000 4000 5000 6000 7000 freq / Hz E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 7 / 37 Redundant information Redundancy removal is lossless Signal correlation implies redundant information I e.g. if x[n] = x[n − 1] + v[n] x[n] has a greater amplitude range ! uses more bits than v[n] I sending v[n] = x[n] − x[n − 1] can reduce amplitude, hence bitrate x[n] - x[n-1] I but: `white noise' sequence has no redundancy ... Problem: separating unique& redundant E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 8 / 37 Optimal coding Shannon information: An unlikely occurrence is more `informative' p(A) = 0.5 p(B) = 0.5 p(A) = 0.9 p(B) = 0.1 ABBBBAAABBABBABBABB AAAAABBAAAAAABAAAAB A, B equiprobable A is expected; B is ‘big news’ Information in bits I = − log2(probability) I clearly works when all possibilities equiprobable Optimal bitrate ! av.token length = entropy H = E[I ] I .. equal-length tokens are equally likely How to achieve this? I transform signal to have uniform pdf I nonuniform quantization for equiprobable tokens I variable-length tokens ! Huffman coding E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 9 / 37 Quantization for optimum bitrate Quantization should reflect pdf of signal: p(x = x0) p(x < x0) x' 1.0 0.8 0.6 0.4 0.2 0 -0.02 -0.015 -0.01 -0.005 0 0.005 0.01 0.015 0.02 0.025 x 0 I cumulative pdf p(x < x0) maps to uniform x Or, codeword length per Shannon log2(p(x)): p(x) Shannon info / bits Codewords -0.02 111111111xx 111101xx -0.01 111100xx 101xx 100xx 0 0xx 110xx 0.01 1110xx 111110xx 1111110xx 0.02 111111100xx 111111101xx 111111110xx 0.03 0 2 4 6 8 I Huffman coding: tree-structured decoder E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 10 / 37 Vector Quantization Quantize mutually dependent values in joint space: 3 x1 2 1 0 -1 -2 x2 -6 -4 -2 0 2 4 May help even if values are largely independent I larger space x1,x2 is easier for Huffman E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 11 / 37 Compression & Representation As always, success depends on representation Appropriate domain may be `naturally' bandlimited I e.g. vocal-tract-shape coefficients I can reduce sampling rate without data loss In right domain, irrelevance is easier to `get at' I e.g. STFT to separate magnitude and phase E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 12 / 37 Aside: Coding standards Coding only useful if recipient knows the code! Standardization efforts are important Federal Standards: Low bit-rate secure voice: I FS1015e: LPC-10 2.4 Kbps I FS1016: 4.8 Kbps CELP ITU G.x series (also H.x for video) I G.726 ADPCM I G.729 Low delay CELP MPEG I MPEG-Audio layers 1,2,3 (mp3) I MPEG 2 Advanced Audio Codec (AAC) I MPEG 4 Synthetic-Natural Hybrid Codec More recent `standards' I proprietary: WMA, Skype... I Speex ... E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 13 / 37 Outline 1 Information, Compression & Quantization 2 Speech coding 3 Wide-Bandwidth Audio Coding E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 14 / 37 Speech coding Standard voice channel: I analog: 4 kHz slot (∼ 40 dB SNR) I digital: 64 Kbps = 8 bit µ-law x 8 kHz How to compress? Redundant I signal assumed to be a single voice, not any possible waveform Irrelevant I need code only enough for intelligibility, speaker identification (c/w analog channel) Specifically, source-filter decomposition I vocal tract & f0 change slowly Applications: I live communications I offline storage E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 15 / 37 Channel Vocoder (1940s-1960s) Basic source-filter decomposition I filterbank breaks into spectral bands I transmit slowly-changing energy in each band Encoder Decoder Bandpass Smoothed Downsample E filter 1 energy & encode 1 Bandpass filter 1 Output Input Bandpass Smoothed Downsample E filter N energy & encode N Bandpass filter 1 Voicing V/UV analysis Pulse Noise Pitch generator source I 10-20 bands, perceptually spaced Downsampling? Excitation? I pitch / noise model I or: baseband + ‘flattening’... E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 16 / 37 LPC encoding The classic source-filter model Encoder Filter coefficients {ai} Decoder |1/A(ej!)| Represent Input f s[n] & encode LPC Output analysis e^[n] s^[n] Represent Excitation All-pole Residual & encode generator filter e[n] 1 t H(z) = -i 1 - "aiz Compression gains: I filter parameters are ∼slowly changing I excitation can be represented many ways 20 ms Filter parameters Excitation/pitch parameters 5 ms E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 17 / 37 Encoding LPC filter parameters For `communications quality': I 8 kHz sampling (4 kHz bandwidth) I ∼10th order LPC (up to 5 pole pairs) I update every 20-30 ms ! 300 - 500 param/s Representation & quantization ai I fai g - poor distribution, can't interpolate -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 ki I reflection coefficients fki g: guaranteed stable -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 fLi I LSPs - lovely! 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 Bit allocation (filter): I GSM (13 kbps): 8 LARs x 3-6 bits / 20 ms = 1.8 Kbps I FS1016 (4.8 kbps): 10 LSPs x 3-4 bits / 30 ms = 1.1 Kbps E6820 (Ellis & Mandel) L7: Audio compression and coding March 31, 2009 18 / 37 Line Spectral Pairs (LSPs) LSPs encode LPC filter by a set of frequencies Excellent for quantization & interpolation Definition: zeros of P(z) = A(z) + z−p−1 · A(z−1) Q(z) = A(z) − z−p−1 · A(z−1) j! −1 −j! −1 I z = e ! z = e ! jA(z)j = jA(z )j on u.circ. I P(z), Q(z) have (interleaved) zeros when −p−1 −1 \fA(z)g = ±\fz A(z )g Q −1 I reconstruct P(z), Q(z) = i (1 − ζi z ) etc.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    37 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us