MIDI Input: Can I input to multiple channels?

Having trouble with LMMS? Ask about it here.
Yesterday I was thinking about a possible workaround to the CPU peak of having multiple Carla tracks on LMMS:

Imagine you have 3 different tracks. Each track is supposed to use a different synthesizer (or the same synthesizer but a different patch) inside Carla. Usually we would load Carla on each one of them and set up the synthesizers individually on each Carla instance. Instead of doing that, I thought about routing the MIDI output of those tracks, each on a different channel, to a single track that would load Carla, and then inside Carla route each channel to its synthesizer. I thought this could ease the CPU load because instead of loading Carla 3 times and the synthesizer 3 times, we would be loading Carla once and the synthesizer 3 times. It would look something like this:

Inside LMMS:
Image

On Carla's Patchbay:
Image

Trying to put it to practice though, I faced a problem. Even when I choose different channels on the MIDI output of each track, when I route them to an MIDI input of the Carla track they all end up being loaded on the same channel.

When I routed each track to an external MIDI monitor, I saw that the output actually had the different channels on the MIDI messages. But when a LMMS track enables MIDI input for them, seems like the channels are lost and are all converted to a single channel (either 1 or the channel selected on the MIDI Input settings of the track).

So my question is, does LMMS support MIDI Input with multiple channels? Or does it always get rid of the channel information and add all routed MIDI messages to a single channel?

Thanks in advance!
IanCaio wrote:
Tue Apr 21, 2020 12:53 pm
when a LMMS track enables MIDI input for them, seems like the channels are lost and are all converted to a single channel (either 1 or the channel selected on the MIDI Input settings of the track).
I have seen that too
So my question is, does LMMS support MIDI Input with multiple channels? Or does it always get rid of the channel information and add all routed MIDI messages to a single channel?
Now.. I do not have Carla, so i am not knowledgable in its inner functions, but i will try
First a question:
If you in Carla load a synth, Can Carla then route a midi-out from that synth?
musikbear wrote:
IanCaio wrote:
Tue Apr 21, 2020 12:53 pm
when a LMMS track enables MIDI input for them, seems like the channels are lost and are all converted to a single channel (either 1 or the channel selected on the MIDI Input settings of the track).
I have seen that too
So my question is, does LMMS support MIDI Input with multiple channels? Or does it always get rid of the channel information and add all routed MIDI messages to a single channel?
Now.. I do not have Carla, so i am not knowledgable in its inner functions, but i will try
First a question:
If you in Carla load a synth, Can Carla then route a midi-out from that synth?
Thanks! I was wondering if it was intentional or a bug, maybe I should post it as an issue on the Github page then? I wish I had experience with C++ and Qt so I could be of more help digging into this. I'll be looking at the source files anyways, searching for something odd and post if I find anything!
musikbear wrote:
Tue Apr 21, 2020 2:07 pm
Now.. I do not have Carla, so i am not knowledgable in its inner functions, but i will try
First a question:
If you in Carla load a synth, Can Carla then route a midi-out from that synth?
Man, I'm really sorry, I must have missed the question when I read your reply earlier and didn't answer it.

I have only been able to route MIDI out of Carla by using it's standalone version, I don't think it's possible (that I know of) to do it using the Carla Plugin/Instrument Track built-in LMMS because it required accessing Carla's patchbay external canvas. On the external canvas you can control the external source of MIDI messages to Carla and the external destination of the MIDI messages sent by Carla.
That external canvas isn't available on the plugin mode, so I think the MIDI messages are lost when you route them to Carla's output inside LMMS. It would be really helpful for debugging if it could be done :(

I just opened an issue as a feature request on the github page by the way: https://github.com/LMMS/lmms/issues/5462
IanCaio wrote:
Wed Apr 22, 2020 12:44 am
musikbear wrote:
Tue Apr 21, 2020 2:07 pm
Now.. I do not have Carla, so i am not knowledgable in its inner functions, but i will try
First a question:
If you in Carla load a synth, Can Carla then route a midi-out from that synth?
Man, I'm really sorry, I must have missed the question when I read your reply earlier and didn't answer it.

I have only been able to route MIDI out of Carla by using it's standalone version, I don't think it's possible (that I know of) to do it using the Carla Plugin/Instrument Track built-in LMMS because it required accessing Carla's patchbay external canvas. On the external canvas you can control the external source of MIDI messages to Carla and the external destination of the MIDI messages sent by Carla.
That external canvas isn't available on the plugin mode, so I think the MIDI messages are lost when you route them to Carla's output inside LMMS. It would be really helpful for debugging if it could be done :(

I just opened an issue as a feature request on the github page by the way: https://github.com/LMMS/lmms/issues/5462
If the individual synths in Carla-rack cant be routed separately, then i cant see any solution for this.
If it was possible to route each one out to own midi-channel, then dummy instruments, like SF2 without a patch, could be middlelayer, and each of those could have own Mixer-bus
But if Carla cant do that- Its a no go :|
musikbear wrote: If the individual synths in Carla-rack cant be routed separately, then i cant see any solution for this.
If it was possible to route each one out to own midi-channel, then dummy instruments, like SF2 without a patch, could be middlelayer, and each of those could have own Mixer-bus
But if Carla cant do that- Its a no go :|
But it isn't necessary, unless you need to use different FX channels or apply separate LMMS effects for each synth. If you can work on the levels and effects internally, you can just have 2 synths, route one channel for the first and the other channel to the second, and route the audio of both to the Audio Output. As in the example picture from the previous post.

And that's just one of the possibilities, another very interesting thing that could be done with the different channels is automating Carla parameters (something that is currently not natively supported). One track would have the progression and the other could have notes representing the parameter values. Inside Carla you set it up to interpret each one appropriately. It's an enhancement that doesn't take no functionality out, but that could bring some possibilities :D

I'm researching the source code, to see if I can figure something out. I've some clues so far, just need to set up my dev environment so I can start testing for real.
IanCaio wrote:
Wed Apr 22, 2020 9:01 pm
I'm researching the source code, to see if I can figure something out. I've some clues so far, just need to set up my dev environment so I can start testing for real.
That sounds really good!
I feel a bit of Image Towards Linux, and definitively toward Carla :)
Just an update:

The behavior is intentional on the code base. Currently the midi events are forwarded to the instrument plugin using the midi output channel selected (even if midi output is disabled). Also, when forwarding midi to another track enabling midi output, the selected channel will act as a filter and only the midi events with that particular midi channel will be forwarded.

I made changes to the code to allow forwarding midi events with their original channels and make things like what I was attempting on that topic possible and submitted them as a Pull Request (https://github.com/LMMS/lmms/pull/5470). There are more details on the functionality on the PR description.