4

I'm working with data taken from the wav files (i.e. an array of integer values). Is it right to think of max volume of wave as the max value of the values from the wav file? I want to process these values, for example, to scale them down - I guess it will reduce the volume of entire wave. And also one point, can I consider the bit depth of the signal as 100% volume (max possible value of the amplitude)?

1 Answer 1

6

If you want to be technically accurate, a sound file does not have a volume, it has a level. Volume can only exist when there is an actual speaker producing sound as that has a fixed SPL(sound pressure level). A signal can be played back at any volume provided the speaker is able to produce it at that volume.

Instead, it is referred to as signal level when it is a data file or just level for short. You are sort of correct that the maximum level corresponds to the maximum integer, but it also corresponds to the minimum.

Sound files are made of samples. Samples indicate (roughly as there is some anti-aliasing involved) the position on the waveform at that moment in time for the signal. The integer values are generally signed, so we care about both the min and max. A loud signal will be oscillating between a very large positive value and a very large negative value. This would result in quick and large speaker movements which produce more pressure and louder sound.

You can adjust the gain of the sample by multiplying all the balanced integers by a fixed number though and it will gain appropriately assuming your wave file is using a linear scale for the samples. If not, then you will need to apply some more complicated math to deal with the non-linear scale. Some values would become smaller (larger negative value) and some will become larger (positive values).

2
  • thanks for your answer. If i understand correctly, the audio's volume will not change if we multiply all signals by a constant value? because the proportion of signals will be the exact same... am i correct? Aug 25, 2020 at 13:09
  • @AminShojaei no, the point of my answer is that the level of signal indicated is irrelevant until you actually produce a sound. You could multiply the values in the file and it would make playback be "louder" for an identically set DAC, amplifier and speaker, but you could also not alter it and double the amount of amplification with the same result potentially (depending on the noise floor of your DAC and amp). In some cases, producing a lower signal level may actually get better output from the DAC, it really all depends.
    – AJ Henderson
    Aug 26, 2020 at 19:11

Your Answer

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

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