Various fixes on sound detection, smoothing and code design

* improved volume detection by Max
* smoothing of the graph (10%)
* split processAudio into smaller functions