Skip to content

EtherMIDI Wiki (main)

Bob Frazier edited this page Nov 3, 2018 · 1 revision

Welcome to the EtherMIDI wiki!

This simple documentation describes the project, why you might need it, how it works, and so forth.

What is EtherMIDI ?

It is an 'ethernet to MIDI synthesizer' bridge that accepts UDP packets in a format as generated by Benno Senoner's 'EthernetMIDI' application for MS Windows, and translates them into MIDI commands for libfluidsynth, thus playing the sounds as a General MIDI tone generator, using a soundfont file of your choice.

Why might I need EtherMIDI ?

If you use a soundfont file (one compatible with fluidsynth), and you want to use a Linux or FreeBSD computer as a MIDI tone generator, and you are able to generate the appropriate UDP packets with your DAW (Digital Audio Workstation), either directly or indirectly, then 'EtherMIDI' will probably fit your needs. It may also be possible to use it with some kind of 'MIDI to Ethernet' bridge connected to a keyboard or other MIDI device.

Additionally, since it uses UDP packets, you could send MIDI commands from multiple sources to a single destination in this way. And because networks have higher bandwidth and lower latency, you are less likely to suffer from bandwidth-related or latency-related issues by using Ethernet as the MIDI transport layer.

How does it work?

A UDP packet is received, with a data payload similar to the following (low endian):

struct udp_midi_payload
{
  uint32_t size;
  uint8_t data[];
};

The binary data is 'low endian', so on x86 and amd64 architectures, there is no need to use 'ntohl' or similar functions to flip the data bytes around.

Typically there are 1 to 3 data bytes in 'data' (as indicated by 'size'), each beginning with a 'function' byte between 80H and FFH. These have identical meaning to the data that would be sent over a MIDI connection. Although it may never happen, the EtherMIDI application is able to accept transactions longer than 3 bytes, so long as it does not contain any 'partial' transactions, and with each transaction segment beginning with a 'function' byte.

Whenever a 'function' byte is received, at the beginning of the UDP data, or possibly as part of the data stream within the UDP data, the remaining data bytes for the MIDI command are processed, and API functions are called within 'libfluidsynth' to perform the desired function. Typically this will be note on, note off, patch and parameter changes, and so forth. The EtherMIDI application has a simple parser that it uses to dispatch the various commands as if it were a MIDI instrument.

IPv4 vs IPv6

The 'EtherMIDI' application accepts IPv4 and IPv6 addresses. When no IP address is specified, ALL IPv4 and IPv6 addresses defined for the host machine are used, i.e. '*'. The default UDP port is 9000, and may be specified on the command line without an IP address, similar to ':9000'. This is consistent with Benno Senoner's 'EthernetMIDI' application.

See Also

EthernetMIDI application