Connecting Arduino Hardware and a Software- serial output together for midi out?

Hi I have made an Arduino Midi musical instrument, using both a Hardware and a Software- serial output to play two Wav samples boards. This was done so that I can send different pitch bend commands for each boards.
I have also incorporated a USB midi socket out, from the arduino`s hardware-serial tx, (using usb Midi moco). This I use with midi editing software. Unfortunately this arrangement only gives me one set of midi notes.

My question is would it be possible to safely connect both the hardware and software-serial outputs together at the output socket, (perhaps using diodes, Op-amp, or opto-isolator) without the signals conflicting with each other?

I'm not a MIDI expert, and I'm not following that exactly... Do you want one MIDI controller and two MIDI instruments? Or two controllers and one instrument?

The original serial MIDI was designed so you could daisy-chain multiple instruments and use one controller to address each instrument.

There's sort-of a general electronics rule that you can't connect to or more outputs together* but you generally can connect two or more inputs together.

If you want to quickly switch between outputs (two controllers into one instrument) you can use a [u]multiplexer[/u]. (The analog inputs on the Arduino ATmega chip are multiplexed into one analog-to-digital converter.)

  • There is something called an open-collector or wired-or connection that does allow 'safe' connection of multiple outputs, but you still have to be careful to use only one output at a time so the data doesn't conflict.

I don't think that is going to work. You probably need to fix it in software.

But for a better answer perhaps we need to know rather more about your set up. What is "usb MIDI moco"? What WAV players are you using that accept pitch bend commands and how exactly are they driven? Do you send MIDI Note On/Off and CC commands to them or what?

What I was thinking was if your WAV players can be set to respond to different MIDI channels it would perhaps be easier just to send all notes on both serial outputs but using separate MIDI channels. That way whatever you are using for editing will see the complete MIDI output.


My musical instrument uses an Arduino uno midi sketch for the control of The “Robertsonics/SparkFun WAV Trigger”. The WAV Trigger supports the MIDI protocol on its serial control port, enabling low-latency, 14-stereo voice poly-phony for creating a basic musical instrument sampler.
The WAV Trigger responds to a small range of midi commands, such as Real-time playback rate control and MIDI Pitch Bend, volume, 16 channels and velocity. (Yes you do send MIDI Note On/Off and CC commands to them)
My instrument has a keyboard that has vibrato implemented for the notes. But also I have other notes that must not be affected by the keyed vibrato notes.
As the Wav player uses Real-time playback rate control to control pitch bend i.e. if I send a midi pitch bend message all playing notes will be affected, The sketch I have written controls the two WAV Trigger boards, with software serial for non vibrato notes and the other using hardware serial for the vibrato keyboard notes.
By replacing the original firmware on Mega8u2/16U2 with dualMocoLUFA firmware, Arduino Uno it acts as USB-MIDI device (Standard Midi Class), which is suitable to build music instruments and devices.
I have thought of your idea of using separate MIDI channels for each Wav board, but as I am using all sixteen channels for different instruments, this would half my available instruments


At the USB MIDI level, a specific "cable number" (CN) could work.
With a specific MIDI USB descriptor , you can create 2 MIDI interfaces , let' say MIDIWAV1 and MIDIWAV2.
That must be compiled with the MIDI USB firmware of the ATMEGA8U2.
The firmware must also be modified to transmit the cable number to the ATMEGA328P.

Then, in the Arduino sketch, you could route MIDI messages according to the CN...

I did that in one of my project...

Many thanks for all your help; I might well take up the last reply byTheKikGen.

Mean while I have had a brain wave and mostly solved the problem.

Up till now I have two sets of wav notes that are not the same on the two WavTrigger boards, instead of having a separate set of notes assigned for the software serial board and another set of notes assigned for the hardware serial board, I am now sending all commands to both boards, including a key change function using the Real-time playback rate control by MIDI Pitch Bend.

The only serial information now not used by both boards is a vibrato command (added to the pitch change information) for controlling the keyed notes on the hardware serial board.
So now I have the most useful midi information on the hardware serial midi out, and all functions still working on the instrument playing the wav files through an amplifier.


Good news !!

Link to my own MIDI USB project in case of...