SIM file format specification as used for 64k intros made with the SquoQuo intro engine
(c)2k2 by Hopper/SquoQuo
Version: 03/01/18



//// File format description \\\\
=================================

Bytes		Description
===========================
1		BPM
1		Resolution (i.e. 32 means 1/32 is the smallest possible length. this smallest unit is called tick)
1		Number of Tracks (i.e. polyphonic instruments)
n*1		For each track volume (0..127)
		<Tracks>

For each Track:
1		channel number
2		Number of notes in track (n) (LSB first (Intel))
n*1		delta note values (i.e. the difference to the last note, start value is 0 so the first value is absolute)
n*2		delta time values (i.e. the difference to the last time, in ticks (usually 1/32), start value is 0 so the first value is absolute)
n*1		delta length values (i.e. the difference to the last length value, start value is 0 so the first value is absolute)
x		<Instrument>

For each Instrument:
1		type of instrument (0=synthesized, 1=singer, 2=GM)
x		<instrument data>

Instrument data for synthesized instrument:
n*x		n <Modules> calculated in sequence
1		0xFF (end-tag)

For each Module:
1		Command byte (<Generator>=0..49 <Filter>=50..99 <Effect>=100..150 <Calculation>=150..255)
		The commands are given as command*2+module offset+buffer flag
		Examples: "amplify" on buffer 1 will be 103=(command 1(amplify))*2 + 100(offset for "effect") + 1(buffer flag)
		          "noise" on buffer 0 will be 4=(command 2 (noise))*2 + 0(offset for "generator") + 0(buffer flag)
x		module specific data

Generator:
x		<Contour> giving the frequency in Hz
4		float value giving the length in seconds

Filter:
x		<Contour> giving the filter frequency in Hz
y		<Contour> giving the filter resonance (this value depends on the filter type, usually 0=no resonance, 1=full resonance)

Effect:
0		if "normalize" needs no parameters
	OR
x		<Contour> giving the amplification factor, if "amplify" (0=silence, 1=original)

Calculation:
0		calculations need no parameters as the calculation combines simply the two buffers. result is put in buffer 0

Contour:
1		type of contour (0=constant value, 1=ADSR)
4		float value if constant value
	OR
32		8 float values defining the ADSR contour.
		Each phase has one time and one value, i.e. A.time A.value D.time D.value S.time S.value R.time R.value
		The time gives the length of the phase, the value gives the target value at the end of the phase

Instrument data for singer instrument:
1		Number of singer parts (think of it as a sung phrase w/o breathing)
		If more than one singer part is given, each singer part is put on one midi note starting at 60 (C3), e.g. the fourth singer part would be 63 (D#3)
		<Singer parts>

For each singer part:
1		Number of phrases
		<Phrases>

For each phrase:
x		Phoneme sequence (null-terminated string) For phonemes see appendix
1		midi note number (0..127)
1		length in ticks (usually 1/32th)

Instrument data for GM instrument:
1		GM patch number (0..127)


//// Appendix phonemes \\\\
===========================

Consonants:
====================
Symbol          Word
--------------------
p               Pin
b               Bin
t               Tin
d               Din
k               Kin
g               Give
c               CHin
j               Gin
f               Fin
v               Vim
T               THin (hard)
D               THis (soft)
s               Sin
z               Zing
S               SHin
Z               meaSure
h               Hit
m               Mock
n               KNock
N               thiNG
r               WRong
l               Long
w               Wasp
y               Yacht

Vowels:
====================
Symbol          Word
--------------------
I               pIt
E               pEt
a               pAt
A               pOt
V               cUt
U               pUt
i               EAse
e               rAIse
u               lOse
o               nOse
O               cAUse
&               rIse
$               nOIse
%               allOW
@		cornER


//// Appendix Synthesizer module commands \\\\
==============================================
The commands are given as command+module offset, e.g. in the file "amplify" will be 101=command 1(amplify)+100(offset for "effect")

Generator (offset 0):
=====================
0		sine
1		square
2		noise (frequency adjustable, too)
3		saw

Filter (offset 50):
===================
0		lowpass
1		bandpass
2		bandstop
3		highpass

Effect (offset 100):
====================
0		normalize
1		amplify
2		overdrive

Calculation (offset 150):
=========================
0		add buffers
1		multiply buffers
2		difference of buffers
