Hard & Soft Serial use for multiple MIDI ports.

Hi,

I was testing with the hardware- and software serial libs to implement multiple Midi ports. I'm planning on using 1 Midi in and 4 Midi out ports. Currently I have 1 Midi in and 1 Midi out working (breadboard). First ran it with the MIDI lib on the rx/tx hardware serial and tested it as midi thru, which worked fine.

But because I knew I wanted to have 4 Midi outs, I rewrote the sample to use plain serial code (no Midi lib) and used software serial to output the incoming midi bytes (tight loop: if available then read from input, write to output). That also seemed to work ok.

Then I also changed the Midi input to the software serial, so both input and output were on software serial. Now I began to notice mangled midi messages. Most of them came through ok, but producing a lot of them (pitch bend or just ramming on the keyboard) introduced errors.

So I had reached a limit here. But it made me think how would that work if I had to output to 4 Midi outputs and process the messages for each Midi output port too.

My question is: Am I missing something obvious, something to get things working faster/better?
And does anyone have experience processing and outputting midi messages to multiple output ports.

Any (other) suggestions are welcome.

Then I also changed the Midi input to the software serial, so both input and output were on software serial. Now I began to notice mangled midi messages. Most of them came through ok, but producing a lot of them (pitch bend or just ramming on the keyboard) introduced errors.

Perhaps you didn't read the documentation on SoftwareSerial. You can have multiple instances, but only one can be active at a time. The one(s) that is (are) not active will silently lose data.

There is not a good solution to your needs, involving Arduino, that I know of. Even the Mega has only 4 hardware serial ports, where you need 5.

I had only one software serial active. Used it for input and output simultaneously, just pumping its input to its own output.

So having the 4 hardware serials on the Mega would surely be (just) enough. On one I would use both input and output, the others are then just used for output only. Hardware support on these port would surely be beneficial to the latency.

I am eyeing the Mega for this project, also because my fear is I will run out of program (and probably ram) memory on the Uno (which I use now). I also saw a memory extension for a good amount of memory and understood from scanning the text, it could also be used for ram. If that is true, my troubles are over XD

The project also involves a LCD display and some keys.