CMF.TXT


               ┌──────────────────────────────────────────┐
               │ Creative Labs File Formats (SBI/CMF/IBK) │
               └──────────────────────────────────────────┘

                 Written for the PC-GPE by Mark Feldman
              e-mail address : u914097@student.canberra.edu.au
                               myndale@cairo.anu.edu.au

              ┌───────────────────────────────────────────┐
              │      THIS FILE MAY NOT BE DISTRIBUTED     │
              │ SEPARATE TO THE ENTIRE PC-GPE COLLECTION. │
              └───────────────────────────────────────────┘


┌────────────┬───────────────────────────────────────────────────────────────
│ Disclaimer │
└────────────┘

I assume no responsibility whatsoever for any effect that this file, the
information contained therein or the use thereof has on you, your sanity,
computer, spouse, children, pets or anything else related to you or your
existance. No warranty is provided nor implied with this information.

┌────────────────────────────────────────────┬───────────────────────────────
│ Sound Blaster Instrument File Format (SBI) │
└────────────────────────────────────────────┘

The SBI format contains the register values for the FM chip to synthesize
an instrument.

┌────────────────────────────────────────────────────────────────────────┐
│ Offset    Description                                                  │
├────────────────────────────────────────────────────────────────────────┤
│ 00h-03h   Contains id characters "SBI" followed by byte 1Ah            │
│ 04h-23h   Instrument name, NULL terminated string                      │
│   24h     Modulator Sound Characteristic (Mult, KSR, EG, VIB, AM)      │
│   25h     Carrier Sound Characteristic                                 │
│   26h     Modulator Scaling/Output Level                               │
│   27h     Carrier Scaling/Output Level                                 │
│   28h     Modulator Attack/Delay                                       │
│   29h     Carrier Attack/Delay                                         │
│   2Ah     Modulator Sustain/Release                                    │
│   2Bh     Carrier Sustain/Release                                      │
│   2Ch     Modulator Wave Seelct                                        │
│   2Dh     Carrier Wave Select                                          │
│   2Eh     Feedback/Connection                                          │
│ 2Fh-33h   Reserved                                                     │
└────────────────────────────────────────────────────────────────────────┘


┌──────────────────────────────────┬─────────────────────────────────────────
│ Creative Music File Format (CMF) │
└──────────────────────────────────┘

The CMF file format consists of 3 blocks: the header block, the instrument
block and the music block.


The CMF Header Block
────────────────────

┌────────────────────────────────────────────────────────────────────────┐
│ Offset    Description                                                  │
├────────────────────────────────────────────────────────────────────────┤
│ 00h-03h   Contains id characters "CTMF"                                │
│ 04h-05h   CMF Format Version MSB = major version, lsb = minor version  │
│ 06h-07h   File offset of the instrument block                          │
│ 08h-09h   File offset of the music block                               │
│ 0Ah-0Bh   Clock ticks per quarter note (one beat) default = 120        │
│ 0Ch-0Dh   Clock ticks per second                                       │
│ 0Eh-0Fh   File offset of the music title (0 = none)                    │
│ 10h-11h   File offset of the composer name (0 = none)                  │
│ 12h-13h   File offset of the remarks (0 = none)                        │
│ 14h-23h   Channel-In-Use Table                                         │
│ 24h-25h   Number of instruments used                                   │
│ 26h-27h   Basic Tempo                                                  │
│ 28h-?     Title, composer and remarks stored here                      │
└────────────────────────────────────────────────────────────────────────┘


The CMF Instrument Block
────────────────────────

The instrument block contains one 16 byte data structure for each instrument
in the piece. Each record is of the same format as bytes 24h-33h in the
SBI file format.


The CMF Music Block
───────────────────

The music block adheres to the standard MIDI file format, and can have from
1 to 16 instruments. The PC-GPE file MIDI.TXT contains more information
on this file format.

The music block consists of an alternating seqence of time and MIDI event
records:

┌─────┬──────────┬─────┬──────────┬─────┬──────────┬─
│dTime│MIDI Event│dTime│MIDI Event│dTime│MIDI Event│ ........
└─────┴──────────┴─────┴──────────┴─────┴──────────┴─

dTime (delta Time) is the amount of time before the following MIDI event.
MIDI Event is any MIDI channel message (see MIDI.TXT).


The CMF file format defines the following MIDI Control Change events:

┌────────────────────────────────────────────────────────────────────────┐
│ Control                                                                │
│ Number        Control Data                                             │
├────────────────────────────────────────────────────────────────────────┤
│  66h          1-127, used as markers in the music                      │
│  67h          0 - melody mode, 1 = rhythm mode                         │
│  68h          0-127, changes the pitch of all following notes upward   │
│               by the given number of 1/128 semitones                   │
│  69h          0-127, changes the pitch of all following notes downward │
│               by the given number of 1/128 semitones                   │
└────────────────────────────────────────────────────────────────────────┘

In rhythm mode, the last five channels are allocated for the percussion
instruments:

                   ┌───────────────────────────┐
                   │ Channel   Instrument      │
                   ├───────────────────────────┤
                   │  12h      Bass Drum       │
                   │  13h      Snare Drum      │
                   │  14h      Tom-Tom         │
                   │  15h      Top Cymbal      │
                   │  16h      High-hat Cymbal │
                   └───────────────────────────┘


┌─────────────────────────────────────────────────┬──────────────────────────
│ Sound Blaster Instrument Bank File Format (IBK) │
└─────────────────────────────────────────────────┘

A bank file is a group of up to 128 instruments.

┌────────────────────────────────────────────────────────────────────────┐
│ Offset    Description                                                  │
├────────────────────────────────────────────────────────────────────────┤
│ 00h-03h   Contains id characters "IBK" followed by byte 1Ah            │
│ 04h-803h  Parameters for 128 instruments, 16 bytes for each instrument │
│           in the same format as bytes 24h-33h in the SBI format        │
│ 804h-C83h Instrument names for 128 instruments, 9 bytes for each       │
│           instrument, each name must be null terminated                │
└────────────────────────────────────────────────────────────────────────┘

┌────────────┬───────────────────────────────────────────────────────────────
│ References │
└────────────┘

Title : Sound Blaster - The Official Book
Authors : Richard Heimlich, David M. Golden, Ivan Luk, Peter M. Ridge
Publishers : Osborne/McGraw Hill
ISBN : 0-07-881907-5