<<

Lecture 2–Signal Processing

ECE 197SA – Systems Appreciation

MP3 Player § Stores and plays back audio § Extremely widely used Ÿ 350 million iPods sold through 2012 Ÿ Over 280 million MP3 players sold annually Ÿ Functionality integrated into many cell phones § How can it play music?

© 2010-14 Tilman Wolf 2

1 Audio as Physical Phenomenon § Vibrations of object generate sound § Sound propagates as pressure wave § Ear can sense pressure wave

§ How can we convert audio into electrical signal?

© 2010-14 Tilman Wolf 3

Audio as § translates waves into varying voltage § Speaker converts electrical signal into pressure wave

§ How can we record, store, and play back signal?

© 2010-14 Tilman Wolf 4

2 Audio Recording § Need ECE system to perform signal processing

ECE System: Audio recording, storage, playback

© 2010-14 Tilman Wolf 5

Analog Signal Recording § Mechanical signal representation

§ Magnetic signal representation

§ Analog recording introduces a lot of noise

© 2010-14 Tilman Wolf 6

3 Digital Signal Recording § Need process to represent analog signal in binary r e w o p

l a n g i s time 01000101110110…

§ How to do conversion?

© 2010-14 Tilman Wolf 7

Digital Signal Recording § Need process to represent analog signal in binary r e w o p

l a n g i s time 01000101110110…

§ Steps 1. Measure signal (“sampling”) 2. Translate into binary (“quantization”) 3. Store or transmit 4. [Reconstruct signal (“excite filter”)]

© 2010-14 Tilman Wolf 8

4 Sampling § Measuring signal at discrete times

§ Samples are representation of signal

§ What are the tradeoffs for quality? © 2010-14 Tilman Wolf 9

Sampling Rate § Sampling rate determines quality of representation high sampling rate medium sampling rate low sampling rate

§ Low-rate sampling fails to capture high frequencies § Nyquist-Shannon sampling theorem Ÿ “If a function f(t) contains no frequencies higher than W hertz, it is completely determined by giving its ordinates at a series of points spaced 1/2 W seconds apart.” Ÿ Intuition: f(t) cannot change substantially in less than half cycle of highest frequency

© 2010-14 Tilman Wolf 10

5 Sampling Rate § Nyquist frequency is half the sampling frequency Ÿ No aliasing if bandwidth of signal is below Nyquist frequency § What is a good sampling frequency for audio? r e w o p

l a n g i s

frequency

§ How to represent sampled values digitally?

© 2010-14 Tilman Wolf 11

Sampling Rate § Nyquist frequency is half the sampling frequency Ÿ No aliasing if bandwidth of signal is below Nyquist frequency § What is a good sampling frequency for audio? r

e Nyquist sampling w

o frequency frequency p

l a n g i s

frequency

§ How to represent sampled values digitally?

© 2010-14 Tilman Wolf 12

6 Quantization § Samples have continuous value Ÿ No way to represent digitally with arbitrary precision § “Quantization” assigns discrete value to each sample § Analog-to-digital (A/D) converter Ÿ n-bit digital output Ÿ As you know from ENGIN112: n bits have 2n possible values original sample quantized value

© 2010-14 Tilman Wolf 13

Quantization § Quantization is lossy Ÿ Coarser quantization levels provide less accuracy original sample quantized value

© 2010-14 Tilman Wolf 14

7 Digital Representation § Digital representation Ÿ Encode quantized values in binary Ÿ Concatenate binary codes of samples Ÿ Add meta-information (can be implied if standard is used) 011 011 011 010 010 010 010 001 001 001 001 000 000 000 000 000 encoded samples 101 101 101 101 101 110 110 110 110 110 111

sample stream 101 001 000 110 101 010 011 101 110 000 010 110 110 001 000 000 101 010 011 001

audio file

meta-information 101001000110101010011101110000010110110001000000101010011001 (sampling rate, coding, …)

© 2010-14 Tilman Wolf 15

Playback § Digital-to-analog (D/A) converter Ÿ Generates voltage of sample value Ÿ Voltage is held for duration of sample period § Low-pass filter to “smooth out” signal

§ Signal is amplified and sent to speaker

© 2010-14 Tilman Wolf 16

8 Aliasing § Difference between original and reconstructed signal

original reconstructed

© 2010-14 Tilman Wolf 17

Sampling and Quantization Tradeoffs § Sampling rate and quantization levels impact quality

low sampling rate, coarse quantization high sampling rate, coarse quantization

low sampling rate, fine quantization high sampling rate, fine quantization

© 2010-14 Tilman Wolf 18

9 Parameters § Configurations used in practice Ÿ Telephony: pulse code (PCM) » ITU-T standard G.711 » Sampling: 8000 samples per second » Quantization: 8-bit samples § Encoded from non-linear quantization of larger samples § µ-law in U.S. (14-bit samples) § A-law in Europe (13-bit samples) » Encoded signal: 64 kb/s (8kB/s) Ÿ CD-quality audio: PCM » Sampling: 44,100 samples per second » Quantization: 16-bit samples » Encoded signal (stereo): 1.411 Mb/s (176.4kB/s) § How can we reduce bandwidth/storage?

© 2010-14 Tilman Wolf 19

Compression § Example for loss-less compression: Huffman coding Ÿ Variable-length code Ÿ Code length inversely related to symbol probability § Huffman coding for our example

101001000110101010011101110000010110110001000000101010011001

Ÿ 2-bit symbol frequency: 100% » 10 (37%), 01 (30%), 00 (23%), 11 (10%) 0 1

10 Ÿ New encoding 63% 37%

» 10→0, 01→10, 11→110, 00→111 0 1

01 33% 00101111000001011010110111111101001101111011111111100010010 30%

0 1 Ÿ Encoded sequence marginally better 11 00 » Only 1 bit (2%) shorter 10% 23% » Better on sequences with more redundancies

© 2010-14 Tilman Wolf 20

10 MP3 Compression § MPEG-1 Audio Layer 3 (MP3) § Lossy compression Ÿ Uses perceptual coding » Reduces precision of audio components less audible to humans Ÿ Sound is analyzed in a short windows » Analysis in time domain and frequency domain Ÿ Coding exploits masking effects » Simultaneous masking: loud sound masks soft sound » Temporal masking: Loud sound masks following soft sound » Etc. § Reduces data rate considerably Ÿ MP3 uses 128kb/s (16kB/s) for CD-quality audio Ÿ Less than 1/10 of uncompressed CD § Typical 5-minute song: 4.8MB Ÿ 16GB MP3 player: more than 3,000 songs

© 2010-14 Tilman Wolf 21

Courses in ECE Curriculum § ECE 313 – Signals and Systems § ECE 563 – Introduction to Communications and Signal Processing § ECE 565 – Digital Signal Processing § ECE 608 – Signal Theory

© 2010-14 Tilman Wolf 22

11 Upcoming… § Labs are available now Ÿ See web site § Lecture 3 – Cell Phones Ÿ Wireless communication Ÿ Usual time, place § Moodle quiz

© 2010-14 Tilman Wolf 23

12