FM Midi Synth driver Version 1.01
Copyright (c) 1993 by Jamie O'Connell


System Exclusive Information

The FM Synth driver is a bi-directional driver: it provides
a MIDI input port in order to implement System Exclusive
dumps.  The driver can send or receive System Exclusive data
and recive commands.  The general format of a SysEx message
is as follows:

     F0      	MIDI Sys Ex
     00,00, 5B  Manufacturers' ID: WinJammer Software Ltd.
     7F      	Device ID -- Must be present
     01      	Model ID -- FM Synth Driver
     xx      	Command ID -- See Below
     aa      	Address MSB -- Location: System,
             	Working storage, or Bank#
     aa      	Address Channel# or Timbre#
     ss      	Size MSB of following Data Block or
             	#Bytes to dump
     ss      	Size LSB
     data    	Data if send request, otherwise blank
     F7      	End of Exclusive Command

Command ID

     Code     Meaning
     (Hex)
     11       Request Data from Driver
     12       Send Data to the Driver, Send Data
              to the Application
     15       Reset Driver to Power-on state
     16       Reset Timbre Banks
     
In order to receive system exclusive dumps from the driver,
the FM Synth SysEx Input driver must be attached to an
application input port.  It is then a simple matter of
sending the desired starting address, and a size describing
the amount of data to dump.  The data received from the
driver contains a command id of 12 hex, so that the data is in
the proper format to be shipped back to the driver at any
time.

The Reset Timbre Bank message and the Reset Driver message
contain only a single Command ID code -- no address or size
bytes.

Address Bytes

The address bytes, together determine where data will be
stored.  See below for specific locations.

Size Bytes

The total size of the data block is determined by combining
the size bytes (7 bits of each).  Data is stored or dumped
consecutively in Address order -- this means that you can
fill or dump the entire contents of the driver with one data
block.

Timbre Banks

Individual timbres or entire banks may be uploaded to the
driver.  The new timbre prameters remain until the driver is
reset.  You can send the sysex block as if the Banks and
timbres were stored consecutively.  Individual parameters
can be written to by placing a value in the address offset
(LSB).  The new timbre will not take effect until a program
change is made to access the timbre.

Address Map

Addr     Addr     Description
MSB      LSB
00       00       Bank 0, Timbre 0 -- this refers to the
                  first timbre in the first bank -- each
                  timbre is 20 bytes long (see below for
                  format)
00       01       This refers to the second timbre in the
                  first bank
...      ...      ... The rest of the bank
00       7F       The last timbre in the first bank
01       00       The first timbre in the second bank
...      ...      ... The remaining timbres
04       7F       The last timbre in the fifth bank
                  
                  Percussion Parameters
10       00       First Percussion timbre
10       2E       Last Percussion timbre (0-46)
11       00       Percussion Map -- Size: 94 bytes (See
                  Below)
                  
                  System Parameters
20       00       Location of the System Parameters --
                  Size: 24 Bytes (See Below)

Timbre Exclusive Format

Offset  Description              Allowed Values

01    Modulator Attack Rate    0 - 15 higher is faster
02    Modulator Decay Rate     0-15
03    Modulator Sustain Rate   0-15
04    Modulator Release Rate   0-15
05    Modulator                4 lower bits indicating on
      Trem,Vib,EnvScale,KSR    or off:
                               |...|AM|VIB|EGT|KSR|
06    Modulator Frequency      0-15 (0 = 1/2)
      Multiplier
07    Modulator KSL            KSL: 0-3
08    Modulator Output Level   0-63 zero is loudest
      (attenuation)
09    Modulator Wave Form      Wave: 0-7 (0-3 on OPL2)
10    Modulator Feedback, Op   |...|F|F|F|C| - FB: 0-7,
      Connection               FM: 0, Add Syn: 1
