Tuesday, November 07, 2017

MIDI Data Over UDP Via OSC Using An ESP8266

This is a simple example of sending MIDI data over UDP via OSC using an ESP8266. The ESP is programmed using the Arduino IDE. The Arduino ESP8266 Arduino Core is used alongside the WiFi UDP library and the OSC library for Arduino. A Max for Live UDP OSC Packet to MIDI message device receives the data within Live.

The button is pressed. The change in state (either high or low) is read by the ESP8266. A note on message is formatted, with MIDI channel 1, note 60 and a velocity that is either 127 or 0 depending on the state of the button. These three bytes are then wrapped up in an OSC message with the name "MIDI", and sent via UDP. One MIDI message is sent per OSC message, and one OSC message is sent per UPD packet.

Download the code here: http://milkcrate.com.au/_other/downloads/arduino/ESP8266_UDP_OSC_MIDI.ino