Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
USBMIDI-Adapter.ino

USBMIDI-Adapter

Turns an Arduino into a USB to 5-pin DIN MIDI adapter.

Boards: 🛈
AVR USB, Due, Nano 33 IoT, Nano 33 BLE, Pi Pico, ESP32-S3, Teensy 3.x

Connections

See https://midi.org/specifications/midi-transports-specifications/5-pin-din-electrical-specs for the schematic, optocoupler models and resistor values.

Behavior

See also
MIDI over USB
MIDI Tutorial

Written by PieterP, 2024-01-21
https://github.com/tttapa/Control-Surface

// Instantiate a MIDI over USB interface
// Instantiate a 5-pin DIN MIDI interface (on the TX and RX pins of Serial1)
HardwareSerialMIDI_Interface midi_ser {Serial1};
// Instantiate the pipe to connect the two interfaces
void setup() {
// Manually route MIDI input from the serial interface to the USB interface,
// and the MIDI input from the USB interface to the serial interface
midi_ser | pipes | midi_usb;
// Initialize the MIDI interfaces
}
void loop() {
// Continuously poll all interfaces and route the traffic between them
}
The main header file that includes all Control-Surface header files.
static void updateAll()
Update all enabled instances of this class.
static void beginAll()
Begin all enabled instances of this class.
A class for MIDI interfaces sending and receiving MIDI messages over a Hardware Serial port.
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
std::pair< MIDI_Pipe, MIDI_Pipe > BidirectionalMIDI_Pipe
A bidirectional pipe consists of two unidirectional pipes.