6
$\begingroup$

The values that one can find in a wave file, e.g.

    0.0036
    0.0026
    0.0174
    0.0050
    0.0026
    0.0108
    0.0154
   -0.0114
   -0.0006
    0.0115

are - as I assume - relative values between -1 and 1, the range you normally see when watching a waveform in some audio editing program. Now, how are these relative values mapped when you playback a file? E.g. if there is a value of 0.5, does it mean playback at half of the maximal possible loudness? Is there some kind of reference value stored in the WAVE file to which the relative values refer to?

Another thing: In the example above there are 7 positive values follow by 2 negative values. So the membran vibrating in a speaker to create the sound is pressed longer in one direction than in the other direction, or how does one has to interpret this? Positive values are one direction of the vibration and negative ones are vibrations into another direction or am I wrong about this?

Thank you very much :-)

$\endgroup$
7
$\begingroup$

What you see are time-domain samples that correspond to the displacement of a speaker from some rest position as a function of time. For example, the first sample corresponds to the membrane's position at $t=0$, the next represents its position at $t=T$, and so on, assuming that there are $T$ seconds between samples. Common sampling intervals for audio include $T = \frac{1}{8000}$ sec and $T = \frac{1}{44100}$ sec.

In order to turn a stream of samples into real audio, a digital-to-analog converter (DAC) is used first to generate a time-varying analog voltage that corresponds to the samples. This analog voltage would be applied to the input of a power amplifier that drives the speaker. The speaker is designed in such a way that the position of its membrane varies proportionally to the speaker's input voltage. At the end of this chain, then, you have a speaker membrane that moves in accordance with the original audio samples, producing the desired audio via its vibrations.

As you noted, the sample values are normalized to a range of $\pm1$. The resulting loudness of the audio can be affected by many non-digital factors, such as the gain of the amplifier driving the speaker or the DAC's output voltage range. The peak sample values $\pm1$ just correspond to "maximum membrane displacement that the hardware can generate." Therefore, there is no way to encode absolute loudness of the audio in such a stream of samples, hence the use of such a normalization scheme.

$\endgroup$
2
$\begingroup$

When you play an audio file, the device normally has some sort of volume control. So 0.5 would be relative to some max volume allowed by the current setting of that volume control.

Furthermore, the path from the samples to the speaker has a frequency response (that likely won't be flat from DC to light) which will modify the actual speaker displacement from the values of the scaled wave samples. Since the frequency response of most audio systems does not pass DC, the speaker response will likely remove any DC offset and balance out the actual physical positive and negative displacements over sufficiently long time periods.

$\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.