Classic Computer Magazine Archive START VOL. 2 NO. 4 / SPECIAL ISSUE #2

TAKE THE HEX OFF YOUR DATA

MIDI
VIEW

by JIM JOHNSON


By now, everyone in the music industry knows at least two critical facts about MIDI: It works, and the hottest MIDI computer available is the Atari ST. Beyond that, though, most musicians' knowledge of MIDI is less than perfect. That's where MIDI View comes in. MIDI View takes the MIDI data coming into your ST and translates it into plain-English descriptions-and you'll find it on your START Disk!

You'll find the program for this article in the file MIDIVIEW.ARC on your START Disk.

Part of the reason most musicians shy away from understanding MIDI is that most MIDI technical documents are a confusing collation of binary hex and decimal numbers, combined with a generous helping of poorly translated jargon. A typical tech manual for MIDI would give pause even to an experienced engineer. Another reason is that most musicians- even the hip keyboard player with the 64-voice monster sequencer system and an LED earring-are still technological primitives at heart. Just mention the words "serial interface" or "31.25 Khz baud rate" to the average musician, and watch the change in expression.

But the most important reason is that nearly all musicians take the way their instruments work on faith. Pluck a guitar string and you'll hear a note, whether you understand the physics and engineering of a guitar or not. Electronic musicians tend to take the transfer of MIDI data on faith, too. Connect the master synthesizer to the slave instrument, press a key on the master; and they should both play the same note.

But if they don't, what next? The answer to this, and just about any other MIDI technical question, is simple enough: We need a tool that will let us look directly at the MIDI data stream, without the need for a synthesizer or other musical instrument to translate that data into sound. That's what MIDI View does. Simply stated, MIDI View uses the rules set down in the MIDI 1.0 Detailed Specification to translate the MIDI information that arrives at the ST's MIDI port, and prints the explanation on the ST's screen in plain English. That way, you've got a fighting chance of figuring out what's running through your MIDI port, and how MIDI works- or fails to work.

Using The Program
To use MIDI View; first copy MIDIVIEW.ARC to a fresh disk, along with ARCX.TTP. Run ARCX, and when the Open Applications box appears type MIDIVIEW.ARC and press the Return key. Your disk drives will whir, messages on the screen will let you know that files are being uncompressed, and soon you'll return to the Desktop with a runnable version of the program, MIDIVIEW.PRG. on your disk.

MIDI View is probably one of the easiest-to-use MIDI programs that you'll find for the ST. First, connect your MIDI instrument's MlDl output to the ST's MIDI input. Next, double-click on MIDIVIEW.PRG. A box with simplified instructions on using the program will appear; click on the Exit box. Next, you can choose whether to print the data you get on the screen or the printer. For now, at least, select the screen. When you do, the screen will go blank, in anticipation of incoming MIDI data.

