[Csnd] trigger events from Csound WASM
| Date | 2026-10-09 18:00 |
| From | Iain Duncan |
| Subject | [Csnd] trigger events from Csound WASM |
Hi all, related question to my other. Is there any way to have the WASM csound object trigger a JS callback once per k-period? I couldn't find such a thing in either Victor or Steven's examples. Iain Duncan Interdisciplinary PhD Candidate, Computer Science & Music University of Victoria, Canada |
| Date | 2026-10-09 18:19 |
| From | Hlöðver Sigurðsson |
| Subject | Re: [Csnd] trigger events from Csound WASM |
We used to have csound.on("perform", () => ... ) that triggered on every ksmps. But it was too CPU intensive. We recently re-introduce this in a different format csound.on("debugCallback", () => { // Called once per k-period. }); await csound.enableDebugCallback(); await csound.start(); it needs to be enabled explicitly. Warning that sending events so frequently trough worker channels may be CPU intensive. I would recommend rather using SAB for this, for which I just discovered a bug (so it doesn't work with SAB atm). I'm opening a PR to fix that. But to use SAB you need to be able to control your HTTP response headers, and set them correctly for browser security reasons. On Fri, 9 Oct 2026 at 20:00, Iain Duncan <iainduncanlists@gmail.com> wrote:
|
| Date | 2026-10-09 18:52 |
| From | Iain Duncan |
| Subject | Re: [Csnd] trigger events from Csound WASM |
Ah thanks. What is SAB though? :-) iain On Fri, Oct 9, 2026 at 10:19 AM Hlöðver Sigurðsson <hlolli@gmail.com> wrote:
Iain Duncan Interdisciplinary PhD Candidate, Computer Science & Music University of Victoria, Canada |