0
$\begingroup$

How do I apply a bandpass filter on an audio file which is in wav format? And write back the filtered data in a new wav file for further analysis.

$\endgroup$
  • 1
    $\begingroup$ What have you tried? What tutorials/books/online resources have you read? This is a pretty basic task that is well documented. $\endgroup$ – MBaz Apr 10 at 17:26
  • $\begingroup$ So I've looked/tried/read ThinkDSP by AllenDowney but it relies heavily on the thinkDSP library. I want a more robust solution. I have a matlab code that works wonderfully. I want to implement it in python as well. $\endgroup$ – PhoenixProject Apr 10 at 19:22
  • $\begingroup$ Try this, they discussed similar topic to yours $\endgroup$ – user41623 Apr 11 at 6:41
0
$\begingroup$

Consider looking at this StackOverflow answer which provides the full code for creating a Butterworth bandpass filter. In the sample code the answerer provides, the filter is applied to a manually constructed simplistic signal x. If you substitute this signal with your own NumPy array, it should achieve the intended effect.

WAV files can be quickly made into NumPy arrays, consider using the librosa module. librosa.core.load will be what you use. To write out the filtered signal, simply use librosa.output.write_wav.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.