14.1.	File Header _________________________________

'Header' The header field should contain the text "GF1PATCH110."  The first 8
bytes will always be GF1PATCH.  The next three bytes are the version number of
the patch format.  As fields are added to the patch, the number will be
incremented.  All of the UltraSound patches are currently at version 110.  The
older 100 patches are obsolete and should no longer be in use.

'Description' This description field is usually for copyright information.

'Instruments' The number of instruments in the patch.  All of the Gravis
patches contain only one instrument.

'Voices' The GF1 synth can update 14 voices at 44.1Khz.  As the number of
voices increases, the actual output rate of each voice drops. This field should
contain the number of voices that were used when creating the patch. This field
could be used by a MIDI engine to try and make the patch sound the same
regardless of the number of active voices.  Currently this feature is not
implemented in the Gravis MIDI engine.

'Channels' This field is unused.  Only mono data can be played out a voice with
the GF1.

'Wave_Forms' The total number of waveforms in the patch.  This field is used by
programs which need to preallocate space for wave form headers before the patch
is loaded.

'Master_Volume' This field is currently unused.

'Data_Size' The size of the patch data after it is loaded into GF1 dram.  This
number includes the space needed to align each of the waveforms on 32 byte
boundaries.  If you patch loader maintains linked list of waveforms in dram,
and you need to use an extra 32 bytes per waveform, then you can use the
wave_forms field to figure out how much memory you will need to load the patch.
i.e.  data_size + (32 * wave_forms).



14.2.	Instrument Header _________________________________

'Instrument' This field is currently unused.

'Instrument_Name' This field is currently unused.

'Instrument_Size' The size of the instrument.  The number of bytes to skip in
order to read the next instrument header.

'Layers' The number of layers in this instrument.  Multiple layers are usually
used in patches where more than one sound is required with a single MIDI event
(note on).  For example, a piano would could have two layers. The first would
be the actual tone from the hammer hitting the strings, and the second would be
the (thunk) of the key being struck and all of the mechanisms moving inside the
piano.  The mechanisms would probably be frequency independent, and also
independent of the length of the tone.

14.3.	Layer Header __________________________

'Layer_Duplicate' Currently unused.  If the layer duplicate  is non zero, then
this layer should use the data from the previous layer. Only the headers will
follow.

'Layer' The current layer number for this instrument

'Layer_Size' The size of this layer.  Can be used to seek past this layer in
the file.

'Samples' The number of waveforms in this layer.  This field is ignored if
layer_duplicate is true.



14.4.	Wave Header _________________________________

'Wave_Name' This field is currently unused

'Fractions' The start_loop and end_loop are the integer portions of the
wavetable address.  The GF1 can interpolate between sample points and therefore
more resolution than just the integer address is needed.  The most significant
four bits are the fractional address for the start_loop, and the least
significant four bits are the fractional address for the end_loop.

'Wave_Size' The number of bytes of wave table data that follows -- not # of
samples.

'Start_Loop' The integer portion of the starting loop address relative to the
beginning of the wave.  This address is the relative number of bytes, and not
the number of samples.

'End_Loop' The integer portion of the ending loop address relative to the
beginning of the wave.  This address is the relative number of bytes, and not
the number of samples.

'Sample_Rate' This is the sample rate of the recorded data.  This number is not
related to the actual pitch of the recorded tone.

'Low_Frequency' Each wave covers a specific frequency range.  This is the
lowest frequency that this wave can be used to play.  This field is scaled be
1000 for accuracy.

'High_Frequency' Each wave covers a specific frequency range.  This is the
highest frequency that this wave can be used to play.  This field is scaled by
1000 for accuracy.  If there is another wave adjacent to this one and its range
overlaps this range, then the next waveform will always be chosen.

'Root_Frequency' If this wave is played back at the original sample_rate, then
this number should be the pitch of the original tone.  This field is modified
to tune the wave to a particular pitch.  This field is scaled by 1000 for
accuracy.

'Tune' This field is unused.  Tuning is accomplished by modifying the root
frequency.

'Balance' is 100% to the left and 15 is 100% to the right.  As the balance is
shifted from left to right, the total output power of both channels is
constant.

'Envelope_Rate' An array of 6 rates to implement a 6-point envelope. The first
three rates can be used for attack and decay.  If the sustain flag is set, than
the third envelope point will be the sustain point. The last three envelope
points are for the release, and an optional "echo" effect.  If the last
envelope point is left at an audible level, then a sampled release can heard
after the last envelope point. The rate values are sent directly to the GF1
hardware, and are described in the volume ramping section.

'Envelope_Offset' An array of 6 offsets to implement a 6-point envelope. The
first three offsets can be used for attack and decay.  If the sustain flag is
set, than the third envelope point will be the sustain point.  The last three
envelope points are for the release, and an optional "echo" effect.  If the
last envelope point is left at an audible level, then a sampled release can
heard after the last envelope point.  The offset values are sent directly to
the GF1 hardware, and are described in the volume ramping section.

'Tremolo_Sweep' Not implemented.  Tremolo starts automatically when the note
sustains. This will be changed in future software to gradually sweep in the
tremolo depth from 0 at the rate of tremolo_sweep / 45 seconds.

'Tremolo_Rate' The rate of amplitude modulation.  0 is 0.05 Hz, and 255 is 6
Hz.  A complete table is in Appendix H.

'Tremolo_Depth' means turn tremolo off.  255 provides a 16 dB modulation.  A
complete table is in Appendix H..

'Vibrato_Sweep' Gradually sweep in the vibrato depth from 0 at the rate of
vibrato_sweep / 45 seconds.

'Vibrato_Rate' The rate of frequency modulation.  0 is 0.05 Hz, and 255 is 6
Hz.

'Vibrato_Depth' means turn vibrato off.  255 is a one octave modulation.

'Modes' A set of bit fields describing modes and data type: BIT 0-	16 bit
data BIT 1-	unsigned data BIT 2-	looping enabled BIT 3-	bi-directional
loop BIT 4-	play patch backwards.  start at end address, loop backwards,
and then end at beginning address.  BIT 5-	sustain - enveloping stops at
third envelope point.  a note off will continue enveloping.  BIT 6-
currently means enveloping enabled.  All Gravis patches have this bit set.
This field will be modified in the near future to implement a sampled release
at note off instead of at the last envelope point.  If this bit is on, the
sample release occurs after the last envelope point.  If this bit is off, the
sampled release occurs at the note off.  BIT 7-	fast release.  The last three
envelope points are ignored.

'Scale_Frequency' Keyboard frequency scaling.  Normally, MIDI note 64 plays a
middle C.  A 65 plays a C#.  frequency scaling changes the distance in pitch of
each MIDI note.   The scale_frequency is the MIDI note number which is the
pivot point for scaling.  If scale_frequency is 64, then MIDI note 64 will
sound like a C4 regardless of scale factor.

'Scale_Factor' means normal scaling. Each MIDI note is one semitone away from
its neighbor.  512 would be 1/2 semitone apart.  2048 is two semitones apart.
This field can range from 0 semitones (you won't hear it) to 2 semitones. A 512
will give you 1/2 semitone steps. a 256 will give you a 1/4 semitone step.  A
1526 will give you a 1 1/2 semitone step, etc.


