MIDI and OSC - the main protocols for the interaction of music applications
Part 1. MIDI
MIDI (Musical Instrument Digital Interface) is a standard for exchanging data between digital musical instruments. It allows you to exchange information such as note number, velocity, timecode, etc. MIDI supports most of the released music devices, exceptions are many modules of modular systems (for example, Eurorack), as well as such specific things as Monome.
1 Background
The need for such a standard arose around the end of the 70s. At that time, the synthesizers were controlled by voltage using the CV / Gate interface . There were several types of it, however, the variant proposed by Roland received the most popularity : in it, with an increase in voltage by 1 V , the frequency of the generated tone increased by one octave. The main disadvantage of this interface is that with it you can control only one voice of polyphony. To extract an extra note, you need to add another CV / Gate interface . In addition, in this way only the fact of pressing the key and its height is transmitted, which is clearly not enough for expressive play.
Another drawback of synthesizers of the time was the complexity of tuning. For each new sound, the musicians had to tune the instrument anew, which was very inconvenient in live performances. At concerts of those times, one could often see whole racks of synthesizers - this is how musicians came out of the situation. Over time, mini-computers were built into the tools, with which it was possible to save the position of the pens in presets.
However, there is another point that has had a big impact on the development of MIDI .
Undoubtedly, each synthesizer has its own sound character, each of them was strong in certain types of sounds. Therefore, many musicians of that time practiced playing the two instruments at once, as if using the best of different models. Layering sounds from various synthesizers has become a performing technique, a hallmark of many musicians. [1]
2 History
By the beginning of the 80s, most manufacturers realized the need to create a single interface. The task was this: to develop a standard for the transfer of performer’s actions in digital form between all types of electric musical instruments. [1]
We will not delve into the history in detail, (although it is very interesting, you can read about it in [1]), here are a few key dates:
- June 1981 - At the NAMM exhibition, the first conversation took place on a single interface between the heads of Sequential Circuits , Roland and Oberheim .
- Autumn 1981 is the first version of the interface called UMI (Universal Musical Interface) .
- June 1982 - at the NAMM exhibition were presented the fruits of international development. Due to possible legal problems, the name UMI had to be abandoned in favor of MIDI .
- October 1982 - The preliminary MIDI specification is completed.
- December 1982 - the first synthesizer equipped with a MIDI interface, the Sequencial Circuits Prophet 600, is released .
- 1983 - The MIDI Standards Committee (JMSC) , the International MIDI User Group (IMUG) were formed , and the MIDI 1.0 specification was released .
- 1984 - The MIDI Manufacturers Association (MMA) is formed .
3 Basics
MIDI is a serial communication protocol between the master and slave. The host device generates messages and sends them to the slave, which executes the received commands. Serial - means the information is transmitted one bit at a time, bit by bit. This implies the impossibility of transmitting multiple messages simultaneously.
The protocol itself consists of three parts [1]: data format specification, hardware interface specification and data storage specification. This article will discuss only the first part.
MIDI messages are divided into two types: channel messages and system messages. The former control sound generation, while the latter perform service functions, such as synchronization.

A message usually consists of two or three bytes. The first byte is called status byte. It sets the type of message and the channel number to which it belongs. All subsequent bytes are called data bytes. The status byte always starts with one, and the byte data from zero - thus the system distinguishes them. It turns out that for the MIDI information, only 7 bits remain, with which you can encode integers from 0 to 127 - this is where this “famous” restriction on the number of notes and controller values comes from.

