node-midi icon indicating copy to clipboard operation
node-midi copied to clipboard

Lost contemporary MIDI message from controller

Open glitched0xff opened this issue 2 years ago • 0 comments

Hi folks Thanks for your work. I'm using midi 2.0 npm in nodejs v20.10. I'm having some trouble with this simple code. Seem like that i lost comtemporary message coming from MIDI controller. For example moving modwheel and press a note on keyboard i usually lost the noteOn if the event is in the same time. I try some different controller and the result is the same Here is the simple code bring from documentation

const midi = require('midi');

// Set up a new input.
const input = new midi.Input();

let last
// Count the available input ports.
let inputs=input.getPortCount();
console.log(inputs)
// Get the name of a specified input port.
input.getPortName(0);
for (let i = 0; i < inputs; i++) {
    let name=input.getPortName(i);
    console.log(name)
}

// Configure a callback.
input.on('message',async (deltaTime, message) => {
  if (message!=banMessage[0]){
    console.log(`m: ${message} d: ${deltaTime}`);
    last=message
  }
   
});

input.openPort(0);
input.ignoreTypes(false, false, false);

glitched0xff avatar Mar 12 '24 10:03 glitched0xff