ANTIC PRESENTS GIST
by
SYNTHETIC SOFTWARE
Design: Lee Actor and Gary Levenberg
Software: Lee Actor
PREFACE
Antic is a trademark of Antic Publishing, Inc. GI Sound Tool (GIST) is
a copyrighted work by Synthetic Software. Copyright (c) 1986 Synthetic
Software.
GIST is provided on an unprotected disk because the authors and Antic
both believe that the buyer should be able to make backup copies for
his or her use ONLY. Because it is unprotected, we expect you to
respect the copyright and NOT give, sell or even lend copies of this
program to anyone else.
The author spent many hours designing, writing and testing this
product. His income depends on its sales. The unauthorized
reproduction of the GIST diskette is illegal. Please help us to
protect and enforce the author's rights in this product so that we may
continue to provide you with unprotected software. No part of this
product may be reproduced and/or distributed in any form or by any
means without the prior written consent of Antic.
Antic and Synthetic Software disclaim responsibility for any damages
resulting from the use or misuse of this software product, and
disclaim liability for losses of any kind or nature, financial or
otherwise, incurred or alleged to have been incurred as a result of the
purchase and use of this product.
For further information and an in depth discussion of sound generation,
refer to "Hot Sounds" by Gary Levenberg and Lee Actor in the Winter
1986 issue of STart Magazine.
Permission to use GIST Sound Driver
Any individual or company having purchased GIST may obtain permission
to use the GIST Sound Driver in their commercial application, program,
or game. Simply write to Synthetic Software at the address below
describing your product and when it will be released. For our
information, please include which compiler you are using.
Permission for use of the copyrighted GIST Sound Driver (C) 1986
Synthetic Software is only available through a written request.
Synthetic Software
880 Wisconsin Street
San Francisco, CA 94107
(415)-285-8832
TABLE OF CONTENTS
Page
1 INTRODUCTION 1
2 OVERVIEW 2
3 UNDERSTANDING GIST 2
3.1 THE ADSR ENVELOPE 2
3.2 NSQ DYNAMIC SOUND 3
3.3 DURATION 5
3.4 LFO 6
3.5 FREQUENCY AND NOISE 7
4 REFERENCE GUIDE 8
4.1 GEM MENUS 8
4.1.1 File 8
4.1.2 Edit 8
4.1.3 Play 9
4.1.4 Misc 9
4.2 EDIT DIALOG BOX CONTROLS 10
4.3 ICONS 11
5 ADVANCED USE: SOUND DRIVER 12
5.1 DESCRIPTION 12
5.2 PRIORITIES 12
5.3 SOUND FILES AND DATA 13
5.4 HOW TO PLAY A SOUND 14
5.5 IMPLEMENTATION 14
1 INTRODUCTION
Sounds computers make include the din of video arcades, the almost
human voice of the telephone-number-reader at information, the beeps
and squeeks of your corner banking machine, and the sophisticated
sounds of modern music synthesizers. Your Atari ST computer contains a
sound-generator chip that directly drives the speaker in its monitor.
It's capable of making a wide range of musical notes and sound
effects.
Atari chose the Yamaha YM2149 software-controlled sound generator for
their ST computers. Designed originally by General Instruments (GI),
this chip has been around for a number of years and, with all the
current developments in sound generation, it seems obsolete by
comparison. But don't be discouraged; with the help of the ST's high
speed microprocessor, the sound chip can generate sounds nobody would
have dreamed of.
GIST (GI Sound Tool) is a graphic-oriented sound editor for the Atari
ST. A motivating force in designing GIST is the opportunity to
establish NSQ -- Near Synthesizer Quality -- a standard on the Atari
that can be shared by developers and hobbyists alike. We intend to
make entire libraries of sounds available through bulletin boards,
users groups, and magazines such as START.
Part of the GIST package is the Sound Driver. This is a linkable
module that you can use in your own application or game to play the
sounds you create using GIST. We have supplied versions for Alcyon,
Megamax, Lattice and GST. If you use any of these compilers or
assemblers, you can easily incorporate sounds into your own program.
The Sound Driver is also able to support your efforts toward
integrating music in you programs. For more information, see section
6, "Advanced Use." If you are familiar with synthesizers, you may want
to go immediately to the Reference Guide on page 8.
2 OVERVIEW
GIST works on an Atari 520ST or 1040ST with one or two floppy disk
drives and/or a hard disk drive. It operates in monochrome or
medium-resolution color but not low-resolution color. It makes use of
the mouse, GEM and the keyboard where appropriate. Any MIDI compatible
musical keyboard can be used to play your ST.
Make a back-up copy of the disk with all the files on it and store the
original in a safe place. Use the back-up disk for day-to-day work.
To run GIST you need both GIST.PRG and GIST.RSC on the disk. There are
sample sound files on the master disk (all sound files have a .SND
extension and are located in the EXAMPLES folder). All other files and
folders are for use with the Sound Driver.
To load GIST, double-click on the icon or name GIST.PRG to load the
program. Once GIST has loaded, you can remove the GIST disk and put in
Page 1
a disk for sound files. You may keep your sound files on a second
drive, a hard drive, or a RAMdisk.
Once in GIST, you can load a sound file or open a new one and edit that
file. The icons are used to play a sounds. You can even use a MIDI
keyboard to play notes.
3 UNDERSTANDING GIST
The basic component of each sound is a square wave, a digitally
generated waveform that sounds much like an electric clock or buzzer.
To hear this sound, load the program and using the mouse select File
from the menu bar. Click on New to open up a window with the default
sound, a square wave. In order to hear this sound, click on the
speaker icon. You will hear a square wave. It is not very
interesting. GIST takes this as the basic component and allows you to
create a wide variety of sounds.
In designing sounds electronically, the goal is to create a sound that
is "alive," i.e., dynamic, not static. A square wave is static. What
distinguishes a live acoustic sound from an electronic one is how it
changes over time. A horn is a constantly changing sound, as is the
ocean or rain. If you add dynamic control through the use of envelopes
and other devices, the electronic sound has a much better chance of
sounding like what we want. Dynamic control is the ability to modify
the sound as it is happening.
The components of the sound that we can change are the volume, pitch
and noise. The volume is how loud the sound is; the pitch is what
musical note we perceive; and noise is white noise, a randomly
generated waveform that sounds like steam escaping from a radiator. To
hear an example of white noise, select File from the menu bar and click
on Open... A file selector will appear. Double-click on NOISE.SND. A
new window will appear over the previous window. To hear this new
sound, click on the speaker icon. You have now heard the two building
blocks used to generate new sounds.
3.1 THE ADSR ENVELOPE
Most sounds have an overall shape -- a beginning, middle and an end.
This is sometimes called the ADSR envelope because the shape of any
sound can be broken down intofour parts: Attack, Decay, Sustain and
Release (ADSR). Many synthesizers have ADSR capability, i.e., they can
generate the Attack, Decay, Sustain, and Release.
When a horn player begins blowing a note, the first part is
characteristic of the instrument as it responds to the changing air
pressure. Typically the volume rises quickly to a peak. This is the
Attack, and is what makes a horn sound like a horn. If you heard the
same sound with the first part cut off, it would sound like an organ.
Page 2
The Attack is usually louder than the rest of the note. It reaches a
peak then will Decay back down to the level you hear for the duration
of the note. This level is called the Sustain level. When the note is
over, the horn player stops blowing, but the air left in the horn
enables the sound to linger for just a short time as it fades away.
This is called the Release. The Release is second only to the Attack
in your perception of a sound. In contrast with the horn, a square
wave has no basic shape and thus when heard without any modification,
starts and ends abruptly.
ADSR is an abstract structure that has been applied to sound for
purposes of analysis. The horn player has never heard of it. But for
us to be able to manipulate sound electronically, a structure is
required. An electronic ADSR follows a prescribed pattern: When a
note is begun, this event is referred to as a NOTE ON. The NOTE ON
initiates the Attack phase of the sound, during which the volume of the
sound goes from zero to its maximum value. This value is the actual
volume of the sound. The Decay portion follows immediately after the
attack as the volume decreases. The Decay time is the period it takes
to reach the Sustain level.
It is important to realize that Sustain is a level, not a time. It is
the volume of the tone after the decay. The time is indeterminate and
depends on the Duration of the note. The Duration is the length of the
note and can range anywhere from a few milliseconds to minutes. When
the Duration is over, this event is referred to as a NOTE OFF. But the
actual sound is not over; NOTE OFF signals the beginning of Release.
3.2 NSQ DYNAMIC SOUND
The ST sound chip is programmable. So we took its basic
features,letting the chip generate the initial square wave, and created
controls that are considered essential on professional synthesizers.
Two types of modification (ADSR and LFO) to volume, frequency, and
noise are available. These modify the general waveform in real-time
(at incredibly high speeds, as the sound is actually made), allowing
dynamic control of sound generation. Using GIST, you can make truly
exciting sounds on the ST.
GIST does not use the built-in ST envelope generators. The confinement
of only a single envelope generator with a very limited set of shapes
prompted us to design a system which would allow a higher degree of
control. The single envelope generator has been replaced with nine
ADSR envelopes and nine LFO's, three apiece for each channel. (LFO's
will be explained later.)
Load BELL.SND. Do this by moving the mouse over File and selecting
Open... in the menu that drops down. Listen to it by clicking the
speaker icon. This uses an ADSR envelope to generate the distinctive
"twang" of a bell. Look at the volume ADSR. To examine the actual
values, select the Edit menu and click on Volume in the drop-down menu.
(If you prefer, you can also double-click anywhere in the volume box of
Page 3
the sound.) The volume edit box will now appear. The envelope values
are listed as Attack, Decay, Sustain and Release. All times are in
milliseconds (msec--0.001 second, or 1/1000 of a second). The Attack
time, 5 msec, is as fast as it can go; it takes 5 msec (almost
instantaneous) for the level of the sound to reach full volume, the
value designated in Volume. This is the Attack and sounds no different
than the sharp ON of a squarewave. What makes this sound like a bell
is the Decay and Release. Once full volume is reached, the sound
decays to the Sustain level in 100 msec, about 1/10 of a second. The
Sustain level is 80 percent of the full volume (a value of about 12).
The time it takes to reach the Sustain level is the sum of the Attack
time and the Decay time. In this case, 5 msec + 100 msec = 105 msec.
When you play the sound, the Attack phase is initiated. When the time
designated by Duration has elapsed, the Release phase is initiated.
Selecting the Speaker icon (on the upper left side of the desktop)
plays the sound at the frequency determined by the frequency parameter
(displayed in the frequency edit box). The duration value is stored
with the sound and can be modified from the desktop by moving the
Duration "fader" with the mouse. The "fader" is the small rectangular
box next to the word Duration on the left hand side of the desktop. It
is a horizontal bar that can be moved up and down along the hash marks.
Use the mouse and either button to "grab" the bar to adjust the fader.
For fine control, click on the arrows next to the fader. Note how the
value in the sound window changes simultaneously.
In order to have a sound continuously repeat, you can set a "cycle
time" with the fader below the speaker icon. If the cycle time is
zero, the speaker icon, when selected, will "light up" briefly as the
sound starts. The note will complete its duration and stop. If the
fader is set to any value, n, greater than zero, the speaker icon will
remain "lit up" and the sound will be restarted every n milliseconds.
Selecting the Note icon (on the lower right portion of the desktop)
differs from the Speaker icon in that it is more like pressing and
holding a key on a MIDI keyboard: the Sustain level is maintained
while you are holding down the mouse button. In order to begin the
Release phase of the ADSR envelope release the mouse button, which is
like releasing a MIDI key. Also, the Note icon uses the Pitch
parameter to select the frequency of the sound, rather than using the
frequency value stored with the sound. You can change the Pitch by
clicking on the Pitch fader and sliding it up or down. Pitch is a
musical term related to notes: musical notes have a set frequency, but
not all frequencies correspond to notes. As with duration fader, you
can use the arrows for finer control.
Move the mouse over the Speaker icon and press the mouse button. Since
the duration of the sound is 100 msec and the length of the
attack/decay sequence is also 100 msec, as soon as the Sustain level is
reached, the Release phase begins. But, even without the Sustain
portion, we still hear a sound! The Release phase of the sound is the
part that is heard after the note is turned off. To understand this
better, you can compare this to another similar sound. Select OK or
Cancel to close the edit dialog box of the current sound, and load in
BELL2.SND and turn it on (this means to select the Speaker icon unless
Page 4
specified otherwise). Note how much longer this sound lasts. To play
BELL.SND again, click anywhere on its window to make it active, then
turn it on. Listen to both sounds again.
The only difference between the two sounds is the Release time.
BELL.SND is 405 msec and BELL2.SND is 1920 msec, nearly two seconds.
To examine the parameters of the current window, select Edit from the
menu and click on Volume. To change any of the values, simply use the
mouse to select Edit from the menu bar. Then click on Volume,
Frequency, or Noise. Remember, you can also double-click on the graph
you want to edit. In any case, an edit dialog box will appear. The
top of the box contains the ADSR and the bottom the LFO. All values
are changed by modifying the graphic waveform with the mouse.
Use the left mouse button to select any of the small boxes on the
graphic displays. You can either move the cursor to the box and then
grab the box by holding down the left mouse, or you can hold down the
left button and then move the cursor to one of the boxes. Once it is
within reach, the box will be grabbed. To stop changing a value,
simply lift your finger off the left mouse button. On the ADSR, the
leftmost box is Attack, the next controls Decay and Sustain, and the
rightmost box controls Release. To only move Decay or Sustain, holding
the Shift key down will only allow up and down movement, while holding
the Control or Alternate key will only allow right or left movement.
[NOTE: An ADSR with the Peak level the same as the Sustain, by
definition has an instantaneous Decay.] On the LFO the leftmost box
controls Delay, and the right box controls Rate and Frequency. The
Shift, Control and Alternate keys act in the same fashion as with the
ADSR. Try different values for yourself to hear the effects.
3.3 DURATION
Duration is important enough to merit a special case. For example, the
horn player knows how to blow the horn for a very short duration. But
what happens when the duration is less than the attack and decay time?
Try it. Set the duration to 10 msec. To do this, use the mouse on the
"fader" to set the duration value. The sound still sounds basically
the same. That is because it is important when designing a sound to
consider what might happen when the duration is extremely short. The
rule is this: if a NOTE OFF occurs before the sound reaches its
Sustain level, it goes into its Release phase. Remember: NOTE OFF
signifies the end of Duration. If the NOTE OFF occurs during the
Attack, the sound will not reach full volume and will immmediately
begin the Release phase at its current volume. If it is in the Decay
phase, the Sustain volume will not be reached and the Release phase
will begin starting at the current volume. Change the Release to 5 and
leave the duration at 10 msec, you will hear a very short sound.
It is important to consider what the likely duration of a sound is
going to be during its design. If a duration of less time than the sum
of the Attack and Decay time is going to be possible, you should
specify an appropriate value for Release. Try your sound with both
long and short durations. That is the best way to be sure what is
Page 5
going to happen.
Consider another way to make the bell sound. Load in BELL3.SND. Its
Attack time is the same as the other sounds, but the duration is 505
msec, the Decay is 500 msec, and the Release is 0. Yet, it sounds very
similar to BELL.SND. The difference is that this sound is complete
when the Duration has elapsed. There is no Release phase. Try playing
this note with a duration of 100 msec. It will just stop mid-note
after 100 msec. But if you set the Sustain level to 80 and the Release
to 405, it will sound more like BELL.SND. You can experiment with the
Sustain level to make it sound just like BELL.SND (you could of course
change the Decay time, but you can leave the Decay at 500 and adjust
the Sustain level instead). This is just to show you the variety of
ways you can alter sounds.
Now close BELL3.SND and open LONGBELL.SND. This is a more complex
version of the BELL sounds. First of all, notice that the Release time
is longer. Set BELL2.SND to the same Release time (3840 msec). Now
compare the two sounds. Notice how much more interesting LONGBELL.SND
is. Some of the differences are subtle, but this is a simple example
of how intricate you can get.
3.4 LFO
The main enhancement in LONGBELL.SND is the use of the LFO's with both
volume and frequency. LFO stands for Low Frequency Oscillator. The
LFO's are triangle waves that modify a parameter by repeatedly
increasing, then decreasing the parameter value at a specified rate.
For example, the volume LFO in LONGBELL.SND modifies the volume by 10
percent. Since volume is 15, it will range over a value from 15 to 15
minus 10 percent of 15. The maximum LFO frequency is 50 Hz. That
means the fastest triangle wave you can have will cycle at 50 times per
second. The LFO frequency for LONGBELL.SND is 5 Hz. Therefore, the
volume will continuously change its value at a rate of 5 times every
second.
Frequency LFO works the same way, but it modifies the frequency
instead. To examine the values for the Frequency LFO, select Frequency
from the Edit menu. The example LONGBELL.SND uses both volume and
frequency LFO to give the bell a more realistic quality. Typically, an
LFO on volume is called tremolo (listen to TREMOLO.SND), and on
frequency is called vibrato (listen to VIBRATO.SND). An example using
both LFO's is EERIEFLY.SND.
To change the values of an LFO, select one of the two small boxes on
the LFO display. The leftmost box adjusts the Delay time, i.e., the
amount of delay before the LFO takes place. The second box adjusts
both the Amount and Frequency. To adjust only the Amount, hold down
the Shift key to move the box only in a vertical direction. Holding
down the Alternate or Control key will allow movement in the horizontal
direction only, to adjust Frequency without altering Amount.
LFO's at lower frequencies (under 15 Hz) add a "wobbling" effect to
Page 6
your sounds (like tremolo and vibrato). This is because the changes are
happening so slowly that your ear is able to resolve them. LFO's at
higher frequencies (from about 15 to 50 Hz) can actually change the
basic characteristics of the sound. Load VIBRATO.SND and listen to it.
Adjust the frequency LFO to change the frequency and amount to its
maximum value. Now play the sound. It sounds nothing like the
original sound. You can do the same with TREMOLO.SND, however, the
result is not quite as pleasing.
You can get a tremendous variety of sounds just with the frequency LFO.
For example, listen to DRWHO.SND, EXPLODE.SND, FALLING.SND and
LASER.SND. This is just a small sampling of the sounds you can make.
3.5 FREQUENCY AND NOISE
Another very important control is the frequency ADSR. It is very
similar to the volume ADSR, but the difference is important. When you
select any ADSR but volume, one parameter is called Peak. You can't
change this value on the volume ADSR, because the volume Attack always
remains at 100 percent. But the frequency ADSR can be varied to higher
levels. A 100 percent change equals one octave, so the value -300
would lower the frequency ADSR by three octaves. For this reason, you
can move the leftmost box on the ADSR both up and down. You are
adjusting both the Attack and the Attack level, referred to as Peak.
Note that the Peak value can be set as high as 800%.
Similarly, the frequency Sustain level can be over the same range.
This allows for a frequency to be controlled over a range from eight
octaves above to three octaves below the initial frequency. The
Release will always bring the sound back to the original pitch. But if
you put in a large enough Release, for example, 30000, and a much
shorter volume Release, possibly 100 msec, the original pitch will not
be heard. This is the case with the DRWHO sound.
Another use of this type of control is evident in PLUCK.SND. The
beginning of the sound appears to have a "plucked" sounding attack.
This is made possible with a very short frequency Attack and Decay and
a large Attack level. This technique is very useful in many percussive
sounds.
The final control to be discussed is the Noise ADSR and LFO. This ADSR
acts just like the frequency in that it can go both postive and
negative and allows you to adjust the Attack level. Also like
frequency, you are shaping the frequency components of the white noise.
Select a New sound. Now turn off the square wave by setting Frequency
to zero in the Frequency dialog box. Close this dialog box and open
the noise dialog box. Using the Noise fader, set it to 32. Play the
sound. It sounds like steam being released or someone telling you to
"Sh-h-h-h." This contains mostly high frequency components. Now
change the noise value to 1. It is a much raspier sound. The higher
values contain higher frequencies. This is difficult to hear as pitch.
What is important is to remember what each end of the range sounds
like.
Page 7
You can make useful sounds just using noise. Load in SNARE.SND.
Experiment with the nominal noise value to hear the difference. To
hear examples using the noise LFO, load in NOISELFO.SND. Remember the
ADSR on noise does not affect the volume of the noise. The overall
volume is controlled by the volume ADSR and LFO. It will affect both
the square wave and the noise. The noise ADSR and LFO alter the
frequency components of the noise.
4 REFERENCE GUIDE
4.1 GEM Menus
4.1.1 FILE
Open... Open a file to be selected from an item selector.
Close Close current window (or click on upper left corner).
New Open a window with default sound (square wave).
Save Save file to disk using current name.
Save as... Save file to disk using name supplied in dialog box.
(Both Save and Save as save two types of files: .SND is the data file
used by the editor. .C is the source file used by a C application.)
Quit Exit the program. A dialog box will ask if you want to
save any open files whose data has been altered (same as Close).
4.1.2 EDIT
Volume Open edit volume dialog box (^V or double-click).
Frequency Open edit frequency dialog box (^F or double-click).
Noise Open edit noise dialog box (^N or double-click).
These menu items can be selected using the mouse or by entering the
appropriate control code (^V, ^F, ^N). To select Volume, press both
Control and V on the keyboard simultaneously. For Frequency, press
Control and F, and for Noise, press Control and N. Another method to
open the edit box is to double-click on the desired area in the sound
window. By double-clicking anywhere in the area enclosing the ADSR and
LFO marked Volume, you can edit volume. The same is true for Frequency
and Noise.
Page 8
4.1.3 PLAY
Single sound Play only the selected window.
Ganged sound Play all windows simultaneously.
When you select either single or ganged, a check will appear next to
your selection. These choices act as a toggle, in other words, you can
select either one, but not both. When Single sound is selected,
whenever you click on the speaker or note icon, only the sound in the
current window will be heard. When using a MIDI keyboard, you can play
the sound in the current window on up to three keys simultaneously (3
note polyphony).
Ganged sound allows you to play all the sound displayed in windows on
the desktop (up to three windows can be open simultaneously). Whenever
you click on the speaker or note icon, all sounds will be heard for
their respective durations. If you open an edit dialog box or change
the duration, only the current window (the one with the gray bar on
top) will be changed. When playing a MIDI keyboard, a single key will
play all the sounds.
4.1.4 Misc
Quiet Turn off all sounds
MIDI Enable/disable MIDI keyboard input
H/W registers Display all Hardware registers of the GI chip
4.2 EDIT DIALOG BOX CONTROLS
When an edit dialog box is open, it will change the values of the
currently selected window (the window with the gray bar on top).
Regardless of the setting of Single sound or Ganged sound, only the
current sound can be affected.
All values are changed graphically using the mouse. The ADSR and LFO
values are displayed and updated as the graphs are modified. To make a
change, you must select with the mouse one of the small boxes at the
junctions in the ADSR or LFO. Select with the left mouse button either
directly on the box, or by pushing the left mouse button and then
moving the mouse over the box. Once you release the mouse, the value
will remain at its last value. If the sound is currently being played,
the change will not be heard until the mouse is released and the sound
is restarted.
The right mouse button is also used to change values, however, it is a
fine tuning control. This allows for value changes down to one-tenth
of one Hertz.
Page 9
The value at the top of the edit box (volume, frequency or nosie) can
be adjusted using its associated "fader" and the mouse (either the left
or right button). When frequency is set to zero, the square wave is
disabled. When noise is set to zero, the white noise is disabled.
(When New has been selected under File, noise is set to zero, frequency
is set to 262 Hz, and volume is set to 15. All the ADSR and LFO
controls are disabled.) The arrows adjacent to the fader is for fine
tuning control. Click on the up arrow to increase the value or on the
down arrow to decrease the value. Either the left or right mouse
button will work. [The right mouse button will also allow fine tuning
control of the noise fader on color monitors.]
All the values are displayed as either msec or %. All rates (Attack,
Decay, Release, and LFO Rate) are displayed in milliseconds (msec,
where 1000 msec = 1 second). Levels (Peak, Sustain and LFO Amount) are
expressed in percent (%). In the case of volume, the sustain is
expressed as a percentage of the actual volume value. If the volume is
12 and the sustain value is 75%, the actual sustain volume will be 9.
With frequency, 100% corresponds to one octave above the frequency
value and -100% is one actave below. This applies to both LFO and
ADSR. If the frequency is 131 Hz and the sustain value is 100%, the
actual sustain frequency will be 262 Hz. The actual frequency range is
from -300% to +800%. This means the frequency ADSR extends over 11
octaves!
Noise can have a value of ranging from 0 to 32. Zero means that noise
is disabled. 32 indicates the highest noise frequency while 1
indicates the lowest. 100% corresponds to the maximum value of 32 and
-100% corresponds to 1. 50% corresponds to the initial value plus 16
(50% of 32). If your initial noise value is 16, it will reach maximum
at 50%. A sustain value any higher would have no effect. If the
initial value is 1, it will reach maximum at 100%.
The noise sustain values are relative offsets, that is, the actual
sustain value depends on the initial noise value. If you consider the
sustain values as offsets, 100% is 32, 50% is 16, 25% is 8, etc. The
noise value is the starting point for the ADSR and the percent value is
a relative offset you add to the initial value to get the actual level.
Of course the maximum value is 32.
Therefore, if the noise value is 32 and the Peak is set to 100%, you
will not hear a change. However, if you start with a noise value of 1,
you will hear the sound change from a crunching sound to a hissing
sound as it "ramps up" from 1 to 32. Conversely, if you start with a
noise value of 32 and set the Peak to -100%, you will hear the sound
change from a hissing sound to a crunching sound.
Selecting OFF disables the ADSR or LFO. Selecting ON will return the
last used values to the LFO and for the ADSR will enable its
operation.
RESET will cause the sound to return to the values it had when you
first opened the edit dialog box. CANCEL will cancel any changes you
made and close the dialog box, and OK will restore the current sound
Page 10
with the changes you have just made and close the dialog box. RETURN
on the keyboard will have the same effect as selecting OK.
Selecting the mouse button and SHIFT allows you to move only in a
vertical direction (so that you can modify sustain without affecting
decay, or LFO amount without affecting freq). Selecting the mouse
button and ALTERNATE or CONTROL allows you to move only in a horizontal
direction (thus modifying decay without affecting sustain, or LFO freq
without affecting amount).
Fine control is available using the right mouse button. Use it in the
same manner as the left when adjusting ADSR or LFO values. However,
the values will change by 5 for any value displayed in milliseconds, by
1 for percent and by 0.1 for Hertz. This is especially helpful on the
LFO amount and rate.
Attack Move leftmost box on ADSR display left or right.
Peak Move leftmost box on ADSR display up or down.
Decay Move middle box on ADSR display left or right.
Sustain Move middle box on ADSR display up or down.
Release Move rightmost box on ADSR display left or right.
When you first adjust an ADSR envelope, the Attack and Decay boxes
appear on top of each other. If you want to grab the Attack box,
approach it from the left side and you will grab it first. If you want
the Decay box, approach it from the right.
Delay Move leftmost box on LFO display left or right.
Amount Move rightmost box on LFO display up or down.
Freq Move rightmost box on LFO display left or right.
4.3 ICONS
Speaker: Plays sound using duration parameter. If cycle value is
greater than zero, it will play the sound with duration as specified
above and repeat it every n milliseconds as displayed in the fader
located underneath the word CYCLE. The frequency of the sound played
is determined by the value in the frequency edit dialog box. If Ganged
sound is checked, each sound will play with its respective duration and
frequency. If you change duration, it will affect only the current
window. If you change cycle, it will affect all the sounds.
Note: Plays a sound with the displayed MIDI pitch for as long as
you hold down the mouse button. When the mouse button is released, the
sound will go into its release phase. Pitch can be changed with the
fader displayed directly underneath this icon. If Ganged sound is
Page 11
checked, all sounds will be played with the pitch designated with the
fader.
5 ADVANCED USE: SOUND DRIVER
5.1 DESCRIPTION
The GIST Sound Driver is an interrupt driven routine written in 68000.
The Sound Driver operates under the 200 Hz system timer interrupt
routine. It is installed by changing the interrupt vector to point to
the Sound interrupt routine. It therefore executes before the regular
system interrupt. The interface between an application program and the
Sound Driver consists of several short C language routines.
5.2 PRIORITIES
The Sound Driver was designed to allow effective playing of both sound
effects and musical sounds. Since there are only three channels
available on the GI chip, it is important to organize your sound
resources carefully. The Sound Driver has a priority scheme built into
it. This allows you to assign priorities to each sound effect and the
Sound Driver will determine which sound can play based on its
priority.
All you have to do to play a sound is request your specified sound to
play on any available channel. If all channels are currently playing a
sound, your new sound can stil play! You do not even have to worry
about which channels are being used or by what sound. When requesting
a sound channel, a priority from 1 to 256 is assigned to the sound by
the user. If all the channels are busy, and the priority of the
requested sound is greater than or equal to any of the currently
playing sounds, the requested sound will then take over.
In addition, the ADSR envelope allows for any sound to interrupt during
the Release phase of the current sound. Once the sound enters the
Release phase, its priority is set to zero. It will still play its
release unless another sound tries to get that channel. This increases
the probability of a channel being available at any time. It also
allows the most important part of the sound to be heard. If you
require a high density of sound, this technique will be very
effective.
It also allows you to write your own music driver that can assign
priorities to each "track" (a single monophonic voice) of music. For
example, you can be playing a track of music with a priority of 10, but
if there is a sound effect that must occur, you can assign its priority
15. When the sound effect is over, the music will continue playing.
Page 12
However, priorities are only assigned on snd_on calls, not on snd_off.
This means that before turning off a musical note, it is good practice
to get the priority of the current sound being played on the voice you
are going to issue a snd_off. The routine get_prior is available for
this purpose. If the returned priority is greater than that of your
musical note, the voice has been interrupted and your music driver
should not turn it off. If you do not follow this rule, a sound effect
can interrupt your music, but as soon as the musical note that was
interrupted is over, a snd_off will be issued that instead will turn
off your sound effect.
The Sound Driver has been designed to be called from within an
interrupt routine. The XBIOS routine for the GI chip (Giaccess) can
NOT be called from an interrupt routine. For this reason trap #9 is
used as a means of altering the GI hardware registers. Naturally, the
application must not use trap #9 for its own purposes.
5.3 SOUND FILES AND DATA
When using GIST, each sound is saved as a C source file, in which a
label is generated that is the same as the file name (without the .C
extension). This label is the name of an array of WORD's representing
the sound data. You may want to create one large include file, or you
can include each sound separately.
The data displayed in the dialog edit boxes in GIST is not always the
same format as the data sent to the sound registers of the ST. Volume
is the same; zero is minimum and fifteen is maximum. The frequency
values are displayed in two ways. The actual frequency is displayed in
Hertz. Although this is not the actual value used by the GI chip, it
is more convenient to use when designing sounds than a number between 0
and 4095. Since a frequncy of 0 is not a useful frequency, that value
is used to turn off the tone generator.
When considering the sustain of the frequency ADSR, 100% corresponds to
one octave. If the initial frequency is 100 Hz, a sustain at 100% is
200 Hz. An initial frequency of 1000 Hz has a sustain of 2000 Hz at
100%. Percent is a more convenient term than Hertz in this case
because the sustain value will change depending on the initial
frequency. By using percent, the value will be consisten with the
audible change. One octave will be designated by 100%, not a change of
100 Hz in one case and 1000 Hz in another.
The values for noise are exactly the opposite of what they are on the
GI chip. GIST uses the value of 0 for noise to indicate it is
disabled. A value of 32 indicates the highest frequency of noise, 1
indicates the lowest. We find this to be a more sensible way of
displaying the noise values.
Page 13
5.4 HOW TO PLAY A SOUND
The routine to turn a sound on requires as parameters only the pointer
to the sound and its priority. The information for pitch, volume and
duration are part of the sound data. The channel can be chosen by the
Sound Driver based on the priority of the sound. Once the duration of
the sound has elapsed, it will be turned off automatically by the Sound
Driver.
However, if you want to turn a sound on from a music driver in your
game or application, the same routine is used. By specifying the pitch
of the sound, it is treated as a musical tone. This means the sound
will remain at its sustain level until turned off by your music driver.
Remember, becuase of the ADSR, all sounds are capable of being
sustained for an indefinite period. This is a desirable feature when
playing music.
5.5 IMPLEMENTATION
In order to use the Sound Driver, there are separate folders on the
master disk: Megamax, Alcyon, Lattice and GST. Within each folder are
the object files required and a sample Make file or Link file. Also on
the master disk is a file named DRVRDEMO.C (There is a special
DRVRDEMO.GST is the demo GST program). This C program will use all the
Sound Driver routines. For GFA Basic and Personal Pascal, there are
folders called GFABASIC and PASCAL. Refer to the DRVRDEMO.BAS and
DRVRDEMO.PAS in the appropriate folders for specific instructions.
Below is a description of all the Sound Driver routines.
Install_int will install the interrupt routine. The vector for the 200
Hz system timer interrupt routine is set to point to the Sound
interrupt routine. This routine MUST be called after appl_init and
before any of the below routines are called.
Calling sequence is:
install_int()
Remove_int will remove the interrupt routine. The 200 Hz system timer
interrupt routine vector is returned to its normal location. This
routine MUST be called prior to appl_exit. None of the below routines
should be called after this routine.
Snd_on will play a sound that was created using GIST and stored as a C
source code on a channel of the GI chip.
Calling sequence is:
Page 14
snd_on(sndptr,voice,volume,pitch,priority)
where:
WORD *sndptr = the pointer to the array of parameters known as
sound data, e.g., drwho[].
WORD voice = the voice number corresponding to the GI
channel number 0, 1, or 2. A -1 tells the sound driver to use any
available channel.
WORD volume = volume of the sound (0-15) or -1 to use volume
stored with sound data.
WORD pitch = the pitch of the sound. When playing sound
effects, (pitch= -1) the sound will play using the frequency value in
the sound data; the duration is determined by the duration value in the
sound data. A sound_off will automatically be issued when the duration
has elapsed. When playing musical tones, pitch (24-108) corresponds to
the semitone number (60 = middle C on a piano keyboard or 262 Hz; 72 =
one octave above; this is the same as MIDI pitch numbers). The sound
will remain on until a sound_off is issued. In other words, if pitch =
-1, it is considered a sound effect. If pitch is specified, it is
considered a musical note.
WORD priority = priority of the sound (0-32767) where the
higher the value, the higher the priority. Equal values take
precedence over each other. When a snd_off is issued, the priority is
reduced to zero during the release phase of any sound. Thus, priority
should normally set set to at least 1.
The voice number used will be returned. If no voice was available, -1
is returned (NOTE: type WORD is always returned except in GST which
returns type int (32-bits)).
Snd_off will cause the sound to move into its release phase and reduce
the priority to zero.
The calling sequence is:
snd_off(voice)
where:
WORD voice = the voice which is to be moved into its release
phase (0, 1, or 2). Any other value has no effect.
Stop_snd will cause the sound to completely stop. No matter what phase
the sound is in (attack, decay, sustain, or release), the sound will
end. Unlike snd_off, there is no release.
The calling sequence is:
stop_snd(voice)
Page 15
where:
WORD voice = the voice which is to be stopped (0, 1 or 2).
Any other value has no effect.
Get_prior will return the priority of the requested voice. This
routine is useful if you have a case where a snd_off might turn off the
wrong sound. You can call get_prior and issue the snd_off only if the
priority matches the original.
The calling sequence is:
get_prior(voice)
where
WORD voice = the voice whose priority is requested (0, 1 or
2). (NOTE: type WORD is always returned except in GST which returns
type int (32-bits)).
Init_snds will completely stop sound on all all channels.
The calling sequence is:
init_snds()
END
Page 16