We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
FFT -> Decibel (Read 3486 times)
FFT -> Decibel
Jul 23rd, 2007, 10:29am
 
Hi,

I'm working on a project wihch requires sound to be displayed in decibel.
I'm using the Sonia library, and I understand it uses an FFT for sound. (liveInput spectrum)
But could anyone please help me out with converting this FFT data to be represented in decibel?

Thanks Smiley
Re: FFT -> Decibel
Reply #1 - Jul 23rd, 2007, 1:35pm
 
do you mean you want to display the sound level in the units decibels? (or is there some application called "Decibel" that you want to get the data into?).

if it's the first question, then you're going to need getLevel(), not fft (which is for getting the frequency spectrum). the reference example is here:
http://sonia.pitaru.com/reference/LiveInput_getLevel_.html

that will return a float value somewhere between 0 and 1 if i remember correctly (0 is silence, 1 is loudest) and you then have to convert that to decibels.

for that you're going to have to callibrate the values with a hand held sound level meter of some sort, like this one: http://www.maplin.co.uk/module.aspx?ModuleNo=46362&doy=23m7
Re: FFT -> Decibel
Reply #2 - Jul 24th, 2007, 10:02am
 
Hey thanks so much for replying, ch Smiley
Its the unit Decibel, that I want to display the data in.

I've tried the reference example, but is it really decibel?
I've been searching a lot for this info, and found that decibel is the ratio of frequency and power of the sound.

But isn't getLevel() only giving us the volume of sound? Or is there a way of converting that to decibel value?
Re: FFT -> Decibel
Reply #3 - Jul 24th, 2007, 10:56am
 
Found a formula  SL(dB) = 10 * log( V/Vo ) in the following site.
http://www.newton.dep.anl.gov/askasci/phy00/phy00445.htm

But will this formula work for the getLevel() function? And is the getLevel() data in W/m^2?

(need a jet plane to fly by to see if the conversion will give me a reading of 130dB Wink )
Re: FFT -> Decibel
Reply #4 - Jul 25th, 2007, 12:16am
 
no... the number you will get out of getLevel() has no units.

but as it happens, the decibel is also unitless (in the sense that all it really is, is a ratio: http://en.wikipedia.org/wiki/Decibel

what you might be talking about is dB(SPL) (see the same page for info on that)

basically it sounds like what you want to measure is loudness

so i'm suggesting that, if you want to be really accurate, you get a sound level meter, make a variety of sounds and measure what the slm says and what getLevel() says and work out what the proportion is.

i.e. if
getLevel()        slm
0.1 ---------->60dB
0.2----------->90dB
0.4------------>150dB

you can start to work backwards to figure out what the equation is, probably something like

float gL = getLevel();

float dB = k * gL^n;

where you have to figure out what k and n are empirically

Re: FFT -> Decibel
Reply #5 - Jul 26th, 2007, 11:57am
 
Thanks so much, but shuks....thats a lot of work.... Smiley
All I want is, to get the decibel number from the values generated by the getLevel() function.
So if a person is speaking, the getLevel() function will generate some value, which will then have to undergo conversion using some formula (I need the formula), and if the result of the formula is about 60, then the result will be printed as 60dB. (60 dB is the decibel value of a normal conversation)

But I just came across the comment at
http://sonia.pitaru.com/reference/LiveInput_getLevel_.html
which mentions an input peak (volume)level from the microphone. Might this be in any way related to the peak to peak values of a sine wave that is obtained from a microphone?
Coz if it is, then probably the formula in this site
http://www.newton.dep.anl.gov/askasci/phy00/phy00445.htm
might actually work, coz they're converting voltage to dB.
Re: FFT -> Decibel
Reply #6 - Jul 26th, 2007, 12:27pm
 
Unfortunately I think every microphone,and every computer's socket are different. Also the "volume" setting in the control panel (for windows at least) will change what actual suound level maps onto 0.5 in the getLevel() function.

so the only way to do it really, is to do the "make noise, find volume on some proper meter, compare to value given by getLevel(), rinse, repeat, work out mapping" cycle.

There's no way of knowing how loud 0.5 (for instance) is without doing the calibration.
Re: FFT -> Decibel
Reply #7 - Jul 27th, 2007, 11:14am
 
Hmm...what you said makes sense...
Thanks a lot John...I guess it is silly to expect a sound intensity value from a microphone....
Re: FFT -> Decibel
Reply #8 - Jul 30th, 2007, 6:23am
 
If sound pressure is what causes the voltage variation in a microphone, then the values we get thru the getLevel() function should be their equivalent, right?
Re: FFT -> Decibel
Reply #9 - Oct 10th, 2007, 6:59am
 
sd wrote on Jul 30th, 2007, 6:23am:
If sound pressure is what causes the voltage variation in a microphone, then the values we get thru the getLevel() function should be their equivalent, right



Not quite. Just like speakers, microphones vary greatly in construction and even in the way they function. Different microphones have different sensitivities to sound pressure, thus result in different outputted voltages.

Page Index Toggle Pages: 1