Send and receive MIDI messages over Ethernet (rtpMIDI or AppleMIDI)

Overview

AppleMIDI (aka rtpMIDI) for Arduino

arduino-library-badge Build Status License: CC BY-SA 4.0

Enables an Arduino with IP/UDP capabilities (Ethernet shield, ESP8266, ESP32, ...) to participate in an AppleMIDI session.

Important: Please read the note below on enlarging the standard Ethernet library buffersize to avoid dropping MIDI messages!

Features

  • Build on top of the popular FortySevenEffects MIDI library
  • Tested with AppleMIDI on Mac OS (Big Sur) and using rtpMIDI from Tobias Erichsen on Windows 10
  • Send and receive all MIDI messages
  • Uses callbacks to receive MIDI commands (no need for polling)
  • Automatic instantiation of AppleMIDI object (see at the end of 'AppleMidi.h')
  • Compiles on Arduino, MacOS (XCode) and Windows (MSVS)

New in 3.0.0

  • Bug Fixes (long session names get cropped)
  • Reduced memory footprint (see AVR_MinMemUsage example and note below)
  • Extended and revised callbacks to receive AppleMIDI protocol feedback (see AVR_Callbacks example)
  • Who may connect to me (Directory) (see AVR_Directory example)

New in 3.1.0

  • Increased stability in high-throughput situations
  • Updated wiki

New in 3.1.1 and 3.1.2

  • Bug fixes en enhancements

Installation

From the Arduino IDE Library Manager, search for AppleMIDI

Installation

This will also install FortySevenEffects MIDI library

Basic Usage

#include <Ethernet.h>
#include <AppleMIDI.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

APPLEMIDI_CREATE_DEFAULTSESSION_INSTANCE(); 

void setup()
{
  Ethernet.begin(mac);

  MIDI.begin(); // listens on channel 1
}

void loop()
{
  // Listen to incoming notes
  MIDI.read();
  
  ....
  if (something) {
    // Send MIDI note 40 on, velocity 55 on channel 1
    MIDI.sendNoteOn(40, 55, 1);
  }
}

More usages in the examples folder and in the wiki

Hardware

  • Arduino/Genuino (Mega, Uno, Arduino Ethernet, MKRZERO, ...)
  • ESP8266 (Adafruit HUZZAH ESP8266, Sparkfun ESP8266 Thing Dev)
  • ESP32 (Adafruit HUZZAH32 – ESP32 Feather Board) Wi-Fi
  • ESP32 with W5500 Setup
  • Teensy 3.2 & 4.1
  • Adafruit Feather M0 WiFi - ATSAMD21 + ATWINC1500

Network Shields

  • Arduino Ethernet shield (Wiznet W5100 and W5500)
  • Arduino Wifi R3 shield
  • MKR ETH shield (W5500 and W6100 based)
  • Teensy WIZ820io W5200
  • Teensy 4.1 with Ethernet Kit

Notes

Session names

Session names can get really long on Macs (eg 'Macbook Pro of Johann Gambolputty .. von Hautkopft of Ulm') and will be truncated to the MaxSessionNameLen

Memory footprint

The memory footprint of the library can be lowered significantly, read the wiki

Ethernet buffer size

It's highly recommended to modify the Ethernet library or use the Ethernet3 library to avoid buffer overruns - learn more

Latency

Use wired Ethernet to reduce latency, Wi-Fi increases latency and latency varies. More of the wiki

Arduino IDE (arduino.cc)

  • 1.8.16

Contributing

I would love to include your enhancements or bug fixes! In lieu of a formal styleguide, please take care to maintain the existing coding style. Please test your code before sending a pull request. It would be very helpful if you include a detailed explanation of your changes in the pull request.

You might also like...
A simple two-axis gimbal built using two servo motors, an mpu6050 gyro and accelerometer sensor, and an Arduino (Uno)
A simple two-axis gimbal built using two servo motors, an mpu6050 gyro and accelerometer sensor, and an Arduino (Uno)

