**This is an old revision of the document!**

n

MIDI

A long time ago, analogue synthesizers got invented, and they were probably mostly intended as single instruments, much like a piano or organ. Like a player-piano, people eventually invented ways to automate synthesizers so that they a user could sequence a set of notes into the synthesizer and have it play it back to them. While that synthesizer played one part, the user would go to a second synth and play the accompaniment. Artists being what they are, two synths were hardly enough, and performers quickly started one-person bands that consisted excluisvely of synthesizers.

There were two serious issues: the synthesizers had to keep time, so internal clocks were installed. But people found that these clocks had a tendency to drift out of sync with one another, so that even if you managed to start all of your synths at the right foot-tap, by the end of a six minute song, any automated sequence would be out of sync with any other given sequence.

The other problem was that there were purely physical logistical problems with one person trying to play and trigger eight different synths to do different parts over the course of a song. It just wasn't practical.

The solution that arose was MIDI: the Musical Instrument Digital Interface.

MIDI Data Streams

You might think of MIDI as a very simple network, like the internet, without routers or switches or DNS servers. That is, all MIDI signals are sent to all clients, and it's up to the client to choose what signal to listen to. Imagine an office with a few employees in it. The employee sitting closest to the server is employee #0, the next is #1, and so on. Each morning, employee 0 copies a dump of all company email off the server onto a thumbdrive and takes it to his or her computer, takes a copy of all email addressed to Employee 0, and passes the thumbdrive on to Employee 1. Employee 1 copies all email address to Employee 1, And so on down to the last employee.

That is, more or less, how MIDI works. MIDI cables are strung from one device (perhaps a sequencer) to another (for instance, a synthesizer, and furthermore, one set to play a warm synth pad), and then from the first synth to a second synth (imagine this one is set to play the sound of a piano), and so on.

midi.jpg

If you compose a tune on the sequencer, you can “play” both synthesizers at once by sending your MIDI data over the cable. If the first synth is set to listen in on Channel 3, and you send some chords along Channel 3, then when you play your composition, you will hear warm chords on the first synth. If the second synth is set to listen in on Channel 4, and you send a melody over Channel 4, then when you play your composition, you'll hear your melody played by a synthesized piano (because that is what we set the second imaginary synth to).

If you suddenly realised that it would sound much better with the chords played by a piano and the melody by a synth pad, all you have to do is tell the first synth to listen in on Channel 4 and the second synth to listen for Channel 3.

Simple as that.

Computer Implementations of MIDI

This worked out so well for the synth world that when computers started taking over the world of electronic music, MIDI was actually reimplemented internally rather than replaced with something new. So anything you know from your experience with hardware synths (or from what you have read about it) applies directly to computer music. The only difference is that the synths are now just applications, and the cables are made of pixels.

For example, if you have a sequencer software (such as [Qtractor] or [Muse] or seq24]), then you can create tracks in your workspace and assign each track an individual MIDI channel. When you press **Play**, all MIDI data gets sent from your sequencer to anything listening. Using the [[jack|JACK routing system, connect soft synths set to listen on some MIDI channel, and, just that quickly, you're making music!

If you want to combine computerised MIDI with traditional MIDI, you can do so with a MIDI interface. These plug in to a computer (usually via USB, but sometimes with IEEE 1394 or “Firewire”) and send and receive MIDI data so that you can use hardware synths with a software sequencer, or a hardware sequencer with soft synths, and so on.

MIDI Driver

Normally, the internal computer MIDI data is handled by a driver provided by ALSA (the same project responsible for driving sound). This makes some logical sense, since when using MIDI you are probably using MIDI for sound. But with the rise of JACK, MIDI as an ALSA technology became, for most people, a technology ripe for deprecation.

There are use-cases for ALSA's MIDI driver (for instance, if you are just listening to MIDI files for fun, you would not have any good reason to start JACK) but if you are using DAWs and soft synths and effects, then the MIDI driver you probably want to use is not the ALSA driver because, just as with ALSA sound, ALSA MIDI cannot connect to JACK devices. The two are separate systems; JACK itself uses ALSA, but not interactively. If you are using JACK to make your music, then you should drive MIDI with the seq driver.

The seq driver is a dynamic bridge that sends and receives MIDI signals with JACK.

$ /usr/bin/jackd -R -d alsa -X seq

Launching jackd with seq defined as the MIDI driver retains all ALSA MIDI ports (which you probably will not use, but they'll be there just in case) and causes any JACK-aware application that you launch to create a MIDI port for itself within the JACK environment.

seqmidi.jpg