Assigning a key to the midi player
-
Is it possible to assign a key (lets say c5) to the keyboard so when you press that key it plays the midi pattern in the midi player?
-
Call this in your onNote on callback (and give it the timestamp from
Message.getTimestamp()
for sample accurate playback). -
@Christoph-Hart I keep getting this message:
Illegal operation in audio thread: String creation -
This post is deleted! -
@BWSounds said in Assigning a key to the midi player:
Is it possible to assign a key (lets say c5) to the keyboard so when you press that key it plays the midi pattern in the midi player?
Still stuck on this!..ive tried,tried & tried, but still no luck.
-
@BWSounds declare the midiPlayer as this:
"Create typed MIDI.....
you'll get this reference:const var MIDIPlayer1 = Synth.getMidiPlayer("MIDI Player1");
in the NoteOn Callback:
function onNoteOn() { if(Message.getNoteNumber() == 84) { var timeStamp = Message.getTimestamp(); MIDIPlayer1.play(timeStamp); Message.ignoreEvent(true); } }
I have the
Message.ignoreEvent(true);
so that the pressed key doesn't sound as well
-
@ulrik Thank you! I guess I was over complicating things.