I'm new to MIDI and started playing with an Arduino Leonardo and arcore.
Based on the example code, I can easily send noteOn/noteOff/controlChange
messages, but I can't seem to send a pitch bend message.
Having a look at this table:
0xE0 Chan 1 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xE1 Chan 2 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xE2 Chan 3 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xE3 Chan 4 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xE4 Chan 5 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xE5 Chan 6 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xE6 Chan 7 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xE7 Chan 8 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xE8 Chan 9 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xE9 Chan 10 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xEA Chan 11 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xEB Chan 12 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xEC Chan 13 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xED Chan 14 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xEE Chan 15 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
0xEF Chan 16 Pitch wheel range Pitch wheel LSB (0-127) Pitch wheel MSB (0-127)
I've tried to send a message like so:
MIDIEvent pitchwheel = {0xe0, 127,127};
MIDIUSB.write(pitchwheel);
but this didn't work and I'm not sure what I'm missing/doing wrong.
Any hints/tips will be helpful.
asked Dec 24, 2015 at 1:15
-
1Please show the working code to send a note-on message.CL.– CL.2015年12月25日 08:20:24 +00:00Commented Dec 25, 2015 at 8:20
1 Answer 1
arcore creator Ralf Kistner provided the answer:
// The pitch bend value is a 14-bit number (0-16383). 0x2000 (8192) is the default / middle value.
// First byte is the event type (0x0E = pitch bend change).
// Second byte is the event type, combined with the channel.
// Third byte is the 7 least significant bits of the value.
// Fourth byte is the 7 most significant bits of the value.
void pitchBendChange(byte channel, int value) {
byte lowValue = value & 0x7F;
byte highValue = value >> 7;
MIDIEvent event = {0x0E, 0xE0 | channel, lowValue, highValue};
MIDIUSB.write(event);
}
answered Feb 17, 2016 at 17:43