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

Raspberry Pi: TypeError: this.instruments.includes is not a function #22

Closed qbalsdon closed 6 years ago

qbalsdon commented 6 years ago

Hi there. I am trying to run this on a Raspberry Pi, and no matter what Midi file I play or when, I get the error below. I am just trying to do your example code at this point.

.../node_modules/midi-player-js/module/midiplayer.js:294 if (!this.instruments.includes(event.value)) { ^

TypeError: this.instruments.includes is not a function at Player. (.../node_modules/midi-player-js/module/midiplayer.js:294:31) at Array.forEach (native) at Player.playLoop (.../node_modules/midi-player-js/module/midiplayer.js:279:17) at Player.dryRun (.../node_modules/midi-player-js/module/midiplayer.js:451:10) at Player.fileLoaded (.../node_modules/midi-player-js/module/midiplayer.js:171:82) at Player.loadFile (.../node_modules/midi-player-js/module/midiplayer.js:111:16) at playMidiFile (.../server.js:53:12) at Object. (.../server.js:15:1) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10)

Running npm i --save midi-player-js@2.0.1 does "fix" the issue but all this means is the latest version breaks something.

grimmdude commented 6 years ago

Hi @qbalsdon,

Thanks for sending. I'm not able to replicate this with the MIDI files I'm testing with. Could you post one of the files you're using so I can further debug? Thanks,

-Garrett