Sunday, July 26, 2015

The Many Meanings of MIDI in PC Gaming

We all know that MIDI stands for Musical Instrument Digital Interface, but the acronym was often taken to mean a great many things to a great many people.  Let's explore some of the common contexts where MIDI is applied.

MIDI Interface

First we have a "MIDI Interface".  This is rather redundant, because when you give words to the letters, it becomes Musical Instrument Digital Interface Interface.  However, because the use of the term MIDI is so broad, we use MIDI Interface to distinguish between other uses of the term like MIDI Module or MIDI Music.

So what is a MIDI Interface?  Well, in terms of hardware, MIDI communication is accomplished by a serial-based transfer at 31,250 baud using current loop signaling.  Typically, MIDI devices are connected through 5-pin DIN plugs. Miniature versions of the MIDI connector exist, but the pinouts are not necessarily going to be identical across manufacturers.  How data was supposed to be sent and received within those parameters was left up to the individual members of the MIDI Manufacturer's Association.

After much evolution, the PC world settled on a UART-compatible MPU-401 Interface.  This interface just sends bytes to and receives bytes from other MIDI compatible devices.  It is little more than an I/O port which can be tied to an IRQ line, and it really does not get any more simple than that.

Historically, there were many MIDI Interfaces, and most were incompatible with each other.  The "Full/Intelligent" Roland MPU-401 supports a simple UART-only mode that eventually became the standard. IBM had its own MIDI Interface in its IBM Music Feature Card.  Both of these Roland and IBM interfaces had many features beyond simple I/O, but PCs became powerful enough to perform most of the special functions that these devices handled on slow PCs.  IBM's card was too pricey considering the sound quality of its built-in synthesizer and it really did not catch on.  However, early games and MIDI Sequencers supported the enhanced features of both the Roland and IBM MIDI Interfaces.

MIDI Interfaces by themselves do not produce sound.  Originally, MIDI Interfaces came without MIDI Synthesizers on them.  The Roland MPU-401 was originally a breakout box with the interface hardware and an interface card to send to and receive data from a computer.  Only when you attached a MIDI Synthesizer to the MPU-401 via a 5-pin DIN cable would you be able to hear sound.  The last iteration of the Roland MPU-401, the MPU-401/AT, is an internal ISA expansion card with the ability to produce sound when a MIDI Synthesizer is connected to it on its waveblaster connector.  Without the waveblaster daughterboard, it just acts like a MIDI Interface.

Sound cards, beginning with the Sound Blaster, often came with MIDI Interfaces.  These interfaces were very basic in their functionality but no two manufacturer's interfaces worked alike.  The Pro Audio Spectrum and the Covox Sound Master II also had their own unique MIDI Interfaces.  Support was lukewarm from games.  Only with a Sound Blaster 16 or a Pro Audio Spectrum 16 (rev. D or later) were UART-only MPU-401 compatible interfaces implemented.  These interfaces typically used some of the unused pins on a gameport for the MIDI In and Out signals, requiring an external box or adapter to provide the 5-pin DINs MIDI modules of the day expected.

Even though the Sound Blaster and similar sound cards have a MIDI interface, it is completely independent of the FM Synthesis chip found on the card.  The MIDI Interface does not communicate with the FM Synthesis on the card in any way.  Unfortunately the MIDI Interface has to coexist with the digital audio capabilities of the Sound Blasters, causing no end of troubles.

Some MIDI modules like the Roland SC-55mkII could connect to a PC or a MAC via serial port.  They came with a special cable and they used Windows and Macintosh drivers.  When USB displaced most other low-bandwidth I/O devices, companies began releasing USB MIDI Interfaces, which still used the 5-pin DINs.  Even more recently, many MIDI devices connect directly by a USB cable to a computer.

MIDI Synthesizer

A MIDI Synthesizer is one that will acknowledge and respond to MIDI commands and generate sound.  There are many, many MIDI commands, sometimes called messages.  Program Change, Control Change, Pitch Bender, Velocity, Mode, After Touch, Note Number, System Common, System Real Time, Auxillary Message and System Exclusive are the main MIDI messages.  They have no relations to the commands sent to a MIDI Interface.

MIDI Synthesizers come in many shapes and sizes.  There are MIDI Keyboards like the Roland D-50 and MIDI Sound Modules like the Roland MT-32.  They are external to the PC and are connected via a 5-pin DIN.  Then there are sound cards with a MIDI Synthesizer like the IBM Music Feature Card and the Roland LAPC-I.  These two cards have both a MIDI Synthesizer and a MIDI Interface.  Finally, there are sound cards with a header for a MIDI Synthesizer on a daughterboard.  The Waveblaster-header designed by Creative Labs is an example of this. In virtually every case, the Synthesizer portion is connected only via MIDI Out, not MIDI In.  The waveblaster's MIDI Out signal is the same signal as being output via the gameports of the card on which it is found.

Many of the internal devices, whether on a card or attached via a waveblaster header, have a corresponding external device.  Here is a short table :

