Simple button with noteOffByEventId
-
Hi! I want to make a simple button to trigger a note (on/off). noteOff works fine, but is depreciated. I read the other posts about artificial notes and noteOffByEventId, but I still couldn't figure out how to solve this simple script.
const var btnPlay = Content.getComponent("btnPlay"); inline function onbtnPlayControl(component, value) { if (value) { Synth.playNote(40, 100); } else { Synth.noteOffByEventId(); } }; Content.getComponent("btnPlay").setControlCallback(onbtnPlayControl);
-
Synth.playNote()
returns an event ID, so you can store that in a variable and use it in the note off function.You might enjoy this video:
https://youtu.be/5PmEgPVsGvA -
@d-healey Thanks! I love your videos :)