Low-Pass Filter

From CCRMA Wiki
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.