LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating dB in sound pressure level)?

Hi,

 

Currently I'm working on a project using LabVIEW 8.2 SE, DSP module 2.0 and NI Speedy-33. Upon accquiring the data input from the two onboard microphones, I would like to convert the value to dB (sound pressure level). The formula is given as dB (SPL) = 2 log (P/Pref). Hence, for the value of P, should I take

 

1) the peak value in time domain?

2) the peak value in time domain after rms?

3) the peak value in freq domain (after FFT)?

 

Also, for the FFT spectral measurement VI, how do I know what is the number of points executed by the FFT?

 

Thanks in-advance!

0 Kudos
Message 1 of 17
(19,185 Views)

By definition, SPL is the RMS sound pressure of a sound relative to a reference value.

Therefore #1 is not correct.

 

Also by definition, the FFT of a signal yields amplitudes vs. frequency.  You would only use that if you were interested only in a particular frequency's SPL, to the exclusion of other frequencies.  I suppose there could be a use for that, but in general SPL refers to the full spectrum measurement.  Therefore #3 is not correct.

 

Note that your equation is incorrect as printed above: The formula is given as dB (SPL) = 2 log (P/Pref).

That should be 20 (twenty) not 2 (two). 

 

Note also that you can't measure SPL unless you have a calibrated microphone and a known amplification path.  Measuring volts by itself will not be accurate unless you can  A) verify the gain between the mike and the measurement, and B) verify the mike's pressure -to-signal conversion ratio.  Your typical computer's microphone and amplifier are not intended for precise measurements of this sort.

 

Message Edited by CoastalMaineBird on 03-15-2009 04:42 PM
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 2 of 17
(19,156 Views)

Hi there

 

Make sure that you use this formula

 

dB (SPL) = 10 log (P/Pref)^2 = 20 log (ABS(P/Pref))

 

CoastalMaineBird wrote

 

"Note also that you can't measure SPL unless you have a calibrated microphone and a known amplification path.  Measuring volts by itself will not be accurate unless you can  A) verify the gain between the mike and the measurement, and B) verify the mike's pressure -to-signal conversion ratio.  Your typical computer's microphone and amplifier are not intended for precise measurements of this sort. "

 

This is absolutly correct. You are NOT able to measure the correct value of any sound related physical value without using sophisticated measurment equipment AND sophisticated measurment environment like isolated sound chambers etc.! Forget it to get values related to real world using the build in soundcard of your computer.

 

The formula refers the measured sound pressure to a reference pressure. This makes it possible to compare the dB values of different measurement, but the dB values you get have nothing to do with "real" values measured with professional equipment or taken from datasheets. Common condensator microphones convert the sound pressure to voltage, i.e. the value (=voltage) you get from the soundcard input is proportional to the sound pressure, but there maybe a frequency depending sensitivity of the microphone. 

 

To calibrate the setup you need a standard sound source, e.g. your systems soundcard output and a speaker,  AND of at least same importance a standard measurement setup, i.e. always the same geometry/distances/environment between speaker and microphone. Make sure to damp environmental noise as far as possible!!

 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
Message 3 of 17
(19,152 Views)

Hai,

 

rms output is considered while doing such calculations.  Pref is taken as 20upa which is the sound pressure in air.

 

Refer to this link: http://en.wikipedia.org/wiki/Sound_pressure

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 4 of 17
(19,129 Views)

Guys, thanks for the reply!

 

Firstly, I've make a typo mistake on the dB (SPL) formula. Yup, it should be 20 log (P/Pref).

 

Secondly, thanks for highlighting/clearing my doubt that the P should be in rms value (Ya, FFT is the amplitude of a particular freq only).

 

Thirdly, I would like to convert the analog input measurement via the  NI Speedy-33 onboard microphones to dB (SPL) level which reference to the human hearing range for better illustration of the project (Pref = 20uPa), i.e roughly how loud is the measurement as compare to our hearing range. I also understand that sophisticated equipments are required to. Hence, therefore, is there any suggestion on how to get the Prms?

0 Kudos
Message 5 of 17
(19,126 Views)

Hai,

 

In Sound and Vibration Toolkit there is a VI named "SVL Scale Voltage to EU (1 Ch).vi".  This takes the voltage input and scales into Engineering units like pa,g,rad etc., with respect to the dB reference given by the user.  This vi will help in converting between units.

 

Hope this helps.

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
Message 6 of 17
(19,120 Views)

Hi JK1,

 

Yup, I've tried using the Sound and Measurement Vibration 7.0 suite (evaluation) but the VIs is unable to execute in DSP module/NI Speedy-33 board (it can only run limited VIs). 

0 Kudos
Message 7 of 17
(19,118 Views)

Hai,

 

The SVL Scale Voltage to EU (1 Ch).vi does some math within it to get the Voltage-EU.  Open the VI and extract only the required portion of the calculation (It doesnt have any DLL'sSmiley Happy) there is lot of code which checks the waveform for some parameters that is not required.

 

 

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 8 of 17
(19,115 Views)

Hi JK1,

 

Yup, that's my initial idea too but I'm using the evaluation mode and I can't see the block diagram. Can you help me do a "print screen"? If I'm not wrong, the formula is

 

P (Pa) = Voltage (mV) / Sensitivity (mV/Pa)

 

whereby

Voltage is the preamp output peak voltage

Sensitivity refer to the microphone's sensitivity (anybody know the sensitivity level of the onboard microphones on the NI-Speedy-33?)

 

With P found, I can plug it into the dB (SPL) = 20 log (P/Pref).

0 Kudos
Message 9 of 17
(19,112 Views)

Hai,

I have attached the vi in the post.Smiley Happy

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 10 of 17
(19,109 Views)