How to Measure SPL using Audacity

Measuring RMS with Audacity

New page- may have some errors- caveat emptor!

History

People have asked how to use Audacity to measure SPL (sound pressure level) in various forums. The answers have generally been unsatisfactory. Too difficult, can't calibrate, not really possible. Well, you can do it. It's not that difficult and you can calibrate it very accurately. Here's what you need to know and how to do it.

But First...

Why do you want to do this? Most of the analysis we audio people care about has little to do with accurately knowing SPL levels. There are so many cheap SPL meters available on Ali Express and Alibaba that it isn't worth much time and effort to do anything else. In my case I need to measure SPLs produced by small mechanical devices. They aren't predictable and might rattle or squeak at random intervals. It's most convenient to simply record them for a period of time, then pick out the interesting areas for measurement and analysis. I can also envision recording a piece of music to explore the loudest or softest portions. Anyway, you'll probably have to spend some money to establish a good calibration for this, so consider the accuracy you really need. Sometimes an approximate answer is sufficient. Or, you could have OCD like me and have to have everything calibrated ten times better than needed.

Decibels

Since we'll be working in dB (decibels), a quick refresher is in order. Decibels are a ratio between two values. Whenever you see some number of dB, it's relative to some other value that's either given or understood. You can use dB to describe voltages, sound pressure levels or various other things. In the case of voltages, the reference level is often 1 volt. Correctly you would write dBV. SPL is referenced to the quietest sound the human ear can supposedly hear, 0.0002 dynes per square centimeter. That's also 20 micropascals. Neither of those units will be terribly meaningful to most people, but that's our reference of 0 dB. At the end of the Wikipedia page on dB there's a long list of the various suffixes and what they mean. The important thing to remember here is a change by a certain number of dB is equivalent. If the voltage changes by x dB, the associated SPL changes by x dB. That's true for microphone output, speaker input or any other more-or-less linear system.

