Audio looper in pure JavaScript