Change channel
Closed this issue · 2 comments
methelas2 commented
I know it have been asked in first issue here, but apparently the person who asked it figured it out without leaving a trace of explanation.
Is there any way I can change channel to which will be NOTE_ON/NOTE_OFF msg sent?
For example: I'd like to send it to channel 10, which according to General MIDi is reserved for percussion instruments.
billthefarmer commented
The channel is encoded in the lower part of the note on and note off message. See the spec: https://www.midi.org/specifications/item/table-1-summary-of-midi-message. For example you could write yourself a noteOn()
function like this:
public boolean noteOn(int channel, int note, int volume)
{
byte noteMsg[] = new byte[3];
noteMsg[0] = (byte)(channel + 0x90);
noteMsg[1] = (byte)note;
noteMsg[2] = (byte)volume;
return midi.write(noteMsg);
}
methelas2 commented
Well thank you! Thats what I've been looking for :)