E85.2607: Lecture 1 Introduction 1 Administrivia 2 DSP review 3 Fun with Matlab E85.2607: Lecture 1 Introduction 2010-01-21 1 / 24
Course overview Advanced Digital Signal Theory Design, analysis, and implementation of audio effects and synthesizers EQ, reverb, chorus, phase vocoder, sinusoidal modeling, FM synthesis,... Emphasis on practical implementation, building complete systems. Course web page: http://www.ee.columbia.edu/~ronw/adst E85.2607: Lecture 1 Introduction 2010-01-21 2 / 24
whoami PhD, Electrical Engineering, Columbia University Research interests: Source separation, speech recognition, music information retrieval http://www.ee.columbia.edu/~ronw E85.2607: Lecture 1 Introduction 2010-01-21 3 / 24
Sound familiar? Periodic and aperiodic signals Discrete Fourier Transform Convolution, filtering Linear time-invariant systems Impulse response Frequency response z-transform E85.2607: Lecture 1 Introduction 2010-01-21 4 / 24
Digital signals Continuous time Discrete time Discrete value Continuous value Discrete-time signal sequence of samples e.g. x[n ] = [0, 2.3, 1.3, 20, 4.2,...] Digital signal discrete-time signal that has been quantized Discrete on both axes: samples can only take on a limited set of values (quantization levels) Quantization introduces noise E85.2607: Lecture 1 Introduction 2010-01-21 5 / 24
Sampling x(t) ADC f = 1 s T f = 1 s T x(n) y(n) y(t) DAFX DAC 0.5 0.05 x(t) 0.05 x(n) T 0.05 y(n) 0.05 y(t) 0 0 0 0-0.05-0.05 0 500 0 10 20 t in sec n -0.05 0 10 20 n -0.05 0 500 t in sec t = n 1 t time in seconds (real number) n time in samples (integer) f s f s sampling rate ( e.g. 44100 samples ) second E85.2607: Lecture 1 Introduction 2010-01-21 6 / 24
Important signals: impulse 1.0 0.8 0.6 0.4 0.2 0.0 δ[n] = { 1, n = 0, 0, n 0 4 2 0 2 4 6 8 10 n Think of all discrete time signals as a sequence of scaled and time-shifted impulses. x[n ] = [0, 2.3, 1.3, 20, 4.2,...] = 0 δ[n ] 2.3 δ[n 1] 1.3 δ[n 2] + 20 δ[n 3] + 4.2 δ[n 4] +... E85.2607: Lecture 1 Introduction 2010-01-21 7 / 24
Important signals: sinusoid 1.0 0.5 x[n] = sin(2πfn) 0.0 0.5 1.0 0 5 10 15 n sin(2πfn + φ), frequency = f Period: N = 1 f samples But what will it sound like? cycles sample, phase = φ E85.2607: Lecture 1 Introduction 2010-01-21 8 / 24
Important signals: sinusoid 1.0 0.5 x[n] = sin(2πfn) 0.0 0.5 1.0 0 5 10 15 n cycles sin(2πfn + φ), frequency = f sample, phase = φ Period: N = 1 f samples But what will it sound like? cycles Convert from samples: f sample 1 samples f s second How many samples in one period of a 440 Hz tone sampled at 44.1 khz? E85.2607: Lecture 1 Introduction 2010-01-21 8 / 24
Discrete Fourier Transform Decompose any periodic signal into sum of re-scaled sinusoids Inverse DFT x[n ] = 1 N N 1 n=0 X [k ] e j2πnk/n k = 0,..., N 1 Forward DFT X [k ] = N 1 n=0 x[n ] e j2πnk/n Note that X [k ] are complex: X [k ] = X R [k ] + jx I [k ] E85.2607: Lecture 1 Introduction 2010-01-21 9 / 24
Magnitude and Phase spectra x[n] = cos(2πfn) j X [k ] X [k ] = X [k ] e Magnitude: amount of energy at each frequency X [k ] = XR 2[k ] + X I 2[k ] Phase: delay at each frequency X [k ] = arctan X I [k ] X R [k ] 1.0 0.5 0.0 0.5 1.0 10 8 6 4 2 0 4 3 2 X[k] X[k] 1 1 0 2 3 4 0 2 4 6 8 10 12 14 16 E85.2607: Lecture 1 Introduction 2010-01-21 10 / 24
DFT symmetry and aliasing 0 X(f) in db -20-40 Spectrum of analog signal -60-80 24000 28000 32000 36000 40000 0 4000 8000 12000 16000 20000 44000 48000 52000 56000 60000 f in Hz X(f) in db 0-20 -40 Spectrum of digital signal Sampling frequency f S=40000 khz -60-80 24000 28000 32000 36000 40000 0 4000 8000 12000 16000 20000 44000 48000 52000 56000 60000 f in Hz The spectrum of a discrete time signal is periodic with period f s The spectrum of a real valued signal is symmetric around f s /2 Any energy at frequencies greater than f s /2 will wrap around E85.2607: Lecture 1 Introduction 2010-01-21 11 / 24
Short-time Fourier Transform What if frequency content varies with time? Break signal up into short (optionally overlapping) segments Multiply by window function Take DFT of each segment E85.2607: Lecture 1 Introduction 2010-01-21 12 / 24
STFT example Frequency (khz) 10 8 6 4 2 0 0 1 2 3 4 5 6 7 8 Time (sec) 30 24 18 12 6 0 6 12 18 24 30 Power (db) E85.2607: Lecture 1 Introduction 2010-01-21 13 / 24
Linear time-invariant systems Process input signal using delays, multiplications, additions Describe using a difference equation, e.g. y[n ] = b 0 x[n ] + b 1 x[n 1] Can also have feedback, e.g. y[n ] = b 0 x[n ] + b 1 x[n 1] + a 1 y[n 1] + a 2 y[n 2] E85.2607: Lecture 1 Introduction 2010-01-21 14 / 24
LTI systems Block diagram E85.2607: Lecture 1 Introduction 2010-01-21 15 / 24
LTI systems Properties Given: x[n] h y[n] x2[n] h y2[n] 1. Linearity a x[n] h a y[n] Scaling x[n] + x2[n] h y[n] + y2[n] Superposition 2. Time-invariance x[n-k] h y[n-k] E85.2607: Lecture 1 Introduction 2010-01-21 16 / 24
Impulse response and convolution 1 x(n) = (n) y(n) = h(n) -1 0 1 2 3 n x(n) = (n) h(n) y(n) = h(n) -1 0 1 2 3 4 n Characterize LTI system in time-domain by its impulse response h[n ] An LTI system is just another signal Given input signal x[n ], output is convolution with h[n ] Convolution y[n ] = x[n ] h[n ] = x[k ] h[n k ] k= But how do we compute the impulse response from a difference equation? E85.2607: Lecture 1 Introduction 2010-01-21 17 / 24
z-transform z-transform X (z) = x[n ] z n n= Maps discrete-time signal to a continuous function of a complex variable Incredibly useful for analyzing LTI systems Turns difference equations into polynomials: x[n m ] Convolution becomes multiplication: x[n ] h[n ] z z M X (z) z X (z) H(z) If z = e jω, get discrete-time Fourier transform (DTFT) E85.2607: Lecture 1 Introduction 2010-01-21 18 / 24
Transfer function Transfer function H(z) is the z-transform of the impulse response Can read off z-transform from difference equation y[n ] = b 0 x[n ] + b 1 x[n 1] + a 1 y[n 1] + a 2 y[n 2] E85.2607: Lecture 1 Introduction 2010-01-21 19 / 24
Transfer function Transfer function H(z) is the z-transform of the impulse response Can read off z-transform from difference equation y[n ] = b 0 x[n ] + b 1 x[n 1] + a 1 y[n 1] + a 2 y[n 2] z Y (z) = (b o + b 1 z 1 ) X (z) + (a 1 z 1 + a 2 z 2 ) Y (z) E85.2607: Lecture 1 Introduction 2010-01-21 19 / 24
Transfer function Transfer function H(z) is the z-transform of the impulse response Can read off z-transform from difference equation y[n ] = b 0 x[n ] + b 1 x[n 1] + a 1 y[n 1] + a 2 y[n 2] z Y (z) = (b o + b 1 z 1 ) X (z) + (a 1 z 1 + a 2 z 2 ) Y (z) H(z) = Y (z) X (z) = b o + b 1 z 1 1 a 1 z 1 a 2 z 2 E85.2607: Lecture 1 Introduction 2010-01-21 19 / 24
Transfer function Transfer function H(z) is the z-transform of the impulse response Can read off z-transform from difference equation y[n ] = b 0 x[n ] + b 1 x[n 1] + a 1 y[n 1] + a 2 y[n 2] z Y (z) = (b o + b 1 z 1 ) X (z) + (a 1 z 1 + a 2 z 2 ) Y (z) H(z) = Y (z) X (z) = b o + b 1 z 1 1 a 1 z 1 a 2 z 2 But why? δ[n ] z 1 Compute impulse response analytically by finding inverse z-transform of H(z) (lots of algebra) E85.2607: Lecture 1 Introduction 2010-01-21 19 / 24
Frequency response H(f) H(f) Magnitude Response 1.2 1.0 0.8 0.6 0.4 0.2 0.0 0 5 10 15 20 Phase Response 4 3 2 1 01 2 3 4 0 5 10 15 20 Frequency (khz) Often more intuitive to analyze system in the frequency-domain H(e jω ) DTFT of impulse response Slice of z-transform corresponding to the unit circle DFT (discrete freq) is just sampled DTFT (continuous freq) E85.2607: Lecture 1 Introduction 2010-01-21 20 / 24
Poles and zeros Imaginary 1.0 0.5 0.0 0.5 1.0 2 1 0 1 2 Real Zeros: roots of numerator of H(z) Correspond to valleys in frequency response Poles: roots of denominator of H(z) Correspond to peaks in frequency response System is unstable if it has poles outside of (or on) the unit circle Impulse response goes to infinity E85.2607: Lecture 1 Introduction 2010-01-21 21 / 24
FIR and IIR filters Finite Impulse Response No feedback all zeroes always stable if coefficients are finite Easy to design by drawing frequency response by hand, then using inverse DFT to get impulse response Often needs a long impulse response expensive to implement Infinite Impulse Response Feedback has poles can be unstable Can implement complex filters using fewer delays than FIR But harder to design E85.2607: Lecture 1 Introduction 2010-01-21 22 / 24
Fun with Matlab Signal generation I/O Plotting Transforms Filtering Analyzing filters linspace, rand, sin wavread, wavwrite, soundsc plot, imagesc fft, ifft conv, filter freqz, zplane, iztrans E85.2607: Lecture 1 Introduction 2010-01-21 23 / 24
Reading Review your DST notes Skim Introduction to Digital Filters Linear Time-Invariant Filters Transfer Function Analysis Frequency Response Analysis DAFX, Chapter 1 (if you have it) E85.2607: Lecture 1 Introduction 2010-01-21 24 / 24