0
\$\begingroup\$

I am calibrating my microphone system consisting of a microphine whose signal is amplified and then converted from analog to digital with an ADC. The ADC converts the data to a 16-bit integer.

The calibration microphone produces 94 dBSPL at 1 kHz. I am sampling with 192 kHz, then plotting the FFT of that signal to find the given dBV at 1kHz.

First, converting the unit-free signal to V using:

calibration_94dB_1kHz = signal * (1 / 32768)

Then applying a window:

N = len(calibration_94dB_1kHz)
s = signal.windows.flattop(N) * calibration_94dB_1kHz

Then calculating the one-sided FFT with:

X = 2 * np.abs(np.fft.rfft(s))/N  # normalize the fft by the window-length and multiply by 2 since we are discarding the negative frequencies of the FFT
X_freq = np.fft.rfftfreq(N, 1.0 / 192000)

The data needs then to be plotted logarithmic so:

X_dbV = 20*np.log10(X)  # get fft in dBV

When plotting the data with:

axs[1, 0].clear()
axs[1, 0].semilogx(X_freq, X_dbV, color=colors[1], label='Frequency response |S(jw)| detrended and windowed')
axs[1, 0].grid(True)
axs[1, 0].legend(loc='upper left')

I get a peak at approximately 1 kHz that is -48.3 dBV. How can I convert this value to dBSPL if the mic has a sensitivity of -38 dBV +- 1, which is tested from the manufacturer with 1 kHz at 94 dBSPL?

enter image description here

EDIT: Here is the updated code:

calibration_94dB_1kHz_detrended = signal.detrend(data=calibration_94dB_1kHz, type='constant')
s = calibration_94dB_1kHz_detrended
Gain = 1 + 100 / 4.7
calibration_in_rms_Vpp = s / (2*np.sqrt(2))  # assuming p-p sinusoidal waveform
sensitivity = -38  # dBV

# Apply window
N = len(calibration_in_rms_Vpp)
s = signal.windows.flattop(N) * calibration_in_rms_Vpp
X = 2 * np.abs(np.fft.rfft(s))/N  # normalize the fft by the window-length and multiply by 2 since we are discarding the negative frequencies of the FFT
X_freq = np.fft.rfftfreq(N, 1.0 / 192000)
X_dbV = 20*np.log10(X)  # dBVrms
X_dbSPL = X_dbV - Gain - sensitivity + 94  # dBSPL
\$\endgroup\$
7
  • \$\begingroup\$ This is already extensively discussed at dsp.se. And there are similar questions here. The manufacturer data sheet clearly says 94 dB(SPL) equals -38 dB(V), so there is an offset of 132. Now, for some reason, you assume 32768 is 1V, which may or may not be true. Just because an ST employee said so on a support forum (and was wrong on other points before that as well) it might not be true. \$\endgroup\$
    – Justme
    Commented Nov 22, 2023 at 17:57
  • \$\begingroup\$ Lets assume 32768 actually equals 1V. Furthermore, i have calculated the gain of the opamp to be $1+\frac{R_f}{R_in}=1+100/4.7=21.27$. Yes, the sensitivity is -38 dBV. How can i then get the dBSPL? \$\endgroup\$
    – Tom
    Commented Nov 27, 2023 at 16:18
  • \$\begingroup\$ It has been said many times now that mic data sheet says -38 dB(V) equals 94 dB(SPL), but I don't know why you are unable to make that connection. \$\endgroup\$
    – Justme
    Commented Nov 27, 2023 at 16:22
  • \$\begingroup\$ I dont want to convert just -38 dBV to dBSPL. That is pointless at this point. I want to convert ALL values to dBSPL. After researching on this topic i have found, that i need to calculate with the gain, sensitivity and dBSPL like this: X_dbSPL = X_dbV - Gain - sensitivity + 94 # dBSPL. I have included the code above. \$\endgroup\$
    – Tom
    Commented Nov 27, 2023 at 16:31
  • \$\begingroup\$ 1V is also, by definition, 0dBV. And then you know everything in both dBV and dB SPL, because you know the relation of 32768 to 1V, 1V to 0 dBV, and dBV to dB SPL. Sorry but I don't understand which part of the puzzle you think you are missing. \$\endgroup\$
    – Justme
    Commented Nov 27, 2023 at 16:47

