analog and digital signals - leiden...
TRANSCRIPT
1
E.M. Bakker
LML Audio Processing and Indexing 1
Analog and Digital Signals1. From Analog to Digital Signal
2. Sampling & Aliasing
LML Audio Processing and Indexing 2
2
Analog and Digital Signals
LML Audio Processing and Indexing 3
Continuous function F of a
continuous variable t (t can be
time, space etc) : F(t)
Analog SignalsDiscrete function Fk of a discrete
(sampling) variable tk, with k an
integer: Fk = F(tk).
Digital Signals
Uniform (periodic) sampling with sampling frequency fS = 1/ tS, e.g., ts = 0.001 sec => fs = 1000Hz
Digital System ImplementationImportant issues:
Analysis bandwidth, Dynamic range
LML Audio Processing and Indexing 4
Analog Input
Antialiasing Filter
A/D Conversion
Digital Processing
Digital Output
• Pass/stop bands
• Sampling rate, Number of bits, and
further parameters
• Digital format
3
SamplingHow fast must we sample a continuous signal to preserve its information content?
Examples: Turning wheels of a train in a movie 25 frames per second, i.e., 25 samples/sec. Train starts => wheels appear to go clockwise Train accelerates => wheels go counter clockwiseRotating propeller of an airplane captured by a Mobile phone camera.
Frequency misidentification due to low sampling frequency.
Sampling: independent variable (for example time) continuous -> discrete
Quantisation: dependent variable (for example voltage) continuous -> discrete.
Here we will talk about uniform sampling.
LML Audio Processing and Indexing 5
Sampling
LML Audio Processing and Indexing 6
__ s(t) = sin(2f0t)
-1.2
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
t
s(t) @ fSFor example:
f0 = 1 Hz, fS = 3 Hz
-1.2
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
t
__ s1(t) = sin(24t)
-1.2
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
t
__ s2(t) = sin(27t)-1.2
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
t
sk (t) = sin( 2 (f0 + k fS) t ) , k N
s(t) @ fS represents exactly all sine-waves sk(t) defined by:
4
The sampling theorem
LML Audio Processing and Indexing 7
A signal s(t) with maximum frequency fMAX can be recovered if sampled at frequency fS > 2 fMAX .
Theorem
Condition on fS?
fS > 300 Hz
t)cos(100πt)πsin(30010t)πcos(503s(t)
F1=25 Hz, F2 = 150 Hz, F3 = 50 Hz
F1 F2 F3
fMAX
Example
* Multiple proposers: Whittaker(s), Nyquist, Shannon, Kotel’nikov.
Nyquist frequency (rate) fN = 2 fMAX
Frequency Domain Time and Frequency are two complementary signal descriptions.
Signal can be seen as projected onto the time domain or frequency domain.
Bandwidth indicates the width of a range in the frequency domain. The range can be located high up in the frequency domain, then we talk about high bandwidth.
Passband Bandwidth => lower and upper cutoff frequencies
LML Audio Processing and Indexing 8
As we have seen from the previous lecture act the inner-ear
together with early neural circuitry as a frequency analyser.
The audio spectrum is split into narrow bands thereby enabling
detection of low-power sounds out of louder background sounds.
5
Sampling Low-Pass Signals
LML Audio Processing and Indexing 9
-B 0 B f
Continuous spectrum (a) Band-limited signal:
frequencies of the signal
assumed in [-B, B] (fMAX = B).
(a)
0 fS/2 f
Discrete spectrum
Aliasing & corruption (c)(c) fS 2 B aliasing !
Aliasing: signal ambiguity in frequency domain
-B 0 B fS/2 f
Discrete spectrum
No aliasing (b) Time sampling frequency
repetition.
fS > 2 B no aliasing.
(b)
sk (t) = sin( 2 (f0 + k fS) t ) , k N
Note: s(t) at fS represents all sine-waves sk(t) defined by:
fS
of the signal
Sampling Low-Pass Signals
LML Audio Processing and Indexing 10
0 fS/2 f
Discrete spectrum
Aliasing & corruption
fS 2 B aliasing !
Aliasing: signal ambiguity in frequency domain
0 fSfS/2 B- fS/2- fS
For example
out of band noise,
or if the sample
rate is too slow for
the bandwidth of
the signal.
Signal
6
Antialiasing Filter
LML Audio Processing and Indexing 11
-B 0 B f
Signal of interest
Out of band noise
Out of band noise
-B 0 B fS/2
f
(a),(b) Out-of-band noise can aliase
into band of interest. Filter it before!
Out of band noise(t) will be sampled:
noise(t) @ fS thereby mimicking a
non-existing frequency within the
band.
(a)
(b)
(c)
Passband: depends on bandwidth of
interest.
(c) Antialiasing filter
Under-sampling
LML Audio Processing and Indexing 12
m
BCf2Sf
1m
BCf2
mN, selected so that fS > 2B
B
0 fC
f
Bandpass signal
centered on fC
-fS 0 f
S 2f
S
f fC
fC = 20 MHz, B = 5MHz
Without under-sampling fS > 40 MHz.
With under-sampling:
fS = 22.5 MHz (m=1)
fS = 17.5 MHz (m=2)
fS = 11.66 MHz (m=3)
Example
Advantages Slower ADCs / electronics
needed.
Simpler antialiasing filters.
Using spectral replications to reduce sampling frequency fS requirements.
>2B
7
Over-sampling
LML Audio Processing and Indexing 13
Oversampling : sampling at frequencies fS >> 2 fMAX .
Over-sampling & averaging may improve ADC resolution
fOS = over-sampling frequency,
w = additional bits required.fOS = 4w · fS
Each additional bit implies/requires over-sampling by a factor of four.
(Some) ADC parameters
LML Audio Processing and Indexing 14
1. Number of bits N (~resolution)
2. Data throughput (~speed)
3. Signal-to-noise ratio (SNR)
4. Signal-to-noise-&-distortion rate
(SINAD)
5. Effective Number of Bits (ENOB)
6. …
NB: Definitions may be slightly manufacturer-dependent!
Imaging / video
Communication
Radar systems
Static distortion
Different applications have different needs.
8
ADC - Number of bits N
LML Audio Processing and Indexing 15
Continuous input signal digitized into 2N levels.
-4
-3
-2
-1
0
1
2
3
-4 -3 -2 -1 0 1 2 3 4
000
001
111
010
V
VFSR
Uniform, bipolar transfer function (number of bits N=3 => 8 levels)
-1
-0.5
0
0.5
1
-4 -3 -2 -1 0 1 2 3 4
- q / 2
q / 2
Quantisation error
Quantisation step q =V max
2N
Ex: Vmax = 1V , N = 12 q = 244.1 V
Voltage ( = q)
Scale factor (= 1 / 2N )
Percentage (= 100 / 2N )
signal
ADC - Quantisation error
LML Audio Processing and Indexing 16
Quantisation Error eq in
[-0.5 q, +0.5 q].
eq limits ability to resolve
small signal.
Higher resolution means
lower eq.
-0.2
-0.1
0
0.1
0.2
0.3
0 2 4 6 8 10
time [ms]
Vo
lta
ge
[V
]
QE for
N = 12
VFS = 1
0 2 4 6 8 10
Sampling time, tk
|e
q |
[V
]
10-4
2 10-4
Quantisation step q =V max
2N
9
SNR of ideal ADC
LML Audio Processing and Indexing 17
)qRMS(e
inputRMS10log20idealSNR (1)
Also called SQNR
(signal-to-quantisation-noise ratio)
(RMS = root mean square)
Ideal ADC: only quantisation error eq( p(e) = quantisation error probability density is assumed to be constant, uniform, etc. ) eq uncorrelated with signal.
ADC performance constant in time.
Assumptions
22
FSRVT
0
dt2
ωtsin2
FSRV
T
1inputRMS
Input(t) = ½ VFSR sin( t).
12N2
FSRV
12
qq/2
q/2-
qdeqep2qe)qRMS(e
eeqq
Error value
pp((ee)) quantisation error probability density
1 q
q 2
q 2
(sampling frequency fS = 2 fMAX)
SNR of ideal ADC
LML Audio Processing and Indexing 18
[dB]1.76N6.02SNRideal (2)Substituting in (1) =>
One additional bit SNR increased by 6 dB
- Real signals have noise.
- Forcing input to full scale unwise.
- Real ADCs have additional noise (aperture jitter, non-linearities etc).
Real SNR lower because:
Actually (2) needs correction factor depending on ratio between sampling freq
& Nyquist freq. Processing gain due to oversampling.
10
ADC Performance
LML Audio Processing and Indexing 19
From: http://www.analog.com/library/analogDialogue/archives/39-06/architecture.html
Currently:
~3 bits higher
Finite word-length effects
LML Audio Processing and Indexing 20
Dynamic rangedB = 20 log10
largest value
smallest value
Fixed point ~ 180 dB
Floating point ~1500 dB
Overflow : arises when arithmetic operation result has one too
many bits to be represented in a certain format.
High dynamic range => wide data set representation with no overflow.
Note: Different applications have different needs. For example:
• Telecommunication: 50 dB
• HiFi audio: 90 dB.
11
Complex Numbers𝑇ℎ𝑒 𝑐𝑜𝑚𝑝𝑙𝑒𝑥 𝑛𝑢𝑚𝑏𝑒𝑟𝑠 𝑎𝑟𝑒 𝑔𝑖𝑣𝑒𝑛 𝑏𝑦:
ℂ = 𝑐 𝑐 = 𝑎 + 𝑏𝑖, 𝑤ℎ𝑒𝑟𝑒, 𝑎, 𝑏 ∈ ℝ}
here i is the imaginary unit that satisfies: 𝑖2 = −1
a is called the real part of c
b is called the imaginary part of c
If z=x+yi, then the complex conjugate z*
is defined as z*=x-yi
LML Audio Processing and Indexing 21
Complex Numbers(see also Wikipedia)
𝑇ℎ𝑒 𝑐𝑜𝑚𝑝𝑙𝑒𝑥 𝑛𝑢𝑚𝑏𝑒𝑟𝑠 𝑎𝑟𝑒 𝑔𝑖𝑣𝑒𝑛 𝑏𝑦:ℂ = 𝑐 𝑐 = 𝑎 + 𝑏𝑖, 𝑤ℎ𝑒𝑟𝑒, 𝑎, 𝑏 ∈ ℝ}
here i is the imaginary unit that satisfies: 𝑖2 = −1
Addition:𝑎 + 𝑏𝑖 + 𝑐 + 𝑑𝑖 = 𝑎 + 𝑐 + 𝑏 + 𝑑 𝑖𝑎 + 𝑏𝑖 − 𝑐 + 𝑑𝑖 = 𝑎 − 𝑐 + 𝑏 − 𝑑)𝑖
Multiplication:𝑎 + 𝑏𝑖 𝑐 + 𝑑𝑖 = 𝑎𝑐 − 𝑏𝑑 + (𝑏𝑐 + 𝑎𝑑)𝑖
𝑎 + 𝑏𝑖
𝑐 + 𝑑𝑖=
(𝑎 + 𝑏𝑖)(𝑐 − 𝑑𝑖)
(𝑐 + 𝑑𝑖)(𝑐 − 𝑑𝑖)=
𝑎𝑏 + 𝑏𝑑
𝑐2 + 𝑑2+
𝑏𝑐 − 𝑎𝑑
𝑐2 + 𝑑2𝑖
LML Audio Processing and Indexing 22
12
Complex Numbers𝑇ℎ𝑒 𝑐𝑜𝑚𝑝𝑙𝑒𝑥 𝑛𝑢𝑚𝑏𝑒𝑟𝑠 𝑎𝑟𝑒 𝑔𝑖𝑣𝑒𝑛 𝑏𝑦:
ℂ = 𝑐 𝑐 = 𝑎 + 𝑏𝑖, 𝑤ℎ𝑒𝑟𝑒, 𝑎, 𝑏 ∈ ℝ}
The absolute value (modulus; magnitude) of 𝑧 = 𝑥 + 𝑦𝑖 is:
𝑟 = 𝑧 = 𝑥2 + 𝑦2
Note that:
𝑧 2 = 𝑧𝑧∗ = 𝑥2 + 𝑦2
The argument (phase) of 𝑧 = 𝑥 + 𝑦𝑖 is:
φ = arg z = {arctan(y/x), if… =
"the angle of the vector (x,y) with
the positive real axis“
Note: 𝑧 = 𝑟(𝑐𝑜𝑠𝜑 + 𝑖𝑠𝑖𝑛𝜑) = 𝑟𝑒𝑖𝜑
LML Audio Processing and Indexing 23
Complex NumbersLet:
𝑧1 = 𝑟1(𝑐𝑜𝑠𝜑1 + 𝑖𝑠𝑖𝑛𝜑1) = 𝑟1𝑒𝑖𝜑1
𝑧2 = 𝑟2(𝑐𝑜𝑠𝜑2 + 𝑖𝑠𝑖𝑛𝜑2) = 𝑟2𝑒𝑖𝜑2
Note:cos 𝑎 cos 𝑏 − sin 𝑎 sin 𝑏 = cos 𝑎 + 𝑏cos 𝑎 sin 𝑏 + sin 𝑎 cos 𝑏 = sin(𝑎 + 𝑏)
Hence:
𝑧1𝑧2 = 𝑟1𝑟2 𝑐𝑜𝑠(𝜑1+𝜑2 + 𝑖𝑠𝑖𝑛(𝜑1+𝜑2)) = 𝑟1𝑟2𝑒𝑖(𝜑1+𝜑2)
LML Audio Processing and Indexing 24
13
Sine Cosine Graphs
LML Audio Processing and Indexing 25
sin 𝜑 + 𝜋/2 = cos(𝜑)
ReferencesThis presentation uses a selection of slides that are
adapted from original slides by
Dr M.E. Angoletta at DISP2003, a DSP course given by CERN and University of Lausanne (UNIL)
LML Audio Processing and Indexing 26