If messages start appearing immediately, press either the left or right Shift key. That should stop those messages (I'll explain what they mean in a moment).

Now play a few notes on your instrument, and you should see two columns of numbers and one of text on the ST's screen. Each row represents one byte that has come in through the ST's MIDI port. The number in the first column just shows how many MIDI bytes have been printed since the program started. The second number is the decimal value of the MIDI byte. The text column shows the program's interpretation of the MIDI byte. The message in this column will be different, depending on what keys you played and how your instrument sends MIDI data. Some messages will make sense immediately; other aspects may be a bit less obvious if you don't know much about MIDI.

Too Many Messages
What if your screen filled up with messages even before you played a note? That probably happened because some synthesizers, especially earlier models, send an Active Sense message every 300 milliseconds (about three times each second). The Active Sense message lets any receiving instruments know that the MIDI connection between them is still intact. This feature of MIDI has turned out to be not terribly useful, and isn't usually found on newer MIDI instruments.

Another possibility is that you're connected to a MIDI drum machine or sequencer, which send a continuous stream of Clock messages. That's more useful than Active Sense messages, but they'll still obscure any other; more important, MIDI data that come in.

Pressing one of the Shift keys solves the too-many-messages problem by filtering out these two message types. If you need to watch for these data types, you can stop filtering them out by pressing a Shift key again.

The only other keys MIDI View uses are the Alternate and Control keys. While you hold down the Alternate key, MIDI View will stop printing data. That allows you to examine the MIDI data stream at a more leisurely pace. Pressing the Control key leaves the program and returns you to the GEM desktop.

Now there's only one question left: What do all these MIDI messages mean?
 
 
1 144 Note On, Channel 1
2 60 C4
3 64 Velocity
4 60 C4
5 0 Velocity
6 144 Note On, Channel 1
7 62 D4
8 64 Velocity
9 62 D4
10 0 Velocity
11 144 Note On, Channel 1
12 64 E4
13 64 Velocity
14 64 E4
15 0 Velocity
16 192 Program Change, Channel 1
17 1 Data
18 144 Note On, Channel 1
19 61 C#4
20 64 Velocity
21 61 C#4
22 0 Velocity
23 176 Control Change, Channel 1
24 65 Partamento Switch
25 127 Value
26 192 Program Change, Channel 1
27 0 Data
 
Sample Output From Midi View

The MIDI Code
For those who have no familiarity with the MIDI spec, here's a little background on how MIDI communicates musical information. The individual bytes that make up a MIDI message are divided into two types: data bytes, which carry the actual data to be sent to the instrument, and status bytes, which tell the receiving instruments exactly what type of data is being sent. Status bytes always have a value of 128 or more, and data bytes are always 127 or less, which makes it easy to tell them apart.

The status bytes break down into four types, corresponding to the different classes of messages that can be sent via MIDI: Channel messages, System Common messages, System Exclusive messages and System Real Time messages. Channel messages are sent to individual instruments via one of MIDI's 16 channels, while System Common messages are sent to all instruments in the system. System Exclusive messages are used by individual manufacturers to send non-musical information (such as voice patches) to their instruments. System Real Time messages are used to synchronize sequencers, drum machines, and other time-dependent devices.

All the musical actions a musician can perform on a synthesizer; such as pressing a key, moving a wheel or pedal, selecting a sound or blowing into a breath controller, are translated into MIDI channel messages by the synthesizer; so these make up the bulk of what you'll be looking at with MIDI View.

When a key is pressed on a MIDI synthesizer a Note On message is sent. It tells you the note number of the key that was pressed and the velocity with which the key was pressed.

When a key is released, a number of different things could happen. MIDI does provide for a separate Note Off message, but it also allows the use of a Note On message with a velocity of zero to signal the end of a note. Most manufacturers these days use the Note On message. Roland instruments send an All Notes Off message anytime all the keys on an instrument are released; this has been known to cause problems when interfacing certain types of equipment, and is exactly the type of thing that MIDI View is good at tracking down.

Off The Keyboard
For a look at some of the other types of data handled by MIDI, move one of your synthesizer's wheels, levers, or pedals. You should see a long stream of data-either Continuous Controller or Pitch Bend messages, depending on which control you moved. Continuous Controller messages give the name of the controller and the controller's value; Pitch Bend messages carry pitch bend information. The meanings of the various continuous controllers weren't standardized until mid-1985, roughly two years after the birth of MIDI, so older instruments may not agree with MIDI View's interpretations. If something doesn't seem to match with your older MIDI instrument, try checking the manuals for information.

As you experiment with your MIDI instrument and MIDI View, you'll begin to get a handle on how MIDI really works. Try connecting each of your instruments to MIDI View in turn, and compare what you get on your screen from each key or controller. As you do, you'll become familiar with each of the different data types, and you should be able to start tracking down glitches, as well as any hidden features, that may be lurking in your equipment.

For example, I have a Yamaha KX5 remote keyboard. I discovered that whenever it's set to send on Channel 2, it sends a continuous stream of System Reset commands in place of the Active Sense message - a potentially disastrous bug that can only be tracked down with this type of program. 1 made another; more cheering, discovery with MIDI View when I found that my Ensoniq ESQ1 sends Note Off commands, complete with release velocity data, when keys are released, rather than the more common Note On/zero velocity combination. Only a few MIDI instruments recognize release velocity, but those that do allow the performer to control many aspects of the sound by how fast the keys are let up, or released, in addition to how fast they are struck.

Final Analysis
As it stands, MIDI View is a complete MIDI data analysis tool, and one that's bound to be a valuable part of any computer musician's software toolbox. If you're a programmer you'll find the C source code on your START Disk. You may want to try adding interpretation functions to deal with MIDI Time Code or the MIDI Sample Dump Standard, two recent additions to the MIDI spec. Or you could add more extensive filtering options, or any other functions you feel would be useful as you explore or troubleshoot your MIDI system - and analyze and understand what MIDI is all about.

If you'd like more articles like this, circle 194 on the Reader Service Card.

Jim Johnson is a freelance writer, musician and MIDI programmer whose writing has appeared in Keyboard and Electronic Musician.