GeekFunkLabs / fluidpatcher

A performance-oriented patch interface for FluidSynth
MIT License
123 stars 15 forks source link

Midi Monitor on fluidpatcher_cli crashes when receiving sysex messages #109

Closed Omodaka9375 closed 8 months ago

Omodaka9375 commented 8 months ago

Hi!

Thank you for making Fluidpatcher I really enjoy working with it! I did notice one issue recently. I have a midi controller (nanoKey) that send System excusive messages when I switch scenes.

Example of such message - selecting first track: "System exclusive F0 42 40 00 01 36 02 00 00 4F 00 F7"

xdotool catches this but MIDI monitor from Fluidpatcher doesn't show these messages at all. I tried using the CLI version and MIDI monitor there gives an exception:

Exception ignored on calling ctypes callback function: <function Synth.__init__.<locals>.<lambda> at 0x7f81df94e0> Traceback (most recent call last): File "/home/bane/synthsynth/fluidpatcher/pfluidsynth.py", line 573, in <lambda> self.custom_router_callback = fl_eventcallback(lambda _, e: self.custom_midi_router(e)) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bane/synthsynth/fluidpatcher/pfluidsynth.py", line 648, in custom_midi_router self.midi_callback(MidiSignal(mevent)) File "/home/bane/synthsynth/fluidpatcher/__init__.py", line 464, in _midisignal_handler if self.midi_callback: self.midi_callback(sig) ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bane/synthsynth/fluidpatcher_cli.py", line 71, in sig_handler t = MSG_TYPES.index(sig.type) ^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: tuple.index(x): x not in tuple

Is it possible to catch these messages in midi monitor in CLI?

albedozero commented 8 months ago

Thanks for the catch! The crashing is now fixed by #110

The MIDI monitors in the scripts are there to help you create router rules that match the events sent by your keyboard, not as general-purpose MIDI monitors. They only show "voice" messages note, noteoff, cc, pbend, kpress, cpress, prog because those are the types that can be used in router rules, and it would be more complicated to display other types (especially sysex, which can carry arbitrary amounts of data). Sysex messages are passed along to FluidSynth (which responds to a few) even though they're not displayed in the monitors, and will be shared with other MIDI devices on your system if you connect them to your controller (e.g. with aconnect).

Is there a need to display sysex messages in the built-in MIDI monitors I'm not thinking of?

Omodaka9375 commented 8 months ago

Thank you for quick response. I was thinking of implementing MIDI learn functionality, because some MIDI controllers are outputing sysex messages for different functions and ability to catch/map those inside the Fluidpatcher would extend the usability.