首先你想对你的音乐文件做一个 wavread 以将它加载到 Matlab 中(这是在时域中),
接下来你要创建 3 个带通滤波器 (Butterworth)
您有 2 条执行路线,在时域或频域中。
在时域中:
[x1 Fs nbits] = wavread('yourfile.wav'); %Fs is your sample frequency, x1 is your vector/matrix depending on single channel or dual channel.
现在您只需要设计您的过滤器。你可以使用 fdesign.bandpass 作弊(见http://uk.mathworks.com/help/dsp/ref/fdesign.bandpass.html)
使用 matlab 巴特沃斯过滤命令
[b,a] = butter(order,NormalizedCutOff); %you have to work out the Normalized Cut Off frequency using your sampling frequency or period, your desired cut-off etc.
如果您想要多个截止频率,请使用 [c1 c2] 代替 NormalizedCutOff (i.e.[b,a] = butter(8,[0.2 0.6],'pass');) %for band stop,将 pass 更改为 stop
freqz(b,a) %The frequency response of your filter
dataIn = x1; %your music
dataOut = filter(b,a,dataIn); %filter command filters your music
你可以通过 wavwrite 文件来收听或使用 (sound(dataout,fs))