grame-cncm / faustide

Faust IDE (Integrated Development Environment)
https://faustide.grame.fr
Other
74 stars 23 forks source link

MIDI input not working in Faust IDE #31

Closed FineArtMaths closed 3 years ago

FineArtMaths commented 4 years ago

At https://faustide.grame.fr/, USB MIDI devices are recognised and displayed in the drop-down list in the upper right corner of the page but they do not appear to do anything. Code that responds to MIDI messages correctly in https://fausteditor.grame.fr/ does not respond to the same devices in Faust IDE.

This has been consistent behaviour for me on Windows 10 / latest Chrome with multiple MIDI devices: keyboards sending note on/off and knobby controllers sending CC messages. It has been the same for every DSP script I've tried -- my own and the built-in examples.

sletz commented 4 years ago

Do you have any error message in the console?

FineArtMaths commented 4 years ago

No errors but the following warnings:

"[Deprecation] Web MIDI will ask a permission to use even if the sysex is not specified in the MIDIOptions since around M82, around May 2020. See https://www.chromestatus.com/feature/5138066234671104 for more details."

and three copies of:

"The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu"

(It does produce audio though)

sletz commented 4 years ago

@Fr0stbyteR any idea what could be the problem?

Fr0stbyteR commented 4 years ago

If you are trying a polyphonic instrument DSP, make sure that the voices option is set to a number >= 1. Is that set correctly? I'm also using Chrome on Windows 10 where MIDI functions work fine.

Fr0stbyteR commented 4 years ago

image When you press a key (note-on message), a badge that displays current MIDI key number should show up. Do you see that happens to your IDE?

FineArtMaths commented 4 years ago

No, I don't see the badge. I do see the drop-down list with my devices. I just restarted the whole PC to make sure it wasn't some kind of Windows MIDI confusion but I still have the same problem. I've also tried a few voice number settings (currently on 8).

sletz commented 4 years ago

At https://faustide.grame.fr/, USB MIDI devices are recognised and displayed in the drop-down list in the upper right

Do you mean non-USB MIDI devices are working? Or no device at all is working?

FineArtMaths commented 4 years ago

I haven't had the opportunity to try non-USB devices. My audio interface has DIN sockets but is itself a USB device so it might be a bit academic but I can give it a try later if that might be useful.

Thanks for helping with this, I appreciate it's very tough to diagnose a problem you can't reproduce. Since it seems something is amiss with my particular environment, maybe this isn't appropriate as a bug report -- we could always take it to the mailing list if that's better.

FineArtMaths commented 4 years ago

For what it's worth, I tried this with the PC in my home studio today and everything works fine (USB keyboard --> Chrome on Win 10).

I admit I'm surprised, since the laptop is kept up to date and clean whereas the studio PC has all manner of accumulated junk and isn't updated (or even usually allowed online; this was a special treat for it).

I guess version numbers might be useful:

Working: Chrome 85.0.4183.121, Windows 10 Pro version 18362.1016. Not working: Chrome 86.0.4240.75, Windows 10 Home version 19041.572.

I imagine we should close this bug (since it's seemingly not a Faust IDE problem) and I'll have to work out what's different between the two. Unless you'd like to investigate further of course.

sletz commented 4 years ago

If is works on https://fausteditor.grame.fr/ on the same machine ? (yes ? confirmed ?), then it seems like a Faust IDE issue.

FineArtMaths commented 4 years ago

Yes indeed, fausteditor is working on my laptop whereas faustide is not. I wonder whether it's to do with the Chrome version? I don't have any extensions installed.

alycklama commented 3 years ago

I'm running into the same issue on OSX. I'm receiving MIDI messages, but the code is not reacting in any way on them.

Here's the snippet I'm using:

declare options "[midi:on][midi:start][nvoices:1]";

import ("stdfaust.lib");

gate = button("gate[midi:keyon][midi:keyoff]");
velocity = hslider("velocity[midi:key]", 1, 0, 127, 1);

process = gate * velocity * os.osc(440) <: _, _;

I tried it in Chrome 86.x.x.x and updated to the latest version 87.0.4280.67 (Official Build) (x86_64). However both are not working. I also tried Chromium and downloaded an older version to see if it works there, but that also not the case unfortunately.

Chromium: Version 85.0.4167.0 (Developer Build) (64-bit)

Any idea what could be going on here? MIDI notes in websites like midi.city are coming in fine, so I guess it must be something in faustide. I would love to test it in fausteditor, but I can't find a way to select a MIDI port.

Any help would be greatly appreciated!

sletz commented 3 years ago

I suggest you read this section: https://faustdoc.grame.fr/manual/midi/#midi-polyphony-support

alycklama commented 3 years ago

Thanks a lot @sletz! That cleared up quite a few questions I had in my mind. The problem in Chrome still occurs though. If I compile the example with faust2caqt -midi <file.dsp> it works perfectly fine. The moment I run it in the browser, there is no sound, though the MIDI messages are coming in.

image

What would be the quickest way to prototype in this case where faustide doesn't seem to process the MIDI messages?

sletz commented 3 years ago

In the Web IDE you'll have to explicitly choose a number of "Poly Voices" with more the 1 voice.

Capture d’écran 2020-11-27 à 18 44 38
alycklama commented 3 years ago

Thanks a lot! That worked perfectly! 👍

ssfrr commented 11 months ago

I just ran into this also. MIDI control worked fine in FaustEditor but not FaustIDE. For me, upping the Poly Voices did not help.

I got it working in FaustIDE by changing the DSP setting to "ScriptProcessor" instead of "AudioWorklet":

image

This is in Chrome on a Mac

sletz commented 11 months ago

Clear your cache and try again ?

ssfrr commented 11 months ago

False alarm, user error - the issue was that I didn't re-compile the code after changing the polyphony.