Dropping Note Events (regression)

Low level MIDI support for Node.js
Post Reply
damon
Posts: 8
Joined: Tue Jun 05, 2018 6:58 am

Dropping Note Events (regression)

Post by damon » Tue Jun 05, 2018 11:43 am

I'm noticing missing note events with the latest versions of both jzz and web-midi-api. When more that one note-in event happens simultaneously, only one of the events is registered. This happens in the latest version of jzz and web-midi-api with Node.js.

I do not observe this behavior with web-midi-api v 1.x. I do not notice any missing events when I roll back to that version.

Damon

sema
Site Admin
Posts: 386
Joined: Mon Oct 17, 2011 7:28 pm

Re: Dropping Note Events (regression)

Post by sema » Tue Jun 05, 2018 8:40 pm

You observe this on Mac, correct?
I'll look into the issue...

damon
Posts: 8
Joined: Tue Jun 05, 2018 6:58 am

Re: Dropping Note Events (regression)

Post by damon » Wed Jun 06, 2018 7:12 am

Yes, on a Mac. When I have a chance I'll test on Rasperry Pi.

macOS 10.13.4
Node 8.11.2
jzz 0.4.9 (broken)
web-midi-api 1.4.4 (works)

Thanks for your help!

damon
Posts: 8
Joined: Tue Jun 05, 2018 6:58 am

Re: Dropping Note Events (regression)

Post by damon » Thu Aug 16, 2018 7:54 am

Has there been any movement on this? I'm still seeing the behavior in the latest version.

sema
Site Admin
Posts: 386
Joined: Mon Oct 17, 2011 7:28 pm

Re: Dropping Note Events (regression)

Post by sema » Thu Aug 16, 2018 8:51 am

I think I know what was the problem. Hopefully it will be fixed in the next release.

damon
Posts: 8
Joined: Tue Jun 05, 2018 6:58 am

Re: Dropping Note Events (regression)

Post by damon » Fri Nov 09, 2018 3:24 pm

I still experience this issue in 0.6.1. Let me know if there's anything I can do to help troubleshoot.

macOS 10.13.6
Node 10.13.0

sema
Site Admin
Posts: 386
Joined: Mon Oct 17, 2011 7:28 pm

Re: Dropping Note Events (regression)

Post by sema » Sun Nov 11, 2018 1:54 pm

Well, I'll meed another look into it then. Apparently, the problem I fixed was not the one you observed.
If you give me instructions how to reproduce the problem, that would be really helpful.

damon
Posts: 8
Joined: Tue Jun 05, 2018 6:58 am

Re: Dropping Note Events (regression)

Post by damon » Mon Nov 12, 2018 8:07 am

I find that simply sending two or more notes events at the same time will result in at least one of them being dropped a significant majority of the time. I'm not sure exactly what the definition of "at the same time" is, but it is easy to reproduce by playing a chord on a MIDI keyboard. I do think it's possible that there has been some small improvement in recent updates. That is, when I first encountered this it was 100% consistent while now I will occasionally see all events reported, though rarely. Thanks for your attention to this.

sema
Site Admin
Posts: 386
Joined: Mon Oct 17, 2011 7:28 pm

Re: Dropping Note Events (regression)

Post by sema » Sat Nov 24, 2018 9:19 pm

Here is my test script. It generates several simultaneous messages and receives all of them.
Seems to work on my Mac.

Code: Select all

// test.js
var jazz = require('jazz-midi');
var test = require('midi-test');
var midi = new jazz.MIDI();

var port = new test.MidiSrc('VIRTUAL MIDI-In');
port.connect();

console.log(jazz.MidiInList());
midi.MidiInOpen('VIRTUAL MIDI-In', function(t, msg) {
  console.log(msg);
});

setTimeout(function() {
  console.log('Sending MIDI...');
  port.emit([0x90, 0x40, 0x7f]);
  port.emit([0x90, 0x44, 0x7f]);
  port.emit([0x90, 0x47, 0x7f]);
  setTimeout(function() {
    midi.MidiInClose();
    console.log('done!');
  }, 100);
}, 100);
run:
npm install jazz-midi
npm install midi-test
node test.js

Do you observe the problem in Node.js or in browser?

damon
Posts: 8
Joined: Tue Jun 05, 2018 6:58 am

Re: Dropping Note Events (regression)

Post by damon » Tue Nov 27, 2018 9:53 pm

I am only using JZZ in Node.

The script you posted works, and I haven't seen the problem with virtual ports (but the only other virtual source I've tested is Max). The problem is happening with actual MIDI hardware. Upon further testing, I find it's only on some MIDI hardware.

I think this log output using your script, but with the MIDI coming from external gear, may shed a little light on what's going:
[ 144, 63, 127 ]
[ 144, 60, 127 ]
[ 128, 60, 64, 128, 63, 64 ]
[ 144, 67, 127, 144, 70, 127 ]
[ 128, 67, 64, 128, 70, 64 ]
...
[ 144, 67, 127, 144, 68, 127 ]
[ 144, 60, 127, 144, 62, 127, 144, 63, 127, 144, 65, 127 ]
[ 128, 68, 64 ]
[ 128, 63, 64, 128, 65, 64 ]
[ 128, 67, 64 ]
[ 128, 60, 64 ]
[ 128, 62, 64 ]
I this example, you can see the first two note-ons came separately, but the following note-offs came jumbled up in one message. The second two note-ons and offs also were each sent together (respectively). Then I played six notes at once and it all came and went in kinda random clumps...

I only have a couple of MIDI devices to test this with so I can't speculate on how widespread this is. The offending instrument demonstrated above is the Korg nanoKontrol (the old one, not the current one). I haven't noticed this behavior in other contexts. It also doesn't happen in the old web-midi-api 1.x.

sema
Site Admin
Posts: 386
Joined: Mon Oct 17, 2011 7:28 pm

Re: Dropping Note Events (regression)

Post by sema » Wed Nov 28, 2018 9:29 am

Thank you for the data! That was very helpful!
Now I can fix it in the nearest future :)

damon
Posts: 8
Joined: Tue Jun 05, 2018 6:58 am

Re: Dropping Note Events (regression)

Post by damon » Wed Nov 28, 2018 6:55 pm

Great! Thanks for your help on this.

sema
Site Admin
Posts: 386
Joined: Mon Oct 17, 2011 7:28 pm

Re: Dropping Note Events (regression)

Post by sema » Mon Dec 10, 2018 9:39 pm

I have rebuilt the Mac binaries.
Please try the new v1.6.7 from https://www.npmjs.com/package/jazz-midi

I hope I've fixed it this time :)

Post Reply