I'm musician and using a music software which provides a plugin in which I can use some javascript code to edit or create MIDI Data in Real Time. I want to implement a logic that increases the value of the Modulation Wheel when a specific button or note on the Keyboard is pressed. My problem is that I have no skills in Javascript programming and I don't know how to start. Can somebody help me with some tipps that will push me in the right direction?
function HandleMIDI(event) {
//How to check if the key which was pressed is a specific note like "A2" ?
//How to check if the key which was pressed is a specific button on the Keyboard ?
if (event instanceof Note) {
//How to overwrite the current value of the Mod Wheel ?
event.send();
}
}
Thanks in advance for your support!
After a lot of research and trying, I found this solution
function HandleMIDI(event)
{
if(event instanceof NoteOn && event.pitch == 84)
{
var modWheel = new ControlChange();
modWheel.channel=5;
modWheel.number=1;
modWheel.value=20;
modWheel.send();
modWheel.trace();
}
else
{
event.send();
}
}