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 )
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?