CS 111 - 4/28/15
max Volume - make the sound as loud as posible without
causing clipping.
"normalization"
To do this I need to find the amplitude with the biggest
value.
Once this largest amplitude value is know, we need to
determine the multiplier that will change this value
to 32767.
Finally multiple all of the amplitude values in the sound
by this multiplier.
How do we find the largest value in a list of numbers
Assume we have the following list:
3 6 8 3 56 34 87 45 35 678 34 454 345 54 765 3
largestSoFar: 765
First set largestSoFar to the value in the first position
Then, loop thought the list of value, if the current
value from the list is greater than the largestSoFar
value, update the largestSoFar value with the current
value.
To determine the multiplier: we have the equation
maxAmpl * mult = 32767
Solve for mult:
double mult = 32767.0 / maxAmpl ;