Patch Tutorial #2 - percussive patches
======================================

Before you start, you need to get some tools that will help you create
patches. All of them can be found on archive.epas.utoronto.ca.

sox7dos.zip  - a must for any serious format manipulations
goldwave.zip - or any other 16 bit wave editor like cooled (optional)
patch.exe    - Gravis patch editor (also found in the sdk)
playfile.exe - included with the Gravis
convert.exe  - needed only if you use goldwave (because of a bug)

I would also suggest programs like Csound and samplevision if you plan on
doing a lot of patches. A ASCII/HEX byte editor like Zap is also very
usefull.

1 - You need a sound. In our example, we will use the included SCRATCH.SND.
It is already a raw soundfile, so all the steps that were described in
TUTOR1.TXT (in PATCHKIT.ARJ) are not nescessary. However when you'll do
a patch on your own, you'll need to follow the steps in TUTOR1.TXT and master
applications like SOX and clearly understand the difference between signed/
unsigned, byte/word/float, uLaw samples etc...

2 - Now, you need to determine what frequency the .SND is. By using playfile,
it should be clear that SCRATCH.SND is a 16 bit, signed, 22050 Hz file. You
then note the length of the file (in bytes) and start PATCH.EXE. I use my own
program (PATCHGOD) that ask me for all these parameters and others and
creates automagically a patch (SWIRL.PAT was created like that). But in your
case, you will need to use PATCH. NOTE: code is beeing added to SOX so
that it will convert any sound to a Gravis Ultrasound patch. This, along
with a DOS synth module application will be released in 4th quarter of 1993.

C:>PATCH

Once started, click on the 8 box. You will then see 16. LOOP should be in
red (indicating it is disabled) and SUST green. If not, click on them. You
may have to click on SUST up to 3 times to get the correct mode (SUST green,
no blue dot). Go to the left with the mouse (position 0), then press a on
your pc keyboard. This will load a wavesample. type SCRATCH.SND, 15296 (the 
length in bytes of the raw file) and 0 for filename, bytes to load and bytes
to skip. Click on RANGE, then click on the leftmost note, then click on LOW.
Then click on C3 (click the notes till you get it) or whatever note you want
to put as root note (usually the root note is the note where the percussive
patch will be assigned; for example, percussion 36 in ULTRASND.INI and
DEFAULT.CFG or 163 in ULTRAMID.INI, would be C3 as you can verify yourself
in the TABLE1.TXT file), then click on ROOT and finally click on OCTAVE
SHIFT, click on the rightmost note, then click on HIGH. Type f, then type
22050 for frequency, and then type enter (in TUTOR1.TXT i made you type in
again the low, root and high frequency again). Last, click on range, go at
position 0 and press [, then at the end and press E, then back up to the left 
by 1 sample position and press ] (these are the start loop point, end point
and end loop point expressed in sample offset instead of byte offset because
we are in 16 bit mode).

Now, here is where we change a lot from TUTOR1.TXT. We will modify the
enveloppe by pressing the ENVEL button. Dont panic, it's not as hard as it
looks. I will not yet enter in the wonderfull world of enveloppes yet. I
will save this for TUTOR3.TXT. But you can experiment. Once you modify the
enveloppe, you can either play on your MIDI keyboard if it is connected to
the Gravis MIDI port (will not work off an MPU401), or click on RANGE and
play with the mouse. To get back to enveloppes, press ENVEL. Now if you
dont have an idea on how to do it, i have included an enveloppe already,
so all you have to do is to press F5. It will ask for the name of the
enveloppe file. Type SCRATCH.ENV. On the other hand if you want to make your
own and at some point you are not sure if you have finished or not, and want
to save the enveloppe, press F6 to save it. I would suggest making a few
basic enveloppes that will serve as general purpose later when you do other
patches.

And it's not finished yet! Now we will have to choose between flexibility
and ease of use. If you know the patch may be needed as a melodic or
percussive patch, you keep the current frequency scaling (1.0). But if you
want to use it only as melodic and be able to change the position of the
patch in the .ini or .cfg files, you have to scale it to 0.0. To do this
click the root note (or whatever note you'd like to use equally on the whole
keyboard), then press F7 and type 0.0. To undo this you'd press F7 and type
1.0. If you still want a little frequency change over the keyboard (to use
the same patch on several notes to simulate low, mid and high toms for
example), you could use a factor between 0.0 and 1.0 and it would give more
flexibility. The factor can be up to 2.0. Experiment with it to see it's
effect. Last, we will introduce another command before saving: H. Go ahead,
press H. You can now enter a description or copyright notice, up to 60 bytes
long. Then you are asked for the number of active voices. Type 14. We will
get into details in another tutorial.

Well, that's it. Type s, then type the name of the patch file and it will be
saved. It should be very similar to SCRATCH.PAT (should at least sound the
same). Due to a few errors in PATCH.EXE, the length of the pat as seen by
PATCHMAN in windows will be 0Kb. Also, it wont have a name. To add a name,
you can use a byte editor like ZAP (the converter in SOX will permit a patch
name) and type the name at offset 131 in decimal. Check out patch.h for more
details, in PATCHKIT.ARJ.

If you get lost, try F1 for help. If that's not enough, you can email me, or
better ask on the digest.

Well that's it for today... more tutorials comming, and maybe more
explanations if it's not clear enough.

As for PAD_C7.AIF from the first tutorial, i said i may give the loop points
found in the AIFF file. Well if you havent found them yet, guess you didn't
really look into it. But i will give them anyway: 5823 and 14330 in byte
offsets, or 2911.5 and 7165 in word (16 bit samples) offset. The fractional
loop points will be needed for the 2911.5. Add to the start loop point
fraction until the loop sounds ok (no buzz).

Francois Dion
    '

      Snail mail:
      IdMEDIA
      c/o Francois Dion
      P.O. Box 312
      St-Lambert, QC
      Canada
      J4P 3P8

      Phone:
      514-671-4933 or 514-343-7511

      Internet:
      dionf@ere.umontreal.ca or cism@ere.umontreal.ca

      Fidonet:
      Francois Dion
      1:167/228
