multiple .wav files, different playback volumes
5 views (last 30 days)
Alice on 4 Oct 2016
I have about 250 .wav audio files which have different volumes during playback. I assume this difference is a result of moving the microphone during recordings.
Is there a way of altering the soundfile itself so that all of the files play at a similar volume.
Steven Van Vaerenbergh on 5 Oct 2016
You should normalize the sounds so they have the same overall power (per time step).
For example, normalize to power 1 (per sample):
x = audioread(filename);
x = x/sqrt(mean(x.^2));
When you play the normalized sounds through the sound(), each sound should appear to have a similar volume.
In order to avoid distortions you may normalize to a smaller power though, e.g.
x = x/sqrt(mean(x.^2))/10;
If you want something more sophisticated you may have a look at dynamic range compression, though this kind of technique will modify the waveform unrecoverably.