1 Answer 1

1
\$\begingroup\$

I'm not sure what to make of "The calibration microphone produces 94 dBSPL at 1 kHz." The microphone is not being used as a projector, thus it will produce some sort of voltage output, not a sound pressure output as a projector would.

Sound-Pressure Level (SPL) in air, is normally given in \$dB \; re \; 20\; \mu Pa\$, also written as \$dB/\!\!/20\; \mu Pa\$ in some literature.

Microphone sensitivity is normally given in \$ dB \; re \; 1V/20 \mu Pa \$, also can be written as \$ dBV \; re \;20 \mu Pa\$. The sensitivity number will look something like -45 dBV re 20 µPa (note: the sensitivity number is normally a negative number).

The 94 dB thing you refer to relates SPL to \$ 1 \; Pa \$, i.e. \$ 93.98 = {20 log({1 \over 20e-6})} \$.
You do not need to include the number 94 in your calculations unless you're trying to redefine SPL relative to one Pascal.

When measuring SPL at a single frequency it is customary to use \$V_{rms}\$.

$$ (SPL\_in\_dB/\!\!/20 \mu Pa) = \\ {(Output\_Voltage\_in\_dBV) - (Amplifier\_Gain\_in\_dB) - (microphone\_sensitivity\_in\_dBV/\!\!/20 \mu Pa)} $$

When measuring the dB value in the FFT, verify the reported number by inputting a reference signal at a known amplitude (rms value) and see that the FFT reports the voltage you expect, i.e., just do a simple amplitude measurement.

\$\endgroup\$
6
  • \$\begingroup\$ on dsp.se, it was apparent that there is a calibration sound source emitting 94dB at 1 kHz, and it was used incorrectly the last time I checked dsp.se so it is anyone's guess if the sound pressure ever was 94 dB at the microphone or not, and there is some weird belief that +/- 32767 equals +/- 1 volts but that info also came from ST forum person who was known to be wrong by saying the sampled values are in decibels, so not very trustworthy source. \$\endgroup\$
    – Justme
    Commented Nov 27, 2023 at 21:26
  • \$\begingroup\$ I have successfully determined the gain of the opamp (13 dB) using an oscilloscope. Furthermore, if i compute the overall $V_{rms}$ of the calibration signal i get -45.81 dBVrms. Now, if i take the sensitivity, output rms voltage in dBV and the gain i get -38 dBV + (-45.81 dBVrms) - 13 dB = -94.5 dBSPL. Shouldnt dBSPL be a positive number? \$\endgroup\$
    – Tom
    Commented Nov 30, 2023 at 13:22
  • \$\begingroup\$ @Tom Excuse me for giving you the wrong equation! I should have started from basics. I have corrected it in the post. Yes, the SPL should normally be a positive number. If not, then the SPL is below hearing threshold for the "average" human. What model microphone are you using? \$\endgroup\$
    – qrk
    Commented Dec 1, 2023 at 1:28
  • \$\begingroup\$ The IMP23ABSU MEMS Microphone. If i use your new formula i get -45.81 dBVrms - 13 dB - (-38 dBV) = -20.81 dBSPL. This also seems not right. Should i add +94 dBSPL as offset? \$\endgroup\$
    – Tom
    Commented Dec 1, 2023 at 8:29
  • \$\begingroup\$ @Tom The sensitivity in the data sheet is given as -38dBV with a 94 dBSPL applied which means the sensitivity is -38 dBV re 1 Pa. The sensitivity in customary units for audio mics is -132 dBv re 20 uPa. So, yes, add 94 dB to your result. \$\endgroup\$
    – qrk
    Commented Dec 1, 2023 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.