Understanding MIDI

Discussion in 'General Sequencing' started by -=BLADE=-, Mar 6, 2004.

  1. -=BLADE=-

    -=BLADE=- Omnipotent Metal God

    Likes Received:
    Trophy Points:
    10 Essential Facts

    Even if you use MIDI every day, there may be moments when you wonder what the heck is going on. Why doesn’t your software know how to talk to your synth? What are those awful noises, and how can you shut them up? Distilling the essentials of MIDI down to a list of 20 facts was a challenge — there are a lot of details that you won’t find below. I’ve concentrated on the basics, while ignoring more esoteric topics like RPNs and quarter-frame messages. But if you don’t come away from this article knowing at least a little more than you did before, it’s because you’re already an expert.

    1. MIDI sends performance instructions, not sound. When you press a key on a MIDI keyboard, you’re not making a sound — you’re sending a performance instruction called a note-on message. (see Fig. 1). It’s entirely up to the instrument at the other end of the cable what sort of sound to create (if any) when it receives the message. What’s more, MIDI cables don’t carry any audio data at all. If you only hook your synth to the rest of your system with MIDI cables, you won’t be able to listen to it unless it has its own speakers.

    2. In goes to out, out goes to in. Most MIDI hardware will give you a set of three jacks on the back panel, labeled In, Out, and Thru. When you’re cabling two devices to one another, the Out jack on your master keyboard should be connected to the In jack on whatever device you want to receive the MIDI data from the keyboard.
    Several devices can be connected in a chain, so they all receive identical messages from the master keyboard (or some other MIDI source, such as a computer). To do this, connect the source device’s Out to the In of the first receiving device. Then connect this device’s Thru to the In of the second device, the Thru of the second device to the In of the third device, and so on.

    3. Too many Thru connections in a row can corrupt the data. It’s not a good idea to connect more than four or five devices in series using MIDI Thru connections. The digital signal will degrade gradually each time it passes through a device. Because it’s digital, the degradation will have no musical consequences at first — but when the signal gets degraded beyond a certain point, the last device(s) in the line will start to freak out, giving you stuck notes and all sorts of other weirdness.

    4. MIDI communications are one-directional. Unlike more modern digital communications transports, such as USB, MIDI cables carry information in only one direction. If you want two devices to be able to communicate with one another (which is often necessary when you’re using MIDI for a system-exclusive data dump, a topic discussed below), the MIDI Out of each device must be connected to the MIDI In of the other.

    5. MIDI connectors transmit data in serial, not parallel, format, and the data transmission rate is barely fast enough. Digital messages fly down a MIDI cable one bit at a time. For technical reasons that you don’t need to worry about, a MIDI byte contains ten bits rather than the usual eight bits. The data transmission speed of MIDI is 31,250 bits per second. As a result, a single MIDI cable can carry, at most, 3,125 bytes per second.
    As explained below, a MIDI note-on message normally contains three bytes. What this means is that, as a rule of thumb, it takes a little less than 1ms (one millisecond) to send a single note-on message down a cable. To send a 20-note chord down the same cable takes about 20ms. The 20th note will arrive at the receiving device 20ms after the first note — a time lag that can be perceived in some situations, at least if you know what to listen for.
    When MIDI is used within the confines of a computer, the speed limitations of hardware MIDI connections are entirely bypassed. For instance, let’s say you instantiate a softsynth within a sequencer and then record a MIDI track that plays the softsynth. Once the MIDI track has been recorded and is playing back, the sequencer should be able to play the softsynth with, at worst, 1 ms of timing slop, which won’t usually be detectable.

    6. Sixteen channels can share one cable. Two types of messages are defined in the MIDI Specification — system messages and channel messages. The actual music performance data (notes, controllers, pitchbend, and so on) is in the form of channel messages. MIDI defines 16 channels, which can all operate independently on a single cable at the same time. To use more than 16 channels, you’ll need a more complex cable setup. For instance, your computer might be equipped with a multiport MIDI interface providing eight output ports. Assuming your sequencer can address these ports independently of one another, you’ll be able to use 16 channels on each port, for a total of 128 channels.
    A few synths can receive on up to 32 channels at once. To do this, they need two physical MIDI input jacks (or else some other type of connector, such as USB, to receive MIDI from a computer).

    7. There are two kinds of MIDI sync. The original MIDI Specification defined the clock message, as well as stop, start, and continue messages and a song position pointer message. These can be used to synchronize two devices, such as sequencers, to one another. The clock message is sent 24 times for each quarter-note, which means it’s tempo-dependent. It contains no information about how much time has passed, or where in the song the transmitting device is at the moment.
    A more complex type of synchronization is provided by MIDI Time Code (MTC). Basically, MTC is a way of sending SMPTE synchronization code (which is used to synchronize tape decks and other devices) down a MIDI cable. MTC provices realtime sync — that is, it contains information about how much time has passed since the beginning of the song. However, MTC does not provide tempo information. If two devices are synced to one another with MTC, and if they’re set to different tempos, they’ll drift apart musically even though they’re properly synchronized.

    8. Middle C is note 60. MIDI defines a set of 128 notes for each channel. Middle C is note 60, which means that a conventional 5-octave MIDI keyboard has a range from note 36 through note 96. There has never been an entirely standard method of displaying octave information in sequencer edit windows, however. Some sequencers display note 60 as C3, while others display it as C4.

    9. A MIDI note-on message contains three parts. First up is the channel number. (For you tweakheads out there, the channel number is part of the status byte. With a few exceptions, every MIDI message starts with a status byte, which tells the receiving device what kind of message is about to arrive.) Then comes the note number. Last is the key velocity. The channel number can have a value between 1 and 16. Both the note number and the velocity can be anywhere between 0 and 127.

    10. A velocity of zero turns a note off. There are two basic ways to turn off a MIDI note once it has started. You can send a note-off message, or you can send a note-on message with a velocity of 0. In either case, obviously, the channel number and note number need to match an earlier note-on message. If they don’t match, the note will never be switched off.
    In your sequencer’s preferences box, you may be able to switch “send note-off messages” on or off. This means, “Send real note-off messages, or send note-ons with velocity 0?” It should make no musical difference how you set this switch, except that in dense musical passages sending note-offs may slow down the MIDI data stream very slightly.
    Because note-on messages with velocity 0 function as note-off messages, the possible range of velocities that can be used to start MIDI notes is 1–127, not 0–127.
  2. -=BLADE=-

    -=BLADE=- Omnipotent Metal God

    Likes Received:
    Trophy Points:
    and another 5!....

    (sorry about the mistake in the last installment about a firgure which doesnt exist!)

    and another 5!....

    11. Continuous controllers are not continuous. Among the MIDI channel messages is a set of 128 “continuous controller” messages (often abbreviated “CC”). These are used mainly to send the movements of knobs, sliders, pedals, and so forth. For example, your synth’s modulation wheel or lever will almost always send CC1 messages.
    Each CC has a possible range of 0–127, so when you move the mod wheel down to its rest position, it should send a CC1 with a value of 0, and when you push it up to its highest point it should send a CC1 with a value of 127. CC values are not smooth, they’re stepped. That is, a standard mod wheel can send a value of 56 or a value of 57, but it can’t send 56.329 or 57.1. Depending on what sound parameter CC1 is controlling, you may hear a slightly grainy, stair-stepped effect when you move the mod wheel while holding a note.

    12. Some continuous controllers are pre-defined. Certain of the CC numbers are reserved for particular purposes. For instance, CC64 is the sustain (damper) pedal. In fact, several of the controllers (64, 65, 66, etc.) are defined as on/off switches rather than as continuous: Your sustain pedal will probably send a CC64 message with a value of 127 when pressed, and another CC64 with a value of 0 when released. The values between 0 and 127 for CC64 are not used — which is why your sequencer’s graphic edit window may try to prevent you from creating them.
    If you’re defining a controller setup, and you want or need to use CC32–63 as independent controllers rather than as LSBs, you’ll probably be able to do so. The MSB/LSB implementation is voluntary, not required. Numerous other CCs are pre-defined; see the MIDI Specification for details.

    13. Pitchbend range is up to the receiving synth. MIDI pitchbend is kind of an odd duck. It’s defined to have 14-bit resolution (see above), but most synths simply toss out the LSB data and use the MSB, thus turning pitchbend into a 7-bit (0–127) message. But maybe that’s okay, because most pitchbend hardware only senses your moves with 7-bit resolution in the first place. This situation explains why some sequencers display pitchbend data with a range from –64 to +63, while others display it with a range from –8192 to +8191. As you can see, pitchbend is a bipolar message. Values range up and down from zero, zero being defined as concert pitch.

    There is a MIDI message with which you can set the pitchbend range of a receiving instrument, but not all synths will respond to it. To be honest, I don’t even know what the format of this message is. It’s part of the RPN (Registered Parameter Numbers) implementation of General MIDI (see below), and is of little use except for helping insure the standardization of Standard MIDI File playback.

    14. Bank Select is a mess. When MIDI was first created, the typical synthesizer could store 32, 40, or at most 64 programs in its memory. Nobody envisioned that someday instruments would have hundreds or even thousands of different programs on tap. As a result, the program change message can only have a value between 0 and 127. In order to get around this logjam, the Bank Select message was devised.
    Bank Select is part of the Continuous Controller area: It’s defined as CC0 (MSB) and CC32 (LSB). This means Bank Select is a 14-bit value, so a synth can have up to 16,384 memory banks, each containing 128 programs. More than enough.
    Trouble is, Bank Select is implemented differently by different manufacturers. Some synths, since they have only a dozen banks or so, will respond to a CC0 message by switching to a new bank, and no CC32 message is needed (though technically it’s required by the MIDI Specification). Others, also with a dozen banks, need to see both CC0 and CC32 messages, because the instruction about which bank to switch to will be contained in the CC32 message. In this case, the CC0 message will always be the same (a CC0 with a value of 0).
    Some synths will switch to a new bank immediately when they receive a new Bank Select (provided they have a bank with the right number), and others, because they assume a Bank Select will always be paired with a program change, will wait for the program change before switching. Some synths, because their banks only hold 50 or 64 programs, will let you get at two different banks with a single Bank Select message, and you’ll also have to offset the program change number by 50 or 64 to get the right program to load. And Kurzweil, which started supporting multiple banks before Bank Select was adopted, offers three different bank switching methods in their K2000/2500 instruments. To add to the confusion, some synths will appear to be ignoring Bank Select messages even when the messages are properly formatted, because some of their program banks contain only a few programs and many empty slots.
    Some sequencers will try to help you sort through this mess by offering several types of Bank Select, but ultimately the only way I’ve found to figure out which messages to send to a particular synth is by trial and error. Send it something and watch the front panel.
  3. -=BLADE=-

    -=BLADE=- Omnipotent Metal God

    Likes Received:
    Trophy Points:
    Final 5...

    15. There are four ways to turn off a stuck note. A stuck note is what happens when a synth receives a note-on message but never receives the matching note-off message. If the note was going to die out anyway because of the envelope in the synth preset — for instance, if you’re using MIDI to play drum sounds — you may never even notice that you had a stuck note. But if the synth tone sustains, it will sustain forever. If you’re on a gig when this happens, you’ve got a big, obvious problem.
    The most likely reason for a stuck note is because your sequencer software has a little tiny bug somewhere. But sometimes the OS of the receiving synth is at fault, and sometimes there’s an electrical problem somewhere in the MIDI wiring. Like, somebody tripped over a cable and unplugged it. (As it happens, MIDI has a method for stopping notes when a cable gets unplugged, but it’s not implemented on all synths.)
    MIDI defines an all-notes-off command. Clicking your sequencer’s “panic button” will send out an all-notes-off command on each of the 16 channels. But there are a few synths that don’t recognize the all-notes-off message, so the panic button may also be set up to send out 2,048 individual note-off messages, one for each MIDI note on each of the 16 channels.
    If the panic button doesn’t work, try sending a program change. Many synths — though by no means all of them — shut off any sounding notes when they switch to a new program. Still hearing the stuck note? If your synth has 32 or fewer voices, or if you’re playing a multi-voice layered sound, the mash-the-forearm-across-the-keyboard trick will probably do the job. The stuck note will go away when the synth has to reassign its voice(s) to play a new note.
    The most drastic solution is to switch the synth’s power off and back on. This is guaranteed to work. But if the stuck note happens to be on a sampler rather than a synth, and if you need to load 64MB of sounds into sample RAM in order to finish the set, you may not be out of the woods yet.

    16. Timing slop can be reduced. MIDI is fast enough (just barely) to let you play music and hear it without any perceptible time lags. If the MIDI performance starts to sound sluggish, though, there are several places where the data may have gotten backed up, and thus several possible solutions:
    Trying to send too much controller data down a single cable can cause notes to arrive late, because they have to wait their turn. This usually happens when a sequencer is playing back several channels that include pitchbends and CC data. Your sequencer will have commands that let you thin out the CC data. You may have even been recording controller data without realizing it. Aftertouch (which is not technically part of the continuous controller area but a separate type of message) is a notorious culprit: If you’re not using it for anything, you can strip it out of the sequencer track(s) entirely.
    Trying to start too many notes at the same moment on a single instrument can cause the instrument’s OS to back up like a slow drain. Your synth may be able to start, say, six or eight notes at a time with no perceptible slop, but if you program a thick 4-voice, 8-oscillator layer and then play a 10-note chord, you’re trying to start 80 oscillators at once. Solution: Either thin the layer by reprogramming it, or spread out the note-on messages a little.

    17. With Standard MIDI Files, you can move MIDI music from place to place. Quite early in the MIDI era, software developers realized it would be useful to have a standard file format that all sequencers could read and write, similar to Microsoft’s .RTF (Rich Text Format), which can be read by almost all word processors. The solution was the Standard MIDI File (SMF, file extension .MID). By saving your sequence data in SMF format, you can load it into any other sequencer, which you might want to do if you’ve updated to a new sequencer and don’t want to lose all your creative work.
    The Specification originally defined three file types — 0, 1, and 2 — but only 0 and 1 are generally used. In a type 0 file, all of the data is contained in a single track (but because each MIDI event has a channel number, it can be separated out into 16 tracks using a sequencer’s edit commands). A type 1 file includes multiple tracks, which can have track names. There’s even a provision in the SMF format for a sequencer with multiple MIDI outs (e.g., for 64 MIDI channels rather than 16).
    The SMF format has been expanded in recent years to include lyrics and other elements. A further development is the XMF file specification, which “bundles” SMFs with DLS (Downloadable Sound) data. What we don’t have (yet) is a standard file format that will describe things like audio tracks and audio effects.

    18. System-exclusive can keep your hardware up to date. Ten years ago, if your synth or effects processor needed an operating system update (to add new features or fix pesky bugs), you had to take it to a service center and pay to have a new chip inserted into a socket on the circuit board. Thanks to MIDI and the Internet, OS updates are much easier these days, and cheaper too. Many manufacturers post occasional updates on their websites. An update will be in the form of a Standard MIDI File (which can be loaded into any sequencer) containing a huge swath of system-exclusive data. .
    System-exclusive is used for other things as well, such as storing synth programs in editor/librarian software. You can build up a library of thousands of patches, sort them by category, and so on.

    19. General MIDI is a compromise, not a cure-all. Released in 1991, the General MIDI (GM) specification (see Fig. 4) was an ambitious but ultimately not an entirely successful attempt to overcome one of the basic limitations of MIDI. The problem is this: MIDI program change messages are simply numbers. They don’t tell you what sort of sound the receiving synth will switch to when it receives, say, program change 27 or 103. Could be a flute, could be a dog barking. You just never know.
    GM defined a list of 128 program names (including both instruments like marimba, muted trumpet, and rock organ and a few sound effects — helicopter, applause, gunshot, and so on). It also defined the way a set of drum sounds would correspond to MIDI note numbers, gave vague instructions about a few controller types, and so on. The idea was that this would allow composers and arrangers to create Standard MIDI Files (sequenced songs, in other words) that would sound the same no matter what MIDI tone module was used to play them. If you’re designing a website, for instance, you might like to have low-bandwidth music files that can play back in a musically sensible way on any computer that has a GM soundcard.
    The trouble is, the “overdriven guitar” on one GM synth may or may not sound similar to the supposedly identical program on another GM synth. As a result, a mix that sounds very respectable on one GM instrument may be a complete joke on another. On top of which, both Roland and Yamaha have released extended versions of the GM spec, called GS and XG, respectively. GS and XG are not identical, so the folks who develop Standard MIDI Files have to jump through some interesting hoops in an effort to insure that their music sounds halfway reasonable when played back on an unknown device.
    General MIDI doesn’t get as much press these days as it used to. The attention has shifted to two more recent attempts to do much the same thing — SoundFonts and Downloadable Sounds (DLS). These are both attempts to gain tighter control of how the music will sound by giving the instrument that will play the sounds (be it a soundcard, a hardware tone module, or a virtual synth living in a computer) the actual instrument tones that should be used for a given track. DLS was developed by the MIDI Manufacturers Association, SoundFonts by a private corporation (Creative Labs). The two specifications are not identical, so synth manufacturers have to choose whether to support one or both.

    Hope you’ve been dropping cookie crumbs, because we’re not out of the woods yet.

    20. The complete MIDI Specification is available from the MMA. At least, it’s complete through 1996. The numerous extensions made to the Spec since that time have been published separately, and most of them are available either for purchase or via a free download, but they haven’t yet been integrated into the main document. According to the MMA website www.midi.org, an updated document incorporating the recent additions will be ready before the end of 2002. The current version costs $49.95 plus shipping, and ordering information is available on the MMA site.

  4. smellyapple

    smellyapple New Member

    Likes Received:
    Trophy Points:
    your good lol. im new hiya :flamemad: heres my tip to add

    to reset midi if it sticks scroll down and reclick the mini driver setting
  5. neale

    neale New Member

    Likes Received:
    Trophy Points:
    Newbie to midi but not computers

    Hi I am trying to incorporate my new sata based computer with 8 usb plugs plus 2 usb3 ports into my home studio.

    Korg M3
    Br1600CD Hard disk recorder
    Focusrite scarlett usb external preamp and soundcard
    Mackie vlz? 3 small 8 channel mixer
    2 mackie reference speakers Hr824s i think

    Assuming all the necessary components can accept usb coms.

    My question is

    Can all comunication be done over usb, or do I have to have midi cables running?

    I have no midi in or outs on my compuetrs on board sound card.

    Any opinions and help would be appreciated oh by the way I was impressed with your 20 points on midi. It should be made available in a resources folder.

Share This Page