Is it possible to use the Analyser
node in the offlineAudioContext
to do frequency analysis?
I found out that ScriptProcessor
The analyser isn't really intended to be used in the offlineContext; in fact, it was originally named "RealtimeAnalyser". But even more importantly, right now you won't get consistent functionality from script processors in offline contexts, either.
An alternative is to use the suspend
and resume
methods available for an OfflineAudioContext
. After suspending, you can use your analyser node to get the desired time and/or frequency domain data. Since the context is stopped, this works just fine. If you're going to do this several times, you'll need to schedule a stop for the next time before resuming.
Unfortunately, AFAIK, only Chrome has implemented suspend
for an OfflineAudioContext