Many computer users share a surprisingly common misconception about MIDI files: they refer to and think of them as "audio" or "sound" files. Nothing could be further from the truth. In fact, honest-to-god MIDI files contain no sound at all. What they do contain is a score: information about which notes to play, when to play them, how loud to play them and so on. They are digital notesheets.
As with all notesheets, if sound is what you're after, somebody (or something) has to read them and use a music instrument to perform the song which they describe. In real life, a human musician might read a notesheet and perform the song on a piano. When the "notesheet" is a MIDI file, the player is typically a computer program and the instrument is a synthesizer or a sampler (often just a single-chip synthesizer mounted on your sound card). Give the same notesheet to musicians using different instruments, or play the same MIDI file on PCs with different sound card models, and the resulting sound might differ widely.
Compare this to an audio file like a WAV. A WAV contains a recording, i.e. a detailed representation not of a song but of the actual sound waves which the listener is supposed to hear. From a musician's point of view, no interpretation or performance is involved in playing a WAV, just faithful reproduction. Ideally, given the same WAV (or other audio file) two different computers will produce exactly the same sound.
As you can see, MIDI files and audio files are completely different beasts, each with its own strengths and weaknesses.
A note-by-note description of a song is ideal if you are a composer, since it allows you to change individual notes or other well-defined aspects of your composition (like tempo or instrument assignments and levels) without affecting anything else. In contrast, once a song has been recorded to audio, editing possibilities are extremely limited.
On the other hand, an audio file is the best choice if you are distributing a finished song to an audience. The last thing you want as a composer is for the listeners to hear not what you intended but what their sound cards come up with when asked to interpret your MIDI file. Besides, you may not be too happy about giving away your notes in a format which anyone can read and manipulate with minimal effort.
Not to mention that MIDI files are strictly instrumental; if you want to have lyrics, MIDI is limited to karaoke mode. A human voice requires an audio file.
What's wrong with this picture? Two things. One is that you see plenty of MIDI files online. There are public archives containing thousands of MIDI songs. That's certainly distribution, not production. Conversely, you do not see public archives containing thousands of WAV songs. Why is this, if audio is so great for distribution?
The answer is size. By their nature, MIDI files are very compact. A typical song only contains a few thousand notes. To hold them all, along with additional information like instrument assignments and volume levels, a few tens of kilobytes are plenty. That's like a moderately heavy GIF image; nothing to write home about. So MIDI files consume little disk space and bandwidth (neither of which is free for site owners) and load fast even through slow phone modems.
WAV files on the other hand are anything but compact. Describing sound waves at the same level of precision (i.e. sound quality) as an audio CD takes 10 MB of data per minute of play time, or roughly 1000 times more storage than a MIDI file of the same duration. You do not really want to download CD-quality songs in WAV format, even on a DSL line.
These considerations are what led to the mass adoption of MIDI as an online music distribution format in the early 90s. Like many things in life, it was a compromise. No, MIDI files were not invented as a means of distribution and they are far from ideal in that role, but they were still better than nothing.
Things got a little bit better with the creation of the GM (General MIDI) and GS (no acronym, just GS) standards. Their most important feature is a common instrument map: on a GM/GS device, MIDI instrument number 0 is always a grand piano, MIDI instrument number 46 is always a harp and so on. Before GM/GS, every MIDI file had to be accompanied by a description of instrument assignments ("channel 1 contains the notes for a string guitar, channel 2 the notes for a violin" and so on). With GM/GS, instrument assignments are embedded in the MIDI file, and the composer can trust that the intended instruments will be used.
Does this mean that MIDI now enjoys the main advantage of audio files, namely composer control over the resulting sound? No. You see, the GM/GS instrument maps only define instrument names. Yes, instrument 0 is always a grand piano, but every manufacturer, and in fact just about every GM/GS device model, has a different opinion on what a grand piano actually sounds like (the idea being that everybody should be free to make a "better" instrument). Play the same MIDI file using two different GM/GS-compatible devices, even closely related ones by the same manufacturer, and you will get two different results. The composer using GM/GS for distribution still doesn't know exactly what the audience will hear.
This was the unsatisfactory situation until the MP3 audio format entered the scene. By stripping non-essential information from sound data, MP3 encoding can reduce the size of a WAV file to about 1/10 of the original without excessive quality losses. This makes MP3 an acceptable compromise for online music distribution, especially with the advent of DSL and cable modems.
Remember, an MP3 file is an audio file stripped of non-essential information. To make one, you still need a WAV or equivalent audio file to feed into your MP3 encoder (MP3 encoders for Windows all read WAV files). So in order to get from MIDI to MP3, you must get from MIDI to WAV first.
There are essentially two ways to do this.
The obvious way is to set your MIDI instrument(s) playing and record the sound produced, the same way you'd record someone's voice. Chances are that your sound card comes with a built-in MIDI synthesizer which you can use to play MIDI files. To record and clean up its output (e.g. to remove leading and trailing silence from the recorded WAVs), you can use a sound editor like Ace of WAV:
But as great as Ace of WAV is, this is not a particularly good way to go from MIDI to WAV.
To start with, chances are that your sound card's built-in MIDI synthesizer isn't all that good. If it uses so-called FM synthesis it's actually downright awful; if it uses sample playback, it's severely constrained by the limited amount of sample data which can be crammed into a sound card's onboard memory. Memory is expensive, and consumer level sound cards must be cheap in order to sell. Sample-based sound cards therefore tend to use very short samples and lots of trickery in the form of tight looping (repetition) and generous application of default chorus and reverb effects to hide their poor sound quality (if you can, try turning off the effects to hear what your card's samples really sound like). Polyphony can also be a problem. More voices require more processing power, which is finite. Often, the first sign that you're running out is strange timing problems, with notes occasionally falling behind just enough for it to be noticeable. Low end sound cards also do not allow you to create your own instruments, nor edit existing ones.
The playback/recording process is inherently bad for sound quality. Consider the steps involved: the synthesizer creates a digital representation of a waveshape, which is passed through a DAC (Digital to Analog Converter) to produce an analog signal. The analog signal is fed through an amplifier circuit. From the amplifier, it's led to a ADC (Analog to Digital Converter) on the sound card where it's converted back to digital form, creating the samples which eventually end up in your WAV file. Each step (DAC, amplifier, ADC) causes a quality deterioration in the form of distortion and noise. Professional studio equipment avoids these traps by never crossing into the analog domain (i.e. the instruments have digital outputs feeding straight into digital hard disk recorders) but home gear is a different matter altogether.
Another fundamental difference between professional recording equipment and your average sound card is shielding. When an ADC step can't be avoided (i.e. whenever recording a real, analog sound source like a human voice) a digital studio will perform the conversion in a separate, well shielded hardware unit. In contrast, all your sound card's electronics (DAC, amplifier, ADC - the works) is stuck inside an extremely noisy electric environment, your computer's innards. Yes, the computer box is shielded so as not to jam the neighbour's phone, radio and TV set - but your sound card is on the wrong side of all that shielding!
So, what can you do if you want good, customizable samples without size limits, no polyphony limitations, no timing problems and clean, all-digital recording?
One way is to spend several thousand dollars on digital studio gear. You will have lots of fun with it and the hardware manufacturers will no doubt love you for it.
Another way is to reproduce the advantages of an all-digital studio inside your PC, essentially simulating one in software and letting it work on files rather than on real time audio streams.
Consider the advantages of this approach. If the synthesizer is actually a program running on your computer, and all you want from it is a WAV file, there is no need to feed its output to a sound card for recording. Just send the samples straight to a disk file and avoid all DAC/amplification/ADC noise and distortion. Since the synthesizer does not have to work in real time, finite processing power does not prevent the use of the best, most computationally intensive algorithms for top notch sound quality. For the same reason, instrument sample size, timing precision and polyphony are not limited as with synthesizers built for real time operation: when working on files, each voice can have all the time and temporary storage space it needs and still be precisely placed in the final mix.
This technique is known as MIDI to WAV rendering. Polyhedric Software makes the leading MIDI to WAV renderer on the market, WAVmaker:
The related MIDInight Express,
is not a renderer in the same sense as WAVmaker, since it's designed to work in real time, but it has the ability to copy its audio output to a WAV file. Note however that the requirement of real time operation makes it susceptible to many of the limitations discussed above. The WAV files which it creates are not CD quality, and there is no support for many of the more advanced features found in WAVmaker, like tune tables and effects. On the other hand, it's free.
There is also a software sampler, the Mellosoftron,
which is fully compatible with both WAVmaker and the MIDInight Express. You can use it to play WAVmaker and MIDInight Express instruments live or with a sequencer (even - horrors! - recording its output the bad old way). Its built-in editor is the recommended tool for editing WAVmaker and MIDInight Express instruments and for creating our own.