Internal Device Device Type External Device Equivalent
IBM Music Feature Sound Card Yamaha FB-01
Roland LAPC-I Sound Card Roland CM-32L
Roland SCC-1 Sound Card Roland SC-55
Roland SCB-7 Daughter Board Roland SC-7
Roland SCB-55 Daughter Board Roland SC-55mkII
Yamaha DB50XG Daughter Board Yamaha MU10XG
Yamaha SW60XG Sound Card Yamaha MU10XG
Korg Ai20 Daughter Board Korg AG-10

Some people make the distinction between a MIDI Synthesizer and a MIDI Sound Generator or Sound Module.  A user can use an MT-32 to create new instruments and is called a Synthesizer.  A device that can only modify existing instruments is often called a Sound Generator.

MIDI 1.0 and General MIDI

The original MIDI Specification, 1.0, defined the communications protocol and the commands to which MIDI devices must respond.  One of the most important commands is Program Change, whereby a MIDI Synthesizer can change one of the instruments it is using.  In one module, a Program Change 01 could indicate a Grand Piano, and in another synthesizer, 01 could be an electric guitar.  MIDI music would sound correct only on the module for which it was composed.  In PC Gaming, early games that supported MIDI gave the user a choice of devices which the game supported.  The only device to gain widespread acceptance at this time was the Roland MT-32.

Another important type of MIDI command is the System Exclusive message.  This message is only intended for a particular synthesizer or module, and is typically used to access the hardware of the module.  In the MT-32, new sounds are sent to the module's memory via System Exclusive messages.  A MT-32 compatible module like the CM-32L will also accept these messages, but a non MT-32 compatible device like the Yamaha DX-7 should ignore them.

In 1991, the MIDI Manufacturers Association agreed on a new standard called General MIDI.  General MIDI compatible synthesizers would share the same basic instrument map.  On a General MIDI compatible Synthesizer, a Program Change 01 command would always give a Piano regardless of the model or manufacturer of the Synthesizer.  There were also other basic specifications a device would have to meet, such as the number of simultaneous notes (polyphony) and being able to respond on MIDI Channels 1-16. The Roland SC-55 is probably the first MIDI Synthesizer to be General MIDI compatible, although it was released before the General MIDI standard was finalized.  The early revisions are unofficially General MIDI compatible and the later revisions are officially General MIDI compatible.  General MIDI does not displace the ability to use System Exclusive commands to get the best performance out of a MIDI module, but such tinkering was far less common after General MIDI became quickly accepted.

Further extensions to General MIDI, like Roland GS and Yamaha XG, were essentially company-specific standards that were not often used in games.  Most games did not usually go beyond the specifications of General MIDI.  An MT-32 could be made much more General MIDI compatible with a utility.  Typically a MIDI Synthesizer would respond to 128 Program Changes, giving you 128 instruments.  Roland and Yamaha's extensions gave you the ability to select instrument variations via 128 Control Change commands, thereby giving you a theoretical access to 16,384 instruments.  No MIDI Synthesizer of the day came close to that number.

MIDI Music

A great deal of MIDI Music is found in a Standard MIDI Format file, which has a .mid extension.  It contains all the information needed to play back a song, the commands, the notes, and the timestamps.  Eventually, game developers found this basic format too limiting, so they came up with extensions like XMI, EMIDI and many more.  SMF files can transmit data specific to modules like the MT-32 as well as data more accepted by any MIDI Synthesizer.  MIDI Music is usually composed with a MIDI Sequencer program like Cakewalk or Sequencer Plus Gold.

MIDI Music has got something of a bad reputation for sounding cheesy and unrealistic.  If you equate MIDI Music with FM Synthesis, then there may be some truth to the charge.  Most PC gamers used FM Synthesis in the early 90s because hardware MIDI devices were very expensive.  Also, not every MIDI device was made equally.  The Roland SC-55, despite having only 3MB for instrument and drum samples, (and only 2MB of that was typically used), usually sounds much better than the Creative Waveblaster, which had 4MB for samples, and can hold its own against the Yamaha XG MIDI Synthesizers, which came with 4MB or more for samples.  The SC-55's samples were well chosen and well balanced, making it the best overall option for PC games by developers and players.  When music that is composed for an MT-32 or SC-55 is ported to the FM Synthesis chip found Sound Blaster, the results are frequently unimpressive.

Any device that can respond to MIDI commands can play back MIDI Music.  Without a software driver, FM Synthesis chips like the OPL2 and OPL3 as found on the Adlib and Sound Blaster cards do not accept MIDI commands.  Nor does the EMU8000 found in the AWE32 and AWE64.  By contrast, the FM Synthesis chip found in the IBM Music Feature will respond to MIDI commands.  However, MIDI does not care what method the device uses for producing sound, whether PSG-style Synthesis, FM Synthesis, PCM Sample Playback or something in between.  In order for a non-MIDI device to respond to MIDI commands, a software interpreter or driver must be used.

No comments: