File: fileformat.txt

package info (click to toggle)
komposter 0%2Bgit20201216%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,716 kB
  • sloc: ansic: 15,586; sh: 4,176; asm: 642; makefile: 72
file content (128 lines) | stat: -rw-r--r-- 2,953 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
FILE FORMATS
^^^^^^^^^^^^

note: there may be inaccuracies in this document. refer to the converter
source code (see fileops.c) if unsure about anything.



komposter .ksyn synthesizer file format (iff-like but small-endian for intel)

offset	length	descr
---------------------------------------------------------
0		4	"KSYN"
4		4	size of data in bytes

--- data starts ---
0		4	number of modules stored (m)
4		4	reserved
8		128	synthesizer name (zero-terminated string)

--- module data repeated m times ---
0		4	type
4		64	label
68		4*4	inputs
84		4	x position (float)
88		4	y position (float)
92		4	active
96		4	output active
100		4	input active
104		6*4	reserved
128




patch bank chunk (KBNK) follows KSYN

offset	length	descr
---------------------------------------------------------
0		4	"KBNK"
4		4	size of data in bytes (multiple of 4)

--- data starts ---
8		4	number of patches in bank (np)
12		4	length of the signal stack (sl)

--- patch repeated np times ---
0       	128	name of the patch
128		sl*4	signal stack in module indexes
128+sl*4	sl*4	modulator values in stack order
128+sl*8	sl*4	modulator precision quantifiers




pattern data chunk (KPAT)

offset	length	descr
---------------------------------------------------------
0		4	"KPAT"
4		4	size of data in bytes

--- data starts ---
8		4	length of pattern in measures (pl)
12		pl*16*4	all 16th notes in pattern (32bits each)




sequencer data chunk (KSEQ)

offset	length	descr
---------------------------------------------------------
0		4	"KSEQ"
4		4	size of data in bytes

--- data starts ---
8		4	number of channels (ch)
12		4	song length in measures (sl)
16		4	beats per minute

20		ch*4	synthesizer assignments and flags for channels
20+ch*4		ch*sl*4	pattern numbers for channels
..		ch*sl*4	repeat counts for channels
		ch*sl*4	transpose values for channels
		ch*sl*4 pattern patch assignments for channels






song container chunk (KSNG)

0		4	"KSNG"
4		4	size of data in bytes (ds)

--- data starts ---
8		4	number of pattern chunks
12		4	number of synthesizer and patch bank chunks
16		n	nested KSEQ, KPAT, KSYN and KBNK chunks

ds-12		4	crc32 checksum of data (excluding checksum itself)




NOTES
^^^^^

- a KSNG chunk must contain one and only one KSEQ chunk.

- there must be a KBNK chunk for each KSYN chunk included. the KSYN and KBNK
  chunks are interleaved inside the file so that the KBNK applies to the KSYN
  chunk prior to it.

- patterns and synthesizers are numbered according to the order their chunks
  are stored within the KSNG chunk.

- KSNG files are stored to disk as .ksong files

- synthesizers are stored to disk as .ksyn files, which are actually composed
  of a KSYN chunk and a KBNK chunk immediately following it. when a synth is
  loaded from disk, its patch bank is loaded at the same time.

- the least significant byte of the synthesizer assignments in KSEQ is the
  synthesizer number, bits 31-8 are flags such as the restart bits.