webaudiomodules / wam-examples

MIT License
42 stars 7 forks source link

Question on sending scripted events to WAM #86

Open rhelsing opened 2 years ago

rhelsing commented 2 years ago

I’m trying to set up a web based sequencer essentially and I’m wondering how feasible it would be to send note on/note off midi type events from the sequencer to a wasm based synth? Is there a javascript accessible event api to send these signals?

owengc commented 2 years ago

Hello and thanks for your interest!

Yes, the WAM API has been designed to facilitate exactly this sort of interaction. I invite you to take a look at the WAM API and SDK repos, as well as the simple host example and sequencer example found here in wam-examples to get a sense of how these things work.

In short, if your synth is a WAM you can use your sequencer to schedule midi events from either the main thread (asynchronous, requires scheduling in advance) or directly on the audio thread (synchronous, can be scheduled 'just in time', but requires that your sequencer is itself also a WAM / AudioWorklet node). Please let us know if you have further questions.