1 audio sampling read chapter 11 in text book! chapter 10 of text provides some additional...
TRANSCRIPT
1
Audio Sampling
• Read Chapter 11 in text book! • Chapter 10 of text provides some additional
information you may find useful (In other words, read the chapter)
• We will cover in some detail exactly how continuously variable (analog) signals become digital (discrete) binary code
2
Background
• Audio signal (sound) reflects the motion of air particles in space
• Microphone converts this motion of air particles into an electrical signal
• Audio signals have frequency components that are complex – In simple terms, most audio signals are made up of
many different frequencies, combining to make the sound we recognize
3
Audio Signal
• Audio signals have certain characteristics that are well known– Human voice varies from about 100 Hz to 4000 Hz
– Piano: The note A above Middle C is 440 Hz
• Hertz (Hz) means cycles per second– Sound varies in a manner similar to a Sine Wave
– Concert A varies 440 times per second
• My voice sounds different than a piano—Why?
4
Audio Signal Components
Concert “A” on a vibraphone
5
Voice Signal Components
6
More information
• Bandwidth– Is often represented by the highest frequency signal in a
sample. But in common usage is used to describe the data rate a channel supports
– Can be thought of as the range of frequencies which some transmission medium (air, water, cable, fiber optics) can support
– Concert A has a bandwidth of 440 Hz– A human voice has a varying bandwidth—
• Recall that the average human’s highest frequency component carrying intelligible information is 3,000 Hz (or 3kHz)—What is the bandwidth?
7
Period: Signal and Sampling
• Take the 440 Hz Concert A—how long is one cycle?– Ts = 1/fs Ts = (1/440) Hz = 0.00227 sec– Also: fs = 1/Ts fs = 1/ 0.00227 sec = 440 Hz– In English: The Time period of one cycle is equal to the
inverse of the frequency of the signal in Hz
• Problem now is that the Concert A is a continuously variable signal, and we want to digitize it– How often should we sample the signal?
8
Nyquist’s Theorem
• Harry Nyquist, working at Bell Labs developed what has become known as the Nyquist Sampling Theorem:– In order to be perfectly represented by its samples, a
signal must be sampled at a sampling rate equal to at least twice its highest frequency component
– Or: fs = 2f
– Note that fs here is frequency of sampling, not the frequency of the sample
9
For Example
• Take Concert A: 440 Hz– What would be the minimum sampling rate needed to
accurately capture this signal?– fs = 2 x 440 Hz = 880 Hz
• Take your telephone used for voice, mostly– Highest voice component is: 3000 Hz– Minimum sampling rate: fs = (2 x 3000 Hz) = 6000 Hz– Bell Labs built in some slop real telephone
digitization is done at 8000 Hz sampling rate (supporting a 4 kHz bandwidth). Why? Remember that Nyquist said “equal to at least twice…”
10
Example: Speech Waveform
11
Sharp Check
• Some of you might be wondering: “The telephone line can support 4 kHz of bandwidth? How can I can use a 56 kbps modem on that line….”
• Stay tuned for Shannon’s Law• Modulation schemes
12
Nyquist’s Revenge
• If you grossly oversample (exceed the Nyquist rate), we create more bits to store and to transmit than is necessary to accurately send the signal to the distant end
• But, moderate oversampling can work to our advantage, making the system more robust and easier to implement – That’s why Bell Labs decided to sample at 8 kHz vice 6
kHz
13
Nyquist’s Revenge, Con’t
• If you under-sample (sample at less than the Nyquist rate), you run the danger of aliasing– Aliasing is when the signal that you decode is not the
signal you encoded
– Aliasing is undesirable!
14
Undersampling—A Very Bad Thing
Thanks to: http://euphoria.org/home/help/nyquist.html
15
Quantization
• Read Chapters 12 and 14 in text book! • Chapter 3 of optional text has excellent material
that complements the required text• Chapter 10 of text provides some additional
information you may find useful (In other words, read the chapter)
• We will cover in some detail exactly how continuously variable (analog) signals become digital (discrete) binary code
16
Quantization
• Audio Signals: Continuous in time and amplitude• Digitization of Audio Signals: Must be made
discrete in time and amplitude• We’ve learned how to make Continuous signals
discrete in Time: Sampling – Don’t forget about Nyquist
• To make Continuous signals discrete in Amplitude, we Quantize
17
What is Quantization?
• Quantization establishes a range of values of the continuous function that we “say” can be represented by a particular binary code
• Looking at it another way: We round things off• For example: We can say that the continuous
temperature range 40.0 to 40.1 degrees F can be represented by one binary code (let’s just say “0110010000”)--The temperature obviously can vary over 40.0 to 40.1 (temp might actually be 40.00987 degrees), but we say that measuring to within a tenth of a degree is OK
18
Picking the Code
• We have a trade-off to make (recurring theme)• Number of bits we want to use versus precision of
digitization (What does that mean?)• Recall our Thermometer Engineering Example:
– We want to measure -40º F to 140º F (Range =180º F)
– We decided to implement an 8 bit code at first
– If we use all the bits, what degree of precision do we achieve?
19
Precision of Quantization
• 8 bit code can represent 256 codewords• Our thermometer can measure to:
– (Range of Measurement)/Number of Codewords– Or: 180º F/256 Codewords = 0.703º F per codeword
• The text on p. 174 uses an example of sampling a voltage that ranges from -10V to +10V– The range measured is over 20V, encoded with 4 bits– Or: 20V/16 Codewords = 1.25V per codeword– For the text example, let’s look at the Quantization
Codetable
20
A Time Quantized Audio Waveform
21
Problems with Quantization
• Some information is lost
• Error is introduced (Noise is introduced)
– Codetable on p. 174 uses the Range Center as the value of quantization to minimize both effects (Noise and Error)
22
Problems with Quantization Cont.
• Quantization Error: Difference between the actual value of signal and the quantized value
• In book example: Say actual voltage value when sampled (a point in time) is +8.5V
– Error is: 8.5V - 8.125V = 0.375V
• Another example: Actual voltage is +7.75V
– Error is 7.75V - 8.125V = -0.375V
23
Quantizing and Re-Constructing the Signal
• Analog-to-Digital Converter (ADC) provides the sampled and quantized binary code
• Digital-to-Analog Converter (DAC) converts the quantized binary code back into an approximation of the analog signal by clocking the code to the same sample rate as the ADC conversion
• Quantize and Reconstruct the analog signal: Example on the next couple of slides
24
Quantizing
25
Reconstructing
26
Another Example
27
Things we can do to improve Quantizing performance
• Use Companding– Quantization levels are non-uniform
– Levels are close where we expect most signals to fall, and farther apart where we expect them less often
• Instead of Quantizing entire range, we can quantize just the difference in level from the last sample
28
Data Rate, Decibels, Signal-to-Noise Ratio,
Channel Capacity (Shannon’s Law)
• Nyquist is only one element in developing a digital transmission system
• Nyquist tells you how often you should sample, but not how much information a channel (a medium through which data moves) can support
• Hang on, this one covers a lot of ground!
29
Logarithm Review
• The use of logarithms came about for two basic reasons:– A need to multiply and divide very large numbers– A need to describe specific processes (e.g. in Information Theory)
that counted in different bases
• The Decimal System can be written as a power of 10– 100 = 1– 101 = 10– 102 = 100– 103 = 1,000– 104 = 10,000
See the pattern? The number of zeroes is the same as the value of the
exponent
30
Logarithm Review
• Let’s look at these again
– 100 = 1
– 101 = 10
– 102 = 100
– 103 = 1,000
– 104 = 10,000
The exponent is called the logarithm of the number :The logarithm of 1 = 0The logarithm of 10 = 1The logarithm of 100 = 2, etc.
31
Logarithm Review
• Question:– We know that log101 = 0 and log1010 = 1.
– What if I want the logarithm of a number between 1 and 10?
• Answer:– The answer must lie between 0 and 1
– The answer = x, where x is the exponent of 10
We’ll do an example
32
Logarithm Review
• Question– What is the logarithm (base 10) of 3?
• Answer:– Write the problem as log103 = x
– Transposing, we have 10x = 3
– And 100.4771213 = 3, giving x = 0.4771
– Thus log103 = 0.4771
33
Logarithm Review
• What if I want to take the logarithm of the value “x” with a different base?
• Assume you want to have loga of x, i.e. the base is “a” and not 10– Then loga x =(log10 x) / (log10 a)
34
Logarithm Review
• Let’s look at this another way:– Log2 10 = 3.3219
• Remember, if loga (number) = x– transpose this to ax = (number)
• Thus, another way of looking at– Log2 10 = 3.3219 is to write
– 23.3219 = 10Consider a system where
the base is 2, and the exponent is always a whole
number?
35
Logarithm Review
• 20 = 1 log2 1 = 0
• 21 = 2 log2 2 = 1
• 22 = 4 log2 4 = 2
• 23 = 8 log2 8 = 3
• 24 = 16 log2 16 = 4
• 25 = 32 log2 32 = 5
• 26 = 64 log2 64 = 6
This is the Binary System
Log2 is fundamental to Information
Theory
36
Logarithm Review
• Note you can go forwards (logarithm) and backwards (anti-logarithm), thus:– If log 10 (number) = x
• Then– The anti-logarithm of a (value = x) is given by
10x
• So the calculator button “log” gives the logarithm (to base 10) and the calculator button “10x” gives the anti-logarithm
37
Logarithm Review
• Standard notations– Any log10 (number) is normally written as log (number)
• We normally leave off the base for base 10
– A logarithm that uses e as a base is referred to as a “natural” logarithm, and is written as
• loge (number), or ln (number)
– All other bases must be included if they are not 10 or e; e.g. log2 (number)
38
Logarithm Review
• So how do logarithms help us?– by converting to logarithms:
• Instead of multiplying you can add
• Instead of dividing you can subtract
• See example on the next slide
39
Logarithm Review
• Examples– 100 1,000 = 102 103 = 105
– 297 4735 = 102.4728 103.6753 = 106.1481
= 1,406,294.998
• Big Deal! My calculator can do that stuff in zero seconds flat!
• logarithms are really an intermediate step to
decibels (written as dB)
2 + 3 = 5
40
A Little Background on Data Rate
• There is a difference between signal rate and data rate• The unit of measure for signal rate is baud• The unit of measure for data rate is bits per second• The difference? A signal rate is equal to the number of
signal events in a period of time.– One bit per signal event--baud rate and bit rate are the
same!– More than one bit per signal event--bit rate exceeds
baud rate!• Don’t believe me? Let’s go to the next two charts
41
One Bit per Signal Event
time
Amplitude (V)
0 -- V0
1 -- V1
One signal event--one bit sent per signal event
Why aren’t the vertical lines vertical?
How many signal events here and here?
42
Signal Events with More than One Bit
time
Amplitude (V)
000 -- V0
001 -- V1
010 -- V2
011 -- V3
100 -- V4
101 -- V5
110 -- V6
111 -- V7
One signal event--three bits sent per signal event
43
Channel Noise and Decoding
Little noise – decoding with M=8
More noise – results in error
The same amount of noise but decoding with M=2
44
Relating Baud to Data Rate
• The signal rate (baud rate) can be related to data rate• We have to know the baud rate (signals per second)• We have to know how many bits are being sent per signal
event, then know how many symbols this number of bits can take on– Often called M-ary transmission--more in the modulation lecture
• Recall that:– log2 x = (log10 x/log10 2) = 3.32 log10 x
• We have to know: D = R log2 M bps– Where D is data rate, R is baud rate and M is number
possible symbols
45
For Example
• A system signals at 1 baud, 1 bit per signal event (2 symbols per event)
D = R log2 M bps --> D = 1 log2 2 = 1 bps
• A system signals at 75 baud, 8 bits per signal event (256 possible symbols)
D = R log2 M bps --> D = 75 log2 256 = 600 bps
• A system signals at 4000 baud, 8 bits per signal event (256 possible symbols)
D = R log2 M bps --> D = 4000 log2 256 = 32000 bps
• Consider: a semaphore signaler signals at 2 baud (each signal could represent 26 symbols)
D = R log2 M bps --> D = 2 log2 26 = 9.4 bps
46
Decibels
• What’s a decibel?– A decibel is one-tenth of a Bel, a unit named for Alexander Graham Bell
– In Electronics the decibel (abbreviated as dB) is a logarithmic expression of the ratio between two signal power, voltage, or current levels.
– In acoustics, the decibel is used as an absolute indicator of sound power per unit area.
• Power. Unit of measurement = watt (W)• dB = 10 log P2/P1
• Voltage or Amperage• dB = 20 log V2/V1 • dB = 20 log A2/A1
Important! Note that dB are log base 10, not base 2!
47
For Example
• You want to express in dB the power relationship between your stereo and the TV (roommate fight)– Stereo has 200W of power, TV has 50W of power
• dBW = 10 log 200/50 = 6.02 dB
• Stereo wins this battle
– Note the other way-- Roomie’s TV has 50W, Stereo 200W
• dBW = 10 log 50/200 = -6.02 dB
• Roomie’s TV loses the battle
48
Signal-to-Noise Ratio
• S/N is normally measured in dB, as a relationship between the signal you want versus the noise that you don’t but is in the medium (to include your radio…heat causes noise…ever notice that your radio warms up when it is on?)
• It can be thought of as a fractional relationship (that is, before you take the log of it):
• 1000 W of power v. 20W of noise is either:
– 50 (unitless!)
– or: about 17 dB ==> 10 log 1000/20 = 16.9897 dB
49
Shannon’s Law(Shannon’s Limit for Information Capacity)
• Claude Shannon at Bell Labs figured out how much information a channel could theoretically carry
• C = B log2 (1 + S/N)– Where C is Information Capacity in bps
– B is bandwidth in Hz
– S/N is Signal-to-Noise ratio • (unitless…don’t make into dB)
Note we are back to log base 2!
50
Shannon’s Law in Action
• You have a telephone system with a 3 kHz bandwidth and a S/N ratio of 1000 (very good indeed!)
C = B log2 (1 + S/N)
= 3000 Hz log2 (1 + 1000) = 29,902 bps (29.9 kbps)
• You have a telephone system with a 3 kHz bandwidth and a S/N ratio of 10 (very bad!)
C = B log2 (1 + S/N)
= 3000 Hz log2 (1 + 10) = 10,378 bps (10.4 kbps)
51
Shannon’s Law Caveats
• In order to achieve the theoretical Shannon limit, the transmission system is not binary, it is some form of M-ary – more than one bit is sent per signal event
• In order to increase capacity, must either;– increase the bandwidth of the channel or
– increase the S/N ratio: • make the signal stronger
• reduce the noise on the channel
52
Modulation
• Re-read Section 14.7 of the text• Modulation is process of impressing a low-frequency
information signal onto a higher frequency carrier signal
• Modulation is done to bring information signals up to the Radio Frequency (or higher) signal
• Some systems even have two stage modulation, where the information is brought up to an Intermediate Frequency (IF), and then increased to the transmission frequency
53
Some Definitions
• Baseband Signal is a term used to describe the unmodulated signal…or in other words, the information signal
• Carrier Signal is what the information signal is combined with to form the new modulated signal…the frequency of the carrier is described as the center frequency of the signal
• BOTH the baseband and carrier have bandwidth--that matters for AM, but not for FM/PM modulated bandwidth
54
Types of “Analog” or “Traditional” Modulation
• Amplitude Modulation (AM)– Information signal is added and subtracted to and from a
carrier signal
• Frequency Modulation (FM)– Information signal varies a constant amplitude carrier signal’s
frequency directly in proportion to the information’s frequency
• Phase Modulation (PM)– Information signal varies a constant amplitude carrier signal’s
phase directly in proportion to the information’s frequency
• Both FM and PM are forms of Angle Modulation
55
Amplitude Modulation
Carrier
Baseband
Modulated
56
AM Continued
• Note that my diagram is highly out of scale
• Carrier Signal is centered on one frequency, and has a bandwidth (like 1000 kHz, 5 kHz)
• Baseband Signal varies from 0 to some value in Hz (human voice 0 -- 4 kHz)
• AM naturally has two sidebands– 1000 kHz ± 3 kHz = 997 kHz and 1003 kHz
– only one sideband is needed to get back all the information
• Figure 14.14 shows this in another way
57
AM Modulation and AM Channels
58
Frequency Modulation
59
FM Continued
• Same scale issues on diagram• FM is constant amplitude--another way of thinking
about it: FM always has the same bandwidth• FM signal varies around the maximum and minimum
deviations of the baseband signal
60
FM Modulation and FM Channels
61
Phase Modulation
• We won’t show• It differs from FM in the time domain, given the
same baseband and carrier signals, but is otherwise identical
62
Digital Modulation Techniques(Some of them, anyway…)
• Frequency Shift Key (FSK)• Binary Phase Shift Key (BPSK)• Quadrature Phase Shift Key (QPSK)• 8-PSK• Offset QPSK (OQPSK)• Quadrature Amplitude Modulation (QAM)• Pulse Code Modulation (PCM)• And we didn’t cover optical--that’s later
63
Frequency Shift Key
• Similar to FM• A low frequency for a time means “0”• A high frequency for a time means “1”• Derived from TTY days: Shift and Mark
0 1 0 1 0 0 1 1
64
Phase Shift Key
• Phase Shift Key depends on being able to differentiate the angle of the signal (and this depends on how many states you are trying to represent)--but is constant amplitude– BPSK is binary: Two states (one bit per signal event),
so the difference in angle is 180º
– QPSK has four states (two bits per signal event), so the difference in angle is 90º
65
QAM
• Similar to PSK, but throw in amplitude as well (not a constant amplitude signal)
• Normally represented by a truth table and a constellation diagram
66
8-QAM Truth Table and Constellation
• Code A (V) Phase• 000 .765V -135°• 001 1.848V -135° • 010 .765V -45° • 011 1.848V -45°• 100 .765V +135°• 101 1.848V +135°• 110 .765V +45°• 111 1.848V +45°
111
110
010000
001
100
101
011
67
Something to Note
• As you begin to use more bits (go from BPSK to QPSK to 8-QAM) you are more susceptible to noise errors– Why? Points are closer together on the Constellation
Diagram
• There are 64-QAM modems out there today– Is a 64-QAM modem more susceptible to noise than a
32-QAM modem? A BPSK modem?– Which should be faster, a 64-QAM modem or a BPSK
modem?
68
Sample QAM Signal Requirements
Bits/symbol (I,Q) QAM constellation size Required SNR
2 (1,1) 4 (QPSK) 14.5 dB3 (1,2) 8 19.3 dB4 (2,2) 16 21.5 dB5 (2,3) 32 24.5 dB6 (3,3) 64 27.7 dB7 (3,4) 128 30.6 dB8 (4,4) 256 33.8 dB10 (5,5) 1024 39.8 dB12 (6,6) 4096 45.8 dB15 (7,8) 32768 54.8 dB
69
Pulse Code Modulation
• PCM is what we did for the Quantization exercise we did in class and the homework
• We quantize an analog signal directly into digital values that represent a signal level (does it always represent it exactly?
• Your 56 kbps modem uses PCM– 56 kbps downstream because ISP uses a “pure”
digital PCM signal– 33 kbps upstream because your modem converts to
an analog signal