1
$\begingroup$

What would be a decent formula for approximating the connection between voltage and decibel output for a typical set of unpowered in-ear headphones?

I'm generating sine waves from the computer: an array of floats between -1.0 and +1.0 gets sent out through the speaker:

X_out = h * sin( f * 2π * t ); // h is the amplitude

Let's say we assume the user to ramp up their volume so that h=1 corresponds to a loud but comfortable listening level. So:

h=1 ~ dB_out=80dB

Now, how can I mathematically connect h and dB_out?

I've read that:

v_out ~ h

Somewhere I have seen the formula:

SPL = 20 * Log10( v_out / v_ref )

So, rearranging:

v_out = v_ref * 10 ^ ( SPL / 20 )
k * h = v_ref * 10 ^ ( SPL / 20 )
h = k' * 10 ^ (SPL / 20 )
  = A * exp( SPL ) + B,  for suitable A, B

Is this working valid?

Here is the alternative formulation of the question:

Given a frequency f, and a desired decibel level,  what h do I need to generate that decibel level?
$\endgroup$
5
$\begingroup$

That depends to a very large degree on the type & sensitivity on the headset, the gain of the amplifier and the frequency. I don't think there is a reasonable rule of thumb, this will be all over the place.

$\endgroup$
5
$\begingroup$

Without an artificial ear and calibrated SPL meter your not going to obtain a valid measurement (even then the SPL will vary per earphone fitting). With earphones and a multimeter, you can only really ballpark the measurement e.g. output a full scale tone, and measure the voltage at the terminals (should be OK to do this by parallel output of the playback device e.g. jack splitter, one socket for phones, the other for multimeter). Then use the phone sensitivity (find spec) to approximate the SPL. You know then that if you vary the digital gain by x dB (from the reference measurement, here full scale), the voltage variation to the phones should be proportional (if all things in your chain are linear) and so should be the SPL. You can go a step further by trying to obtain (or have measured) the transfer function of the phones, and use the magnitude response to estimate the SPL as a function of frequency/design a digital filter with this response and use that to estimate the SPL of a complex signal. This is not an accurate methodology though.

Adding to your updated post, here's some Python code to do what you want (note you should not exceed full scale):

import numpy as np
amp_cal = 1
fs = 32e3
f = 1e3
signal = amp_cal*np.sin(2*np.pi*f*np.arange(fs)/fs)
rms = 10*np.log10(np.mean(signal**2))

SPL_cal = 80
SPL_desired = 60
dif = SPL_desired-SPL_cal
gain = 10**(dif/20.0)
signal2 = signal * gain
rms2 = 10*np.log10(np.mean(signal2**2))
print rms, rms2
$\endgroup$
  • 1
    $\begingroup$ 'rms = 10*np.log10(np.mean(signal**2))' <-- RMS of a sine wave amplitude A is A / Sqrt(2), isn't it? Could you explain this line? I don't quite get it... $\endgroup$ – P i Jun 6 '13 at 9:12
  • $\begingroup$ Sure: 20*log10(root_mean_square) = 10*log10(mean_square), because of the logarithm power rule: mathwords.com/l/logarithm_rules.htm $\endgroup$ – Dom Jun 7 '13 at 10:57
1
$\begingroup$

Here, the point is that, the power of the two sine waves with different frequencies but with same amplitudes will give the same signal power. However, human ear have different sensitivities to different frequencies and when tuning your decibel level, you may need to take this into consideration.enter image description here

Transfer function between voltage and decibel output for in-ear headphones

$\endgroup$
1
$\begingroup$

SPL = 20 * Log10( v_out / v_ref )

Nope. That's still a voltage measurement, but in dBV or dBu (depending on what v_ref is), not a sound pressure measurement in dB SPL. To convert voltage to sound pressure, you need to know the sensitivity of your transducer. Typically this is specified in dB SPL/mW, so you also need to convert from voltage to watts, which requires you to know the impedance.

For example:

  • 2 Vrms into 32 ohm → V^2/R = 125 mW
  • Headphone sensitivity of 100 dB/mW
  • So dB SPL for 2 Vrms is 100 + 10*log10(125 mW/1 mW) = 121 dB SPL
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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