grimmdude / MidiPlayerJS

♬ MIDI parser & player engine for browser or Node. As a parser converts MIDI events into JSON. Works well with single or multitrack MIDI files.
https://grimmdude.com/MidiPlayerJS/
MIT License
357 stars 52 forks source link

[bug] Pitch Bend message has no value #65

Closed skabbit closed 3 years ago

skabbit commented 4 years ago

The value of Pitch Bend event is not set.

Here is the code from src/track.js:

} else if (this.lastStatus <= 0xef) {
              // Pitch Bend
              eventJson.name = 'Pitch Bend';
              eventJson.channel = this.lastStatus - 0xe0 + 1;
              this.pointer += deltaByteCount + 2;
            } else {

According to MIDI protocol there is two bytes (MSB and LSB) for pitch bend value, but most of the software/devices ignore LSB, so this bug is easy solved by line like: eventJson.value = this.data[eventStartIndex + 2]