SCC-Musixx file format
This page was last modified 14:02, 19 March 2022 by Ro. Based on work by Mars2000you.

Note: the information below is based on reverse engineering of the replayer and file data. As no manual was available, some attributes and/or command names could differ from the original naming.

The .sng file does not have a header and has a maximum length of 32KB, depending on how many patterns are used. The name of the song is the filename (8 characters).

The structure of a .SNG file is as follows:

Offset	Length	Label	Description
0000	0780	|Instr	Instruments. 48xWave(32)+Name(8)
0780	0001	|sngln	Song length (positions)
0781	0064	|postb	Position table
07E5	0600xn	|patrn	Patterns (n times)

Instruments - The file starts with instruments data. It stores 48 (0x30) instruments, no matter if used or not. Each instrument is 0x28 (40) bytes long and contains 0x20 (32) bytes of wave data followed by 8 bytes for the instrument name. The total length of the instrument storage is 48*40=#0780 bytes.

Position table - The position table is 0x64 (100) bytes long, independant of the song length. Each byte contains a pattern number. The patterns are played in order of the position table.

Patterns - The file ends with a serie of pattern data. A song can have a maximum of 0x14 (20) patterns, but only used patterns are saved. Pattern data is fixed in length and is 0x0600 bytes long. It contains 64 rows of 5 channels of data. The first 4 channels are each 5 bytes in length, the 5th channel is 4 bytes. The 5th channel does not have an instrument byte assigned like the first 4 do. This is a default SCC property.

One row of pattern data is set up like this:

[channel#1(5)][channel#2(5)][channel#3(5)][channel#4(5)][channel#5(4)]

For channels 1-4:
Offset	Length	Description
00	02	Frequency of played note
02	01	Instrument
03	01	Volume(b7-4)/Command(b3-b0)
04	01	Command value

For channel 5:
Offset	Length	Description
00	02	Frequency of played note
02	01	Volume(b7-4)/Command(b3-b0)
03	01	Command value
The tone value can be related to notes using the table below:
   C-1 $0D5D  C-2 $06AF  C-3 $....  C-4 $....  C-5 $....  C-6 $....  C-7 $....  C-8 $....  
   C#1 $0C9C  C#2 $064E  C#3 $....  C#4 $....  C#5 $....  C#6 $....  C#7 $....  C#8 $....   
   D-1 $0BE7  D-2 $05F4  D-3 $....  D-4 $....  D-5 $....  D-6 $....  D-7 $....  D-8 $....  
   D#1 $0B3C  D#2 $059E  D#3 $....  D#4 $....  D#5 $....  D#6 $....  D#7 $....  D#8 $....  
   E-1 $0A9B  E-2 $054E  E-3 $....  E-4 $....  E-5 $....  E-6 $....  E-7 $....  E-8 $....  
   F-1 $0A02  F-2 $0501  F-3 $....  F-4 $0140  F-5 $....  F-6 $....  F-7 $....  F-8 $....  
   F#1 $0973  F#2 $04BA  F#3 $....  F#4 $....  F#5 $....  F#6 $....  F#7 $....  F#8 $....  
   G-1 $08EB  G-2 $0476  G-3 $....  G-4 $011D  G-5 $....  G-6 $....  G-7 $....  G-8 $....  
   G#1 $086B  G#2 $0436  G#3 $....  G#4 $....  G#5 $....  G#6 $....  G#7 $....  G#8 $....  
   A-1 $07F2  A-2 $03F9  A-3 $....  A-4 $....  A-5 $....  A-6 $....  A-7 $....  A-8 $....  
   A#1 $0780  A#2 $03C0  A#3 $....  A#4 $00F0  A#5 $0078  A#6 $....  A#7 $....  A#8 $....  
   B-1 $0714  B-2 $038A  B-3 $....  B-4 $....  B-5 $....  B-6 $....  B-7 $....  B-8 $....    

When a note is being played (frq is set), the instrument and volume needs to be set too.

Commands:
Code	Value	Description
00	-	Nop
01	xx	Frequency slide up to value xx within one row count
02	xx	Frequency slide down to value xx within one row count
03	xx	Frequency flip-flop up (zweef)
04	xx	Frequency flip-flop down (zweef)
05	yx	Volume fade to x. When y=0 slide up, when y<>0 slide down. (note this function has a bug) 
06	xx	Transpose frequency up +xx
07	xx	Transpose frequency down -xx
08	--	not used
09	xx	Change SCC deformation register value to xx
0A	--	Early End of Pattern
0B	xx	Goto position xx
0C	xx	Capslock on (xx<>0) off (xx=0)
0D	--	not used
0E	xx	Set user timer byte in replayer to value xx
0F	xx	Tempo (speed). Higher is slower.