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 Analog Signal Microphone 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 signal power time 01000101110110 How to do conversion? 2010-14 Tilman Wolf 7 Digital Signal Recording Need process to represent analog signal in binary signal power 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? signal power 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? signal power Nyquist frequency sampling frequency 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 2 n 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 010 001 000 101 110 111 001 000 101 011 011 010 010 010 101 101 101 110 110 110 110 001 001 000 000 000 encoded samples 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 (sampling rate, coding, ) 101001000110101010011101110000010110110001000000101010011001 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 modulation (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:» 10 (37%), 01 (30%), 00 (23%), 11 (10%) New encoding» 10 0, 01 10, 11 110, 00 111 00101111000001011010110111111101001101111011111111100010010 10 37% 0 100% 01 30% 1 0 63% 1 33% Encoded sequence marginally better» Only 1 bit (2%) shorter» Better on sequences with more redundancies 11 10% 0 1 00 23% 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
Labs are available now See web site Lecture 3 Cell Phones Wireless communication Usual time, place Moodle quiz Upcoming 2010-14 Tilman Wolf 23 12