100 likes | 221 Views
Digital Linear Filters. 張智星 (Roger Jang) jang@mirlab.org http://mirlab.org/jang 多媒體資訊檢索實驗室 清華大學 資訊工程系. Digital Linear Filters. Goal Sound effects: echo, reverberation Frequency-dependent manipulation: high-pass, low-pass, band-pass, etc. Implementation
E N D
Digital Linear Filters 張智星 (Roger Jang) jang@mirlab.org http://mirlab.org/jang 多媒體資訊檢索實驗室 清華大學 資訊工程系
Digital Linear Filters • Goal • Sound effects: echo, reverberation • Frequency-dependent manipulation: high-pass, low-pass, band-pass, etc. • Implementation • Use a set of coefficients to transform the original signal into a new one.
General Formula for a Linear Filter • The specs of a linear filter are represented by two vectors: • The output of the filter:
Example 1: Low-pass Filter • a=[1], b=[1/5, 1/5, 1/5, 1/5, 1/5] • y[n]=(x[n]+x[n-1]+x[n-2]+x[n-3]+x[n-4])/5 • A low-pass filter
Example 2: High-pass Filter • a=[1], b=[1, -1] • y[n]=x[n]-x[n-1] • A high-pass filter
Example 3: One-fold Echo • a=[1], b=[1, 0, …, 0, 0.8] (3199 zeros) • y[n]=x[n]+0.8*x[n-3200] • One-fold echo, with time delay = 3200/fs = 0.2 sec
Example 4: Multiple-fold Echo • a=[1, 0, …, 0, -0.8] (3199 zeros), b=[1] • y[n]=x[n]+0.8*y[n-3200] • Multiple-fold echo, with time delay = 3200/fs = 0.2 sec
Frequency-domain Decomposition • Signal decomposition • If we only keep the first 10 components, then we have a low-pass version of x[n]. Amplitude Freq= Phase
Filters for Frequency Manipulation • Problems • Computationally intensive to find the decomposition (via FFT) and then to resynthesize to obtain the low-pass version. • Online implementation not readily available. • Alternatively • Use the Butterworth filter that has designated parameters for defining passing frequency range
MATLAB Command for Butterworth Filter • We can use “butter” command to design a Butterworth filter: • [b, a]=butter(order, wn, function) • order: order of the filter (which is equal to the length of a and b.) • wn: normalized frequency (wn=0~1 corresponds to f=0~fs/2) • function: ‘low’, ‘high’, ‘band’ • Please refer to the online tutorial for examples.