Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Acoustics related matlab question......

Status
Not open for further replies.

antonywilliams

Civil/Environmental
Mar 21, 2006
7
Please bear in mind that I am a complete newbie to Matlab...

I need to find the Leq (equivalent continous noise level) of a .wav file using Matlab. I was wondering if anyone knows if this is a simple function within one of the toolboxes or even if there is actually a way to implement this...

Any help would be much appreciated!!

Thanks
 
Replies continue below

Recommended for you

You have two distinct problems

1. Getting the .wav file into the Matlab work space.

2. Calculating the Leq.

The way to approach problem 1 is to study the Matlab documentation on .wav files. The online help is fully searchable so it shouldn't be too much of a problem.

For problem 2, the definition of Leq


includes an integration stage. You can again search the Matlab documentation for this but for your application you can simply use the 'sum' function.

The Leq calculation can be done in a single line of code. Something like:

Leq = 10*log10( sum(p.^2)/T/pref.^2 )

where p is measured pressure waveform from the .wav file, pref is the reference acoustic pressure and T is the averaging period.

M

--
Dr Michael F Platten
 
... And then there is the problem of calibration.

If your .wav file does not have a cal tone in it anywhere (fairly likely), you'll have no idea of the recording level. .wav files when loaded into Matlab have a range of -1 to 1 - what to multiply it by to get Pa?
 
Thanks for the replys guys, it all seems good apart from obtaining p, the measured pressure. How can I get that from the .wav file? Is this just an average pressure for the entire duration of the file?

I guess using the 'wavread' function is going to be the best way get it into matlab, this seems to put it into a 2 column matrix. Not too sure if this is what i need, i need to mess about with it some more.

With respect to calibration, that doesnt matter because I just want to scale a number of different .wavs so that they all have an leq value of 55dB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor