Teensy 4.0 - Multiple Serial and USB MIDI cables


Active member

I would like to build the following setup with a teensy 4.0.

4x serial midi OUT
2x serial midi IN
5x class compliant USB MIDI cables

Is this possible at all?

Also i couldnt find a example for using using multiple usb midi cables.

any hint?

thanks in advance
Yes, it is possible. But the ready-made configurations you can select from the Tools > USB Type menu have 4 or 16 virtual cables. To get exactly 5, you'd need to edit the USB code. Probably best to use 16 and leave 11 unused, at least while getting everything else working.

Use of MIDI virtual cables is documented on this page. Scroll down to "Transmit With Virtual Cables/Ports".


To transmit, you just add 1 more parameter for the cable number.

For Receiving, you would call usbMIDI.getCable() to learn which cable was used for the message.

For example code, in Arduino click File > Examples > Teensy > USB_MIDI > Interface_3x3. You can also see this example on github.


On the other non-USB, yes, Teensy 4.0 has 7 hardware serial ports. You can use up to 7 input and 7 output for regular serial (5 pin DIN) MIDI.