Handle beat analysis using scriptprocessor onaudioprocess event instead of using a setinterval