home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
sharewar
/
FFE
/
SOUND.SWG
/
0006_CMF.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-09-04
|
4KB
|
84 lines
┌──────────────────────────────────┬─────────────────────────────────────────
│ 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 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 .
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 │
└───────────────────────────┘