MIDI2 network transport

Browse source code on GitHub

Overview

This sample demonstrates usage of the Network MIDI 2.0 stack:

  • start a UMP Endpoint host reachable on the network

  • respond to UMP Stream discovery messages, so that clients can discover the topology described in the device tree

  • if midi_serial port is defined in the device tree, send MIDI1 data from UMP group 9 there

  • if midi_green_led node is defined in the device tree, light up the led when sending data on the serial port

Requirements

This sample requires a board with IP networking support. To perform anything useful against the running sample, you will also need a Network MIDI2.0 client to connect to the target, for example pymidi2

Building and Running

The easiest way to try out this sample without any hardware is using native_sim. See native_sim ethernet driver to setup networking on your computer accordingly

# From the root of the zephyr repository
west build -b native_sim samples/net/midi2/
west build -t run

The Network MIDI 2.0 endpoint should now be reachable on the network:

$ pymidi2 find
Zephyr-UDP-MIDI2 (udp://192.0.2.1:45486)
- Block #0 [io : Recv/Send] 'Synthesizer' UMP groups {0, 1, 2, 3} [MIDI1 + MIDI2]
- Block #1 [i- : Recv     ] 'Keyboard' UMP groups {8} [MIDI1 only]
- Block #2 [-o :      Send] 'External output (MIDI DIN-5)' UMP groups {9} [MIDI1 31.25kb/s]

Furthermore, this sample pairs well with the Olimex SHIELD-MIDI, that conveniently defines the device tree nodes for the external MIDI OUT and its led. For example, using this shield on the ST Nucleo F429zi:

# From the root of the zephyr repository
west build -b nucleo_f429zi --shield olimex_shield_midi samples/net/midi2
west flash

Using authentication

To enable shared secret authentication to connect to the UMP endpoint host, enable CONFIG_NET_SAMPLE_MIDI2_AUTH_SHARED_SECRET, and then configure the desired shared secret in CONFIG_NET_SAMPLE_MIDI2_SHARED_SECRET

To enable user/password authentication instead, enable CONFIG_NET_SAMPLE_MIDI2_AUTH_USER_PASSWORD, and then configure the desired username/password in CONFIG_NET_SAMPLE_MIDI2_USERNAME and CONFIG_NET_SAMPLE_MIDI2_PASSWORD

See also

MIDI2 Universal MIDI Packet definitions
Network MIDI 2.0