Gain adjustment

Write a program which reads a sound file using the libsndfile library, and adjusts the volume. Undergraduate students adjust the volume by one half, graduate students should identify the peak volume (that sample which has the largest absolute value) and normalize the audio in the file such that the peak has an absolute value of 1.0.

Don't panic, you do not need to understand very much about audio files. This is all you need to know: audio is represented in the computer as a list of samples. A sample is a number. To change the volume you multiply each sample by a constant factor, e.g. 0.5.

Likewise, you don't need to understand everything about libsndfile. The functions you need to use are:

It's common to refer to an example when trying to use a new library. I have written an example libsndfile program which you can refer to, and you may find other examples on the web.

To compile this lab, you will need to save Makefile.gain as Makefile and name your program source file gain.c.

Yes, this final project is considerably more difficult, but you have considerably more time to work on it. Remember I am happy to let you do another appropriate project of your choosing, if you discuss it with me beforehand.