home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / FAQSYS18.ZIP / FAQS.DAT / CMF_FORM.TXT < prev    next >
Internet Message Format  |  1995-10-13  |  4KB

  1. Date: Wed, 9 Mar 94 16:14:20 PST
  2. From: awiggins@sdcc5.UCSD.EDU (Adam Wiggins)
  3. Subject: Re: Need CMF format
  4. Newsgroups: rec.games.programmer
  5.  
  6. >  I need the format of CMF files, particularly the FM instruments part.
  7. >Thanks in advance.
  8.  
  9. CMF consists of 3 different block structures: header block, instrument block
  10. and a music block.
  11.  
  12.                         Header Block.
  13.  
  14. Offset         Description
  15.  
  16. 00-03          File ID'CTMF'
  17. 04-05          Version # (currently 1.10)
  18. 06-07          Offset of instrument block from start of file
  19. 08-09          Offset of music block from start of file
  20. 0A-0B          Ticks per quarter note (default=120)
  21. 0C-0D          Clock ticks per second (default=96)
  22. 0E-0F          Offset of music title from start of file (0=none)
  23. 10-11          Offset of composer name (0=none)
  24. 12-13          Offset of remarks (0=none)
  25. 14-23          Channel-in-use table (16 bytes long)
  26. 24-25          # of instruments used
  27. 26-27          Basic tempo
  28. 28-            Title, composer and/or remarks
  29.  
  30.  
  31.                 Instrument Block
  32.  
  33. Each instrument block is 16 bytes long. 
  34.  
  35. Offset         Description
  36.  
  37. 00             Modulator characteristic
  38. 01             Carrier characteristic
  39.                    bit 7    Pitch Vibrato
  40.                        6    Amplitude Vibrato
  41.                        5    Sustaining Sound
  42.                        4    Envelope Scaling
  43.                        3-0  Frequency Multiplier
  44. 02             Modulator Scaling/Output Level
  45. 03             Carrier Scaling/Output Level
  46.                   bit 7-6  Level Scaling
  47.                       5-0  Output Level
  48. 04             Modulator Attack/Delay
  49. 05             Carrier Attack/Delay
  50.                    bit 7-4 Attack Rate 
  51.                        3-0 Delay Rate
  52. 06             Modulator Sustain Level/Release Rate
  53. 07             Carrier Sustain Level/Release Rate
  54.                    bit 7-4  Sustain Level
  55.                        3-0  Release Rate
  56. 08             Modulator Wave Select
  57. 09             Carrier Wave Select
  58.                    bit 7-2 (all cleared)
  59.                        0-1 Wave Select
  60. 0A             Feedback/Connection
  61.                    bit 7-4 (cleared)
  62.                        3-1 Modulator Feedback   
  63.                        0   Connection
  64. 0B-0F          Not used (Reserved)
  65.  
  66.   
  67.                         Music Block
  68.  
  69. The music block is single track, polyphonic, with a max of 16 channels.
  70. It adheres to the Standard Midi File format. It is like: 
  71.  
  72.  Music block = <delta time> <Midi event> <delta time> <Midi event>...
  73.  
  74.  where:       Delta time = amount of time before Midi event (in ticks)
  75.  
  76.               Midi event = any Midi channel message
  77.  
  78. Here is where the book gets foggy. Some Midi events are Control Change events
  79. but it doesn't say if all are like that. These are the only ones discussed:
  80.  
  81. Control Number       Control Data
  82.    66h               1-127 (Used as markers in music)
  83.    67h               0-Melody mode
  84.                      1-Rhythm mode
  85.  
  86. I don't know of the 0 or 1 are bits or follow the Control Number but it
  87. appears that there will be a 66h then a number between 1 and 127 
  88. designating seminote length (1 seminote = 1/128 of a tick or something)
  89. or a 67h and a 0 or 1 to determine the mode. In Rhythm mode, the last 
  90. 5 channels are:
  91.  
  92. Channel      Rhythm
  93. 12           Bass Drum
  94. 13           Snare
  95. 14           Tom-tom
  96. 15           Top-cymbal
  97. 16           High-hat
  98.  
  99. Control Number      Control Data
  100.    68h                0-127 (Changes pitch upward by the # of 1/128 seminotes.
  101.                              0=Cancel pitch change)
  102.  
  103.    69h                0-127 (Changes pitch downward by the # of 1/128 
  104.                              seminotes. 0=Cancel pitch change)
  105.  
  106.  
  107. Sorry about the ^M's.
  108.  
  109. ...Boone
  110.  
  111.