FortySevenEffects / arduino_midi_library

MIDI for Arduino
MIT License
1.59k stars 255 forks source link

make sure to mention that pitch bend values need to be corrected #190

Open Pomax opened 3 years ago

Pomax commented 3 years ago

Right now the callback for pitch bend data receives the bend value as signed integer, which is not how the MIDI spec deals with them, where they are only ever positive values between 0x0000-0x3FFF with 0x2000 representing "neutral". While it is of course not possible to change the way the API works (that would break every sketch out there), it is possible to add documentation to the callbacks page to explain that if you're going to forward the event on, or write it to file, you have to add 0x2000 to the bend value and then turn it into 7-bit lsb and msb bytes. If you don't the pitch bend information will be incredibly wrong =D

image