Issue capturing control change messages
crstffr opened this issue · 30 comments
Hello,
First off I want to thank you for your hard work with this library. It has been very easy to use so far and I appreciate the work you've put into the docs. I've stumbled across a problem and I'm not sure if it's my doing, or if there's something missing.
I am using JZZ
in NodeJS and am able to capture Midi messages using the JZZ.Widget
class connected to an external Midi hardware interface. All of the Note On
, Note Off
, Timing Clock
, Start
and Stop
messages are captured and logged to my console without a problem.
const input = await JZZ().openMidiIn(0);
input.connect(JZZ.Widget({
_receive: function(msg) {
console.log(msg.toString());
}
});
The problem is when I move knobs or faders on my Midi keyboard. Only a single message is captured for all of the control change messages. For example, here I pressed a few keys and then moved a few different knobs and faders. Notice there's only a single event logged, even though I interacted with multiple CC controls.
96 24 5a -- Note On
86 24 40 -- Note Off
96 25 60 -- Note On
86 25 59 -- Note Off
96 26 55 -- Note On
86 26 4d -- Note Off
96 27 4c -- Note On
86 27 54 -- Note Off
96 28 49 -- Note On
86 28 54 -- Note Off
b1 49 3f -- Sound Controller 4
I would expect to see a large number of messages with multiple CC param and values changing.
I am using Node v12.16.1
. This is the info I get from JZZ().info()
:
{
name: 'JZZ.js',
ver: '1.0.3',
version: '1.5.2',
inputs: [...truncated...],
outputs: [...truncated...],
engine: 'node',
sysex: true
}
Please let me know if there's some configuration I'm missing, or if there are any more details I can provide you to help troubleshoot.
Best,
Chris
Which operation system are you using?
Try to output msg
instead of msg.toString()
- that might give more information on what's going on.
Thanks for the quick response! I am using Linux Mint 19.3.
When I log out msg
I still only get a single message instead of a stream of messages.
MIDI {
'0': 177,
'1': 73,
'2': 0,
_from: [
_R {
_orig: [Circular],
_ready: true,
_queue: [],
_log: [],
_handles: [],
_outs: [Array],
_bad: false,
_impl: [Object],
_info: [Object],
_close: [Function]
}
],
length: 3
}
Thank you for the data!
I suspected to see multiple messages stuck in the same array, but that is not the case.
Do you see more controller messages when you use different software?
Yes, using a Midi monitor application I do see a stream of Control Change messages from the keyboard.
Needs an investigation...
I have noticed that I get the same sort of behavior from Mod Wheel, Pitch Control, and actually just playing multiple notes at once. Perhaps the queue is not working properly?
Is there any more information I can provide to help with this?
That is a good hint. Thanks!
I'll need to inspect the code.
I just discovered a similar issue while using a different Midi library that was solved by disabling "Running Status". Is this something that is possible with your library?
Thanks for the info!
I don't think I did anything related to the running status in my code.
How was it "disabled"?
Here's a link to the documentation for the Midi Stream Encoder that I am using with Node Midi, the config option is useRunningStatus
.
https://www.npmjs.com/package/@lachenmayer/midi-messages#encodestream
It links to this document: http://midi.teragonaudio.com/tech/midispec/run.htm
If I understand correctly, "Running Status" attempts to save bandwidth by omitting the "status byte" from concurrent messages of the same type. Which is exactly what is happening with my issue in JZZ - subsequent messages of the same type are not being registered.
Have you been able to test this locally? Do you not experience the same issue?
Hi guys, just to chime in, I'm having a similar - possibly the same - issue on Arch Linux, I can't seem to get all MIDI messages when playing cords and such, just the first key press registers.
I have also ran a simple test on a Windows machine and it apparently works fine there.
If there's anything I can help with please let me know, I'd love to get to use this library, as it seems really awesome!
Thank you very much for all your work!
Does the musical instrument itself send the messages with running status?
None of the instruments I owned did.
I have posted a question at MIDI.org, let's see if we get some helpful info...
https://www.midi.org/forum/5262-running-status
Is there a way to turn Running Status on/off on your device or driver?
How about we try and reproduce the issue on something like VMPK? That way we can set aside any hardware differences and have the same setup.
Does VMPK have a RS on/off switch? If so that would be very nice to try...
Can you guys by any chance direct your MIDI messages to https://github.com/jazz-soft/midi-test ?
Hmm, this is interesting, all messages appear fine inside midi-test.
I hooked up VMPK output to both the midi-test and on electron sample (in which I only added a console.log inside the animate function) and here's how it looks:
So when I'm pressing 3 keys in midi-test I get 3 messages, but in electron sample only 1.
@crstffr Looking at the above, could you please confirm you're having the same problem?
@robb4 I'm not exactly sure what you're asking of me. I see your gif, but not sure what it is you are showing exactly. Are you playing multiple notes via a Midi keyboard, or through VMPK, or through the Sample JZZ Midi Project
? What is the Sample JZZ Midi Project
? Is that your application?
@jazz-soft What exactly do you mean by this:
Can you guys by any chance direct your MIDI messages to https://github.com/jazz-soft/midi-test ?
midi-test must be able to report MIDI messages that are incomplete or depend on running status.
I want to find out if the problem is related to running status or something different.
@crstffr Sure, I can give you a rundown of what's happening in that gif:
- on the left side it's just the output of
aconnect -l
so you can see all the midi ports and how they are connected - on the middle bottom there's VMPK, on the top is the
midi-test
application @jazz-soft requested to connect to - on the right side I have open a sample application by jazz-soft, I thought it would showcase the issue best, you can consider that to be any client / application using the JZZ library
The VMPK output is connected to both midi-test and the sample.
I'm playing 3 keys simultaneously and then sequentially through VPMK - when playing them at the same time I get 3 messages in midi-test
and only one in the client, when playing them one after each other it's all fine.
Thanks a lot for everyone who participated!
It seems like I found the problem.
A new release of jazz-midi will be published at NPM shortly.
I have posted a fixed version of jazz-midi at https://www.npmjs.com/package/jazz-midi
Please give it a try.
Thanks again!
@jazz-soft Thank you very much, my particular issue seems fixed in version 1.7.3!
I have not tried the control change messages though, only multiple key presses, I'll leave that to @crstffr to confirm as fixed :)
Just as a curiosity, what was the issue? Was it related to the running status?
Again, thank you and I hope my input was of use :D
There was a couple of bugs in the Linux implementation.
Kind of related to the running status:
ALSA MIDI decoder produces running status messages even if it receives normal messages from the instrument.
That was very surprising to discover...
While working on this issue, also fixed a bug in https://github.com/jazz-soft/midi-test
So this ticket was really helpful!
JZZ v1.0.7 is released at https://www.npmjs.com/package/jzz
If there are no objections, I'm closing this ticket.
hi! i still have this issue, i'm using jzz
1.0.9.
i have the original issue, only the first cc message comes through. if i send any cc message then no other cc messages will get through until i send a note message.
i'm using linux.
it works as expected with chrome's webmidi implmentation, but i want to build this in firefox.
thank you very much for this library!
Are you using the latest jazz-midi / jazz plugin ?
@jazz-soft i'm using the download from here: https://jazz-soft.net/download/Jazz-Plugin/, i downloaded it fresh just a few days ago
and i have the addon from here: https://addons.mozilla.org/en-US/firefox/addon/jazz-midi/ fully up to date