11    Carrier Attack Rate      0 - 15 higher is faster
12    Carrier Decay Rate       0-15
13    Carrier Sustain Rate     0-15
14    Carrier Release Rate     0-15
15    Carrier                  4 lower bits indicating on
      Trem,Vib,EnvScale,KSR    or off:
                               |...|AM|VIB|EGT|KSR|
16    Carrier Frequency        0-15 (0 = 1/2)
      Multiplier
17    Carrier KSL              KSL: 0-3
18    Carrier Output Level     0-63 zero is loudest
      (attenuation)
19    Carrier Wave Form        Wave: 0-7 (0-3 on OPL2)
20    Percussion Voice#        Used for Percussion
                               patches: 6=BD, 7=SD,
                               8=TT, 9=CYM, 10=HH
21    Transposition Offset     |...|S|TTTTTT| S=0 pos,1
                               neg;Trans: 0-63
22    Reserved                 Set to 0 -- Future Use
23    Reserved                 Set to 0 -- Future Use
24    Reserved                 Set to 0 -- Future Use

Each timbre is 24 bytes long.  Each bank holds 128 timbres.
There are 3,072 bytes in an entire Bank message (plus
header).  All five banks can be filled by one 15,360 byte
message (plus header).

Percussion Timbres

General MIDI defines 47 drum notes, and the driver has
storage for 47 drum timbres.  The percussion timbres use the
percussion voice# parameter to decide which of the 5 drum
voices to sound for the drum tone.  In addition a percussion
mapping of Key to Timbre is implemented, and may be dumped
and loaded.  There are 47 slots in the percussion map, which
cover MIDI notes 35 to 81 (in other words, array element 0
corresponds to MIDI note 35).  Each slot is 2 bytes, so the
map is 94 byes long:

              Percussion Map Slot
     Offset   Meaning
     01       Timbre number to sound (0-46)
     02       MIDI Note to play for the key
              (60 = Middle C)

System Parameters Exclusive Format

Certain driver configuration parameters may be sent to or
received from the driver.  Following is the format for the
system parameter dump and load.  The address to use for
system parameters is 20 hex:

Offset  Description            Allowed Values

01    Stereo Mode              0 = Mono, 1 = Stereo
02    Percussion Mode          0 = Off, 1 = On
03    Percussion Channel       if Percussion mode = 1:
                               channel = 0-15 (i.e. MIDI
                               channel 10 is value 9)
04    Default Bank             0-4 (Bank1 - Bank5)
05    Vibrato Depth            0 = light, 1 = deep
06    Tremolo Depth            0 = light, 1 = deep
07    Bend Range               0-12 semitones (1 octave)
08    Save these settings      1 = Save the settings in
                               the INI file
09    Channel 0 -- MIDI        0 = Off, 1 = On
      Channel Map
:     :                        The channel map specifies
:     :                        which channels to receive
                               on.
24    Channel 15               0 = Off, 1 = On

Examples

The following message will send a timbre to the first bank,
timbre slot 12 (Vibraphone).  All numbers are in
hexadecimal:

     F0, 00, 00, 5B, 7F, 01, 12 Header & Send Request
     00, 0B, 00, 28        	Bank#1,Timbre#12, Size: 40
     0F, 0B, 0C, 01, 06, 03, 	Data: Operator
     01, 01, 03, 07          	Parameters
     0D, 0A, 0C, 02, 07, 02, 
     01, 03, 02, 00
     1F, 2A, 0B, 00, 06, 03, 	Data: 2nd Timbre
     01, 02, 02, 05          	Operator Parameters
     03, 0D, 0C, 01, 06, 00, 
     00, 03, 03, 00
     F7            	        End of Exclusive
     
This message requests the driver to send timbre#13, 14, and
15 from the 2nd Bank:

     F0, 00, 00, 5B,    	Header & Dump
     7F, 01, 11,          	Request
     01, 0C, 00, 3C, F7   	Bank#2, Timbre#14, Size: 60

The next message requests the driver to reset all the patch
banks to the startup state:

     F0, 00, 00, 5B,      Header & Reset
     7F, 01, 16, F7       Request
