This project has moved. For the latest updates, please go here.

Amplify/Normalize a wave file.

Jan 30, 2013 at 4:59 PM

Is there a way amplify/normalize a wave file?

I need to raise the volume of files!

Hope you can help me



Jan 31, 2013 at 7:38 AM
Try the AudioFileReader, which will give you IEEE float as an ISampleProvider. This will allow you to easily examine the value of each sample as it comes through. You amplify by multiplying each sample by a value > 1. AudioFileReader has a Volume property that will do this for you.

To write back to a wav file, you'd use a SampleToWaveProvider16 to get back to 16 bit (and will clip if necessary), then pass that into WaveFileWriter.CreateWaveFile.

Normalizing, is the process of amplifying by the largest amount possible without actually clipping. It isn't actually a particularly useful feature as a single sample close to the maximum value means that you can't amplify the volume at all. It is much better to use dynamic range compression, which is a more complex algorithm. I've got an example in SimpleCompressor class, but it needs a bit of work to be easily inserted into the signal chain at this point.