Audacity Math (You don't really need to know this.)

When you record with Audacity you'll see a vertical scale on the left ranging from -1 to +1. The largest unclipped sine wave you can have goes from -1 to +1, a peak to peak value of 2. The RMS value of that is 0.7071. Audacity reports the amplitude values in dB and (using a reference value of 1) 0.7071 is -3.01 dB. You can prove this to yourself by generating a sine wave with an amplitude of 1.0 and measuring the RMS value as described momentarily. A clipped sine wave could have a higher value and even climb into the positive. Audacity is dealing with digitized signals and "knows" nothing about the original amplitude or what processing took place between the microphone and digital data it records. It only knows about signals in terms of it's own -1 to +1 amplitude range.

The plug-in described below will report "dB SPL" when calibration numbers are used. It will report "dB" when they are not; technically, based on the above, it should report something like "dB RMS referred to full scale peak-to-peak", but that's too much of a mouthful!

Setting up Audacity

The first thing you need is Audacity and I'll assume you've downloaded it and learned how to record, save and display the waveforms. The next part of the puzzle is how to actually measure the amplitude of a waveform. For that we need a plug-in. There's a demo plug-in called Measure RMS that you can install. I believe it comes with the installation but isn't enabled. It's written in Nyquist, a special extension of LISP, for Audacity. It gives you a way to measure RMS levels in Audacity, but it still doesn't connect that number to an actual SPL at the microphone.

An Audacity Plug-in Just for Us

The Measure RMS plug-in would be perfect if it could also include a calibration value for our microphones and report SPL directly. Working with Steve Dalton on the Nyquist forum, we came up with a variation of the Measure RMS plug-in called Measure SPL that does exactly that. You can download it here.

Measure SPL.zip A plug-in to give SPL directly.

Unzip (extract) the plug-in. Launch Audacity. Under Tools you'll find the Nyquist Plug-in Installer. Run it, navigate to the directory containing the new plug-in and install it. For manual installation it should go in your AppData folder for Audacity plug-ins. This would typically be "Local Disk (C:) > Users > {username} > AppData > Roaming > audacity > Plug-Ins". Next, go to the Analyze menu and select Add/Remove plug-ins... Measure SPL should show up as 'new' and you can highlight it, click 'enable' and then 'OK'.

If you record some sound and highlight a section you can run Measure SPL. It will first display a window with some calibration numbers that I use. Click 'OK' and it should report values for one or two tracks. Those values mean nothing at this point because you haven't calibrated your microphone, but don't worry, we'll cover that in a minute.

When you calibrate your microphone you'll need to measure Audacity signal levels. If you enter zeros in the first plug-in window, it will report RMS signal levels just like the Measure RMS plug-in does. After determining your microphone calibration numbers you'll enter those in the first window, instead of zeros. They will be remembered for any future time you use the plug-in. If you use the plug-in a lot you may find having to go through the first window wastes time. There are instructions in the plug-in text to hard code the numbers and eliminate the window. If you do that it will also eliminate the link to this page, but you can always get it from the plug-in text. To edit the plug-in be sure to use a plain text editor, not notepad or wordpad. I recommend Notepad++, which is a free download.

USB Microphones

So let's talk microphones. I'm going to start with the easiest, though not the cheapest, solution. For a few hundred bucks you can buy a class 1 USB measurement microphone. It will have a condenser capsule with a wide flat bandwidth and extremely low noise. The preamp and digitization is built in. It will have a reasonably well known output and, thanks to the fact that the signal is already digitized, there's little chance of confusing matters with the Windows level controls. In fact, they won't have any effect at all. For the mic I'll describe, there are two outputs. Even though it's a single mic, they output both a left and right channel. The left is high gain and is useful from about 20 dB to 100 dB. The right channel has less gain and is useful from about 50 dB to 140 dB (which is darn loud). There may be similar units, but this is the one I use. I'll tell you how to get one shortly, along with how to use any other microphone that you might have or prefer.

Most of what I measure isn't terribly loud, so I mostly use the left channel data. Audacity will let you split stereo tracks (left click to the left of the signals) and I just delete the right channel recording entirely. Less to look at and more screen area to look at it.

In a perfect world the usable microphone signal would be matched to the digital range so that it clipped or distorted right at the maximum possible value. For my mics left channel that would mean a 100 dB SPL sine wave would measure -3 dB in Audacity. In the real world they have to allow a bit of headroom, accommodate tolerances in the mic capsule and in the gain of the internal amplifier, so my mic would only get to about -5 dB. They allowed an extra 2 dB of wiggle room for tolerances.

To get SPL you have to add the Audacity amplitude to some constant. In the above case that magic number would be 105 dB. You measure the Audacity amplitude of -5 and add it to 105. That gives you 100 dB, the maximum advertised SPL of the mic. That last bit is the most important take-away on this page: for any given microphone and setup, what reference value do you add to your measurement to get actual SPL? When that number is entered in the first window of Measure SPL, it will be added automatically thereafter, giving you your SPL measurement directly.

Other Microphones and Calibration

I explained the USB mic solution first, as it's easiest to do, producing good results without gain mysteries and significant calibration issues. I realize lots of people won't want to go that route and will want to use whatever mic they have on hand, plus go through all manner of digital interfaces. Therein lies the rub. Every time you want to make a measurement you have to be sure the gain is the same. Or, you have to calibrate every setup. If somebody has messed with the gain pots on your interface, the Windows mic level controls or changed the Audacity level (which is the same thing), you're SPL value is going to be wrong. This is still a usable path, but you have to do a good job of documenting the setup so you can do it more than once.

It's desirable to calibrate the USB mic for best accuracy, but absolutely essential to calibrate an analog mic. The best way is to buy a new or used calibrator, which can be fairly inexpensive. This is a small device that outputs a tone at a specific dB level, usually 114 dB. You insert the microphone, make your measurements, and will then know the sensitivity of your measurement system. One type, the most affordable one, is nothing more than a simple oscillator and loudspeaker. They usually run at 1 kHz. It works in the obvious way. The other type is called a pistonphone. It has tiny internal pistons that ride on a motor-driven cam. Because the diameter and stroke of the pistons is known, and the volume of the chamber is known, the SPL can be determined with great accuracy. They often operate at or near 250 Hz and tend to be expensive.

Measurement microphones come in several sizes and the calibrators will have adapters to accept them. The usual ones are 1/4", 1/2" and 1", but it's like 2x4 lumber, they aren't actually that size when you include the grid. The 1/2" mics are actually 0.522" and the 1" mics are actually 0.936". Not sure about the 1/4". This is important because if you have some other size mic you won't be able to calibrate it in a calibrator, at least not easily or with known accuracy. All is not lost. If you have access to another SLM (sound level meter), you can calibrate by simple comparison. I usually create a noise track in Audacity and play it back, pointing the SLM mic and the mystery mic at the speaker from the same location. You can also use a pure tone but I find it more annoying to listen to.

All that said, the calibration process is fairly simple. If you have a calibrator, stick it gently on the mic and record a few seconds in Audacity. If you're using another SLM for calibration by comparison, play your noise track and record a few seconds, noting the SLM reading at the same time. Measure your noise or tone with the Audacity plug-in, window values set to zero. Now simple a subtraction finishes the job. Let's say the actual noise or tone was 100 dB SPL and Audacity measured the signal as -10 dB. Subtract -10 from 100. 100-(-10)=110. 110 dB would be your full scale reference value for future measurements. Enter it in the first window of the Measure SPL plug-in.

Double check your work. Record the calibrator again. Measure. You should now get the calibrator output SPL value, or very close to it.

One important check- expand the signal in Audacity and be sure it isn't clipping. If it is, the calibration values won't be correct. You'll have to reduce the gain and try again. Remember that you have to be able to reproduce that gain for future measurements.

Calibration in a Nutshell

My microphone has two channels, high gain on the left and low gain on the right. I enter different calibration numbers for each channel. If you have a single channel you may want to enter identical calibration numbers in all three positions. That way it doesn't matter if you record in stereo or mono or delete an unused track; the plug-in will always report a correct value. Just be sure you have the correct calibration constant entered for the channel your microphone is using.

Sensibly Priced Professional Level Tools

Now a plug for one of my favorite companies that nobody has ever heard of. The measurement microphone I use is an iSV-1611 from Hangzhou Aihua Instruments Co., Ltd. The company makes all manner of high quality sound measuring equipment, from simple microphone capsules to sophisticated FFT analyzers, but they do not yet have USA distribution. You can get an iSV-1611 via Alibaba. I was a bit nervous about this, having never used it before, but the company is extremely responsive and easy to deal with. The contact person, Jessica, seems able to answer queries at all hours of the day. They also have excellent condenser microphone capsules at far better prices than the more famous brands. Shipping took a little over a week. Like many companies on Alibaba they have minimum order quantities for most items. I was ordering several different items and my guess is they can be flexible on quantities so long as the order total is worth their while. If in doubt, ask them.

There is also the popular UMIK-1 from MiniDSP, plus a higher spec UMIK-2. I haven't used these but they appear to have a single channel. You probably want the more expensive UMIK-2 if you work at low levels. One reason I like the iSV-1611 is the excellent noise performance that results from the extra 40 dB of front end gain on the high gain (L) channel. UMIK-2 accomplishes this just by using more bits. MiniDSP also recommends the Room EQ Wizard software. It has more features to help with tuning your room and system. Not as well developed as Audacity or Visual Analyser but will certainly be preferred by some. It works fine with the iSV mic too.

Keeping Your Mic Alive and Healthy

One final thing about condenser microphone care and feeding. The gossamer thin diaphragm is very fragile and sensitive. Always insert and remove mics very slowly from a calibrator, lest the pressure change damage the diaphragm. There's usually a vent to equalize the pressure, but it's quite small. Never speak or breath directly into a condenser mic without a foam windscreen or spit shield (those round black screens you see in studio settings) because any moisture (or worse) that gets on the diaphragm can damage or change the response and sensitivity of the mic. Don't let your friends near your good measurement mics!

Useful Links

Hangzhou Aihua Contact Jessica to get current pricing on iSV-1611 and other products. Group with friends or forum members or possibly negotiate on the minimum order Q.

MiniDSP More measurement mics with different specs.

Audacity Get the latest version of Audacity here.

Measure RMS This link will tell you how to enable the Measure RMS plug-in.

Ali Express Very low prices for calibrators and meters but I've no experience with them.

A-weighting Some useful info on applying weighting curves.

Visual Analyser Real time spectral analysis and many other things. Significant learning curve if you're not a techie.

Room EQ Wizard Real time spectral analysis and many other things. Less techie than the above. Includes SPL meter that you can calibrate.

Notepad++ A very good tabbed plain text editor that supports highlighting for many languages.

Weighting Curves

Dedicated SLMs will almost always have a choice of weighting curves. These are usually A-weighting and C-weighting. A-weighting filters out lower frequencies that are less noticeable, attempting to match human hearing. The reality is it's a very flawed approach, but is so ingrained in standards and law that we're pretty much stuck with it. For analyzing speakers and rooms you'll almost always want flat response, so it won't be necessary to apply weighting. However, if you need it, there's an A-weighting plug-in in the links section. One thing A-weighting is good for is reducing the amount of HVAC air handler noise in some locations. If you apply weighting to your Audacity files, be careful not to overwrite the originals because it's near impossible to get the filtered data back.

Hopefully this has proved useful, or at least more enlightening than previous answers. Lastly, remember that a commercial SLM has highly defined response speed, various weighting curves and would have NIST traceable calibration. Those are needed in any legal setting, say industrial noise exposure monitoring, traffic court (loud mufflers), or anyplace where a sound level measurement is part of a contract. What I've described here is suitable for home hobby use and informal measurements unless you go through a rigorous and documented calibration and use procedure.

Accuracy

NIST (The National Institute of Standards and Technology) can establish sound level calibrations to about ± 0.01 dB. That requires gobs of money and specialized equipment. The best pistonphone you and I could buy is specified at ± 0.05 dB, but it would cost a months salary. The more common inexpensive calibrators will be ± 0.5 dB. It's doubtful any of us need better than that and it's probably wishful thinking that the rest of our measurement systems are capable of doing better. SPL measurement is subject to all manner of variables, so don't get too hung up on extreme accuracy.

Addendum

A few other random thoughts. You will often find used calibrators on eBay. In particular, the General Radio units are quite good. The problem is you have no way of knowing if they're still accurate and that somebody hasn't messed with the adjustments. Or, they could simply have drifted with age. Unless you have a way to verify or calibrate one, you're better off with a new unit. True pistonphones might be better, but they're still subject to wear. Given the higher price for a true pistonphone, you're probably still better off with a new non-mechanical unit. Note that the non-mechanical units are often called pistonphones too, which can confuse things. Be sure you know what you're paying for.

If you're calibrating a high gain range that might have a ceiling of only 100 dB, you need a calibrator that has a lower output, say 94 dB, along with the usual 114 dB. Not all do, so read the specifications carefully.

There are many remarkably inexpensive SLMs available, unlike some years ago. I've no experience with them, but given the low cost they might be worth taking a chance on. The worst SLM is probably better than the best phone app.

Your local barometric pressure (station pressure) has a small effect on calibration and measurement. It's usually only a couple tenths of a dB and won't be an issue here. If you were doing actual calibrations of test equipment you'd have to compensate for it. The new pistonphones may compensate for this automatically and the old ones came with special barometers for the purpose.

There is one more program in the links section called Visual Analyser. It will give you a real-time spectral analysis or real time octave analysis, plus a bunch of other stuff. It's a lot like a traditional hardware based analyzer, so there's more than a bit of a learning curve, but it can be very useful for speaker setup.

If you have a calibrator, pop it on the mic and record a few seconds of calibrated tone at the beginning of your recordings. That way you can double check your measurements. It will increase certainty and the recordings can be rechecked in the future if the results come into question.

C. Hoffman
last edit April 22, 2022