LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to record audio in decibels?

I am trying to use a usb microphone (Blue Yeti) to record the audio volume while this program is running. I have figured out that LabView will recognize the device if I restart my computer with it plugged in. But I can't figure out what it is measuring it in (volts?) and what to make of the values (their magnitude and their signs- can't speak at a negative volume). Can anyone tell me how to interpret this data and how to get it into decibels? Thanks!

0 Kudos
Message 1 of 11
(2,148 Views)

It sounds (sorry for the pun) as if you need to understand two things prior to answering your question.

  1. What & How are decibels measured.  Your response reveals your level of knowledge.
  2. Use of a calibrated source in order to define/understand how well your microphone is working. (Sensitivity/ Gain settings - Is it clipping)?
Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 2 of 11
(2,121 Views)

1. Your block diagram is messy. When asking for help, it's not polite to present a mess.
2. A decibel is a tenth of a bel.
3. To get bels, take the common logarithm of power.
4. Your mic is probably outputting voltage that is proportional to sound pressure.
5. Power will be proportional to the square of the voltage.
6. You want to use RMS, not Mean on your waveform.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 11
(2,104 Views)

In addition decibel doesn’t really have a unit in itself since it is simply the logarithm of  a measurement to a specific reference. What type of reference that is is usually indicated by an additional letter appended to dB such as dBa or dBV. It’s in itself a unit less logarithm of a measurement in a certain unit divided by a reference of the same unit.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 11
(2,049 Views)

Hi everyone,

Sorry for the delayed response, I have been trying to analyze all of your suggestions and comments (thank you all for your help).

First, I would like to mention that I am nearly brand new to LabView, coding in general, and audio so please excuse any dumb errors, messiness, etc. I am trying my best.

Second, I have adjusted my original code to basically try to incorporate my new understanding of recording audio and working with Pa/V/dB. The below steps are based on the common equation I have seen: dB (or Lp) =20*log(p/p0)

  1. I switched the mean function to RMS in order to (I believe) find the RMS value of the voltage data my mic is taking in every 1 second.
  2. Converted the (now RMS'ed) voltage to pressure in pascals. The sensitivity of my mic (Blue Yeti) is 4.5 mV/Pa, so to get from V to Pa I multiplied by 1000/4.5 (~222.22). This is the value for p.
  3. Scaled this by dividing by 0.00002 Pa. There are apparently many different ways to scale that I found when researching how to convert to dB, but this seems to be the widely accepted method in regards to sound pressure for p0. Please tell me if there is another way I should scale this. 
  4. Took the log (base 10) of that.
  5. Multiplied by 20.

So that's where I am now. It seems at least like my mic is responding appropriately (the reading is increasing when I talk/make noise into it) but I'm getting numbers in the 100s, which isn't right for decibels (at least I don't think- every website says 60 dB for normal conversational voice but they don't tell me what value was used to scale). Is this reasonable? Am I missing something, conceptually or mathematically? Is my code okay for this portion?

I know this is becoming more and more of an audio question than a coding question, but I will post it here anyways in case I get lucky and there happens to be an audio expert present.

Thank you in advance!

0 Kudos
Message 5 of 11
(1,984 Views)

What they don't tell you is how far away from you that person is talking.  If they are right across the table from your mic, sure, 60 dB is reasonable.  But if they are talking right into the mic, it will be much louder.  Imagine someone talking in a normal voice right in your ear.  Now maybe we are getting into the 100 dB range.

 

By "hundreds", do you mean literally, like 200 or more, or do you just mean greater than 100?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 11
(1,976 Views)

Bill,

Ahhh, I didn't consider that, thank you. 

Sorry, I should have been clearer. I mean in the mid 100s. With minimal audio (some typing and sniffles- typical office noises but no talking) it reads at about 110. With snapping, tapping, and talking right next to the mic, the values increase to 120-130. The fact that the background noise reading is so high is what is really confusing me.

Attached is a screenshot of the data I'm reading, plus a graph, for reference. 

I also forgot to attach the updated VI, will attach here.

Thanks!

mnchem_0-1625598023136.png

 

0 Kudos
Message 7 of 11
(1,970 Views)

@mnchem wrote:

Bill,

Ahhh, I didn't consider that, thank you. 

Sorry, I should have been clearer. I mean in the mid 100s. With minimal audio (some typing and sniffles- typical office noises but no talking) it reads at about 110. With snapping, tapping, and talking right next to the mic, the values increase to 120-130. The fact that the background noise reading is so high is what is really confusing me.

Attached is a screenshot of the data I'm reading, plus a graph, for reference. 

I also forgot to attach the updated VI, will attach here.

Thanks!

mnchem_0-1625598023136.png

 


Is this going through a sound card?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 11
(1,961 Views)

I'm not and expert here, but it looks like sometimes the formula multiplies by 10 and other times it multiplies by 20.  The difference appears to be whether the values you're taking the log of are squared or not.

 

If you were to divide your results by 2, you'd be getting much more reasonable values (i.e. conversational levels instead of jet engine levels).

 

I know a lot of Analog to Digital conversions aren't actually straight linear conversions.  Is there a chance maybe you have squared values and didn't know it?  

0 Kudos
Message 9 of 11
(1,957 Views)

Not sure if it is going through a sound card, how would I check that? It is a USB connected microphone, so I don't think so... 

And I am not sure if the values are being squared already or not. I wouldn't think so, I think the mic is taking in straight volts (which I converted to pascals). Halving the values would make them more reasonable, but I would still be measuring background noise (hardly anything at all) at 60 dB, which is not reasonable, so I am not sure if that's the problem...

Here is a graph of a test I just ran. The mic was sitting on top of a noisy instrument, recording me talking/making other noises into the instrument. The good thing is I can at least see it picking up audio appropriately, but again the actual numbers are just off (I think).

mnchem_0-1625604204169.png

 

0 Kudos
Message 10 of 11
(1,947 Views)