CS 414 Multimedia Systems Design Lecture 3 Digital

  • Slides: 38
Download presentation
CS 414 – Multimedia Systems Design Lecture 3 – Digital Audio Representation Klara Nahrstedt

CS 414 – Multimedia Systems Design Lecture 3 – Digital Audio Representation Klara Nahrstedt Spring 2014 CS 414 - Spring 2014

Administrative n Form Groups for MPs ¨ Deadline January 27 (today!!) to email TA

Administrative n Form Groups for MPs ¨ Deadline January 27 (today!!) to email TA CS 414 - Spring 2014

Why is sound logarithmic? Last lecture we had d. B = 10*log (I/I 0),

Why is sound logarithmic? Last lecture we had d. B = 10*log (I/I 0), where I 0 is threshold of hearing n Question: why is sound (loudness) behaving logarithmically? n One answer: Human senses obey Weber. Fletcher law, where it was measured that the response of the sense machinery is logarithm of an input. This applies to hearing, eye sensitivity, temperature sense, etc. n CS 414 - Spring 2014

Weber-Fletcher Law n Weber law: ¨ Studied responses of humans to physical stimulus in

Weber-Fletcher Law n Weber law: ¨ Studied responses of humans to physical stimulus in quantitative fashion ¨ Just-noticeable difference between two stimuli is proportional to magnitude of stimuli n Fechner law: ¨ Constructed psychophysical scale to describe relationship between physical magnitude of stimulus and perceived intensity ¨ Formalized scaling and specified that perceived loudness/brightness is proportional to log 10 (actual intensity measured with an accurate non-human instrument) http: //en. wikipedia. org/wiki/Weber-Fechner_law

Integrating Aspects of Multimedia Image/Video Capture Audio/Video Perception/ Playback Audio/Video Presentation Playback Image/Video Information

Integrating Aspects of Multimedia Image/Video Capture Audio/Video Perception/ Playback Audio/Video Presentation Playback Image/Video Information Representation Transmission Audio Capture Transmission Compression Processing Audio Information Representation Media Server Storage CS 414 - Spring 2014 A/V Playback

Today Introduced Concepts n Analog to Digital Sound Conversion ¨ Sampling, sampling rate, Nyquist

Today Introduced Concepts n Analog to Digital Sound Conversion ¨ Sampling, sampling rate, Nyquist Theorem ¨ Quantization, pulse code modulation, differentiated PCM, Adaptive PCM Signal-to-Noise Ratio n Data Rates n CS 414 - Spring 2014

Key Questions n How can a continuous wave form be converted into discrete samples?

Key Questions n How can a continuous wave form be converted into discrete samples? n How can discrete samples be converted back into a continuous form? CS 414 - Spring 2014

Lifecycle from Sound to Digital to Sound Source: http: //en. wikipedia. org/wiki/Digital_audio

Lifecycle from Sound to Digital to Sound Source: http: //en. wikipedia. org/wiki/Digital_audio

Characteristics of Sound n n n Amplitude Wavelength (w) Frequency ( ) Timbre Hearing:

Characteristics of Sound n n n Amplitude Wavelength (w) Frequency ( ) Timbre Hearing: [20 Hz – 20 KHz] Speech: [200 Hz – 8 KHz]

Digital Representation of Audio n Must convert wave form to digital ¨sample ¨quantize ¨compress

Digital Representation of Audio n Must convert wave form to digital ¨sample ¨quantize ¨compress

Sampling (in time) n Measure amplitude at regular intervals n How many times should

Sampling (in time) n Measure amplitude at regular intervals n How many times should we sample? CS 414 - Spring 2014

Nyquist Theorem For lossless digitization, the sampling rate should be at least twice the

Nyquist Theorem For lossless digitization, the sampling rate should be at least twice the maximum frequency response. In mathematical terms: fs > 2*fm n where fs is sampling frequency and fm is the maximum frequency in the signal n CS 414 - Spring 2014

Limited Sampling n But what if one cannot sample fast enough? CS 414 -

