Created
December 14, 2020 11:41
-
-
Save Nekodigi/e2ba7f5de65ab17e41a6b902d775f958 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import themidibus.*; | |
| import javax.sound.midi.MidiMessage; | |
| import javax.sound.midi.ShortMessage; | |
| MidiBus myBus; // MidiBus | |
| void setup() { | |
| MidiBus.list(); //MIDI list | |
| myBus = new MidiBus(this, 0, 4); //MIDI input,output | |
| } | |
| void midiMessage(MidiMessage message, long timestamp, String bus_name) { | |
| int note = (int)(message.getMessage()[1] & 0xFF) ; | |
| int vel = (int)(message.getMessage()[2] & 0xFF); | |
| if(message.getStatus() == ShortMessage.NOTE_ON) myBus.sendNoteOn(0, note, vel); | |
| if(message.getStatus() == ShortMessage.NOTE_OFF) myBus.sendNoteOff(0, note, vel); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment