Closed Fannon closed 1 year ago
When you say "If I start Synthesia and then launch the script which enables WebMIDI", which script are you referring to? What is the relation between your script and Synthesia? Is Synthesia an online tool or a downloaded app that uses Node.js in the background? I'm not sure I understand your setup.
The WEBMIDI.js library does rely on the jzz
module when it is run inside Node.js. When it is run inside a browser, it relies on the Web MIDI API.
Sorry for being unclear. I was referring to a Node.js CLI script that I've started writing, which essentially tries to connect to some MIDI ports. But it never got to the point where I can even find out what input and output ports there are when Synthesia was already running.
But the code example I pasted above is the minimum code that already runs into the problem.
I've now changed my approach anyway and converted the script into a web app. That makes it much more easy to distribute and consume, anyway. In the browser, I was not running into this particular problem.
In case you're interested, here is a link to the new project: https://github.com/Fannon/linnstrument-light-guide#linnstrument-light-guide-support
Since you moved to another solution, I will close this issue. However, I'm worrying that there might indeed be an issue that needs fixing.
On Windows, only one application can use a MIDI port at once. That may be the reason. However, if it was, it shouldn't have worked when you used the jzz
module directly. Just to be sure... did you try to use the jzz
module while Synthesia was open? If so, was it working?
By the way, your project looks cool!
On Windows, only one application can use a MIDI port at once. That may be the reason. However, if it was, it shouldn't have worked when you used the
jzz
module directly. Just to be sure... did you try to use thejzz
module while Synthesia was open? If so, was it working?
Yes, that's excactly what I tried out and why I think this is a bug. It wasn't working with webmidi
on Node.js, but it's working with jzz
on Node or webmidi
on Web. It might be something weird with Synthesia, because when I started the Reaper DAW which also uses some MIDI ports it was not causing issues.
By the way, your project looks cool!
Thanks!
I am getting this error as well, but slightly differently. With the script @Fannon provides, Node v20.6.1 on Arch Linux prints:
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<DOMException>".] {
code: 'ERR_UNHANDLED_REJECTION'
}
I am not a JS expert and I was not able to troubleshoot exactly what was causing this. I have switched to using JZZ's MIDI APIs directly and they do not exhibit any issues.
Unfortunately , I do not have a way to replicate your setup or to reproduce the error.
Description If I start Synthesia and then launch the script which enables WebMIDI, I'm getting this error message right away, even before activating a certain port:
Using this script:
Environment: Specify the environment where you are witnessing the problem:
Details I have tried the
jzz
NPM library which this one seems to rely on? There I could access the MIDI ports and create a listener. So it seems to be running into a problem within the webmidi library.