Several midi channels on windows

Hello and thank you for this impressive library.
I would like to use it to connect several midi channels to my DAW (Bitwig) using loopmidi. This can be done with the “session.new_midi_part…” for example:
violin = session.new_midi_part(“violin”,1,start_channel=0,num_channels=1)
piano = session.new_midi_part(“piano”,1,start_channel=1,num_channels=1)
and it woks fine on Linux.
However on Windows it works only on a single channel. When the second channel is added I get the following error message “rtmidi._rtmidi.SystemError: MidiOutWinMM::openPort: error creating Windows MM MIDI output port”.
I tried various workaround but without success.
It is suggested on the Web that it is a feature of rtmidi on Windows which limits the number of port connections to one. However in this particular case I am using a single output port. In addition I have used other Python libraries (Pyo, Isobar) and they allow connecting several midi channels to the DAW on Windows.
Do you know if there is a solution or a workaround ?
Thank you and greetings from France.

Hi @jerry400bc—great to meet you!

I think that you maybe encountered a limitation I was not aware of on Windows (I use Mac and Linux primarily, so this happens occasionally!) . The way SCAMP approaches this internally, it opens a new port connection for each MIDI part. So even though you only need to use the different channels of one connection, it’s trying to open that connection twice. This isn’t a problem I’ve on mac or linux, but I guess it is on windows!

I’m going to try fixing it in the next update in the next few days—I should be able to save and reuse the same connection—and I think it should solve the problem. I’ll keep you posted!

Tank you Marc, much appreciated

Don’t know if it may help but the error log points to line 148 of the _midi.py file, just after your comment that you prefer to ignore the call to 'del midiout".

François