Audio bandpass using Fourier transform

For a mathematics class I am in, my professor is having us manipulate audio files in various ways in order to demonstrate some of the processes we have learned about.

One of these in particular is giving me a lot of trouble. The assignment is to perform a Fourier transform on an audio file, isolate certain frequencies using a step function, and the performing an inverse Fourier transform.

While I understand qualitatively how the problem works, I am having trouble implementing it in Mathematica. I am somewhat new to the software, so any tips you can offer would be much appreciated.

The latest iteration of my code imports the file using AudioData[Import[filename]] and then performs the Fourier transform using Fourier[data], though I am not confident that this is the best method.

though I am not confident that this is the best method

Why? Fourier does FFT on data. Make sure if your audio has more than one channel to do one at a time.

 a = Import["ExampleData/drums.ogg"];
AudioChannels[a]

(* 2 *)

data = AudioData[a];
Dimensions[data]
(*  {2, 695674} *)

ListLinePlot[Abs[Fourier[data[[1, 1 ;; 200]]]]^2]


• From there how can I then remove frequencies? Commented Apr 24, 2020 at 18:12
• @Anonymous yes, use BandpassFilter command. You need to provide the cut off frequencies to do that. Commented Apr 25, 2020 at 7:02