How to compute SPL from sound inputed from a microphone.

The joys of multi-platform Audio Programming

How to compute SPL from sound inputed from a microphone.

Postby lance » Mon Oct 26, 2009 1:43 pm

Dear all
I am new to audacity.
I want to develop an ap with function of measure sound level. I have not enough knowlegde about that. May I have your suggestion? Is there some code in audacity I can reference?
My programme language is C# and MFC.
Any suggestion will be greatly appreciated.

Email:lanxiaolin007@sina.com
Xiaolin.lan
lance
 
Posts: 3
Joined: Mon Oct 26, 2009 1:02 pm

Re: How to compute SPL from sound inputed from a microphone.

Postby Irish » Mon Oct 26, 2009 8:11 pm

It is not as simple as that.

To measure sound level, you have to know the following:

With [this microphone], a sound pressure level (SPL) of [this number of decibels] at [this frequency] at a distance of 1 metre from the mic gives an output of [this number of millivolts].
With [this sound card] on [this computer] using [this operating system], and with [these input settings in Control Panel] and [these input settings in Audacity], an input of [this number of millivolts] gives a level of [this number of decibels] on the recording level meters in Audacity.

That's eight variables between the sound and the display you will get in Audacity. Change any one of them and your answer will be wrong.

Now, having completely discouraged you, there is one way you could get an appoximate value for SPL using Audacity;
Beg, borrow or rent a Sound Pressure Level meter. Put its microphone and your microphone (connected to Audacity) side by side and record a range of sounds.
Note the reading on the SPL meter and Audacity's level meter for each sound.

Now you know that with that microphone, that computer and that setup, a level of "x" dB on the Audacity meter means that the sound level is "y" dB.

That's about as close as you will get.

PO'L
Irish
 
Posts: 99
Joined: Sat Sep 05, 2009 9:25 pm
Location: Dublin, Ireland

Re: How to compute SPL from sound inputed from a microphone.

Postby lance » Mon Oct 26, 2009 10:53 pm

Dear PO'L
Thanks for your reply.
I will make the solution according your suggestion.
Could you tell me which file the code is used to compute sound level locate at?
I have read the code for a day, but I am so dizzy because of too many source code files.
lance
 
Posts: 3
Joined: Mon Oct 26, 2009 1:02 pm

Re: How to compute SPL from sound inputed from a microphone.

Postby Irish » Mon Oct 26, 2009 11:17 pm

I don't think the source code will tell you a lot.

Audacity doesn't calculate SPL values; it just converts the analogue input to digital and assigns 0dB on the recording level meters to a certain input level, which corresponds to the maximum value of the digital signal. I'm not familiar with the source code, but I don't think you will find a part of it that you can take out and use as a separate application.

Maybe someone else can point you to the part of the code that generates the meter display.

PO'L
Irish
 
Posts: 99
Joined: Sat Sep 05, 2009 9:25 pm
Location: Dublin, Ireland

Re: How to compute SPL from sound inputed from a microphone.

Postby lance » Tue Oct 27, 2009 10:35 pm

OK!
I should try to look up some other solution.
Thanks!
Lance
lance
 
Posts: 3
Joined: Mon Oct 26, 2009 1:02 pm

Re: How to compute SPL from sound inputed from a microphone.

Postby kozikowski » Sat Nov 14, 2009 7:34 am

<<<That's about as close as you will get.>>>

Real SPL meters also have curves. Workplace rules for dangerous noises are written in "A" curve which gives less importance to very high and very low pitch sounds. The "C" curve isn't a curve at all, but gives equal importance to all pitches of sound. So even if you got the code to work, you'd still only have one of the two meters.

dBSPL meters are not all that big a deal to walk out and buy one.

http://www.radioshack.com/search/index. ... meter&sr=1

I have an analog one and the company owns a digital one. They still make both because you can't measure music with the digital one.

Koz
kozikowski
 
Posts: 7630
Joined: Thu Aug 02, 2007 5:57 pm
Location: Los Angeles


Return to General Audio Programming

Who is online

Users browsing this forum: No registered users and 1 guest