Low-Pass Filter

From CCRMA Wiki
Revision as of 14:51, 30 July 2008 by Jsundram (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The following code shows how to run a low-pass filter in matlab. You'll want to change 4000 to your desired cutoff.

[x, fs] = wavread(file);
cutoff = 4000/(fs / 2); % cutoff 4 kHz
[B, A] = butter(10,fCutoff,'low'); % construct low pass filter. 10 should make it nice and sharp.
x = filtfilt(B,A,x); % do the filtering and clobber x with the result.
a = miraudio(x, fs); % construct a miraudio object and go on our merry way.