I am trying to create a Web Audio script processor in Dart. I noticed this question that shows using a "javascriptnode":ScriptProcessorNode
This doesn't seem to be present in the current Dart build. Does anyone have an example of how to use it. I am trying to create a BitCrusher processor.
It seems the latest api doesn't have the "onAudioProcess" method and I am guessing I should be using the "addEventListener" method but I don't know what the message type should be. I even tried the "setEventListener" method but I still don't get events.
_script = _context.createScriptProcessor(2048, 1, 1);
_script.addEventListener("message", _onProcess);
_script.setEventListener(_onProcess); //<--- this doesn't work either.
void _onProcess(Event e) { //<---- This is never called
// Perform bit crush algorithm
}
In the mean time (i.e. assuming that soon you could use directly _script.onAudioProcess) you can use the following stub
and use it like this