Limited Sampling n But what if one cannot sample fast enough? CS 414 - Spring 2014

Limited Sampling n Reduce signal frequency to half of maximum sampling frequency ¨ low-pass

Limited Sampling n Reduce signal frequency to half of maximum sampling frequency ¨ low-pass filter removes higher-frequencies ¨ e. g. , if max sampling frequency is 22 k. Hz, must low-pass filter a signal down to 11 k. Hz CS 414 - Spring 2014

Sampling Ranges n Auditory range 20 Hz to 22. 05 k. Hz ¨ must

Sampling Ranges n Auditory range 20 Hz to 22. 05 k. Hz ¨ must sample up to to 44. 1 k. Hz ¨ common examples are 8. 000 k. Hz, 11. 025 k. Hz, 16. 000 k. Hz, 22. 05 k. Hz, and 44. 1 KHz n Speech frequency [200 Hz, 8 k. Hz] ¨ sample up to 16 k. Hz ¨ but typically 4 k. Hz to 11 k. Hz is used CS 414 - Spring 2014

CS 414 - Spring 2014

CS 414 - Spring 2014

Quantization CS 414 - Spring 2014

Quantization CS 414 - Spring 2014

Sampling and 4 -bit quantization CS 414 - Spring 2014 Source: http: //en. wikipedia.

Sampling and 4 -bit quantization CS 414 - Spring 2014 Source: http: //en. wikipedia. org/wiki/Digital_audio

Quantization http: //en. wikipedia. org/wiki/Quantization_(signal_processing) CS 414 - Spring 2014

Quantization http: //en. wikipedia. org/wiki/Quantization_(signal_processing) CS 414 - Spring 2014

Quantization n Typically use ¨ 8 bits = 256 levels ¨ 16 bits =

Quantization n Typically use ¨ 8 bits = 256 levels ¨ 16 bits = 65, 536 levels n How should the levels be distributed? ¨ Linearly? (PCM) ¨ Perceptually? (u-Law) ¨ Differential? (DPCM) ¨ Adaptively? (ADPCM) http: //csweb. cs. wfu. edu/~burg/CCLI/Templates/flash. php? file=Chapter 5/Quantization. swf

Bit Rate Bits per second n Bits per sample X samples per second n

Bit Rate Bits per second n Bits per sample X samples per second n 16 X 44. 1 = 705. 6 Kbps (Mono) n 16 X 44. 1 X 2 = 1411. 2 Kbps (Stereo) n CS 414 - Spring 2014

Nyquist Limit n max data rate = 2 H log 2 V bits/second, where

Nyquist Limit n max data rate = 2 H log 2 V bits/second, where H = bandwidth (in Hz) V = discrete levels (bits per signal change) n Shows the maximum number of bits that can be sent per second on a noiseless channel with a bandwidth of H, if V bits are sent per signal ¨ Example: what is the maximum data rate for a 3 k. Hz channel that transmits data using 2 levels (binary) ? ¨ Solution: H = 3 k. Hz; V = 2; max. data rate = 2 x 3, 000 xln 2=6, 000 bits/second CS 414 - Spring 2014

Pulse Code Modulation n Pulse modulation ¨ Use discrete time samples of analog signals

Pulse Code Modulation n Pulse modulation ¨ Use discrete time samples of analog signals ¨ Transmission is composed of analog information sent at different times ¨ Variation of pulse amplitude or pulse timing allowed to vary continuously over all values n PCM ¨ Analog signal is quantized into a number of discrete levels https: //www. youtube. com/watch? v=Hq. HIOA-Fcuw CS 414 - Spring 2014

PCM Quantization and Digitization Quantization CS 414 - Spring 2014

PCM Quantization and Digitization Quantization CS 414 - Spring 2014

