Had a quick look at the code and tried to generate a couple of SVG waveforms. Nice!
Using max peaks can give a pretty flat overall picture when there is a lot of clipping (as is the case for quite a lot of our recordings I suspect). Audacity shows (see image) both Max (dark blue and big values) and RMS (light blue overlay; smaller values and no clipping).

Maybe consider using RMS (Root Mean Square) statistic?
See: Wikipedia: Root Mean Square
See example implementations: Rosetta Code: Averages/Root mean square