Makeshift Gimbal Project A simple two-axis gimbal built using two servo motors, an mpu6050 gyro and accelerometer sensor, and an Arduino (Uno). A shor

Arduino, esp32 and esp8266 library for ABB (ex PowerOne) Aurora Inverter, implement a full methods to retrieve data from the Inverter via RS-485
Arduino, esp32 and esp8266 library for ABB (ex PowerOne) Aurora Inverter, implement a full methods to retrieve data from the Inverter via RS-485

ABB Aurora protocol You can refer the complete documentation on my site ABB Aurora PV inverter library for Arduino, esp8266 and esp32 I create this li

CAN Driver for Teensy 3.1 / 3.2, 3.5 and 3.6

CAN Library for Teensy 3.1 / 3.2, 3.5, 3.6 Compatibility with the ACANxxxx libraries This library is fully compatible with the MCP2515 CAN Controller

Arduino library for SPI and I2C access to the PN532 RFID/Near Field Communication chip

Adafruit-PN532 This is a library for the Adafruit PN532 NFC/RFID breakout boards This library works with the Adafruit NFC breakout https://www.adafrui

Arduino library for sending email and SMS from nothing but the ESP8266!
Arduino library for sending email and SMS from nothing but the ESP8266!

Did you know your ESP8266 could send Email and SMS without any special hardware or paid services like Twilio? With AlertMe, your ESP8266 project can:

IOTBOT, which is designed as an Internet-oriented robotic coding training kit and powered by the ESP32 processor
IOTBOT, which is designed as an Internet-oriented robotic coding training kit and powered by the ESP32 processor

IOTBOT-Firmware! Test Series IOTBOT, which is designed as an Internet-oriented robotic coding training kit and powered by the ESP32 processor, knows n

An implementation of a ANT driver for Arduino, Mbed and ESP-IDF

ant-arduino Arduino library for communicating with ANT radios, with support for nRF51 devices. This library Includes support for the majority of packe

A library to simplify the process of getting and storing data to Antares IoT Platform through HTTP on ESP8266.
A library to simplify the process of getting and storing data to Antares IoT Platform through HTTP on ESP8266.

Antares ESP8266 HTTP This is the documentation for Antares ESP8266 library. This library is meant to simplify the process of retrieving and deploying

A library to simplify the process of subscribing and publishing data to Antares IoT Platform through MQTT on ESP8266.
A library to simplify the process of subscribing and publishing data to Antares IoT Platform through MQTT on ESP8266.

Antares ESP8266 MQTT A Library to simplify the process of MQTT publication and subscription to Antares IoT Platform using ESP8266. This library works

