Debian Codegraph @

android/app/jni/papers/format.md

raw
1 # the Furnace file format (.fur)
2
3 while Furnace works directly with the .dmf format, I had to create a new format to handle future additions to the program.
4
5 this document has the goal of detailing the format.
6
7 **notice:** GitHub's Markdown formatter may break on this file as it doesn't seem to treat tables correctly.
8
9 # information
10
11 files may be zlib-compressed, but Furnace accepts uncompressed files as well.
12
13 all numbers are little-endian.
14
15 the following fields may be found in "size":
16 - `f` indicates a floating point number.
17 - `STR` is a UTF-8 zero-terminated string.
18 - `???` is an array of variable size.
19 - `S??` is an array of `STR`s.
20 - `1??` is an array of bytes.
21 - `2??` is an array of shorts.
22 - `4??` is an array of ints.
23
24 the format has changed several times across versions. a `(>=VER)` indicates this field is only present starting from format version `VER`, and `(<VER)` indicates this field is present only before version `VER`.
25
26 furthermore, an `or reserved` indicates this field is always present, but is reserved when the version condition is not met.
27
28 the `size of this block` fields represent the size of a block excluding the ID and the aforementioned field.
29 these fields are 0 in format versions prior to 100 (0.6pre1).
30
31 # format versions
32
33 the format versions are:
34
35 - 228: Furnace 0.6.8.1
36 - 227: Furnace 0.6.8
37 - 226: Furnace 0.6.8pre2
38 - 225: Furnace 0.6.8pre1
39 - 219: Furnace 0.6.7
40 - 218: Furnace 0.6.6
41 - 214: Furnace 0.6.5
42 - 212: Furnace 0.6.4
43 - 201: Furnace 0.6.3
44 - 197: Furnace 0.6.2
45 - 192: Furnace 0.6.1
46 - 181: Furnace 0.6
47 - 180: Furnace 0.6pre18
48 - 179: Furnace 0.6pre17
49 - 178: Furnace 0.6pre16
50 - 177: Furnace 0.6pre15
51 - 175: Furnace 0.6pre14
52 - 174: Furnace 0.6pre13
53 - 173: Furnace 0.6pre12
54 - 172: Furnace 0.6pre11
55 - 171: Furnace 0.6pre10
56 - 169: Furnace 0.6pre9
57 - 166: Furnace 0.6pre8
58 - 162: Furnace 0.6pre7
59 - 161: Furnace 0.6pre6
60 - 158: Furnace 0.6pre5
61 - 146: Furnace Pro (joke version)
62 - 143: Furnace 0.6pre4
63 - 141: Furnace Tournament Edition (for intro tune contest)
64 - 133: Furnace 0.6pre3
65 - 132: Furnace 0.6pre2
66 - 116: Furnace 0.6pre1.5
67 - 100: Furnace 0.6pre1
68 - 75: Furnace dev75/April Fools' 0.6pre0
69
70 - 54: Furnace 0.5.8
71 - 53: Furnace 0.5.7
72 - 52: Furnace 0.5.7pre4
73 - 51: Furnace 0.5.7pre3
74 - 50: Furnace 0.5.7pre2
75 - 49: Furnace 0.5.7pre1
76 - 48: Furnace 0.5.6
77 - 47: Furnace 0.5.6pre1
78 - 46: Furnace 0.5.5
79 - 45: Furnace 0.5.5pre3
80 - 44: Furnace 0.5.5pre2
81 - 43: Furnace 0.5.5pre1
82 - 42: Furnace 0.5.4
83 - 41: Furnace 0.5.3
84 - 40: Furnace 0.5.2
85 - 39: Furnace 0.5.2pre3
86 - 38: Furnace 0.5.2pre2
87 - 37: Furnace 0.5.2pre1
88 - 36: Furnace 0.5.1
89 - 35: Furnace 0.5
90 - 27: Furnace 0.4.6
91 - 26: Furnace 0.4.6pre1
92 - 25: Furnace 0.4.5
93 - 24: Furnace 0.4.4
94 - 23: Furnace 0.4.3
95 - 22: Furnace 0.4.2
96 - 21: Furnace 0.4.1
97 - 20: Furnace 0.4
98 - 19: Furnace 0.4pre3
99 - 18: Furnace 0.4pre2
100 - 17: Furnace 0.4pre1
101 - 16: Furnace 0.3.1
102 - 15: Furnace 0.3
103 - 14: Furnace 0.2.2
104 - 13: Furnace 0.2.1
105 - 12: Furnace 0.2
106
107 versions that do not appear in this list are `dev???` ones.
108
109 # header
110
111 the header is 32 bytes long.
112
113 ```
114 size | description
115 -----|------------------------------------
116 16 | "-Furnace module-" format magic
117 2 | format version
118 2 | reserved
119 4 | song info pointer
120 8 | reserved
121 ```
122
123 # song info
124
125 ```
126 size | description
127 -----|------------------------------------
128 4 | "INFO" block ID
129 4 | size of this block
130 1 | time base (of first song)
131 1 | speed 1 (of first song)
132 1 | speed 2 (of first song)
133 1 | initial arpeggio time (of first song)
134 4f | ticks per second (of first song)
135 | - 60 is NTSC
136 | - 50 is PAL
137 2 | pattern length (of first song)
138 | - the limit is 256.
139 2 | orders length (of first song)
140 | - the limit is 256 (>=80) or 127 (<80).
141 1 | highlight A (of first song)
142 1 | highlight B (of first song)
143 2 | instrument count
144 | - the limit is 256.
145 2 | wavetable count
146 | - the limit is 256.
147 2 | sample count
148 | - the limit is 256.
149 4 | pattern count (global)
150 32 | list of sound chips
151 | - possible soundchips:
152 | - 0x00: end of list
153 | - 0x01: YMU759 - 17 channels
154 | - 0x02: Genesis - 10 channels (compound!)
155 | - 0x03: SMS (SN76489) - 4 channels
156 | - 0x04: Game Boy - 4 channels
157 | - 0x05: PC Engine - 6 channels
158 | - 0x06: NES - 5 channels
159 | - 0x07: C64 (8580) - 3 channels
160 | - 0x08: Arcade (YM2151+SegaPCM) - 13 channels (compound!)
161 | - 0x09: Neo Geo CD (YM2610) - 13 channels
162 | - 0x42: Genesis extended - 13 channels
163 | - 0x43: SMS (SN76489) + OPLL (YM2413) - 13 channels (compound!)
164 | - 0x46: NES + VRC7 - 11 channels (compound!)
165 | - 0x47: C64 (6581) - 3 channels
166 | - 0x49: Neo Geo CD extended - 16 channels
167 | - 0x80: AY-3-8910 - 3 channels
168 | - 0x81: Amiga - 4 channels
169 | - 0x82: YM2151 - 8 channels
170 | - 0x83: YM2612 - 6 channels
171 | - 0x84: TIA - 2 channels
172 | - 0x85: VIC-20 - 4 channels
173 | - 0x86: PET - 1 channel
174 | - 0x87: SNES - 8 channels
175 | - 0x88: VRC6 - 3 channels
176 | - 0x89: OPLL (YM2413) - 9 channels
177 | - 0x8a: FDS - 1 channel
178 | - 0x8b: MMC5 - 3 channels
179 | - 0x8c: Namco 163 - 8 channels
180 | - 0x8d: YM2203 - 6 channels
181 | - 0x8e: YM2608 - 16 channels
182 | - 0x8f: OPL (YM3526) - 9 channels
183 | - 0x90: OPL2 (YM3812) - 9 channels
184 | - 0x91: OPL3 (YMF262) - 18 channels
185 | - 0x92: MultiPCM - 28 channels (UNAVAILABLE)
186 | - 0x93: Intel 8253 (beeper) - 1 channel
187 | - 0x94: POKEY - 4 channels
188 | - 0x95: RF5C68 - 8 channels
189 | - 0x96: WonderSwan - 4 channels
190 | - 0x97: Philips SAA1099 - 6 channels
191 | - 0x98: OPZ (YM2414) - 8 channels
192 | - 0x99: Pokémon Mini - 1 channel
193 | - 0x9a: AY8930 - 3 channels
194 | - 0x9b: SegaPCM - 16 channels
195 | - 0x9c: Virtual Boy - 6 channels
196 | - 0x9d: VRC7 - 6 channels
197 | - 0x9e: YM2610B - 16 channels
198 | - 0x9f: ZX Spectrum (beeper, SFX-like tildearrow engine) - 6 channels
199 | - 0xa0: YM2612 extended - 9 channels
200 | - 0xa1: Konami SCC - 5 channels
201 | - 0xa2: OPL drums (YM3526) - 11 channels
202 | - 0xa3: OPL2 drums (YM3812) - 11 channels
203 | - 0xa4: OPL3 drums (YMF262) - 20 channels
204 | - 0xa5: Neo Geo (YM2610) - 14 channels
205 | - 0xa6: Neo Geo extended (YM2610) - 17 channels
206 | - 0xa7: OPLL drums (YM2413) - 11 channels
207 | - 0xa8: Atari Lynx - 4 channels
208 | - 0xa9: SegaPCM (for DefleMask compatibility) - 5 channels
209 | - 0xaa: MSM6295 - 4 channels
210 | - 0xab: MSM6258 - 1 channel
211 | - 0xac: Commander X16 (VERA) - 17 channels
212 | - 0xad: Bubble System WSG - 2 channels
213 | - 0xae: OPL4 (YMF278B) - 42 channels
214 | - 0xaf: OPL4 drums (YMF278B) - 44 channels
215 | - 0xb0: Seta/Allumer X1-010 - 16 channels
216 | - 0xb1: Ensoniq ES5506 - 32 channels
217 | - 0xb2: Yamaha Y8950 - 10 channels
218 | - 0xb3: Yamaha Y8950 drums - 12 channels
219 | - 0xb4: Konami SCC+ - 5 channels
220 | - 0xb5: tildearrow Sound Unit - 8 channels
221 | - 0xb6: YM2203 extended - 9 channels
222 | - 0xb7: YM2608 extended - 19 channels
223 | - 0xb8: YMZ280B - 8 channels
224 | - 0xb9: Namco WSG - 3 channels
225 | - 0xba: Namco C15 - 8 channels
226 | - 0xbb: Namco C30 - 8 channels
227 | - 0xbc: MSM5232 - 8 channels
228 | - 0xbd: YM2612 DualPCM extended - 11 channels
229 | - 0xbe: YM2612 DualPCM - 7 channels
230 | - 0xbf: T6W28 - 4 channels
231 | - 0xc0: PCM DAC - 1 channel
232 | - 0xc1: YM2612 CSM - 10 channels
233 | - 0xc2: Neo Geo CSM (YM2610) - 18 channels
234 | - 0xc3: YM2203 CSM - 10 channels
235 | - 0xc4: YM2608 CSM - 20 channels
236 | - 0xc5: YM2610B CSM - 20 channels
237 | - 0xc6: K007232 - 2 channels
238 | - 0xc7: GA20 - 4 channels
239 | - 0xc8: SM8521 - 3 channels
240 | - 0xc9: M114S - 16 channels (UNAVAILABLE)
241 | - 0xca: ZX Spectrum (beeper, QuadTone engine) - 5 channels
242 | - 0xcb: Casio PV-1000 - 3 channels
243 | - 0xcc: K053260 - 4 channels
244 | - 0xcd: TED - 2 channels
245 | - 0xce: Namco C140 - 24 channels
246 | - 0xcf: Namco C219 - 16 channels
247 | - 0xd0: Namco C352 - 32 channels (UNAVAILABLE)
248 | - 0xd1: ESFM - 18 channels
249 | - 0xd2: Ensoniq ES5503 (hard pan) - 32 channels (UNAVAILABLE)
250 | - 0xd4: PowerNoise - 4 channels
251 | - 0xd5: Dave - 6 channels
252 | - 0xd6: NDS - 16 channels
253 | - 0xd7: Game Boy Advance (direct) - 2 channels
254 | - 0xd8: Game Boy Advance (MinMod) - 16 channels
255 | - 0xd9: Bifurcator - 4 channels
256 | - 0xda: SCSP - 32 channels (UNAVAILABLE)
257 | - 0xdb: YMF271 (OPX) - 48 channels (UNAVAILABLE)
258 | - 0xdc: RF5C400 - 32 channels (UNAVAILABLE)
259 | - 0xdd: YM2612 XGM - 9 channels (UNAVAILABLE)
260 | - 0xde: YM2610B extended - 19 channels
261 | - 0xdf: YM2612 XGM extended - 13 channels (UNAVAILABLE)
262 | - 0xe0: QSound - 19 channels
263 | - 0xe1: PS1 - 24 channels (UNAVAILABLE)
264 | - 0xe2: C64 (6581) with PCM - 4 channels
265 | - 0xe3: Watara Supervision - 4 channels
266 | - 0xe5: µPD1771C-017 - 4 channels
267 | - 0xf0: SID2 - 3 channels
268 | - 0xf1: 5E01 - 5 channels
269 | - 0xf5: SID3 - 7 channels
270 | - 0xfc: Pong - 1 channel
271 | - 0xfd: Dummy System - 8 channels
272 | - 0xfe: reserved for development
273 | - 0xff: reserved for development
274 | - (compound!) means that the system is composed of two or more chips,
275 | and has to be flattened.
276 | - (UNAVAILABLE) means that the chip hasn't been implemented in Furnace
277 | yet.
278 32 | sound chip volumes (<135) or reserved
279 | - signed char, 64=1.0, 127=~2.0
280 | - as of version 135 these fields only exist for compatibility reasons.
281 32 | sound chip panning (<135) or reserved
282 | - signed char, -128=left, 127=right
283 | - as of version 135 these fields only exist for compatibility reasons.
284 128 | sound chip flag pointers (>=119) or sound chip flags
285 | - before 118, these were 32-bit flags.
286 | - for conversion details, see oldflags.md.
287 STR | song name
288 STR | song author
289 4f | A-4 tuning
290 1 | limit slides (>=36) or reserved
291 1 | linear pitch (>=36) or reserved
292 | - 0: non-linear
293 | - 1: only pitch change (04xy/E5xx) linear
294 | - 2: full linear (>=94)
295 1 | loop modality (>=36) or reserved
296 1 | proper noise layout (>=42) or reserved
297 1 | wave duty is volume (>=42) or reserved
298 1 | reset macro on porta (>=45) or reserved
299 1 | legacy volume slides (>=45) or reserved
300 1 | compatible arpeggio (>=45) or reserved
301 1 | note off resets slides (>=45) or reserved
302 1 | target resets slides (>=45) or reserved
303 1 | arpeggio inhibits portamento (>=47) or reserved
304 1 | wack algorithm macro (>=47) or reserved
305 1 | broken shortcut slides (>=49) or reserved
306 1 | ignore duplicate slides (>=50) or reserved
307 1 | stop portamento on note off (>=62) or reserved
308 1 | continuous vibrato (>=62) or reserved
309 1 | broken DAC mode (>=64) or reserved
310 1 | one tick cut (>=65) or reserved
311 1 | instrument change allowed during porta (>=66) or reserved
312 1 | reset note base on arpeggio effect stop (0000) (>=69) or reserved
313 4?? | pointers to instruments
314 4?? | pointers to wavetables
315 4?? | pointers to samples
316 4?? | pointers to patterns
317 ??? | orders (of first song)
318 | - a table of bytes
319 | - size=channels*ordLen
320 | - read orders then channels
321 | - the maximum value of a cell is FF (>=80) or 7F (<80).
322 ??? | effect columns (of first song)
323 | - size=channels
324 1?? | channel hide status (of first song)
325 | - size=channels
326 1?? | channel collapse status (of first song)
327 | - size=channels
328 S?? | channel names (of first song)
329 | - a list of channelCount C strings
330 S?? | channel short names (of first song)
331 | - same as above
332 STR | song comment
333 4f | master volume, 1.0f=100% (>=59)
334 | this is 2.0f for modules before 59
335 --- | **extended compatibility flags** (>=70)
336 1 | broken speed selection
337 1 | no slides on first tick (>=71) or reserved
338 1 | next row reset arp pos (>=71) or reserved
339 1 | ignore jump at end (>=71) or reserved
340 1 | buggy portamento after slide (>=72) or reserved
341 1 | new ins affects envelope (Game Boy) (>=72) or reserved
342 1 | ExtCh channel state is shared (>=78) or reserved
343 1 | ignore DAC mode change outside of intended channel (>=83) or reserved
344 1 | E1xy and E2xy also take priority over Slide00 (>=83) or reserved
345 1 | new Sega PCM (with macros and proper vol/pan) (>=84) or reserved
346 1 | weird f-num/block-based chip pitch slides (>=85) or reserved
347 1 | SN duty macro always resets phase (>=86) or reserved
348 1 | pitch macro is linear (>=90) or reserved
349 1 | pitch slide speed in full linear pitch mode (>=94) or reserved
350 1 | old octave boundary behavior (>=97) or reserved
351 1 | disable OPN2 DAC volume control (>=98) or reserved
352 1 | new volume scaling strategy (>=99) or reserved
353 1 | volume macro still applies after end (>=99) or reserved
354 1 | broken outVol (>=99) or reserved
355 1 | E1xy and E2xy stop on same note (>=100) or reserved
356 1 | broken initial position of porta after arp (>=101) or reserved
357 1 | SN periods under 8 are treated as 1 (>=108) or reserved
358 1 | cut/delay effect policy (>=110) or reserved
359 1 | 0B/0D effect treatment (>=113) or reserved
360 1 | automatic system name detection (>=115) or reserved
361 | - this one isn't a compatibility flag, but it's here for convenience...
362 1 | disable sample macro (>=117) or reserved
363 1 | broken outVol episode 2 (>=121) or reserved
364 1 | old arpeggio strategy (>=130) or reserved
365 --- | **virtual tempo data**
366 2 | virtual tempo numerator of first song (>=96) or reserved
367 2 | virtual tempo denominator of first song (>=96) or reserved
368 --- | **additional subsongs** (>=95)
369 STR | first subsong name
370 STR | first subsong comment
371 1 | number of additional subsongs
372 3 | reserved
373 4?? | pointers to subsong data
374 --- | **additional metadata** (>=103)
375 STR | system name
376 STR | album/category/game name
377 STR | song name (Japanese)
378 STR | song author (Japanese)
379 STR | system name (Japanese)
380 STR | album/category/game name (Japanese)
381 --- | **extra chip output settings (× chipCount)** (>=135)
382 4f | chip volume
383 4f | chip panning
384 4f | chip front/rear balance
385 --- | **patchbay** (>=135)
386 4 | patchbay connection count
387 4?? | patchbay
388 | - see next section for more details.
389 1 | automatic patchbay (>=136)
390 --- | **a couple more compat flags** (>=138)
391 1 | broken portamento during legato
392 1 | broken macro during note off in some FM chips (>=155)
393 1 | pre note (C64) does not compensate for portamento or legato (>=168)
394 1 | disable new NES DPCM features (>=183)
395 1 | reset arp effect phase on new note (>=184)
396 1 | linear volume scaling rounds up (>=188)
397 1 | legacy "always set volume" behavior (>=191)
398 1 | legacy sample offset effect (>=200)
399 --- | **speed pattern of first song** (>=139)
400 1 | length of speed pattern (fail if this is lower than 1 or higher than 16)
401 16 | speed pattern (this overrides speed 1 and speed 2 settings)
402 --- | **groove list** (>=139)
403 1 | number of entries
404 ??? | groove entries. the format is:
405 | - 1 byte: length of groove
406 | - 16 bytes: groove pattern
407 --- | **pointers to asset directories** (>=156)
408 4 | instrument directories
409 4 | wavetable directories
410 4 | sample directories
411 ```
412
413 # patchbay
414
415 Furnace dev135 adds a "patchbay" which allows for arbitrary connection of chip outputs to system outputs.
416 it also allows connecting outputs to effects and so on.
417
418 a connection is represented as an unsigned int in the following format:
419
420 - bit 16-31: source port
421 - bit 0-15: destination port
422
423 a port is in the following format (hexadecimal): `xxxy`
424
425 - `xxx` (bit 4 to 15) represents a portset.
426 - `y` (bit 0 to 3) is the port in that portset.
427
428 reserved input portsets:
429 - `000`: system outputs
430 - `FFF`: "null" portset
431
432 reserved output portsets:
433 - `000` through `01F`: chip outputs
434 - `FFD`: wave/sample preview
435 - `FFE`: metronome
436 - `FFF`: "null" portset
437
438 # subsong
439
440 from version 95 onwards, Furnace supports storing multiple songs on a single file.
441 the way it's currently done is really weird, but it provides for some backwards compatibility (previous versions will only load the first subsong which is already defined in the `INFO` block).
442
443 ```
444 size | description
445 -----|------------------------------------
446 4 | "SONG" block ID
447 4 | size of this block
448 1 | time base
449 1 | speed 1
450 1 | speed 2
451 1 | initial arpeggio time
452 4f | ticks per second
453 | - 60 is NTSC
454 | - 50 is PAL
455 2 | pattern length
456 | - the limit is 256.
457 2 | orders length
458 | - the limit is 256.
459 1 | highlight A
460 1 | highlight B
461 2 | virtual tempo numerator
462 2 | virtual tempo denominator
463 STR | subsong name
464 STR | subsong comment
465 ??? | orders
466 | - a table of bytes
467 | - size=channels*ordLen
468 | - read orders then channels
469 | - the maximum value of a cell is FF.
470 ??? | effect columns
471 | - size=channels
472 1?? | channel hide status
473 | - size=channels
474 1?? | channel collapse status
475 | - size=channels
476 S?? | channel names
477 | - a list of channelCount C strings
478 S?? | channel short names
479 | - same as above
480 --- | **speed pattern** (>=139)
481 1 | length of speed pattern (fail if this is lower than 1 or higher than 16)
482 16 | speed pattern (this overrides speed 1 and speed 2 settings)
483 ```
484
485 # chip flags
486
487 ```
488 size | description
489 -----|------------------------------------
490 4 | "FLAG" block ID
491 4 | size of this block
492 STR | data
493 ```
494
495 flags are stored in text (`key=value`) format. for example:
496
497 ```
498 clock=4000000
499 stereo=true
500 ```
501
502 # asset directories (>=156)
503
504 also known as "folder" in the user interface.
505
506 ```
507 size | description
508 -----|------------------------------------
509 4 | "ADIR" block ID
510 4 | size of this block
511 4 | number of directories
512 --- | **asset directory** (×numberOfDirs)
513 STR | name (if empty, this is the uncategorized directory)
514 2 | number of assets
515 1?? | assets in this directory
516 ```
517
518 # instrument (>=127)
519
520 Furnace dev127 and higher use the new instrument format.
521
522 ```
523 size | description
524 -----|------------------------------------
525 4 | "INS2" block ID
526 4 | size of this block
527 2 | format version
528 2 | instrument type
529 ??? | features...
530 ```
531
532 see [newIns.md](newIns.md) for more information.
533
534 # old instrument (<127)
535
536 instruments in older versions of Furnace used a different format. see [oldIns.md](oldIns.md) for more information.
537
538 ## C64 compatibility note (>=187)
539
540 in Furnace dev187 the volume and cutoff macros have been separated, as noted above.
541 however, there are two other changes as well: **inverted relative (non-absolute) cutoff macro**; and a new, improved Special macro.
542
543 if version is less than 187, you must convert the Special macro:
544 1. do not continue if ex4 is not a Sequence type macro!
545 2. move bit 0 of ex4 macro data into bit 3.
546 3. set bit 0 on all steps of ex4 macro to 1.
547 4. if ex3 is not a Sequence type macro, stop here.
548 5. if ex3 macro length is 0, stop here.
549 6. merge the ex3 macro (former Special) into ex4 (former Test).
550 - use the largest size (between ex3 and ex4).
551 - if the ex3 macro is shorter than the ex4 one, use the last value of ex3, and vice-versa.
552 - if the ex4 macro length is 0, expand it to the largest size, and set all steps to 1.
553
554 don't worry about loop or release...
555
556 # wavetable
557
558 ```
559 size | description
560 -----|------------------------------------
561 4 | "WAVE" block ID
562 4 | size of this block
563 STR | wavetable name
564 4 | wavetable width
565 4 | reserved
566 4 | wavetable height
567 4?? | wavetable data
568 ```
569
570 # sample (>=102)
571
572 this is the new sample storage format used in Furnace dev102 and higher.
573
574 ```
575 size | description
576 -----|------------------------------------
577 4 | "SMP2" block ID
578 4 | size of this block
579 STR | sample name
580 4 | length
581 4 | compatibility rate
582 4 | C-4 rate
583 1 | depth
584 | - 0: ZX Spectrum overlay drum (1-bit)
585 | - 1: 1-bit NES DPCM (1-bit)
586 | - 3: YMZ ADPCM
587 | - 4: QSound ADPCM
588 | - 5: ADPCM-A
589 | - 6: ADPCM-B
590 | - 7: K05 ADPCM
591 | - 8: 8-bit PCM
592 | - 9: BRR (SNES)
593 | - 10: VOX
594 | - 11: 8-bit μ-law PCM
595 | - 12: C219 PCM
596 | - 13: IMA ADPCM
597 | - 14: 12-bit PCM (MultiPCM)
598 | - 16: 16-bit PCM
599 1 | loop direction (>=123) or reserved
600 | - 0: forward
601 | - 1: backward
602 | - 2: ping-pong
603 1 | flags (>=129) or reserved
604 | - 0: BRR emphasis
605 1 | flags 2 (>=159) or reserved
606 | - 0: dither
607 | - 1: no BRR filters (>=213)
608 4 | loop start
609 | - -1 means no loop
610 4 | loop end
611 | - -1 means no loop
612 16 | sample presence bitfields
613 | - for future use.
614 | - indicates whether the sample should be present in the memory of a system.
615 | - read 4 32-bit numbers (for 4 memory banks per system, e.g. YM2610
616 | does ADPCM-A and ADPCM-B on separate memory banks).
617 ??? | sample data
618 | - size is length
619 ```
620
621 # old sample (<102)
622
623 this format is present when saving using previous Furnace versions.
624
625 ```
626 size | description
627 -----|------------------------------------
628 4 | "SMPL" block ID
629 4 | size of this block
630 STR | sample name
631 4 | length
632 4 | compatibility rate
633 2 | volume (<58) or reserved
634 2 | pitch (<58) or reserved
635 1 | depth
636 | - 0: ZX Spectrum overlay drum (1-bit)
637 | - 1: 1-bit NES DPCM (1-bit)
638 | - 3: YMZ ADPCM
639 | - 4: QSound ADPCM
640 | - 5: ADPCM-A
641 | - 6: ADPCM-B
642 | - 8: 8-bit PCM
643 | - 9: BRR (SNES)
644 | - 10: VOX
645 | - 16: 16-bit PCM
646 1 | reserved
647 2 | C-4 rate (>=32) or reserved
648 4 | loop point (>=19) or reserved
649 | - -1 means no loop
650 ??? | sample data
651 | - version<58 size is length*2
652 | - version>=58 size is length
653 ```
654
655 # pattern (>=157)
656
657 ```
658 size | description
659 -----|------------------------------------
660 4 | "PATN" block ID
661 4 | size of this block
662 1 | subsong
663 1 | channel
664 2 | pattern index
665 STR | pattern name (>=51)
666 ??? | pattern data
667 | - read a byte per row.
668 | - if it is 0xff, end of data. the rest of the pattern is empty.
669 | - if bit 7 is set, then skip N+2 rows. N is bits 0-6.
670 | - for example, $80 means skip 2 rows, $81 means skip 3, $82 means 4 and so on.
671 | - if bit 7 is clear, then:
672 | - bit 0: note present
673 | - bit 1: ins present
674 | - bit 2: volume present
675 | - bit 3: effect 0 present
676 | - bit 4: effect value 0 present
677 | - bit 5: other effects (0-3) present
678 | - bit 6: other effects (4-7) present
679 | - if none of these bits are set, then skip 1 row.
680 | - if bit 5 is set, read another byte:
681 | - bit 0: effect 0 present
682 | - bit 1: effect value 0 present
683 | - bit 2: effect 1 present
684 | - bit 3: effect value 1 present
685 | - bit 4: effect 2 present
686 | - bit 5: effect value 2 present
687 | - bit 6: effect 3 present
688 | - bit 7: effect value 3 present
689 | - if bit 6 is set, read another byte:
690 | - bit 0: effect 4 present
691 | - bit 1: effect value 4 present
692 | - bit 2: effect 5 present
693 | - bit 3: effect value 5 present
694 | - bit 4: effect 6 present
695 | - bit 5: effect value 6 present
696 | - bit 6: effect 7 present
697 | - bit 7: effect value 7 present
698 | - then read note, ins, volume, effects and effect values depending on what is present.
699 | - for note:
700 | - 0 is C-(-5)
701 | - 179 is B-9
702 | - 180 is note off
703 | - 181 is note release
704 | - 182 is macro release
705 ```
706
707
708 # old pattern (<157)
709
710 ```
711 size | description
712 -----|------------------------------------
713 4 | "PATR" block ID
714 4 | size of this block
715 2 | channel
716 2 | pattern index
717 2 | subsong (>=95) or reserved
718 2 | reserved
719 ??? | pattern data
720 | - size: rows*(4+effectColumns*2)*2
721 | - read shorts in this order:
722 | - note
723 | - 0: empty/invalid
724 | - 1: C#
725 | - 2: D
726 | - 3: D#
727 | - 4: E
728 | - 5: F
729 | - 6: F#
730 | - 7: G
731 | - 8: G#
732 | - 9: A
733 | - 10: A#
734 | - 11: B
735 | - 12: C (of next octave)
736 | - this is actually a leftover of the .dmf format.
737 | - 100: note off
738 | - 101: note release
739 | - 102: macro release
740 | - octave
741 | - this is an signed char stored in a short.
742 | - therefore octave value 255 is actually octave -1.
743 | - yep, another leftover of the .dmf format...
744 | - instrument
745 | - volume
746 | - effect and effect data (× effect columns)
747 | - for note/octave, if both values are 0 then it means empty.
748 | - for instrument, volume, effect and effect data, a value of -1 means empty.
749 STR | pattern name (>=51)
750 ```
751
752 # the Furnace wavetable format (.fuw)
753
754 similar to the instrument format...
755
756 ```
757 size | description
758 -----|------------------------------------
759 16 | "-Furnace waveta-" format magic
760 2 | format version
761 2 | reserved
762 ```
763
764 wavetable data follows.