MIDI files; the set-up measure. (section 1)
Definitions.
Before going into detail about what can be contained within a set-up measure, it's probably important to define exactly what is meant by the name.
Set-up in this case implies that within this part of the MIDI file there will be instructions to the sound module (e.g. MU128, SC-8850) or software (MS GS synth, SY50-XG, Roland VSC) that will
play the music to tell it exactly how it should set itself up, in order that it plays the notes, in the way that I or you, the programmer, or subsequent re-arranger of the file, want it to be played. A
Measure or bar is often, but not always, a set of four quarter-notes that beat Strong, Weak, Less strong, Weak to the count of
1, 2,
3, 4. Those of you who can read from a score won't need this last piece of information.
What's it all about?
We will, within our MIDI file, almost certainly want to define how loud the file is to be played and what the relative volumes are between the different instruments that are playing. We will definitely want to define which instrument will play on each of the 16 MIDI channels (more if you're lucky enough to own a 32 or 64 MIDI channel sound module). If our PA system is stereo then we'll want to pan the instruments around the sound stage. If it's mono we may want to pan the music to the left channel and have a click track, maybe for the drummer, on the right or vice versa. Then feed one to the PA the other to a monitor or to headphones.
We may in addition, if our sound module supports it, want to define the FX used such as reverb type i.e. room, hall, plate etc. If we can do this then we probably will want to define just how much of that reverb will apply to each instrument. There could well be other FX that we want to apply too such as chorus.
But,
over and above all these, if a MIDI file has been playing before the current file, then we probably need to make sure that any alteration to the default settings of controllers, made by playing that previous file, is either reset or changed to a more suitable setting.
So where are we going to put these commands that set up not only the overall way the sound module responds but also how each channel works within that overall set-up?
The set-up measure.
There's a good argument that says that there should be one musical measure (or bar) of say, 4/4 time, in which all these initiating commands are programmed into the MIDI file as a set-up sequence, and that should be the very first measure of the file. The musical notes (MIDI note on and note off instructions) will then start in bar two. Why not just spread the commands around in the file where they're needed? Well, yes, that can be done too if you like. But, if you've ever tried to modify a file created in this way, because it doesn't play quite the way you want it to on your system, then you'll realise that finding these set-up instructions within each track of your sequencer can be a nightmare and sometimes, when you make a modification, the most unexpected results can ensue because you've missed something in another place in the file. Hands up those who have experienced this.
A long pause?
Of course having a measure at the beginning with no musical notes in it implies that there will be some seconds of silence before the file begins to play. But with the creative use of the MIDI
Tempo that should be limited to about two seconds for even the most complex of set-up measures. And, if we're going to record our output to wav or mini-disk or to an mp3 file, then it's possible to remove that silence fairly simply using one of a variety of hardware or software tools. If, like many professionals, you prefer using the sound-module live, then there's probably even a way around this problem of initial silence (if it is a problem for you) by creating a
very short set-up measure, of less than a second, then perhaps having the hi-hat count in (
tick, tick,
tick, tick) whilst the rest of the set-up is done in parallel.
If even that is unacceptable, then we may just create the set-up measure at the start of the very first song in the set (or even in a separate tiny file, transmitted before the first song) and then put appropriate messages
at the end of every file so that each new file starts from square one. It may not be necessary to have a 4/4 bar as the set-up measure. It could be 3/4, 2/4 or even as small as 1/8. Its length will depend upon what you need to incorporate in the set-up measure for the sound module or software that you use.
There are many variations and combinations of different ways of doing this set-up, which, I'm aware, many of our more experienced people here are doing right now. And I imagine that, over time, those people have got used to each file's little idiosyncrasies. But what if there were a better way? I maintain that having the set-up measure first and editing it for each file is still the best way. I figure that most people can cope with a two second pause before the count in or before the song starts.
If you start by creating a MIDI file just one measure long with the set-up that suits your sound-module and then copy the song file that you use to measure two, then edit the instrument set-ups to suit yourself, you're likely to end up with good sounding MIDIs all the time. Now that's got to be worthwhile hasn't it?
-----------------------------------------------------------------
This is the first section of a multi-part article.
The second section will follow shortly.
-----------------------------------------------------------------
MIDI files; the setup measure. (section 2)
The need for a set-up measure
But why do we need to send these commands in the first place? Why don't all MIDI files just work properly?
Well, the fact is, that there's more than one way of setting up a MIDI file and it depends on which sound module, or software, you're using. If you've got an elderly sound card or module it may have been designed (in the early or mid-nineties) using the initial GM (General MIDI) standard. If the device was designed in 1998/9 or later then it may implement the GM2 (General MIDI 2) standard, which will give you more instrument sounds to choose from and some FX. If the device comes from Yamaha then it's likely to implement their XG (eXtended General MIDI) format. If it's from Roland or a recent copy of Windows Media player then it's likely to use the Roland GS standard.
But some sound modules, notably from both Yamaha and Roland, are capable of working in GM, GM2, GS and XG modes, depending what commands they're sent! (Both XG and GS extend a sound module's capabilities way beyond what was envisaged by the MMA, the MIDI Manufacturers Association who control the standards.) So it may be necessary to send a command to make sure the module plays the way the programmer intended, as far as possible, and for you to make the necessary alterations to those set-up instructions so that it plays correctly on your system.
The other issue that we face is that many people who create the MIDI files, that we may subsequently use, are probably first class musicians, but may not know all the technicalities of MIDI. So they may, for example, use a fade out at the end of the file, and leave an instrument's volume at, or close to, zero. They may use pitch bend and leave the control off centre meaning all subsequent notes on that MIDI channel will play out of tune. They may even change the pitch bend range away from its default of two semitones to, say, an octave. Then when you play the next file mayhem ensues!
So, there are numerous controls that can be modified and what we need to do is to make sure that they are all reset to their default settings before the next MIDI file begins to play and, maybe, modify them again.
-----------------------------------------------------------------------------------
Contents of the set-up measure - 1. Meta Data.
So what are we going to put into this set-up measure? Well the very first thing ought to be, what's known technically as, Meta-Data. Meta-data is information that is needed or stored by the sequencer about essentials of how the file is to be played, like beats per bar, tempo etc. It is also information that the programmer may want stored, like copyright data or the naming of tracks and channels or some text data. It is also information that may be displayed in some way like lyrics, sequence name or, if the sequencer can display notation information, then it might include key signature as well as transposition information for various instruments, whether both upper and lower staves are shown or just one or the other etc. This data is read into memory as the file is loaded and usually requires no time to process; it's just stored for the sequencer to use.
Contents of the set-up measure - 2. GM System On.
The next thing that we need in the file is a reset command. Why? Well, if it's not the
first file played since the sound-module was switched on, then the previous file
will have altered some settings. We could go around issuing set channel volume to 100 16 times, and set panpot to centre 16 times and so on but it's much simpler to insert one command that resets all the commonly used parameters to their default positions. This reset command is known as GM System On.
It's important that there is then a short period when no more commands are sent. Why? It can take a GM sound module up to 200 milliseconds (1/5th of a second) to implement this reset, it usually depends just how old the module is. (A response to a poll done by the MMA found that some MIDI devices could take up to 1 to 2 seconds to complete the GM on process!) Please note that there are a few things that the "GM On" message doesn't reset and this is quite deliberate.
-----------------------------------------------------------------------------------------------------
What GM On does
According to the MMA specification this is what a GM On message is supposed to do:
Set channel Volume (controller #7) to 100 (maximum is 127).
Set Expression Pedal (controller #11) to 127 (maximum).
Set channel Pan (controller #10) to 64 (centre).
All actions defined for the channel message Reset All Controllers (see next paragraph) should be implemented.
Those devices that respond to effects controllers #91 to #95, reset them to their defaults.
Any other actions to restore the device to GM power-up state e.g. Bank Select and Program Change to zero.
Many people use another MIDI command called "Reset All Controllers". The trouble is that this command is misnamed and only resets some of the controllers
not ALL. (Maybe it should be re-named "reset some controllers"?) As it's a
channel message we'll have to issue one to Reset each MIDI channel that could have been altered. (Maybe all 16 channels to be on the safe side?)
What Reset All Controllers does.
Again these are the MMA recommendations:
Set Modulation (controller #1) to zero.
Set Expression (controller #11) to 127 (maximum).
Set Pedals #64 to #67 to zero (minimum or off). (Sustain, Portamento, Sostenuto, Soft pedals.)
Set Registered (RPN) and Non-Registered (NRPN) Parameters LSB and MSB to null (127).
Set Pitch Bend to centre (64).
Reset Channel pressure to zero.
Reset Poly pressure to zero.
All other controllers should be set to zero.
(One of the RPNs controls Pitch Bend sensitivity i.e. the range of the Pitch Bend wheel.)
Note especially that no Bank Select or Program Change messages are altered.
-------------------------------------------------------------------------------------------------
Contents of the set-up measure - 3. GM2, GS or XG System On.
Now, if we are using a GM2 sound-module (from about 1999 on) or one from Roland or Yamaha then, if we intend to use the modules full capabilities i.e.
not just use it in GM mode, we almost certainly need to insert another type of reset to get things like FX and so forth back to their defaults. Surprisingly perhaps
these are known as GM2 System On, GS System On and amazingly XG System On. We need to insert just one of these, depending on the sound module we are using, after the GM On. 1/5th of a second after. As these sound modules are likely to have been made when electronics were becoming much faster they typically only need around 50 milliseconds (1/20th of a second) for the module to perform the reset.
It is these one (GM) or two (GM2 or GS or XG) System On messages that really should go at the beginning of the MIDI file, if at all possible, definitely before any note data and preferably before any Program Changes (instrument allocations). However, if we add up the two times that they take to implement we're only talking about 250 to 300 milliseconds (a quarter of a second or so) to implement them both. Surely most people can wait that long before the first tick of the count in? Along with these set-up messages, if we choose to use it, should go the command that sets the Master Volume i.e. the overall volume for the entire device. All these messages are what are known as System Exclusive (SysEx) messages and I'll detail their form for you later on the article.
Other system set-up messages.
The next things that must go into this measure, if we are going to use them, are the system set-ups for any sound effects that are to be used, an example, and the most commonly used, is Reverb Type. i.e. what acoustic do we want to surround the MIDI instruments playing. GM2 settings are Small Room, Medium Room, Large Room, Medium Hall, Large Hall and Plate. It's also possible with GM2, with Roland GS and with Yamaha XG compatible devices to define Reverb Time as well as Chorus Type and a several other effect types too. These parameters take very little time to implement (a few milliseconds) and will, unless you are setting-up many different devices simultaneously, take just a very short time to send. These are, pretty well, the only things that it's really essential to put in a set-up measure at the beginning of a MIDI file for the average live gig user.
-----------------------------------------------------------------------------------
Defining the instruments etc.
Once we've set up the sound-module's global parameters then we can start to define, channel by channel, what instrument sound will be used, how loud that instrument will be, whereabouts (left, centre, right) it appears and how it will use any Reverb, Chorus or other sound effect that has been pre-defined. These again
could all go in the set-up measure to make them easier to edit later, if necessary. But then again they could go all go at the beginning of the 2nd measure in channel order, or in the order in which the instruments sound,
all, that is, except for one.
Defining the Rhythm Channel drum set.
If we are to start the song with a count in measure (1, 2, 3, 4), say using the high-hat, and we intend to use a drum kit
other than the standard one defined in the GM MIDI spec. then we need to issue the commands to select that Rhythm kit
before we use it. So in this case we should insert those Rhythm Channel set-up commands within the first (set-up) measure too. In order to implement this non-standard Rhythm Channel assignment we have to insert a couple of commands for each channel we are using for drums. N.B. the GM2 spec allows us to use channel 11 as well as the default channel 10 for Rhythm Channels. If we're going to use a 2nd Rhythm Channel then we should, ideally, set it up at the beginning. Again I'll detail these commands later on in the article.
Getting the timing right.
Now, what is important, as we create the first and second measures, is that we insert those instructions (a) in the correct sequence and (b) that there is a sufficient timing gap between each instruction, especially the various System On messages. How do we do that? Well, very often this means that we have to switch into a more detailed view, often called the Event List, insert the commands and/or edit the timing of those commands within the MIDI file. A bit daunting perhaps when we first do it but actually very easy and even a bit boring once we've got used to it. I'll give some examples later.
Problems with timing?
Usually we define the instruments etc. in the main window of our software sequencer but, with many sequencers it will put all these Program Change messages at the same identical moment in the file, in terms of timing, and actually most sound-modules will cope with them without problem. However, when we start to use the more advanced Bank Select messages that allow us to allocate alternate voices for a given sound e.g. "wide grand piano" or "dark grand piano" as defined in GM2, GS and XG sound sets, then it is necessary to insert Bank Change messages which
must be implemented
before the Program Change. Quite often simple sequencers lump all the Bank Selects and Program Changes together at the same MIDI timing point within the file (usually at MIDI clock 000.00.000). The free JazzWare sequencer is particularly bad at this.
This can cause chaos and make the sound-module falter or even stop. So separating these messages by one MIDI pulse or tick and implementing them in the right sequence and channel-by-channel will prevent this problem. Examples coming right up.
-----------------------------------------------------------------------
Notice for beginners
Now, there's a great deal of information in those last paragraphs, and for some of you setting out on MIDI file modification for the first time, it's going to be a struggle understanding some of it. That's quite normal. Don't be put off. Go back and read the earlier articles, maybe have a cup of tea or coffee. Leave it for a day or two then come back and read it again. Let me re-assure you it will, eventually, start to make sense.
Or, of course, you can always ask me a question of clarification. That's what the forum is for.
--------------------------------------------------------------------------------
This is the 2nd section of a multi-part article. The nitty-gritty will follow in the next part.
--------------------------------------------------------------------------------
Since all the tables I created in the subsequent parts were written many years ago, and PHBB has been updated, I'll have to reformat them all.
If you're impatient for more, they can be seen in their original form over on my MIDI-tutor forum.
--------------------------------------------------------------------------------
Akai EWI4000s; Samson Graphite 49; Casio Privia PX-560; Yamaha AN1x; Novation X-Station 25;
Yamaha UW500; 2 x MU1000 + PLGs AN, DX, VL, PF & VL; VL70m; Roland SC8850; Steinberg UR22mkII;
Motu Micro Lite; E-MU 02 cardbus + 1616m. Finale 26; Sonar 7 PE and CbB; Yamaha XGworks v4; SQ01; SOL2;
Garritan GPO5; COMB2; JABB3; IO; Organs; Steinway; World; Harps; CFX Concert Grand.