0

I have a audio file I want to filter it so that i can just have frequency within certain range. I just want signal from 12Khz to 14Khz I want to filter out the other frequency. I tried the butterworth filter in matlab but i dont seem to understand the parameter.

Adam
  • 11
  • 1
    You may want to see http://stackoverflow.com/questions/7710847/designing-a-simple-bandpass-bandstop-filter-in-matlab – lakshayg Jun 21 '15 at 17:05
  • not really this filters out the signal i want to keep the signal and remove everything else. – Adam Jun 21 '15 at 17:10

1 Answers1

3

Have you try:

[y,fs]=audioread('audio.audioformat'); 
wn=[12000 14000]/(fs/2);   
[b,a]=butter(n_order,wn);
f=filter(b,a,y);

And we divide wn by (fs/2) because the butter command only accept a normalized Frequency

obchardon
  • 10,614
  • 1
  • 17
  • 33
  • Also, `filtfilt` is a good alternative to filter if phase shift is a problem. – Andrzej Pronobis Jun 21 '15 at 17:39
  • 1
    @Adam Watch out for potential numerical issues with the `butter` function. If you want to be on the safe side, [use the zero-pole representation](http://stackoverflow.com/a/23665440/2586922) of the filter rather than the coefficient (`b`, `a`) form – Luis Mendo Jun 21 '15 at 18:29