Midi Tutorial
Midi Tutorial
Midi Tutorial
MIDI Tutorial
Table of Contents
Tutorial on MIDI and Music Synthesis............................................................................................................1
Introduction .............................................................................................................................................1
MIDI vs. Digitized Audio........................................................................................................................1
MIDI Basics.............................................................................................................................................1
MIDI Messages........................................................................................................................................4
Channel Voice Messages.........................................................................................................................4
Note On / Note Off / Velocity....................................................................................................4
Aftertouch...................................................................................................................................4
Pitch Bend...................................................................................................................................5
Program Change.........................................................................................................................5
Control Change...........................................................................................................................5
Channel Mode Messages.........................................................................................................................6
System Messages.....................................................................................................................................6
System Common Messages........................................................................................................6
System Real Time Messages......................................................................................................6
System Exclusive Messages.......................................................................................................7
Running Status.........................................................................................................................................7
MIDI Sequencers and Standard MIDI Files............................................................................................7
Synthesizer Basics...................................................................................................................................8
Polyphony...................................................................................................................................8
Sounds.........................................................................................................................................8
Multitimbral Mode......................................................................................................................8
The General MIDI (GM) System.............................................................................................................9
Synthesis Technology: FM vs. Wavetable...............................................................................................9
Wavetable Synthesis Techniques...........................................................................................................10
Looping and Envelope Generation...........................................................................................10
Loop Length..............................................................................................................................12
OneShot Sounds.....................................................................................................................12
Sample Editing and Processing.................................................................................................12
Sample Data Compression........................................................................................................13
Pitch Shifting............................................................................................................................13
Interpolation..............................................................................................................................14
Oversampling............................................................................................................................15
Splits.........................................................................................................................................15
Aliasing Noise...........................................................................................................................15
LFOs for Vibrato and Tremolo.................................................................................................15
Layering....................................................................................................................................16
Digital Filtering.........................................................................................................................16
Connecting MIDI devices to your PC....................................................................................................16
Microsoft Windows Systems....................................................................................................17
Summary................................................................................................................................................18
Introduction
The Musical Instrument Digital Interface (MIDI) protocol has been widely accepted and utilized by musicians and composers since
its conception in 1983. MIDI data is a very efficient method of representing musical performance information, and this makes
MIDI an attractive protocol not only for composers or performers, but also for computer applications which produce sound, such as
multimedia presentations or computer games. However, the lack of standardization of synthesizer capabilities hindered applications
developers and presented new MIDI users with a rather steep learning curve to overcome.
Fortunately, thanks to the publication of the General MIDI System specification, wide acceptance of the most common PC/MIDI
interfaces, support for MIDI in Microsoft WINDOWS and other operating systems, and the evolution of lowcost music
synthesizers, the MIDI protocol is now seeing widespread use in a growing number of applications. This document is an overview
of the standards, practices and terminology associated with the generation of sound using the MIDI protocol.
MIDI Basics
The Musical Instrument Digital Interface (MIDI) protocol provides a standardized and efficient means of conveying musical
performance information as electronic data. MIDI information is transmitted in "MIDI messages", which can be thought of as
instructions which tell a music synthesizer how to play a piece of music. The synthesizer receiving the MIDI data must generate the
actual sounds. The MIDI 1.0 Detailed Specification provides a complete description of the MIDI protocol.
The MIDI data stream is a unidirectional asynchronous bit stream at 31.25 Kbits/sec. with 10 bits transmitted per byte (a start bit, 8
data bits, and one stop bit). The MIDI interface on a MIDI instrument will generally include three different MIDI connectors,
labeled IN, OUT, and THRU. The MIDI data stream is usually originated by a MIDI controller, such as a musical instrument
keyboard, or by a MIDI sequencer. A MIDI controller is a device which is played as an instrument, and it translates the
performance into a MIDI data stream in real time (as it is played). A MIDI sequencer is a device which allows MIDI data sequences
MIDI Tutorial
to be captured, stored, edited, combined, and replayed. The MIDI data output from a MIDI controller or sequencer is transmitted
via the devices' MIDI OUT connector.
The recipient of this MIDI data stream is commonly a MIDI sound generator or sound module, which will receive MIDI messages
at its MIDI IN connector, and respond to these messages by playing sounds. Figure 1 shows a simple MIDI system, consisting of a
MIDI keyboard controller and a MIDI sound module. Note that many MIDI keyboard instruments include both the keyboard
controller and the MIDI sound module functions within the same unit. In these units, there is an internal link between the keyboard
and the sound module which may be enabled or disabled by setting the "local control" function of the instrument to ON or OFF
respectively.
The single physical MIDI Channel is divided into 16 logical channels by the inclusion of a 4 bit Channel number within many of
the MIDI messages. A musical instrument keyboard can generally be set to transmit on any one of the sixteen MIDI channels. A
MIDI sound source, or sound module, can be set to receive on specific MIDI Channel(s). In the system depicted in Figure 1, the
sound module would have to be set to receive the Channel which the keyboard controller is transmitting on in order to play sounds.
Information received on the MIDI IN connector of a MIDI device is transmitted back out (repeated) at the devices' MIDI THRU
connector. Several MIDI sound modules can be daisychained by connecting the THRU output of one device to the IN connector
of the next device downstream in the chain.
Figure 2 shows a more elaborate MIDI system. In this case, a MIDI keyboard controller is used as an input device to a MIDI
sequencer, and there are several sound modules connected to the sequencer's MIDI OUT port. A composer might utilize a system
like this to write a piece of music consisting of several different parts, where each part is written for a different instrument. The
composer would play the individual parts on the keyboard one at a time, and these individual parts would be captured by the
sequencer. The sequencer would then play the parts back together through the sound modules. Each part would be played on a
different MIDI Channel, and the sound modules would be set to receive different channels. For example, Sound module number 1
might be set to play the part received on Channel 1 using a piano sound, while module 2 plays the information received on Channel
5 using an acoustic bass sound, and the drum machine plays the percussion part received on MIDI Channel 10.
MIDI Tutorial
MIDI Tutorial
MIDI Messages
A MIDI message is made up of an eightbit status byte which is generally followed by one or two data bytes. There are a number
of different types of MIDI messages. At the highest level, MIDI messages are classified as being either Channel Messages or
System Messages. Channel messages are those which apply to a specific Channel, and the Channel number is included in the status
byte for these messages. System messages are not Channel specific, and no Channel number is indicated in their status bytes.
Channel Messages may be further classified as being either Channel Voice Messages, or Mode Messages. Channel Voice Messages
carry musical performance data, and these messages comprise most of the traffic in a typical MIDI data stream. Channel Mode
messages affect the way a receiving instrument will respond to the Channel Voice messages.
Aftertouch
Some MIDI keyboard instruments have the ability to sense the amount of pressure which is being applied to the keys while they are
depressed. This pressure information, commonly called "aftertouch", may be used to control some aspects of the sound produced by
MIDI Messages
MIDI Tutorial
the synthesizer (vibrato, for example). If the keyboard has a pressure sensor for each key, then the resulting "polyphonic aftertouch"
information would be sent in the form of Polyphonic Key Pressure messages. These messages include separate data bytes for key
number and pressure amount. It is currently more common for keyboard instruments to sense only a single pressure level for the
entire keyboard. This "Channel aftertouch" information is sent using the Channel Pressure message, which needs only one data byte
to specify the pressure value.
Pitch Bend
The Pitch Bend Change message is normally sent from a keyboard instrument in response to changes in position of the pitch bend
wheel. The pitch bend information is used to modify the pitch of sounds being played on a given Channel. The Pitch Bend message
includes two data bytes to specify the pitch bend value. Two bytes are required to allow fine enough resolution to make pitch
changes resulting from movement of the pitch bend wheel seem to occur in a continuous manner rather than in steps.
Program Change
The Program Change message is used to specify the type of instrument which should be used to play sounds on a given Channel.
This message needs only one data byte which specifies the new program number.
Control Change
MIDI Control Change messages are used to control a wide variety of functions in a synthesizer. Control Change messages, like
other MIDI Channel messages, should only affect the Channel number indicated in the status byte. The Control Change status byte
is followed by one data byte indicating the "controller number", and a second byte which specifies the "control value". The
controller number identifies which function of the synthesizer is to be controlled by the message. A complete list of assigned
controllers is found in the MIDI 1.0 Detailed Specification.
Bank Select
Controller number zero (with 32 as the LSB) is defined as the bank select. The bank select function is used in some synthesizers in
conjunction with the MIDI Program Change message to expand the number of different instrument sounds which may be specified
(the Program Change message alone allows selection of one of 128 possible program numbers). The additional sounds are selected
by preceding the Program Change message with a Control Change message which specifies a new value for Controller zero and
Controller 32, allowing 16,384 banks of 128 sound each.
Since the MIDI specification does not describe the manner in which a synthesizer's banks are to be mapped to Bank Select
messages, there is no standard way for a Bank Select message to select a specific synthesizer bank. Some manufacturers, such as
Roland (with "GS") and Yamaha (with "XG") , have adopted their own practices to assure some standardization within their own
product lines.
RPN / NRPN
Controller number 6 (Data Entry), in conjunction with Controller numbers 96 (Data Increment), 97 (Data Decrement), 98
(Registered Parameter Number LSB), 99 (Registered Parameter Number MSB), 100 (NonRegistered Parameter Number LSB),
and 101 (NonRegistered Parameter Number MSB), extend the number of controllers available via MIDI. Parameter data is
transferred by first selecting the parameter number to be edited using controllers 98 and 99 or 100 and 101, and then adjusting the
data value for that parameter using controller number 6, 96, or 97.
RPN and NRPN are typically used to send parameter data to a synthesizer in order to edit sound patches or other data. Registered
parameters are those which have been assigned some particular function by the MIDI Manufacturers Association (MMA) and the
Japan MIDI Standards Committee (JMSC). For example, there are Registered Parameter numbers assigned to control pitch bend
sensitivity and master tuning for a synthesizer. NonRegistered parameters have not been assigned specific functions, and may be
used for different functions by different manufacturers. Here again, Roland and Yamaha, among others, have adopted their own
practices to assure some standardization.
Pitch Bend
MIDI Tutorial
System Messages
MIDI System Messages are classified as being System Common Messages, System Real Time Messages, or System Exclusive
Messages. System Common messages are intended for all receivers in the system. System Real Time messages are used for
synchronization between clockbased MIDI components. System Exclusive messages include a Manufacturer's Identification (ID)
code, and are used to transfer any number of data bytes in a format specified by the referenced manufacturer.
MIDI Tutorial
The System Real Time messages are the Timing Clock, Start, Continue, Stop, Active Sensing, and the System Reset message. The
Timing Clock message is the master clock which sets the tempo for playback of a sequence. The Timing Clock message is sent 24
times per quarter note. The Start, Continue, and Stop messages are used to control playback of the sequence.
The Active Sensing signal is used to help eliminate "stuck notes" which may occur if a MIDI cable is disconnected during playback
of a MIDI sequence. Without Active Sensing, if a cable is disconnected during playback, then some notes may be left playing
indefinitely because they have been activated by a Note On message, but the corresponding Note Off message will never be
received.
The System Reset message, as the name implies, is used to reset and initialize any equipment which receives the message. This
message is generally not sent automatically by transmitting devices, and must be initiated manually by a user.
Running Status
Since MIDI data is transmitted serially, it is possible that musical events which originally occurred at the same time and must be
sent one at a time in the MIDI data stream may not actually be played at exactly the same time. With a data transmission rate of
31.25 Kbit/s and 10 bits transmitted per byte of MIDI data, a 3byte Note On or Note Off message takes about 1 ms to be sent,
which is generally short enough that the events are perceived as having occurred simultaneously. In fact, for a person playing a
MIDI instrument keyboard, the time skew between playback of notes when 10 keys are pressed simultaneously should not exceed
10 ms, and this would not be perceptible.
However, MIDI data being sent from a sequencer can include a number of different parts. On a given beat, there may be a large
number of musical events which should occur simultaneously, and the delays introduced by serialization of this information might
be noticeable. To help reduce the amount of data transmitted in the MIDI data stream, a technique called "running status" may be
employed.
Running status considers the fact that it is very common for a string of consecutive messages to be of the same message type. For
instance, when a chord is played on a keyboard, 10 successive Note On messages may be generated, followed by 10 Note Off
messages. When running status is used, a status byte is sent for a message only when the message is not of the same type as the last
message sent on the same Channel. The status byte for subsequent messages of the same type may be omitted (only the data bytes
are sent for these subsequent messages).
The effectiveness of running status can be enhanced by sending Note On messages with a velocity of zero in place of Note Off
messages. In this case, long strings of Note On messages will often occur. Changes in some of the MIDI controllers or movement
of the pitch bend wheel on a musical instrument can produce a staggering number of MIDI Channel voice messages, and running
status can also help a great deal in these instances.
MIDI Tutorial
information to be sent along with the MIDI messages.
However, if the MIDI data is to be stored as a data file, and/or edited using a sequencer, then some form of "timestamping" for the
MIDI messages is required. The Standard MIDI Files specification provides a standardized method for handling timestamped
MIDI data. This standardized file format for timestamped MIDI data allows different applications, such as sequencers, scoring
packages, and multimedia presentation software, to share MIDI data files.
The specification for Standard MIDI Files defines three formats for MIDI files. MIDI sequencers can generally manage multiple
MIDI data streams, or "tracks". Standard MIDI files using Format 0 store all of the MIDI sequence data in a single track. Format 1
files store MIDI data as a collection of tracks. Format 2 files can store several independent patterns. Format 2 is generally not used
by MIDI sequencers for musical applications. Most sophisticated MIDI sequencers can read either Format 0 or Format 1 Standard
MIDI Files. Format 0 files may be smaller, and thus conserve storage space. They may also be transferred using slightly less system
bandwidth than Format 1 files. However, Format 1 files may be viewed and edited more directly, and are therefore generally
preferred.
Synthesizer Basics
Polyphony
The polyphony of a sound generator refers to its ability to play more than one note at a time. Polyphony is generally measured or
specified as a number of notes or voices. Most of the early music synthesizers were monophonic, meaning that they could only play
one note at a time. If you pressed five keys simultaneously on the keyboard of a monophonic synthesizer, you would only hear one
note. Pressing five keys on the keyboard of a synthesizer which was polyphonic with four voices of polyphony would, in general,
produce four notes. If the keyboard had more voices (many modern sound modules have 16, 24, or 32 note polyphony), then you
would hear all five of the notes.
Sounds
The different sounds that a synthesizer or sound generator can produce are sometimes called "patches", "programs", "algorithms",
or "timbres". Programmable synthesizers commonly assign "program numbers" (or patch numbers) to each sound. For instance, a
sound module might use patch number 1 for its acoustic piano sound, and patch number 36 for its fretless bass sound. The
association of all patch numbers to all sounds is often referred to as a patch map.
Via MIDI, a Program Change message is used to tell a device receiving on a given Channel to change the instrument sound being
used. For example, a sequencer could set up devices on Channel 4 to play fretless bass sounds by sending a Program Change
message for Channel four with a data byte value of 36 (this is the General MIDI program number for the fretless bass patch).
Multitimbral Mode
A synthesizer or sound generator is said to be multitimbral if it is capable of producing two or more different instrument sounds
simultaneously. If a synthesizer can play five notes simultaneously, and it can produce a piano sound and an acoustic bass sound at
the same time, then it is multitimbral. With enough notes of polyphony and "parts" (multitimbral) a single synthesizer could
produce the entire sound of a band or orchestra.
Multitimbral operation will generally require the use of a sequencer to send the various MIDI messages required. For example, a
sequencer could send MIDI messages for a piano part on Channel 1, bass on Channel 2, saxophone on Channel 3, drums on
Channel 10, etc. A 16 part multitimbral synthesizer could receive a different part on each of MIDI's 16 logical channels.
The polyphony of a multitimbral synthesizer is usually allocated dynamically among the different parts (timbres) being used. At
any given instant five voices might be needed for the piano part, two voices for the bass, one for the saxophone, plus 6 voices for
the drums. Note that some sounds on some synthesizers actually utilize more than one "voice", so the number of notes which may
be produced simultaneously may be less than the stated polyphony of the synthesizer, depending on which sounds are being utilized.
Synthesizer Basics
MIDI Tutorial
MIDI Tutorial
adjustment of the attack and decay rates of the signal. Although FM systems were implemented in the analog domain on early
synthesizer keyboards, modern FM synthesis implementations are done digitally.
FM synthesis techniques are very useful for creating expressive new synthesized sounds. However, if the goal of the synthesis
system is to recreate the sound of some existing instrument, this can generally be done more accurately with digital samplebased
techniques.
Digital sampling systems store high quality sound samples digitally, and then replay these sounds on demand. Digital
samplebased synthesis systems may employ a variety of special techniques, such as sample looping, pitch shifting, mathematical
interpolation, and digital filtering, in order to reduce the amount of memory required to store the sound samples (or to get more
types of sounds from a given amount of memory). These samplebased synthesis systems are often called "wavetable" synthesizers
(the sample memory in these systems contains a large number of sampled sound segments, and can be thought of as a "table" of
sound waveforms which may be looked up and utilized when needed).
10
MIDI Tutorial
A great deal of memory can be saved in wavetable synthesis systems by storing only a short segment of the sustain section of the
waveform, and then looping this segment during playback. Figure 5 shows a two period segment of the sustain section from the
waveform in Figure 4, which has been looped to create a steady state signal. If the original sound had a fairly constant spectral
content and amplitude during the sustained section, then the sound resulting from this looping operation should be a good
approximation of the sustained section of the original.
For many acoustic string instruments, the spectral characteristics of the sound remain fairly constant during the sustain section,
while the amplitude of the signal decays. This can be simulated with a looped segment by multiplying the looped samples by a
decreasing gain factor during playback to get the desired shape or envelope. The amplitude envelope of a sound is commonly
modeled as consisting of some number of linear segments. An example is the commonly used four part piecewiselinear
AttackDecaySustainRelease (ADSR) envelope model. Figure 6 depicts a typical ADSR envelope shape, and Figure 7 shows the
result of applying this envelope to the looped waveform from Figure 5.
11
MIDI Tutorial
A typical wavetable synthesis system would store sample data for the attack section and the looped section of an instrument sound.
These sample segments might be referred to as the initial sound and the loop sound. The initial sound is played once through, and
then the loop sound is played repetitively until the note ends. An envelope generator function is used to create an envelope which is
appropriate for the particular instrument, and this envelope is applied to the output samples during playback.
Playback of the initial wave (with the attack portion of the envelope applied) begins when a Note On message is received. The
length of the initial sound segment is fixed by the number of samples in the segment, and the length of the attack and decay sections
of the envelope are generally also fixed for a given instrument sound.
The sustain section will continue to repeat the loop samples while applying the sustain envelope slope (which decays slowly in our
examples), until a Note Off message is applied. The Note Off message triggers the beginning of the release portion of the envelope.
Loop Length
The loop length is measured as a number of samples, and the length of the loop should be equal to an integral number of periods of
the fundamental pitch of the sound being played (if this is not true, then an undesirable "pitch shift" will occur during playback
when the looping begins). In practice, the length of the loop segment for an acoustic instrument sample may be many periods with
respect to the fundamental pitch of the sound. If the sound has a natural vibrato or chorus effect, then it is generally desirable to
have the loop segment length be an integral multiple of the period of the vibrato or chorus.
OneShot Sounds
The previous paragraphs discussed dividing a sampled sound into an attack section and a sustain section, and then using looping
techniques to minimize the storage requirements for the sustain portion. However, some sounds, particularly sounds of short
duration or sounds whose characteristics change dynamically throughout their duration, are not suitable for looped playback
techniques. Short drum sounds often fit this description. These sounds are stored as a single sample segment which is played once
through with no looping. This class of sounds are referred to as "oneshot" sounds.
Loop Length
12
MIDI Tutorial
Editing may also be required to make the endpoints of the loop segment compatible. If the amplitude and the slope of the waveform
at the beginning of the loop segment do not match those at the end of the loop, then a repetitive "glitch" will be heard during
playback of the looped section. Additional processing may be performed to "compress" the dynamic range of the sound to improve
the signal/quantizing noise ratio or to conserve sample memory. This topic is addressed next.
When all of the sample processing has been completed, the resulting sampled sound segments for the various instruments are
tabulated to form the sample memory for the synthesizer.
Pitch Shifting
In order to minimize sample memory requirements, wavetable synthesis systems utilize pitch shifting, or pitch transposition
techniques, to generate a number of different notes from a single sound sample of a given instrument. For example, if the sample
memory contains a sample of a middle C note on the acoustic piano, then this same sample data could be used to generate the C#
note or D note above middle C using pitch shifting.
Pitch shifting is accomplished by accessing the stored sample data at different rates during playback. For example, if a pointer is
used to address the sample memory for a sound, and the pointer is incremented by one after each access, then the samples for this
sound would be accessed sequentially, resulting in some particular pitch. If the pointer increment was two rather than one, then
only every second sample would be played, and the resulting pitch would be shifted up by one octave (the frequency would be
doubled).
In the previous example, the sample memory address pointer was incremented by an integer number of samples. This allows only a
limited set of pitch shifts. In a more general case, the memory pointer would consist of an integer part and a fractional part, and the
increment value could be a fractional number of samples. The memory pointer is often referred to as a "phase accumulator" and the
increment value is then the "phase increment". The integer part of the phase accumulator is used to address the sample memory, the
fractional part is used to maintain frequency accuracy.
For example if the phase increment value was equivalent to 1/2, then the pitch would be shifted down by one octave (the frequency
would be halved). A phase increment value of 1.05946 (the twelfth root of two) would create a pitch shift of one musical halfstep
(i.e. from C to C#) compared with an increment of 1. When noninteger increment values are utilized, the frequency resolution for
playback is determined by the number of bits used to represent the fractional part of the address pointer and the address increment
parameter.
13
MIDI Tutorial
Interpolation
When the fractional part of the address pointer is nonzero, then the "desired value" falls between available data samples. Figure 8
depicts a simplified addressing scheme wherein the Address Pointer and the increment parameter each have a 4bit integer part and
a 4bit fractional part. In this case, the increment value is equal to 1 1/2 samples. Very simple systems might simply ignore the
fractional part of the address when determining the sample value to be sent to the D/A converter. The data values sent to the D/A
converter when using this approach are indicated in the Figure 8, case I.
A slightly better approach would be to use the nearest available sample value. More sophisticated systems would perform some
type of mathematical interpolation between available data points in order to get a value to be used for playback. Values which
might be sent to the D/A when interpolation is employed are shown as case II. Note that the overall frequency accuracy would be
the same for both cases indicated, but the output is severely distorted in the case where interpolation is not used.
There are a number of different algorithms used for interpolation between sample values. The simplest is linear interpolation. With
linear interpolation, interpolated value is simply the weighted average of the two nearest samples, with the fractional address used
Interpolation
14
MIDI Tutorial
as a weighting constant. For example, if the address pointer indicated an address of (n+K), where n is the integer part of the address
and K is the fractional part, than the interpolated value can be calculated as s(n+K) = (1K)s(n) + (K)s(n+1), where s(n) is the
sample data value at address n. More sophisticated interpolation techniques can be utilized to further reduce distortion, but these
techniques are computationally expensive.
Oversampling
Oversampling of the sound samples may also be used to improve distortion in wavetable synthesis systems. For example, if 4X
oversampling were utilized for a particular instrument sound sample, then an address increment value of 4 would be used for
playback with no pitch shift. The data points chosen during playback will be closer to the "desired values", on the average, than
they would be if no oversampling were utilized because of the increased number of data points used to represent the waveform. Of
course, oversampling has a high cost in terms of sample memory requirements.
In many cases, the best approach may be to utilize linear interpolation combined with varying degrees of oversampling where
needed. The linear interpolation technique provides reasonable accuracy for many sounds, without the high penalty in terms of
processing power required for more sophisticated interpolation methods. For those sounds which need better accuracy,
oversampling is employed. With this approach, the additional memory required for oversampling is only utilized where it is most
needed. The combined effect of linear interpolation and selective oversampling can produce excellent results.
Splits
When the pitch of a sampled sound is changed during playback, the timbre of the sound is changed somewhat also. The effect is
less noticeable for small changes in pitch (up to a few semitones), than it is for a large pitch shift. To retain a natural sound, a
particular sample of an instrument sound will only be useful for recreating a limited range of notes. To get coverage of the entire
instrument range, a number of different samples, each with a limited range of notes, are used. The resulting instrument
implementation is often referred to as a "multisampled" instrument. This technique can be thought of as splitting a musical
instrument keyboard into a number of ranges of notes, with a different sound sample used for each range. Each of these ranges is
referred to as a split, or key split.
Velocity splits refer to the use of different samples for different note velocities. Using velocity splits, one sample might be utilized
if a particular note is played softly, where a different sample would be utilized for the same note of the same instrument when
played with a higher velocity. This technique is not commonly used to produce basic sound samples because of the added memory
expense, but both key splitting and velocity splitting techniques can be utilized as a performance enhancement. For instance, a key
split might allow a fretless bass sound on the lower octaves of a keyboard, while the upper octaves play a vibraphone. Similarly, a
velocity split might "layer" strings on top of an acoustic piano sound when the keys are hit with higher velocity.
Aliasing Noise
Earlier paragraphs discussed the timbre changes which result from pitch shifting. The resampling techniques used to shift the pitch
of a stored sound sample can also result in the introduction of aliasing noise into an instrument sound. The generation of aliasing
noise can also limit the amount of pitch shifting which may be effectively applied to a sound sample. Sounds which are rich in
upper harmonic content will generally have more of a problem with aliasing noise. Lowpass filtering applied after interpolation
can help eliminate the undesirable effect of aliasing noise. The use of oversampling also helps eliminate aliasing noise.
Oversampling
15
MIDI Tutorial
Layering
Layering refers to a technique in which multiple sounds are utilized for each note played. This technique can be used to generate
very rich sounds, and may also be useful for increasing the number of instrument patches which can be created from a limited
sample set. Note that layered sounds generally utilize more than one voice of polyphony for each note played, and thus the number
of voices available is effectively reduced when these sounds are being used.
Digital Filtering
It was mentioned earlier that lowpass filtering may be used to help eliminate noise which may be generated during the pitch
shifting process. There are also a number of ways in which digital filtering is used in the timbre generation process to improve the
resulting instrument sound. In these applications, the digital filter implementation is polyphonic, meaning that a separate filter is
implemented for each voice being generated, and the filter implementation should have dynamically adjustable cutoff frequency
and/or Q.
For many acoustic instruments, the character of the tone which is produced changes dramatically as a function of the amplitude
level at which the instrument is played. For example, the tone of an acoustic piano may be very bright when the instrument is
played forcefully, but much more mellow when it is played softly. Velocity splits, which utilize different sample segments for
different note velocities, can be implemented to simulate this phenomena.
Another very powerful technique is to implement a digital lowpass filter for each note with a cutoff frequency which varies as a
function of the note velocity. This polyphonic digital filter dynamically adjusts the output frequency spectrum of the synthesized
sound as a function of note velocity, allowing a very effective recreation of the acoustic instrument timbre.
Another important application of digital filtering is in smoothing out the transitions between samples in keybased splits. At the
border between two splits, there will be two adjacent notes which are based on different samples. Normally, one of these samples
will have been pitch shifted up to create the required note, while the other will have been shifted down in pitch. As a result, the
timbre of these two adjacent notes may be significantly different, making the split obvious. This problem may be alleviated by
employing a digital filter which uses the note number to control the filter characteristics. A table may be constructed containing the
filter characteristics for each note number of a given instrument. The filter characteristics are chosen to compensate for the pitch
shifting associated with the key splits used for that instrument.
It is also common to control the characteristics of the digital filter using an envelope generator or an LFO. The result is an
instrument timbre which has a spectrum which changes as a function of time. An envelope generator might be used to control the
filter cutoff frequency generate a timbre which is very bright at the onset, but which gradually becomes more mellow as the note
decays. Sweeping the cutoff frequency of a filter with a high Q setting using an envelope generator or LFO can help when trying to
simulate the sounds of analog synthesizers.
Layering
16
MIDI Tutorial
MSDOS applications which utilize MIDI synthesizers include MIDI sequencing software, music scoring applications, and a
variety of games. In terms of MIDI interface compatibility, virtually all of these applications support the "MPU401" interface. The
MPU401 is a smart MIDI interface, which also supports a dumb mode of operation (often referred to as "UART mode"). There
are a number of MPU401 compatible MIDI interfaces on the market, some which only support the UART (dumb) mode of
operation. In addition, the majority of PC addin sound cards include builtin MIDI interfaces which implement the UART mode
functions of the MPU401. Other MIDI interfaces, such as serial port or parallel port MIDI adapters, will only work if the
application provides support for that particular model of MIDI interface.
17
MIDI Tutorial
The MIDI Mapper Setups can also be used to change the Channel number of MIDI messages. If you have MIDI files which were
composed for a General MIDI instrument, and you are playing them on a Base Multitimbral Synthesizer, you would probably want
to take the MIDI percussion data coming from your application on Channel 10 and send this information to the device driver on
Channel 16.
The MIDI Mapper patch maps are used to translate patch numbers when playing MPC or General MIDI files on synthesizers which
do not use the General MIDI patch numbers. Patch maps can also be used to play MIDI files which were arranged for nonGM
synthesizers on GM synthesizers. For example, the Windowssupplied MT32 patch map can be used when playing
GMcompatible .MID files on the Roland MT32 sound module or LAPC1 sound card. The MIDI Mapper key maps perform a
similar function, translating the key numbers contained in MIDI Note On and Note Off messages. This capability is useful for
translating GMcompatible percussion parts for playback on nonGM synthesizers or viceversa. The Windowssupplied MT32
key map changes the keytodrum sound assignments used for General MIDI to those used by the MT32 and LAPC1.
Summary
The MIDI protocol provides an efficient format for conveying musical performance data, and the Standard MIDI Files specification
ensures that different applications can share timestamped MIDI data. While this alone is largely sufficient for the working MIDI
musician, the storage efficiency and onthefly editing capability of MIDI data also makes MIDI an attractive vehicle for
generation of sounds in multimedia applications, computer games, or highend karaoke equipment.
The General MIDI system provides a common set of capabilities and a common patch map for high polyphony, multitimbral
synthesizers, providing musical sequence authors and multimedia applications developers with a common target platform for
synthesis. With the greater realism which comes from wavetable synthesis, and as newer, interactive, applications come along,
MIDIdriven synthesizers will continue to be an important component for sound generation devices and multimedia applications.
Summary
18