You are here

Changing instrument with MIDI pads

Hi everyone!

For a live setup using Qsynth, my need should be as following...

I have a midi controller which sends on MIDI channel 2 the notes played on keyboard. On channel 1, it sends the "notes" coming from the pads. (this is a factory setting which I cannot change.)

I'd like Qsynth to change instrument when I press the pads. Let's take as example the FluidR3_GM soundfont: I'd like to assign a piano preset to a pad, an organ to another pad, a trumpet on a third pad... and so on. "instrument" changes should be read by Qsynth on channel 1. Channel 2 is receiving the played notes. Is there a way to do this?

thanks,
greetings
Manu

Forums: 
rncbc's picture

theoretically yes, if you can assign arbitrary Program Change messages (PC) to the pad or button on the MIDI controller you have...
but you also said that it's a factory setting which I cannot change., so probably you can't in practice ;)
more like a limitation of the MIDI controller and not one of Qsynth(fluidsynth) I'm afraid!

copyc4t's picture

Hi,

x42-midimap should be able to do it, once properly configured; discover what those "notes" exactly are with the help of tools like gmidimonitor and midisnoop, and then map them as the desired program changes to the channel you need.
Debian has it in the x42-plugins package.

Cheeers,
copyc4t

I wanted this for my Akai MPK mini. It sends Prog Changes messages only for the pads (on channel 9) and not for the keys (on channel 0). However you can remap the Prog Change messages. FluidSynth has a built-in midi router, however it is not (yet!) exposed by Qsynth. I added code to the qsynthMainForm.cpp to do the remapping:

$ git diff
diff --git a/src/qsynthMainForm.cpp b/src/qsynthMainForm.cpp
index 6e40f67..6549d98 100644
--- a/src/qsynthMainForm.cpp
+++ b/src/qsynthMainForm.cpp
@@ -2109,6 +2109,26 @@ bool qsynthMainForm::startEngine ( qsynthEngine *pEngine )
                }
        }
 
+   fluid_midi_router_clear_rules(pEngine->pMidiRouter);
+   fluid_midi_router_rule_t* rule;
+
+   // pass thru notes unmodified
+   rule = new_fluid_midi_router_rule();
+   fluid_midi_router_rule_set_chan(rule, 0, 16, 1.0, 0);
+   fluid_midi_router_rule_set_param1(rule, 0, 255, 1.0, 0);
+   fluid_midi_router_add_rule(pEngine->pMidiRouter, rule, FLUID_MIDI_ROUTER_RULE_NOTE);
+
+   rule = new_fluid_midi_router_rule();
+   fluid_midi_router_rule_set_chan(rule, 0, 16, 1.0, 0);
+   fluid_midi_router_rule_set_param1(rule, 0, 255, 1.0, 0);
+   fluid_midi_router_add_rule(pEngine->pMidiRouter, rule, FLUID_MIDI_ROUTER_RULE_CC);
+
+   // map pads (ch9) prog change over to channel 0
+   rule = new_fluid_midi_router_rule();
+   fluid_midi_router_rule_set_chan(rule, 9, 9, 0.0, 0);      /* Map all on channel 9 to 0 */
+   fluid_midi_router_rule_set_param1(rule, 0, 255, 1.0, 0);    /* Match all commands */
+   fluid_midi_router_add_rule(pEngine->pMidiRouter, rule, FLUID_MIDI_ROUTER_RULE_PROG_CHANGE);
+
        // Run the server, if requested.
        if (pSetup->bServer) {
        #ifdef CONFIG_FLUID_SERVER

Add new comment