Routing different MIDI instruments to different applications

Do you typeset your scores on Linux? Share your thoughts, tips, and tricks here.

Moderators: MattKingUSA, khz

Post Reply
User avatar
Rainmak3r
Established Member
Posts: 888
Joined: Sat Mar 02, 2019 12:24 pm
Has thanked: 49 times
Been thanked: 180 times
Contact:

Routing different MIDI instruments to different applications

Post by Rainmak3r »

Hi all,

not sure if my question belongs here or to the "Recorders & Sequencers" section, since it's more MIDI related, but since it all starts from a requirement I have using Lilypond and Frescobaldi I thought I'd ask here. Please let me know if this should be moved elsewhere.

Just to give some context, as anticipated I usually write all my music in Lilypond with Frescobaldi, which I found to be quite faster than using other more visual editors. Eventually, when the bulk of the writing is done, I import the resulting MIDI file in Ardour, and then do everything else there: assigning the right instrument via a SF2/SFZ/whatever plugin, adding real recorded instruments, and so on. The reason why I don't do any MIDI editing in Ardour (apart from very minor tweaks) is that I really don't like how MIDI is handled there: this makes the process a bit of a pain, because if it turns out I have to do some major correction, this means going back to Frescobaldi, regenerate the MIDI, import again and replace the notes in the tracks I imported previously.

Which brings me to my main question. At the moment, in Frescobaldi I can only configure a single MIDI output, which I usually set to a QSynth instance with the default Fluidsynth soundfont for rendering. This is nice for a preview, but I'd like to get more done here, since most of the times the corrections I have to make are related to how different the preview is from the end result. Since what I do in Ardour is typically associate different instruments/tracks to different renderers, I'd love to do the same while writing as well, for a "better" and a bit more realistic preview. Since there's only a single MIDI output I can configure, this means I need an intermediary that can "split" the incoming MIDI messages to different recipients: e.g., send instrument A to ZynAddSubFx, instrument B and C to QSynth, instrument D to a VST, and so on. If not an intermediary, I'd be happy even with a regular MIDI player/sequencer that can configure the instrument mappings, since Lilypond generates a MIDI file anyway.

I thought this was a relatively trivial requirement, but it looks like it's not. Apparently all you can do out of the box is connecting ports in their entirety, which doesn't have the finer-grained flexibility I need in this context. Searching around on this forum and the Internet in general, I did find a couple of old applications that seem to be able to make this possible, namely midish and mididings. That said, they seem to be very low level, and from a quick glance also apparently have a very high learning curve for what seems to be a simple need (I guess I'm probably making it easier than it really is, MIDI-wise). Someone else mentioned qmidiroute as well, which does have a GUI and seems easier with its rules, but also seems limited to two output ports: either I'm missing a way to change that, or that would mean chaining more instantes in a tree topology if you have more than two instruments.

Is there really no alternative to the above for what I need to do? And if not, is there any example I can use as a reference? For instance mididings requires programming scripts in Python, a language I don't know, and I'd rather not study it just for this...

Thanks!
tavasti
Established Member
Posts: 2047
Joined: Tue Feb 16, 2016 6:56 am
Location: Kangasala, Finland
Has thanked: 369 times
Been thanked: 208 times
Contact:

Re: Routing different MIDI instruments to different applications

Post by tavasti »

Rainmak3r wrote:Someone else mentioned qmidiroute as well, which does have a GUI and seems easier with its rules, but also seems limited to two output ports:
For qmidiroute 2 ports is default, but there is command line option to select number of ports.

Linux veteran & Novice musician

Latest track: https://www.youtube.com/watch?v=ycVrgGtrBmM

User avatar
Rainmak3r
Established Member
Posts: 888
Joined: Sat Mar 02, 2019 12:24 pm
Has thanked: 49 times
Been thanked: 180 times
Contact:

Re: Routing different MIDI instruments to different applications

Post by Rainmak3r »

tavasti wrote:
Rainmak3r wrote:Someone else mentioned qmidiroute as well, which does have a GUI and seems easier with its rules, but also seems limited to two output ports:
For qmidiroute 2 ports is default, but there is command line option to select number of ports.
I knew I was missing something obvious... Thanks! I'll start tinkering with that to see if I can get somewhere.
User avatar
Rainmak3r
Established Member
Posts: 888
Joined: Sat Mar 02, 2019 12:24 pm
Has thanked: 49 times
Been thanked: 180 times
Contact:

Re: Routing different MIDI instruments to different applications

Post by Rainmak3r »

qmidiroute and its configurable number of ports was definitely what I needed! Very easy to route specific notes/program changes from a specific channel to a specific MIDI port. Thanks for the quick reply and the good help!
User avatar
noedig
Established Member
Posts: 233
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa
Has thanked: 9 times
Been thanked: 52 times

Re: Routing different MIDI instruments to different applications

Post by noedig »

You can also use Konfyt for this.
https://github.com/noedigcode/konfyt

MIDI can be input on one MIDI port, and then multiple instrument layers can be created, each using a different MIDI channel.
SF2 and SFZ instruments can be hosted directly in the app.
External synth apps can also be used by using MIDI output ports.
Post Reply