1
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
2
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
3
Audio Recording § Need ECE system to perform signal processing
© 2010-14 Tilman Wolf 5
ECE System: Audio recording, storage, playback
Analog Signal Recording § Mechanical signal representation
§ Magnetic signal representation
§ Analog recording introduces a lot of noise © 2010-14 Tilman Wolf 6
4
Digital Signal Recording § Need process to represent analog signal in binary
§ How to do conversion?
© 2010-14 Tilman Wolf 7
time
sign
al p
ower
01000101110110…
Digital Signal Recording § Need process to represent analog signal in binary
§ Steps 1. Measure signal (“sampling”) 2. Translate into binary (“quantization”) 3. Store or transmit 4. [Reconstruct signal (“excite filter”)]
© 2010-14 Tilman Wolf 8
time
sign
al p
ower
01000101110110…
5
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
§ 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
high sampling rate medium sampling rate low sampling rate
6
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?
§ How to represent sampled values digitally? © 2010-14 Tilman Wolf 11
frequency
sign
al p
ower
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?
§ How to represent sampled values digitally? © 2010-14 Tilman Wolf 12
frequency
sign
al p
ower Nyquist
frequency sampling frequency
7
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
© 2010-14 Tilman Wolf 13
original samplequantized value
Quantization § Quantization is lossy
� Coarser quantization levels provide less accuracy
© 2010-14 Tilman Wolf 14
original samplequantized value
8
Digital Representation § Digital representation
� Encode quantized values in binary � Concatenate binary codes of samples � Add meta-information (can be implied if standard is used)
© 2010-14 Tilman Wolf 15
111110101000001010011
101
001000
110 110 110 110101 101 101
000 000 000001 001
010 010 010011 011
101 001 000 110 110 110 110101 101 101000 000 000001 001010 010 010011 011
encoded samples
sample stream
audio file
meta-information (sampling rate, coding, …) 101001000110101010011101110000010110110001000000101010011001
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
9
Aliasing § Difference between original and reconstructed signal
© 2010-14 Tilman Wolf 17
originalreconstructed
Sampling and Quantization Tradeoffs § Sampling rate and quantization levels impact quality
© 2010-14 Tilman Wolf 18
high sampling rate, fine quantizationlow sampling rate, fine quantization
high sampling rate, coarse quantizationlow sampling rate, coarse quantization
10
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
� 2-bit symbol frequency: » 10 (37%), 01 (30%), 00 (23%), 11 (10%)
� New encoding » 10→0, 01→10, 11→110, 00→111
� Encoded sequence marginally better » Only 1 bit (2%) shorter » Better on sequences with more redundancies
© 2010-14 Tilman Wolf 20
101001000110101010011101110000010110110001000000101010011001
0 1
0
1
1
0
63%
33%
1110%
0023%
0130%
100%
1037%
00101111000001011010110111111101001101111011111111100010010
11
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
12
Upcoming… § Labs are available now
� See web site
§ Lecture 3 – Cell Phones � Wireless communication � Usual time, place
§ Moodle quiz
© 2010-14 Tilman Wolf 23