Fundamentals of digital signal processing 1 Sound modeling sound symbols aims analysis synthesis processing classification: signal models source models abstract models 2 Digital signals analog sampling processing reconstruction x(t) x(n) y(n) y(t) 0.05 0.05 0.05 0.05 0 0 0 0 -0.05 -0.05 500 0 0 t in µs ec -0.05 10 n 20 -0.05 0 10 n 20 0 500 t in µs e c sampling interval T sampling frequency fs= 1/T 3 Digital signals: time representations 0.5 x(n) 8000 samples 100 samples line with dots 0 -0.5 0 1000 2000 3000 4000 5000 6000 7000 8000 x(n) 0.5 0 -0.5 x(n) vertical quantization integer e.g. -32768 .. 32767 normalized e.g. -1 .. (1-Q) Q = quantization step 0 100 200 300 400 500 600 700 800 900 1000 0 10 20 30 40 50 60 70 80 90 100 0.05 0 -0.05 n 4 Spectrum: analog vs. digital signal sampling leads to a replication of the baseband spectrum 5 Spectrum: analog vs. digital signal Sampling leads to a replication of the analog signal spectrum Reconstruction of the analog signal: low pass filtering the digital signal 6 Discrete Fourier Transform Magnitude Phase 7 Discrete Fourier Transform (example) FFT with 16 points cosine (16 points) 1 Cos ine s ignal x(n) a) 0 -1 0 4 6 b) 8 10 12 14 16 n 1 Ma gnitude s pe ctrum |X(k)| 0.5 0 0 2 4 6 8 10 12 14 16 k 1 c) magnitude (16 points) normalization: 0 dB for sinusoid ±1 magnitude (frequency points) 2 Ma gnitude s pe ctrum |X(f)| 0.5 kfs / N 0 0 step fs/N 0.5 1 1.5 2 f in Hz 2.5 3 3.5 x 10 4 20 magnitude dB vs. Hz |X(f)| in dB Magnitude s pe ctrum |X(f)| in dB 0 -20 -40 0 0.5 1 1.5 2 f in Hz 2.5 3 3.5 x 10 8 4 Inverse Discrete Fourier Transform (DFT) if X(k) = X*(N-k) then IDFT gives N discrete-time real values x(n) 9 Frequency resolution Zero padding: to increase frequency resolution 8 s amples 8-point FFT 10 2 8 6 |X(k)| x(n) 1 0 4 2 -1 0 0 2 4 6 0 8 s amples + ze ro-pa dding 2 4 6 16-point FFT 10 2 8 6 |X(k)| x(n) 1 0 4 2 -1 0 0 5 10 n 15 0 5 10 15 k 10 Window functions to reduce leakage: weight audio samples by a window Hamming window wH(n) = 0.54 – 0.46 cos(2 n/N) Blackman window wB(n) = 0.42 – 0.5cos(2 n/N) + 0.08(4 n/N) 11 Window Reduction of the leakage effect by window functions: (a) the original signal, (b) the Blackman window function of length N =8, (c) product x(n)w(n) with 0 n N-i, (d) zero-padding applied to z(n) w(n) up to length N = 16 The corresponding spectra are shown on the right side. 12 Spectrograms 13 Waterfall representation S ignal x(n) 1 0.5 x(n) 0 -0.5 -1 Magnitude in dB 0 1000 2000 3000 4000 5000 6000 7000 n Waterfall Repres entation of S hort-time FFTs 8000 0 -50 0 2000 4000 6000 -100 0 5 10 15 20 n f in Hz 14 Digital systems 15 Definitions Unit impulse Impulse reponse h(n) = output to a unit impulse h(n) describes the digital sistem Discrete convolution: y(n)=x(n)*h(n) 16 Algorithms and signal graphs Delay e.g. y(n) = x(n-2) Weighting factor e.g. y(n) = a x(n) Addition e.g. y(n) = a1 x(n) + a2 x(n) 17 Simple digital system weighted sum over several input samples 18 Transforms Frequency domain desciption of the digital system Z transform Discrete time Fourier transform Transfer function H(z): Z transform of h(n) Frequency response: Discrete time Fourier transform of h(n) 19 Causal and stable systems Causality: a discrete-time system is causal if the output signal y(n) = 0 for n <0 for a given input signal u(n) = 0 for n <0. This means that the system cannot react to an input before the input is applied to the system Stability: a digital system is stable if stability implies that transfer function H(z) and frequency response are related by 20 IIR systems = system with infinte impulse response e.g. second order IIR system Difference equation Transfer function 21 IIR systems = system with infinte impulse response h(n) Difference equation Z transform of diff. eq. Transfer function 22 FIR systems = system with finite impulse response h(n) e.g. second order FIR system Difference equation Z transform of diff. eq. Transfer function 23 Fir example computation of frequency response (a ) Impuls e Re s pons e h(n) (b) Magnitude Res pons e |H(f)| 0.8 0.6 0.1 0.4 |H(f)| 0.2 0 0.2 -0.1 0 0 2 4 0 n (c ) P ole/Zero plot 10 20 30 40 f in kHz (d) P ha s e Res pons e H(f) 0 1 -0.5 4 0 H(f)/ Im(z) impulse response magnitude resp. pole/zero plot phase resp. 0.3 -1 -1.5 -1 -2 -1 0 1 Re (z) 2 0 10 20 f in kHz 30 40 24