page : Infos on Midi, Wav, and Mp3
Informations about Midi, Wav, and Mp3
You're probably not looking after technical details about sound file formats, and in anyway you won't find them here (for this kind of information you might want to go to Harmony central which will tell you a lot of things about MIDI data structures and programmation, for instance).
But you're indeed reading the right page if you're a little bit confused about all these file formats, and wondering why there are so many of them. Thus, I'll try to give here a few basic principles that I've found useful for my personal usage.
MIDI, a sound recipe
Driving a synthetiser or an electronic piano from the computer, or, conversely, sending to it, in a score editor, notes played on a keyboard... how are these miracles possible? They are because the computer and the sound device - which might be a basic soundcard - agree on some method to talk to each other by exchanging a set of commands known as MIDI standard.
Each event involves such a command labelled by a number; often some more data is added after the command in order to describe precisely what should be done. Thus, the beginning of a note is specified by some command followed by a number giving its pitch. Other commands specify the end of a note, its loudness, the amount of reverberation, etc.
Changing the program or patch is quite a remarkable event that specifies which instrument must be heard. By what will this instrument be played? By hardware and software installed at your home: soundcard and its drivers, synthetiser... That's why performances might sound quite differently, depending on the configuration, because each device holds its own sound samples, which were made more or less carefully, thus making each instrument sound with more or less truth, loudness, softness, etc.
And we're quite lucky, because General MIDI standard once put an end to a great cacophony: some time ago, sound devices were agreeing on basic MIDI commands, but not on instrument numbers; hence you could send a violin patch command, for instance, and ignore that some people were hearing a saxophone! Such proprietary instrument numberings still continue to exist - I don't know why - but, at least, everybody seems to agree to support this General MIDI mapping which insures a minimum of compatibility between various configurations.
Now, how is it possible that we hear different instruments at the same time? Well, first of all, because hardware allows that, like it does for some powerful multi-processor computers. Secondly, each of these playing modules is labelled by a chanel number. Most commands, like changing the instrument patch, are thus supplemented with the chanel number to which they must be sent; that's why one can change not only the instrument program, but also its loudness, its position in space, ... ; and this can be done for each chanel independantly.
To summarize about this first file format, two things must be emphasized:
- playing a MIDI file is not reproducing a performance, it's a new performance;
- such a file made of command numbers is quite small: a few thousands or dozens of thousands of bytes. That's why it's so popular on the net, since it can be downloaded very quickly.
WAV, tasting the meal
WAV files are nearly as old as micro-computers, but they seem to become up-to-date again, for several reasons:
But, what is a WAV file? It's the result of a sampling process: sound amplitude is measured dozens of thousands of times every second, and these values are collected in the file, which is therefore quite large - sometimes thousand times as large as a MIDI file! Such a file created by sampling can be compared to an image bitmap file; the higher the resolution - or the sampling frequency - the more faithful the result.
- some subtle details remain beyond the purpose of MIDI standard; WAV file format can reproduce them;
- the most recent soundcards allow to personnalize instrument patches; this dramatic improvement has its drawback however: it makes still more difficult to compare performances heard on various configurations;
- WAV format is a step in the process of creating an MP3 file which appeared recently and that we'll describe later.
The performance memorized in the file is the one heard on the source configuration on which it was recorded, involving its soundcard and drivers. In particular, original instrument patches and balance are memorized, and later reproduced rather faithfully on some other target configuration (rather, because loudspeakers, and only them, aren't involved here).
The most recent soundcards allow a personnalization of instrument patches: instead of being stored in some firmware memory chip on the card, instrument programs are loaded in computer's memory, and thus may be replaced by other soundfonts. While a MIDI performance obviously depends on soundfonts available on the target configuration, it's not the case for a WAV file which replays what was heard on the source configuration with its own soundfonts. You might consider this as a good point or not, depending on your taste and your patience in gathering faithful soundfonts, but, at least, will we be able to compare each other's experience when listening to the same performance.
WAV files are seldom made available on the net because of their size. The MIDI version of the introduction of Monteverdi's Vespers, for instance, has a size of 33 KB, while it's WAV version weights as much as... 20 MB!
MP3, fast food
The MP3 algorythm is an approximative compression technology, which allows to reduce WAV file sizes by a factor of 4 to 40 roughly.
Generally speaking, two main classes of compression techniques may be considered:
- An exact compression takes in account data redundancy; it's moderately efficient, but it can rebuild exactly the original data when uncompressing; this is necessary for some computer data files containing texts or programs, for instance. Let's imagine we're compressing this page; we would memorize once only the word soundfonts labelled by some number like 14 - why not - and then refer to it several times and save some space in the file; later on, the uncompressing program will rebuild the original text from the only instance of the expression memorized in the compressed file.
- An approximative compression is able to extract that part of data which is responsible for the most important part of the expected result. That is, we accept some loss of picture or sound quality, in exchange of saving a lot of space. The most versatile techniques allow to choose the compression ratio, and therefore the balance between size and quality. It's remarkable that such compressions are possible, but it must be said that they involve advanced mathematical techniques, applied to specific types of data. MP3 is just one of these techniques, relevant to sound files. Real audio is another one, which performs a higher compression but with a greater loss of quality. Such techniques are also available for pictures, resulting, for example, in JPEG file format, well known on the net.
The compression is made on the WAV file recorded on the source configuration. Size-quality balance still depends on our ideas about performances and telephone bills!
More about soundfonts
Better ones can dramatically improve a MIDI performance, if you accept to do some more work on the files: articulations and note velocities obtained with great effort under a given soundfont set won't be relevant anymore under another set, since the latter will show, most often, quite a different instrumental balance, and different reberveration rates, etc.
We could share our comments about a performance if I'd publish here all the fonts that were used for each file, but this would be rather boring and would lead to a few problems:
before making soundfonts available for download, I'd have to get each author's agreement;
I'd hardly be able to give soundfont names: they are are often quite obscure, and for this reason I changed many of them and forgot the original names;
last, soundfonts must match your soundcard, which I don't know (mine is SB Live).
However, these are three sites where you'll find soundfonts:
Hammer font library
The sound site
Hitsquad - Windows music software
For, I'm to publish MP3 files in a few relevant cases only: first, for large ensembles, for which instrumental balance is critical, and also in all these cases where outstanding soundfonts dramatically improve sound "truth".
For solo instruments, I'll let you look by yourself for fonts improving a standard MIDI performance; for example, I'd personally warmly recommand the soundfonts BHCello and German8 (harpsichord), that you'll find, IIRC, on the first site mentionned above. Don't get disappointed too quickly: some recorder, contrabass or voice patches are quite ridiculous indeed, but you'll find also a few gems, like this really fantastic organ pipes soundfont called Jeux_1_2. Good luck!
Soundfonts and the SBLive! card
The AudioHQ - Soundfont dialog box allows to load soundfonts into memory, up to a total size of 64 Mb.
You'll easily find better banks: Symphony Hall, Cadenza, etc. But they're much larger, and I'm not sure it's interesting to get them. Personnaly I prefer to start with a small medium quality bank, and then, when needed, improve instrument patches one after the other, like I'll explain just below.
Thus, each instrument patch, numbered from 0 to 127, can be personalized. A set of fonts with a patch for each of the instruments in the General MIDI mapping is called a sound bank.
Obviously, the better are the patches, the larger they are, and thus the same for the bank itself. To help us in finding a size-quality balance fitting our taste and hardware constraints, the card soft provides three factory banks of sizes 2, 4, and 8 Mb. They can't give an excellent sound for each instrument, but, at least, they let us start with an instrument patch for each number in the General MIDI table.
Loading instrument patches
In fact, nothing now prevents us to improve some instrument patch. To do that, let's choose an instrument number on the Configure instrument tab, then load a soundfont for that instrument. This font will be played instead of the one included in the original bank at the same instrument number.
I don't have the English version of the SBLive! software, thus, I'm re-translating menu options and tab labels from French; the original English ones might be slightly different.
We could do so for each poor instrument patch in the bank, when we find better soundfonts... Of course, each time we load a font, we use a little bit more of the maximum allowed 64 Mb of memory.
Loading another bank
After some time, one finds that a single configuration won't fit all situations. First, many pieces don't need every instrument. Then, depending on the piece, some instrumental family (choir, strings, ...) may be more critical than others to get the best possible result. Last, some fonts include several instrumental patches, and therefore can't be loaded as single instruments. (the Jeux d'orgues soundfont is such an example).
That's why the Configure bank tab allows to load new banks, or instrumental families: open the Select bank list, choose a number which is free (with an Empty mention), and load some soundfont.
Now, going back to the instruments tab, we could also improve some instruments in this new bank, by loading single instrument patches.
Good news: when several banks use the same font in order to improve the same instrument patch (for instance: harpsichord), the corresponding amount of memory will be used only once.
The default bank, numbered 000, is the one heard when playing a MIDI file which doesn't contain any bank switching command. Therefore:
- You'll hear a difference every time you'll load a different instrument in bank 000;
- But, if you can't edit the MIDI file, you won't be able to switch to a different bank;
- To switch to another bank, you'll have to insert commands in the MIDI file.
To switch to another bank, the SBLive card expects a Controller 0 command, followed by the new bank number. Let's assume we've loaded the Jeu d'orgues soundfont as bank 1; this bank contains dozens of jeux (Ripieno, Montre, Grand jeu, ...). To hear it, we'll just have to insert a Control 0 1 command at the beginning of the MIDI file, with some sequencer or score editor.
Soundfonts and Encore editor
Under this score editor, banks will appear as devices in the Staff sheet window!
You'll notice a difference of 1 in the way instruments are numbered by Encore and by the AudioHQ - Sounfont dialog, just because the range is 0 to 127 in one soft, but is 1 to 128 in the other one. This difference has no practical consequence.
Let's open this window, then click on the Program name column, and open the Device list; it displays several device maps: Generic, General Midi, Roland MT32, Kawai K1, etc. Let's learn a little more about this list, by having a look at the Devices directory under your Encore installation path (that is C:\Encore\Devices for most of you).
Find, then open the Devices.ini file, it will look like that :
These devices are those appearing when opening the list in the Staff sheet window. By the way, if you're never using Roland MT32 and a few others, you can make this list smaller by replacing some the corresponding lines with this:
And now, what about the numbers at the beginning of each line? Each of them refers to one of the files Dev0.ini, Dev1.ini, ... in the Devices directory. Such a file describes a mapping that will be shown in the Staff sheet window when choosing this device. If you open Dev1.ini, for example, you'll see the quite familiar General MIDI table:
Installing a bank in Encore
Now, how will we install that Jeu d'orgues soundfount, assuming that we've loaded it as bank 1, for example? Well, I'll just tell you how I did that (I don't pretend I've discovered all that can be done):
I save the original Devices.ini, then I edit it: finding the first line with NOT_IN_USE for which no corresponding Dev.ini file exists in the directory, I write into it the name of the new bank:
Now we have still to create the Dev11.ini file, by looking at the instruments available for the Jeux d'orgues soundfont in the AudioHQ - Soundfont dialog:
4=Montre 8 Prestant 4
5=Principal (g.o.) 8+4+2
I guess you know what will happen now when we'll open the Devices list in the Staff sheet window: we'll be able to choose the Jeux d'orgues device (!); this will show its mapping table, and we'll be able to change the jeu exactly the same way we're used to change an instrument! Beware, don't forget that this will work only if we haven't forgotten to insert a swich to bank 1 command at the beginning of the file...
I hope this example will give you some insight to try other combinations ; in anyway, at the moment I'm writing, I don't know more than that! By the way, I'd be indebted if you would send me a message about other discoveries that you might have done...