Refactor audio; add length counter

The Web Audio API might not cut it.