Define "peaks".
The example given try to sample the wave and detect the highest point of a wave. But when you say "peak" in relation to sound, I'm thinking "volume" or "decibels". The peak of an input wave is not necessarily the same, or is it?
Anyway, for peak detection where you don't care about the rest of the data I'd use a different approach.
Set the ADC in free running mode where it just does conversions as fast as it can, and have it trigger an interrupt every time a conversion is complete.
Have the ISR read the ADC register, and see if the value in this register is higher than the previous recorded value. If so, record that as new value. This way you record the peak value (and only the peak value - the rest of the wave is discarded).
Then after a certain time has passed you can record this peak value into another array and reset it to zero, to start measuring the next peak. If you like you can set up a timer interrupt for this, and it is basically running in the background.