loudness detector rewrite. closes #27 and #25