Releases(v3.2.0)
  • v3.2.0(Jan 26, 2022)

    • events return a pointer to this for easy command/event chaining and avoid have to create separate function declarations. It adds to the readability and brevity of the code.
    AppleMIDI
      .setHandleConnected([](const APPLEMIDI_NAMESPACE::ssrc_t & ssrc, const char* name) {
    // do something
      })
      .setHandleDisconnected([](const APPLEMIDI_NAMESPACE::ssrc_t & ssrc) {
    // dome something else
      });
    
    • setPort

    Ability to the RTPMIDI UTP port (default 5004), call this before you call MIDI.begin

    Source code(tar.gz)
    Source code(zip)
  • v3.1.2(Aug 26, 2021)

  • v3.1.1(Aug 22, 2021)

    Bug fixes and enhancements:

    • session name longer than 48 bytes would hang the parser #128
    • data parser could hang in rare cases #127
    • fix for Malformed packets #129
    • remote session name return in stead of local session name #130

    Thank you @hallvardkristiansen, @folkertvanheusden for reporting, identifying and helping to fix issues

    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Feb 13, 2021)

  • v3.0.0(Dec 30, 2020)

    • Bug Fixes (long session names get cropped)
    • Reduced memory footprint (see AVR_MinMemUsage example and note below)
    • Extended and revised callbacks to receive AppleMIDI protocol feedback (see AVR_Callbacks example)
    • Who may connect to me (Directory) (see AVR_Directory example)
    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Dec 20, 2020)

    Bug fixes and enhancements - update recommended

    • Fixed suport for ESP8266
    • remove usimg namespace under include (requires namespace when using eg ssrc_t: APPLEMIDI_NAMESPACE::ssrc_t)
    • bug fix where wrong ssrc was sent during SYNC
    • bug fix where
    • debug MACROS moved to own header file
    • various enhancements in the examples
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(May 3, 2020)

    Based on issues #83 (big thank you to @hugbug)

    • easier integration of custom settings
    • bug fix: buffer empty too soon in multi participant environment
    • bug fix: allow missing sessionNames in responses (part of the AppleMID spec)
    • UDP buffer size moved to Settings (No longer using UDP_TX_PACKET_MAX_SIZE)
    • Compiles on MS Visual C++ and Xcode
    • Removed warning from Endian.h
    • Moved Endian.h to Platform.h
    Source code(tar.gz)
    Source code(zip)
  • v2.0.5(May 1, 2020)

  • v2.0.4(Apr 24, 2020)

  • v2.0.3(Apr 21, 2020)

  • v1.6.1(Aug 11, 2019)

    • Save 2000 bytes when not initiating sessions, by #undef APPLEMIDI_REMOTE_SESSIONS in AppleMidi_Settings.h
    • Fixed travis-ci compilation errors
    • removed unused variables
    • tested on MKRZERO + MKR ETH shield
    Source code(tar.gz)
    Source code(zip)
  • 1.6.0(Oct 29, 2018)

    Changelog

    API Changes

    Non-Breaking Changes

    The following changes mark the following old parts of the API as deprecated.

    They are kept for backwards compatibility, but should not be used for new sketches. The old definitions will be removed in the next release. Purpose is to align with the FortySevenEffects/arduino_midi_library and https://github.com/lathoub/Arduino-BLE-MIDI naming convention.

    noteOn becomes sendNoteOn noteOff becomes sendNoteOff ...

    All examples have been upgraded to the new naming

    Source code(tar.gz)
    Source code(zip)
  • 1.5.4(Apr 14, 2018)

  • v1.5.3(Aug 26, 2017)

  • v1.5.2(Aug 20, 2017)

  • v1.5.1(Aug 17, 2017)

    RTP-MIDI (also known as AppleMIDI) is a protocol to transport MIDI messages within RTP (Real-time Protocol) packets over Ethernet and WiFi networks. It is completely open and free (no license is needed), and is compatible both with LAN and WAN application fields. Compared to MIDI 1.0, RTP-MIDI includes new features like session management, device synchronization and detection of lost packets (with automatic regeneration of lost data). RTP-MIDI is compatible with real-time applications, and supports sample-accurate synchronization for each MIDI message. (from https://en.wikipedia.org/wiki/RTP-MIDI) Tested on Windows 10 and Mac OS 10.12.6 using Arduino Mega, Arduino Ethernet and Adafruit Huzzah

    New feature: send and receive SysEx

    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Aug 13, 2017)

    RTP-MIDI (also known as AppleMIDI) is a protocol to transport MIDI messages within RTP (Real-time Protocol) packets over Ethernet and WiFi networks. It is completely open and free (no license is needed), and is compatible both with LAN and WAN application fields. Compared to MIDI 1.0, RTP-MIDI includes new features like session management, device synchronization and detection of lost packets (with automatic regeneration of lost data). RTP-MIDI is compatible with real-time applications, and supports sample-accurate synchronization for each MIDI message. (from https://en.wikipedia.org/wiki/RTP-MIDI)

    Tested on Windows 10 and Mac OS 10.12.6 using Arduino Mega, Arduino Ethernet and Adafruit Huzzah

    Source code(tar.gz)
    Source code(zip)
  • 1.4.0(May 31, 2016)

    RTP-MIDI (also known as AppleMIDI) is a protocol to transport MIDI messages within RTP (Real-time Protocol) packets over Ethernet and WiFi networks. It is completely open and free (no license is needed), and is compatible both with LAN and WAN application fields. Compared to MIDI 1.0, RTP-MIDI includes new features like session management, device synchronization and detection of lost packets (with automatic regeneration of lost data). RTP-MIDI is compatible with real-time applications, and supports sample-accurate synchronization for each MIDI message. (from https://en.wikipedia.org/wiki/RTP-MIDI)

    Source code(tar.gz)
    Source code(zip)
  • v1.0(Dec 19, 2015)

    RTP-MIDI (also known as AppleMIDI) is a protocol to transport MIDI messages within RTP (Real-time Protocol) packets over Ethernet and WiFi networks. It is completely open and free (no license is needed), and is compatible both with LAN and WAN application fields. Compared to MIDI 1.0, RTP-MIDI includes new features like session management, device synchronization and detection of lost packets (with automatic regeneration of lost data). RTP-MIDI is compatible with real-time applications, and supports sample-accurate synchronization for each MIDI message. (from https://en.wikipedia.org/wiki/RTP-MIDI)

    Source code(tar.gz)
    Source code(zip)
  • v0.9-beta(Aug 18, 2015)

  • v0.9-alpha(Aug 16, 2015)

Owner
null
Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.

Adafruit IO Arduino Library This library provides a simple device independent interface for interacting with Adafruit IO using Arduino. It allows you

Adafruit Industries 168 Dec 23, 2022
ESP32-S2 and CC1101S 433Mhz usb stick to record and send car gates/garages data keys and open stuff

HackZeGarage ESP32-S2 and CC1101S 433Mhz usb stick to record and send car gates/garages data keys and open stuff **HackZeGarage @sulfuroid / Dr CADIC

Dr PhilMorph 5 Mar 16, 2022
Arduino library for interfacing with any GPS, GLONASS, Galileo or GNSS module and interpreting its NMEA messages.

107-Arduino-NMEA-Parser Arduino library for interfacing with any GPS, GLONASS, Galileo or GNSS module and interpreting its NMEA messages. This library

107-Systems 15 Jan 1, 2023
An Arduino library with additions to vanilla Serial.print(). Chainable methods and verbosity levels. Suitable for debug messages.

advancedSerial This library provides some additions to vanilla Serial.print(): 1. Chainable print() and println() methods: // you can chain print() a

Vasily Klenov 17 Dec 13, 2022
Converting CASIO MA-150 as a USB MIDI Input using Arduino uno

Arduino USB MIDI CASIO MA-150 Converting CASIO MA-150 as a USB MIDI Input using Arduino uno Use 74HC595 shift register with arduino uno to accommodate

Shamila Wijekoon 3 Jul 2, 2022
Minimal bit-bang send serial 38400/115200 baud for 1MHz or 115200/230400 baud for 8 or 16MHz ATtiny clock

Attiny Serial Out Available as Arduino library "ATtinySerialOut" Version 2.0.1 - work in progress Minimal bit-bang send serial 115200 baud for 1/8/16

Armin 35 Jan 4, 2023
Websocket client for Arduino, with fast data send

Websocket client for Arduino, with fast data send This is a simple library that implements a Websocket client running on an Arduino. Rationale For our

Davide Monari 29 Aug 4, 2022
A Wiring/Arduino library to tokenize and parse commands received over a phisical/software serial port or buffer.

A Wiring/Arduino library to tokenize and parse commands received over a phisical/software serial port or buffer.

Guglielmo Braguglia 5 Jun 9, 2022
Easily and asynchronously interact with a serial device requiring call-and-response style commands.

Arduino Managed Serial Device Note This library was formerly less-descriptively named "Arduino Async Duplex" This library allows you to asynchronously

Adam Coddington 20 Nov 20, 2022
Easily and asynchronously interact with a serial device requiring call-and-response style commands.

Arduino Managed Serial Device Note This library was formerly less-descriptively named "Arduino Async Duplex" This library allows you to asynchronously

Adam Coddington 20 Nov 20, 2022