[Physics] How to decrease the volume of a sound wave

acousticswaves

I have a sound wave in a computer, represented as a series of values (samples). Each sample is in the range roughly between -30000 and 30000.

Say I want to decrease the loudness of the entire wave by a certain value. How can I achieve that?

It sounds trivial but for some reason I can't get it to work. Is it anything more than moving each sample closer to 0 by a certain value? (E.g., the decrease value is 100, so the sample -25000 becomes -24900, etc.). Am I missing something?

Also, what about samples that their distance from 0 is less than the decrease value?

Best Answer

Multiply your values my some number less than 1.0. That will "move all the values closer to zero". But remember that the human hearing system is logarithmic, not linear. And "volume" is a psycho-physical phenomenon that is hard to quantify, and varies from person to person.

Reducing your values by a factor of two will not reduce the perceived volume by a factor of two. Rule of thumb: it takes a reduction of 6 - 10 dB in intensity to reduce perceived volume by a factor of two. 6 dB is a factor of 4, 10 dB is a factor of 10. Let's take the high end: 10 dB. To reduce the loudness by a factor of 2, you might have to multiply your values by 0.1. To reduce the loudness by a factor of 4, you might have to multiply by 0.01.

If you are not aware of these things, you might not be reducing your values nearly enough. Experiment my multiplying your values by factors in the 0.1 - 0.2 ballpark. Don't be afraid to to use much smaller values.

update after comment

Eliminating distortion: It depends on the system you use to realize your sound wave (your audio system), the nature of the sound wave (does it have a lot of sharp peaks) and your tolerance for distortion. Eliminating all distortion is impossible, as no reproduction system is perfect. You can eliminate clipping/saturation by reducing total volume, but if there is any small peak at all your volume might be very very low. Allowing a small, inaudible amount of distortion would help. Sometimes dynamic compression is used to reduce audible distortion while keeping the volume reasonably high.

Harmonic distortion occurs before the primary effects of clipping are audible. Can you tolerate that?

Reproduction systems always change the amplitude and phase of each frequency component. That's an unavoidable distortion. If you think you want to avoid that, you are sunk.

The fact that you have a digitized version of the waveform is a distortion.

We really need more context. What are you trying to do?