As can be seen from the figure, only 3 bits are allocated for message type information, in which only 8 numbers can be encoded. 7 of them are reserved for the most frequently used commands, and the latter is used for system messages. When a system message is transmitted, the last 4 bits of the byte status (in which the channel number is usually transmitted) determine the type of system message.
Tab. 1. Channel messages.
| Message | Status byte | Data Byte 1 | Data byte 2 |
| Note off | 1000nnnn | Note number | Velocity |
| Note on | 1001nnnn | Note number | Velocity |
| Polyphonic key pressue | 1010nnnn | Note number | Pressure |
| Control change | 1011nnnn | Controller number | Value |
| Program change | 1100nnnn | Program number | - |
| Channel pressure | 1101nnnn | Pressure | - |
| Pitch wheel change change | 1110nnnn | Program number | - |
| System messages | 1111nnnn | ... | ... |
Tab. 2. System messages
| Message | Status byte | Data Byte 1 | Data byte 2 |
| System Exclusive (SysEx) | |||
| System exclusive | 11110000 | ID | ... |
| System common | |||
| MTC Quater Frame | 11110001 | Timecode | - |
| Song position pointer | 11110010 | LSB | Msb |
| Song select | 11110011 | Song number | - |
| Tune request | 11110110 | - | - |
| End Of Exclusive (EOX) | 11110111 | - | - |
| Real time | |||
| Timing clock | 11111000 (248) | - | - |
| Start | 11111010 (250) | - | - |
| Continue | 11111011 (251) | - | - |
| Stop | 11111100 (248) | - | - |
| Active sensing | 11111110 | - | - |
| System reset | 11111111 | - | - |
4 disadvantages
MIDI was developed as an affordable and practical standard for transferring artist's gestures between any MIDI devices [2]. Last but not least, due to its lightness, he received such a distribution. Whatever you say, he copes with his mission perfectly, and this is confirmed by time.
So, probably, the most famous drawback is the limitation of controller values to 128 values. Of course, it is possible to transmit them using two data bytes (which gives 16 384 possible values), but for this you need to send three Control Change messages, which will load the protocol very much, since the data is transmitted at 31,200 bps . This is very small. For comparison, a 12-note chord will be transmitted in about 10 ms.. And this is without other messages, such as Clock and CC . In a real performance, when many different parameters are transmitted simultaneously, problems with synchronization may occur.
Part 2. Open Sound Contol
“Open Sound Control is a new protocol optimized for modern network technologies for the interaction of computers, sound synthesizers and other multimedia devices” - this was presented by OSC at the international conference on computer music in 1997 [3]. OSC is not a protocol in the form that MIDI is , since it does not describe hardware requirements - specifications describe only the data transfer format. In this regard, OSC is more similar to XML or JSON than to MIDI [8].
For now, let’s leave the technical details and start from the very beginning, with history.
1 History, applications
Open Sound Control was created in 1997 by Matthew Wright and Adrian Freed at the University of California at the Center for New Music and Audio Technologies (CNMAT - Center of New Music and Audio Technologies) . The developers wanted to use high-speed network technologies in interactive computer music [4]. OSC doesn't matter what protocol is transmitted, since it is just a binary message format, although most implementations use TCP / IP or UDP . Another reason for the creation was that MIDI, with its notes, channels and controllers, did not logically fit the synthesizer being developed at that timeCAST (CNMAT Additive Synthesis Tools) , which is understandable, because MIDI is a key-oriented protocol that was developed to control one synthesizer from another [1].
The word "Open" in the name means that OSC does not predetermine which messages should be used for certain parameters - this is decided by the developer of a particular device. In addition, this word has another meaning: the protocol is open, its specifications are on the official website, where you can download the sources.
A small (and incomplete) list of programs using Open Sound Control :
- Programming languages: C / C ++, Java, Php, Python, Ruby.
- Visual programming and synthesis environments: Bidule, Chuck, Common Music CPS, Intakt, Max / MSP, Open Sound World, Pd, SuperCollider, Reaktor, VVVV.
- Devices for working with sensors: EtherSense, Gluion, IpSonLab Kroonde, Lemur, Smart, Controller, Teabox, Toaster.
- Other programs: EyesWeb, Picker, SonART, SpinOSC.
2 Features
- Allows you to use any data transfer protocols (the most common are TCP / IP and UDP ).
- OSC allows you to set intuitive addresses for parameters. For example, if you want to set the volume equal to 100 of the third channel of the mixer, the message may look like this: "/ mixer / channel / 4 / volume 100" .
- It is possible to control several parameters with a single message using the so-called pattern matching . For example, you can lower the volume of all mixer channels to 10 using the following message: "/ mixer / channel / * / volume 10" . This recording format may be familiar to programmers and users of the Unix family of operating systems.
- In one OSC message, several types of data can be transmitted.
- Time tags Each message is assigned a time stamp.
3 Anatomy of posts

It is worth noting that when using UDP , if messages were transmitted in different packets, they will not necessarily arrive in the order in which they were transmitted [6]. Let's say the messages were transmitted: In fact, they can come in the reverse order: This can lead to problems with voice control in polyphony, for example, the noteoff command is sent in this message , which turns off the voice and then turns on another note. If these messages arrive in the reverse order, the voice will not be released and the new note will not be able to start. To avoid this, you need to send messages in one packet (bundle), or use TCP / IP , it differs from UDP
/synth1/noteoff 54
/synth1/noteon 60/synth1/noteoff 60
/synth1/noteon 54so that it guarantees the correct delivery of packets, passing each of them until it is transmitted in its original form. It should be borne in mind that at the price of such convenience there will be large delays in comparison with UDP , so the use of TCP / IP should be justified.
4 pattern matching
Characters that can be used in the address bar [7]:
- "?" - matches any one character.
- "*" - matches a sequence of zero or any other number of characters.
- Characters in square brackets (for example, "[string]") - matches any character in a string. In square brackets, a hyphen (-) and an exclamation mark (!) Have a special meaning: a
hyphen between two characters means a range of numbers in an ASCII sequence (a hyphen at the end of a line has no special meaning);
the exclamation mark after the first square bracket “reverses” the action of the characters: now they will correspond to all characters that are not in the line (if this character is put in any other place, its special meaning will disappear). - Constructs like {first, second} correspond to any sequence of characters written with a comma.
References
[1] A series of articles on MIDI from the journal Musical Equipment .
[2] T. Winkler " Composing interactive music " - 2001 MIT Press.
[3] M. Wright, and A. Freed, 1997. " Open Sound Control: a new protocol for communicating with sound synthesizers. " - ICMC 1997.
[4] M. Wright " Open Sound Control: an enabling technology for musical networking " Organized Sound 10 (3): 193-200 - 2005 Cambridge University Press.
[5] A. Schmeder, A. Freed, D. Wessel " Best Practices for Open Sound Control " - Linux Audio Conference, 05/05/2010, Utrecht, NL, (2010).
[6] A. Fraietta " Open Sound Control: Constraints and Limitations"- 2008 8th NIME conference.
[7] M. Wright" The Open Sound Control 1.0 Specification "- 2002.
[8] A. Freed, A. Schmeder" Features and Future of Open Sound Control version 1.1 for NIME "- 2009.
PS Many thanks to the 8bitjoey habrayuzer for the error found in the article.