xmp/docs/format/sfx_format
analysed by Claudio Matsuoka <claudio@helllabs.org>
Mon Feb 22 09:29:58 EST 1999

Format: SFX
Version 1.3
Author: C. Haller and A. Weber
Origin: SoundFX (Amiga)


As far as I can tell this is a pretty simple format and despite its name
it has very limited effects. This format description was reverse-engineered
from "FasterThanLight.sfx" and "PSA.sfx" found in the Delitracker mods disk
and later tested with "FutureWars.sfx" and "Twinworld.sfx". Byte order is
big-endian.

Update: effects description added based on the replayer code sent by BuZz
(Sound Abspiel Routine zu Sound FX (C) 1988 LINEL Switzerland)

Here is the format description in "Asle" style:


Offset    Size (bytes)   Comment
------    ------------   -------
   0	       60	 Sample size table, 4 bytes per sample
  60            4	 ID 'SONG'
  64            2        Delay value (see below)
  66           14        ?

      ***************************************
      * The following is repeated 15 times  *
      * with 30 bytes description for 1 smp *
******************************************************        
                                                     *
  80	       22        Sample name                 *
 102            2        Sample length / 2 (?)       *
 104            1        Finetune (?)                *
 105            1        Volume (00 - 3f)            *
 106            2        Loop start                  *
 108            2        Loop length / 2             *
                                                     *
******************************************************        

 530            1        Song length
 531            1        ? (restart position?)
 532          128	 Orders
 660	        ?        Pattern data

 Each note takes 4 bytes and is stored like Protracker:

        period value
       /           \
      |             |
 0000 0000  0000 0000  0000 0000  0000 0000
 |  |                  |  | |  |  |       |
  \  \                /  /   \/    \     /
   `----Sample number---'  effect   effect
                                   parameter

Protracker periods:

C-1 to B-1 : 856,808,762,720,678,640,604,570,538,508,480,453
C-2 to B-2 : 428,404,381,360,339,320,302,285,269,254,240,226
C-3 to B-3 : 214,202,190,180,170,160,151,143,135,127,120,113


   ?            ?        Sample data stored like Protracker


Effects:

  1xy	Arpeggio
  2xy	Pitch bend (x = down, y = up)
  3xx	LED on (set bit 0 at address 0xbfe001)
  4xx	LED off (clear bit 0 at address 0xbfe001)
  5xx	Volume up (add xx to current volume)
  6xx	Set volume (like Protracker Cyy where yy = 64 - xx)
  7xx	Set step up
  8xx	Set step down

The default delay value is 14565 (approx. 122 BPM in Protracker).