Linear Quantization (PCM) Divide amplitude spectrum into N units (for log 2 N bit

Linear Quantization (PCM) Divide amplitude spectrum into N units (for log 2 N bit quantization) Quantization Index n Sound Intensity CS 414 - Spring 2014

Non-uniform Quantization CS 414 - Spring 2014

Non-uniform Quantization CS 414 - Spring 2014

Perceptual Quantization (u-Law) Want intensity values logarithmically mapped over N quantization units Quantization Index

Perceptual Quantization (u-Law) Want intensity values logarithmically mapped over N quantization units Quantization Index n Sound Intensity CS 414 - Spring 2014

Differential Pulse Code Modulation (DPCM) n What if we look at sample differences, not

Differential Pulse Code Modulation (DPCM) n What if we look at sample differences, not the samples themselves? ¨ dt = xt-xt-1 ¨ Differences tend to be smaller n Use 4 bits instead of 12, maybe? CS 414 - Spring 2014

Differential Pulse Code Modulation (DPCM) n n Changes between adjacent samples small Send value,

Differential Pulse Code Modulation (DPCM) n n Changes between adjacent samples small Send value, then relative changes ¨ value uses full bits, changes use fewer bits ¨ E. g. , 220, 218, 221, 219, 220, 221, 222, 218, . . (all values between 218 and 222) ¨ Difference sequence sent: 220, +2, -3, 2, -1, -1, +4. . ¨ Result: originally for encoding sequence 0. . 255 numbers need 8 bits; ¨ Difference coding: need only 3 bits CS 414 - Spring 2014

Adaptive Differential Pulse Code Modulation (ADPCM) n n Adaptive similar to DPCM, but adjusts

Adaptive Differential Pulse Code Modulation (ADPCM) n n Adaptive similar to DPCM, but adjusts the width of the quantization steps Encode difference in 4 bits, but vary the mapping of bits to difference dynamically ¨ If rapid change, use large differences ¨ If slow change, use small differences CS 414 - Spring 2014

Signal-to-Noise Ratio (metric to quantify quality of digital audio) CS 414 - Spring 2014

Signal-to-Noise Ratio (metric to quantify quality of digital audio) CS 414 - Spring 2014

Signal To Noise Ratio n Measures strength of signal to noise SNR (in DB)=

Signal To Noise Ratio n Measures strength of signal to noise SNR (in DB)= n Given sound form with amplitude in [-A, A] A n Signal energy = 0 -A http: //www. ap. com/solutions/introtoaudiotest/snr

Quantization Error n Difference between actual and sampled value ¨ amplitude between [-A, A]

Quantization Error n Difference between actual and sampled value ¨ amplitude between [-A, A] ¨ quantization levels = N n e. g. , if A = 1, N = 8, = 1/4 CS 414 - Spring 2014

Compute Signal to Noise Ratio n Signal energy = ; Noise energy = n

Compute Signal to Noise Ratio n Signal energy = ; Noise energy = n Signal to noise = n Every bit increases SNR by ~ 6 decibels CS 414 - Spring 2014 ;

Example n n n Consider a full load sinusoidal modulating signal of amplitude A,

Example n n n Consider a full load sinusoidal modulating signal of amplitude A, which utilizes all the representation levels provided The average signal power is P= A 2/2 The total range of quantizer is 2 A because modulating signal swings between –A and A. Therefore, if it is N=16 (4 -bit quantizer), Δ = 2 A/24 = A/8 The quantization noise is Δ 2/12 = A 2/768 The S/N ratio is (A 2/2)/(A 2/768) = 384; SNR (in d. B) 25. 8 d. B CS 414 - Spring 2014

Data Rates n Data rate = sample rate * quantization * channel n Compare

Data Rates n Data rate = sample rate * quantization * channel n Compare rates for CD vs. mono audio ¨ 8000 samples/second * 8 bits/sample * 1 channel = 8 k. Bytes / second ¨ 44, 100 samples/second * 16 bits/sample * 2 channel = 176 k. Bytes / second ~= 10 MB / minute CS 414 - Spring 2014

Comparison and Sampling/Coding Techniques CS 414 - Spring 2014

Comparison and Sampling/Coding Techniques CS 414 - Spring 2014

Summary CS 414 - Spring 2014

Summary CS 414 - Spring 2014