Вопрос

i am using Web Audio API's ScriptProcessor and it's onaudioprocess event for repetitive callbacks such as a metronome.

I tried using requestAnimationFrame and analyser node for audio visualisation in the same app.

It seems like the speed of which onaudioprocess event happens is being slowed down by half when trying to draw to a canvas using requestAnimationFrame or setInterval .

The question is, is it normal that other stuff can interrupt onaudioprocess speed? or am i doing something hugely wrong?

Or it is being effected by canvas drawing stuff? Because i tried using RAF and set Interval to log stuff to console and it did not effect anything.

Это было полезно?

Решение

ScriptProcessor really shouldn't be used as an event source like that. If you just want to build a metronome, I'd refer you to the HTML5Rocks article I wrote early this year - http://www.html5rocks.com/en/tutorials/audio/scheduling/.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top