------------------------------------------------------------------------------ F2R (Farandole Form2.0) linear-layout digital music specifications. By Daniel Potter/Digital Infinity. This is the internal format we use for writing demos. Currently there are these versions of the F2R playing code: A) A full C++ version that is rather slow, but plays all effects correctly. B) A full ASM version that is fast, although in real mode, and plays almost no effects C) A full ASM version in protected mode that has been extremely optimized and plays almost no effects (working on it). These will all be available when I see that they are fit for the public eye.. You will see in a moment why I call it a linear-layout format. Everything can be read easily in one pass without mixing up too many variables. (Ex: sample data is stored with sample headers..) Header A -------- len description --- ----------- 3 'F2R' - file magic 3 Composer magic. Only existing one right now is 'FAR' (farandole) 40 Song name in ASCIIZ 2 Songtext length (in bytes) STLen Songtext (length in previous field) 1 Song version. Current version is 0x20 (2.0) 1 Number of channels. Probly not more than 16, but up 256. 1 Default tempo, in ticks per second. NChan Default panning for each channel (length in NOC field above) 1 Number of samples saved in file. Sample Structures ----------------- len description --- ----------- 32 Sample name in ASCIIZ 4 Sample length (PC dword) 1 FineTune. Not currently supported. 1 Volume. Also has no purpose currently. 4 Repeat START (PC dword) 4 Repeat END (PC dword) (note that this is NOT repeat LENGTH) 1 Sample type. bit 0=1->16 bit data Len Sample data in signed format (length=SLen field above) This structure repeats for the number of samples stored in the file. Header B -------- len description --- ----------- 3 SectionID - 'JDC' - (see below comment) 1 Order length 1 Number of patterns stored in file 1 Loop To value (order index) 128 Order table. Blank entries padded with 0xFF Pattern Structure ----------------- len description --- ----------- 3 SectionID - 'JDC' 2 Number of events stored in this pattern 4 Length of pattern in bytes (starting with next byte) What remains is an event for each thing that is to happen on any channel. This eliminates the need for saving blank data, and thus this is currently the most efficient digital format out. Here's the format of each event: len description --- ----------- 1 Event type. Each bit denotes a bit of information included: bit description --- ----------- 0 New note pitch 1 New instrument value 2 Start a new note 3 New volume 4 Effect (normal effect) 5 Extended effect 1 Channel Each of the follow is included only if the appropriate bit is set: 1 ET0-(Octave*12)+Note 1 ET1-Sample number 1 ET3-Volume (0-FF) 2 ET4-effect #+effect data 1 1 ET5-effect data 2 1 Eventtick - number of ticks to wait before processing next event The above structure repeats for NumEvents (in pattern header) and the entire pattern structure continues until all patterns are saved. Effects are standard Farandole Composer effects. Here is a list in case you do not know them: 0- No effect 1- Slide pitch up 2- Slide pitch down 3- Slide to pitch * 4- Retrigger 5- Set vibrato amplitude 6- Vibrato current note with given wavelength 7- Volume slide up 8- Volume slide down 9- Sustained vibrato A- Slide to volume * B- Set panning C- Note offset D- Fine tempo down E- Fine tempo up F- Set tempo *-extended effect (ET5) For more info on how these work and how they are implemented, please see the Farandole documentation, FORMATS.DOC. In the case of the extended effects, the second parameter is what is being slid to. ie pitch slide, parameter two is the pitch to slide to, and vol slide, is the volume to slide to. Note about SectionID: I had a tremendous trouble debugging originally because since all the data in the file practically looked like garbage, there was no way to tell what was going on. What this does is provide the program a way to gauge if the file is valid. If you ever read a section ID and it is not 'JDC' verbatim you should stop reading the file and declare it invalid. This format was provided as a service to the general demo/music/game community. It may be used for any purpose, however if you use my format I would like to at least be greeted or credited or something.. whatever you feel is appropriate. Good luck! Daniel Potter/DI Apr 13, 1994 ----------------------------------------------------------------------------