Button to trigger MIDI note

Has anyone figured out how to make a button trigger a midi note?

of course this button can play a note

const var test = Content.getComponent("test");
var EventId = 0;

inline function ontestControl(component, value)
{
		if (value)
 	{
		Synth.playNote(1, 100);
 	}
 	else
 	{
 		Synth.noteOffByEventId(EventId);
 	}
};

Content.getComponent("test").setControlCallback(ontestControl);

but how can I also play the actual midi note? I’d like to be able to record the button presses in an empty midi file in a midi player, but that currently only records notes pressed by the keyboard, not the buttons

Thanks!

Read more here: Source link