Forums

How to apply Fourier Transform to audio files in Matlab? Or something else?

Started by Mudchild January 15, 2007
Greetings

I hope I'm in the right place, and forgive me if I appear dumb!

I need to do Fourier Transform analysis of some audio impulse
response files, for a Uni assignment (Music Engineering). I have been
recommended to use Matlab for this, and as my Uni has it, I have
gained access... however I do not really know how to operate the
program, and unfortunately I don't have time to start from the
beginning.

I was hoping someone could advise me how to do it! This is what I
need to do:

"Apply a fourier transform to the whole impulse to get the frequency
domain behaviour of the space (which tells you nothing about the time
domain, then apply a series of much shorter windowed fourier
transforms to get the system's behaviour over time.

Plot a time/energy/frequency graph with a suitable 3d plotting
utility, and see what that tells you about reverb time and
reflections VS frequency and time."

I have got as far as opening the Signal Processing Toolbox, but I do
not know how to import my audio files, or to apply the fourier
transform.

Please could anyone give me some hints?

Thanks in advance

Alex

Mudchild wrote:
> Greetings > > I hope I'm in the right place, and forgive me if I appear dumb! > > I need to do Fourier Transform analysis of some audio impulse > response files, for a Uni assignment (Music Engineering). I have been > recommended to use Matlab for this, and as my Uni has it, I have > gained access... however I do not really know how to operate the > program, and unfortunately I don't have time to start from the > beginning. > > I was hoping someone could advise me how to do it! This is what I > need to do: > > "Apply a fourier transform to the whole impulse to get the frequency > domain behaviour of the space (which tells you nothing about the time > domain, then apply a series of much shorter windowed fourier > transforms to get the system's behaviour over time. > > Plot a time/energy/frequency graph with a suitable 3d plotting > utility, and see what that tells you about reverb time and > reflections VS frequency and time." > > I have got as far as opening the Signal Processing Toolbox, but I do > not know how to import my audio files, or to apply the fourier > transform. > > Please could anyone give me some hints? > > Thanks in advance > > Alex
The "Fourier transform" in general is a continuous-time operation. You can use the MATLAB command fft(), which uses the Fast Fourier Transform (a fast algorithm for computing the Discrete Fourier Transform) to get a frequency-domain view of the sampled data. That's what your professor wants. Jason
Mudchild wrote:
> Greetings > > I hope I'm in the right place, and forgive me if I appear dumb! > > I need to do Fourier Transform analysis of some audio impulse > response files, for a Uni assignment (Music Engineering). I have been > recommended to use Matlab for this, and as my Uni has it, I have > gained access... however I do not really know how to operate the > program, and unfortunately I don't have time to start from the > beginning. > > I was hoping someone could advise me how to do it! This is what I > need to do: > > "Apply a fourier transform to the whole impulse to get the frequency > domain behaviour of the space (which tells you nothing about the time > domain, then apply a series of much shorter windowed fourier > transforms to get the system's behaviour over time. > > Plot a time/energy/frequency graph with a suitable 3d plotting > utility, and see what that tells you about reverb time and > reflections VS frequency and time." > > I have got as far as opening the Signal Processing Toolbox, but I do > not know how to import my audio files, or to apply the fourier > transform. > > Please could anyone give me some hints? > > Thanks in advance > > Alex >
I'm guessing they probably gave you a wave file to analyze. That being the case you read the file like this: [x fs bits] = wavread('filename.wav'); Make sure you either put in the entire path or you've set the "current directory" of Matlab to the directory where the wave file is located or else you'll get an error saying the file cannot be found. The wavread command will give you an array x that contains all the sample data. Note that typing 'help wavread' (no ') will spit out information about this command to give you all the details. You'll probably also want to do something like X=fft(x) to get the fft. Other potentially useful commands might be abs() to get the absolute value of an fft and plot() to draw a graph of something. Since you're doing audio you may want to use semilogx() instead of plot() in order to get a semilog scale. Remember to use 'help' if you want more detailed info on any of these. Once you get your plot you can save it as a jpg through the file menus. There's your two-minute primer! Good luck! Brad
much obliged chaps - I shall give it a try later.

Mud

Brad Griffis wrote:
> Mudchild wrote: > > Greetings > > > > I hope I'm in the right place, and forgive me if I appear dumb! > > > > I need to do Fourier Transform analysis of some audio impulse > > response files, for a Uni assignment (Music Engineering). I have been > > recommended to use Matlab for this, and as my Uni has it, I have > > gained access... however I do not really know how to operate the > > program, and unfortunately I don't have time to start from the > > beginning. > > > > I was hoping someone could advise me how to do it! This is what I > > need to do: > > > > "Apply a fourier transform to the whole impulse to get the frequency > > domain behaviour of the space (which tells you nothing about the time > > domain, then apply a series of much shorter windowed fourier > > transforms to get the system's behaviour over time. > > > > Plot a time/energy/frequency graph with a suitable 3d plotting > > utility, and see what that tells you about reverb time and > > reflections VS frequency and time." > > > > I have got as far as opening the Signal Processing Toolbox, but I do > > not know how to import my audio files, or to apply the fourier > > transform. > > > > Please could anyone give me some hints? > > > > Thanks in advance > > > > Alex > > > > I'm guessing they probably gave you a wave file to analyze. That being > the case you read the file like this: > > [x fs bits] = wavread('filename.wav'); > > Make sure you either put in the entire path or you've set the "current > directory" of Matlab to the directory where the wave file is located or > else you'll get an error saying the file cannot be found. > > The wavread command will give you an array x that contains all the > sample data. Note that typing 'help wavread' (no ') will spit out > information about this command to give you all the details. > > You'll probably also want to do something like X=fft(x) to get the fft. > Other potentially useful commands might be abs() to get the absolute > value of an fft and plot() to draw a graph of something. Since you're > doing audio you may want to use semilogx() instead of plot() in order to > get a semilog scale. Remember to use 'help' if you want more detailed > info on any of these. Once you get your plot you can save it as a jpg > through the file menus. > > There's your two-minute primer! Good luck! > > Brad