Debian Codegraph @

android/app/jni/papers/oldIns.md

raw
1 # old instrument format (<127)
2
3 this format is used in older versions of Furnace.
4
5 # header
6
7 .fui files use the following header:
8
9 ```
10 size | description
11 -----|------------------------------------
12 16 | "-Furnace instr.-" format magic
13 2 | format version
14 2 | reserved
15 4 | pointer to instrument data
16 2 | wavetable count
17 2 | sample count
18 4 | reserved
19 4?? | pointers to wavetables
20 4?? | pointers to samples
21 ```
22
23 instrument data follows.
24
25 this header is not present on instruments inside a .fur file.
26
27 # data
28
29 notes:
30
31 - the entire instrument is stored, regardless of instrument type.
32 - the macro range varies depending on the instrument type.
33 - "macro open" indicates whether the macro is collapsed or not in the instrument editor.
34 - as of format version 120, bit 1-2 indicates macro mode:
35 - 0: sequence (normal)
36 - 1: ADSR
37 - 2: LFO
38 - see sub-section for information on how to interpret parameters.
39 - FM operator order is:
40 - 1/3/2/4 (internal order) for OPN, OPM, OPZ and OPL 4-op
41 - 1/2/?/? (? = unused) for OPL 2-op and OPLL
42 - meaning of extended macros varies depending on instrument type.
43 - meaning of panning macros varies depending on instrument type:
44 - for hard-panned chips (e.g. FM and Game Boy): left panning is 2-bit panning macro (left/right)
45 - otherwise both left and right panning macros are used
46
47 ```
48 size | description
49 -----|------------------------------------
50 4 | "INST" block ID
51 4 | size of this block
52 2 | format version (see header)
53 1 | instrument type
54 | - 0: SN76489/standard
55 | - 1: FM (OPN)
56 | - 2: Game Boy
57 | - 3: C64
58 | - 4: Amiga/sample
59 | - 5: PC Engine
60 | - 6: AY-3-8910
61 | - 7: AY8930
62 | - 8: TIA
63 | - 9: SAA1099
64 | - 10: VIC
65 | - 11: PET
66 | - 12: VRC6
67 | - 13: OPLL
68 | - 14: OPL
69 | - 15: FDS
70 | - 16: Virtual Boy
71 | - 17: Namco 163
72 | - 18: SCC
73 | - 19: OPZ
74 | - 20: POKEY
75 | - 21: PC Speaker
76 | - 22: WonderSwan
77 | - 23: Lynx
78 | - 24: VERA
79 | - 25: X1-010
80 | - 26: VRC6 (saw)
81 | - 27: ES5506
82 | - 28: MultiPCM
83 | - 29: SNES
84 | - 30: Sound Unit
85 | - 31: Namco WSG
86 | - 32: OPL (drums)
87 | - 33: FM (OPM)
88 | - 34: NES
89 | - 35: MSM6258
90 | - 36: MSM6295
91 | - 37: ADPCM-A
92 | - 38: ADPCM-B
93 | - 39: SegaPCM
94 | - 40: QSound
95 | - 41: YMZ280B
96 | - 42: RF5C68
97 | - 43: MSM5232
98 | - 44: T6W28
99 1 | reserved
100 STR | instrument name
101 --- | **FM instrument data**
102 1 | alg (SUS on OPLL)
103 1 | feedback
104 1 | fms (DC on OPLL)
105 1 | ams (DM on OPLL)
106 1 | operator count
107 | - this is either 2 or 4, and is ignored on non-OPL systems.
108 | - always read 4 ops regardless of this value.
109 1 | OPLL preset (>=60) or reserved
110 | - 0: custom
111 | - 1-15: pre-defined patches
112 | - 16: drums (compatibility only!)
113 2 | reserved
114 --- | **FM operator data** × 4
115 1 | am
116 1 | ar
117 1 | dr
118 1 | mult
119 1 | rr
120 1 | sl
121 1 | tl
122 1 | dt2
123 1 | rs
124 1 | dt
125 1 | d2r
126 1 | ssgEnv
127 | - bit 4: on (EG-S on OPLL)
128 | - bit 0-3: envelope type
129 1 | dam (for YMU759 compat; REV on OPZ)
130 1 | dvb (for YMU759 compat; FINE on OPZ)
131 1 | egt (for YMU759 compat; FixedFreq on OPZ)
132 1 | ksl (EGShift on OPZ)
133 1 | sus
134 1 | vib
135 1 | ws
136 1 | ksr
137 1 | operator enabled (>=114) or reserved
138 1 | KVS mode (>=115) or reserved
139 | - 0: off
140 | - 1: on
141 | - 2: auto (depending on alg)
142 10 | reserved
143 --- | **Game Boy instrument data**
144 1 | volume
145 1 | direction
146 1 | length
147 1 | sound length
148 --- | **C64 instrument data**
149 1 | triangle
150 1 | saw
151 1 | pulse
152 1 | noise
153 1 | attack
154 1 | decay
155 1 | sustain
156 1 | release
157 2 | duty
158 1 | ring mod
159 1 | osc sync
160 1 | to filter
161 1 | init filter
162 1 | vol macro is cutoff (<187) or reserved
163 | - from version 187 onwards, volume and cutoff macros are separate.
164 | - if this is on and the version is less than 187, move the volume macro into the ALG one.
165 1 | resonance
166 1 | low pass
167 1 | band pass
168 1 | high pass
169 1 | channel 3 off
170 2 | cutoff
171 1 | duty macro is absolute
172 1 | filter macro is absolute
173 --- | **Amiga instrument data**
174 2 | initial sample
175 1 | mode (>=82) or reserved
176 | - 0: sample
177 | - 1: wavetable
178 1 | wavetable length (-1) (>=82) or reserved
179 12 | reserved
180 --- | **standard instrument data**
181 4 | volume macro length
182 4 | arp macro length
183 4 | duty macro length
184 4 | wave macro length
185 4 | pitch macro length (>=17)
186 4 | extra 1 macro length (>=17)
187 4 | extra 2 macro length (>=17)
188 4 | extra 3 macro length (>=17)
189 4 | volume macro loop
190 4 | arp macro loop
191 4 | duty macro loop
192 4 | wave macro loop
193 4 | pitch macro loop (>=17)
194 4 | extra 1 macro loop (>=17)
195 4 | extra 2 macro loop (>=17)
196 4 | extra 3 macro loop (>=17)
197 1 | arp macro mode (<112) or reserved
198 | - treat this value in a special way.
199 | - before version 112, this byte indicates whether the arp macro mode is fixed or not.
200 | - from that version onwards, the fixed mode is part of the macro values.
201 | - to convert a <112 macro mode to a modern one, do the following:
202 | - is the macro mode set to fixed?
203 | - if yes, then:
204 | - set bit 30 of all arp macro values (this is the fixed mode bit)
205 | - does the macro loop?
206 | - if yes, then do nothing else
207 | - if no, then add one to the macro length, and set the last macro value to 0
208 | - if no, then do nothing
209 1 | reserved (>=17) or volume macro height (>=15) or reserved
210 1 | reserved (>=17) or duty macro height (>=15) or reserved
211 1 | reserved (>=17) or wave macro height (>=15) or reserved
212 4?? | volume macro
213 | - before version 87, if this is the C64 relative cutoff macro, its values were stored offset by 18.
214 4?? | arp macro
215 | - before version 31, this macro's values were stored offset by 12.
216 | - from version 112 onward, bit 30 of a value indicates fixed mode.
217 4?? | duty macro
218 | - before version 87, if this is the C64 relative duty macro, its values were stored offset by 12.
219 4?? | wave macro
220 4?? | pitch macro (>=17)
221 4?? | extra 1 macro (>=17)
222 4?? | extra 2 macro (>=17)
223 4?? | extra 3 macro (>=17)
224 4 | alg macro length (>=29)
225 4 | fb macro length (>=29)
226 4 | fms macro length (>=29)
227 4 | ams macro length (>=29)
228 4 | alg macro loop (>=29)
229 4 | fb macro loop (>=29)
230 4 | fms macro loop (>=29)
231 4 | ams macro loop (>=29)
232 1 | volume macro open (>=29)
233 1 | arp macro open (>=29)
234 1 | duty macro open (>=29)
235 1 | wave macro open (>=29)
236 1 | pitch macro open (>=29)
237 1 | extra 1 macro open (>=29)
238 1 | extra 2 macro open (>=29)
239 1 | extra 3 macro open (>=29)
240 1 | alg macro open (>=29)
241 1 | fb macro open (>=29)
242 1 | fms macro open (>=29)
243 1 | ams macro open (>=29)
244 4?? | alg macro (>=29)
245 4?? | fb macro (>=29)
246 4?? | fms macro (>=29)
247 4?? | ams macro (>=29)
248 --- | **operator macro headers** × 4 (>=29)
249 4 | AM macro length
250 4 | AR macro length
251 4 | DR macro length
252 4 | MULT macro length
253 4 | RR macro length
254 4 | SL macro length
255 4 | TL macro length
256 4 | DT2 macro length
257 4 | RS macro length
258 4 | DT macro length
259 4 | D2R macro length
260 4 | SSG-EG macro length
261 4 | AM macro loop
262 4 | AR macro loop
263 4 | DR macro loop
264 4 | MULT macro loop
265 4 | RR macro loop
266 4 | SL macro loop
267 4 | TL macro loop
268 4 | DT2 macro loop
269 4 | RS macro loop
270 4 | DT macro loop
271 4 | D2R macro loop
272 4 | SSG-EG macro loop
273 1 | AM macro open
274 1 | AR macro open
275 1 | DR macro open
276 1 | MULT macro open
277 1 | RR macro open
278 1 | SL macro open
279 1 | TL macro open
280 1 | DT2 macro open
281 1 | RS macro open
282 1 | DT macro open
283 1 | D2R macro open
284 1 | SSG-EG macro open
285 --- | **operator macros** × 4 (>=29)
286 1?? | AM macro
287 1?? | AR macro
288 1?? | DR macro
289 1?? | MULT macro
290 1?? | RR macro
291 1?? | SL macro
292 1?? | TL macro
293 1?? | DT2 macro
294 1?? | RS macro
295 1?? | DT macro
296 1?? | D2R macro
297 1?? | SSG-EG macro
298 --- | **release points** (>=44)
299 4 | volume macro release
300 4 | arp macro release
301 4 | duty macro release
302 4 | wave macro release
303 4 | pitch macro release
304 4 | extra 1 macro release
305 4 | extra 2 macro release
306 4 | extra 3 macro release
307 4 | alg macro release
308 4 | fb macro release
309 4 | fms macro release
310 4 | ams macro release
311 --- | **operator release points** × 4 (>=44)
312 4 | AM macro release
313 4 | AR macro release
314 4 | DR macro release
315 4 | MULT macro release
316 4 | RR macro release
317 4 | SL macro release
318 4 | TL macro release
319 4 | DT2 macro release
320 4 | RS macro release
321 4 | DT macro release
322 4 | D2R macro release
323 4 | SSG-EG macro release
324 --- | **extended op macro headers** × 4 (>=61)
325 4 | DAM macro length
326 4 | DVB macro length
327 4 | EGT macro length
328 4 | KSL macro length
329 4 | SUS macro length
330 4 | VIB macro length
331 4 | WS macro length
332 4 | KSR macro length
333 4 | DAM macro loop
334 4 | DVB macro loop
335 4 | EGT macro loop
336 4 | KSL macro loop
337 4 | SUS macro loop
338 4 | VIB macro loop
339 4 | WS macro loop
340 4 | KSR macro loop
341 4 | DAM macro release
342 4 | DVB macro release
343 4 | EGT macro release
344 4 | KSL macro release
345 4 | SUS macro release
346 4 | VIB macro release
347 4 | WS macro release
348 4 | KSR macro release
349 1 | DAM macro open
350 1 | DVB macro open
351 1 | EGT macro open
352 1 | KSL macro open
353 1 | SUS macro open
354 1 | VIB macro open
355 1 | WS macro open
356 1 | KSR macro open
357 --- | **extended op macros** × 4 (>=61)
358 1?? | DAM macro
359 1?? | DVB macro
360 1?? | EGT macro
361 1?? | KSL macro
362 1?? | SUS macro
363 1?? | VIB macro
364 1?? | WS macro
365 1?? | KSR macro
366 --- | **OPL drums mode data** (>=63)
367 1 | fixed frequency mode
368 1 | reserved
369 2 | kick frequency
370 2 | snare/hi-hat frequency
371 2 | tom/top frequency
372 --- | **Sample instrument extra data** (>=67)
373 1 | use note map
374 | - only read the following two data structures if this is true!
375 4?? | note frequency × 120
376 | - 480 bytes
377 2?? | note sample × 120
378 | - 240 bytes
379 --- | **Namco 163 data** (>=73)
380 4 | initial waveform
381 1 | wave position
382 1 | wave length
383 1 | wave mode:
384 | - bit 1: update on change
385 | - bit 0: load on playback
386 1 | reserved
387 --- | **even more macros** (>=76)
388 4 | left panning macro length
389 4 | right panning macro length
390 4 | phase reset macro length
391 4 | extra 4 macro length
392 4 | extra 5 macro length
393 4 | extra 6 macro length
394 4 | extra 7 macro length
395 4 | extra 8 macro length
396 4 | left panning macro loop
397 4 | right panning macro loop
398 4 | phase reset macro loop
399 4 | extra 4 macro loop
400 4 | extra 5 macro loop
401 4 | extra 6 macro loop
402 4 | extra 7 macro loop
403 4 | extra 8 macro loop
404 4 | left panning macro release
405 4 | right panning macro release
406 4 | phase reset macro release
407 4 | extra 4 macro release
408 4 | extra 5 macro release
409 4 | extra 6 macro release
410 4 | extra 7 macro release
411 4 | extra 8 macro release
412 1 | left panning macro open
413 1 | right panning macro open
414 1 | phase reset macro open
415 1 | extra 4 macro open
416 1 | extra 5 macro open
417 1 | extra 6 macro open
418 1 | extra 7 macro open
419 1 | extra 8 macro open
420 --- | **even more macro data** (>=76)
421 4?? | left panning macro
422 4?? | right panning macro
423 4?? | phase reset macro
424 4?? | extra 4 macro
425 4?? | extra 5 macro
426 4?? | extra 6 macro
427 4?? | extra 7 macro
428 4?? | extra 8 macro
429 --- | **FDS instrument data** (>=76)
430 4 | modulation speed
431 4 | modulation depth
432 1 | init modulation table with first wave
433 3 | reserved
434 32 | modulation table
435 --- | **OPZ instrument extra data** (>=77)
436 1 | fms2
437 1 | ams2
438 --- | **wavetable synth data** (>=79)
439 4 | first wave
440 4 | second wave
441 1 | rate divider
442 1 | effect
443 | - bit 7: single or dual effect
444 1 | enabled
445 1 | global
446 1 | speed (+1)
447 1 | parameter 1
448 1 | parameter 2
449 1 | parameter 3
450 1 | parameter 4
451 --- | **additional macro mode flags** (>=84)
452 1 | volume macro mode
453 1 | duty macro mode
454 1 | wave macro mode
455 1 | pitch macro mode
456 1 | extra 1 macro mode
457 1 | extra 2 macro mode
458 1 | extra 3 macro mode
459 1 | alg macro mode
460 1 | fb macro mode
461 1 | fms macro mode
462 1 | ams macro mode
463 1 | left panning macro mode
464 1 | right panning macro mode
465 1 | phase reset macro mode
466 1 | extra 4 macro mode
467 1 | extra 5 macro mode
468 1 | extra 6 macro mode
469 1 | extra 7 macro mode
470 1 | extra 8 macro mode
471 --- | **extra C64 data** (>=89)
472 1 | don't test/gate before new note
473 --- | **MultiPCM data** (>=93)
474 1 | attack rate
475 1 | decay 1 rate
476 1 | decay level
477 1 | decay 2 rate
478 1 | release rate
479 1 | rate correction
480 1 | lfo rate
481 1 | vib depth
482 1 | am depth
483 23 | reserved
484 --- | **Sound Unit data** (>=104)
485 1 | use sample
486 1 | switch roles of phase reset timer and frequency
487 --- | **Game Boy envelope sequence** (>=105)
488 1 | length
489 ??? | hardware sequence data
490 | size is length*3:
491 | 1 byte: command
492 | - 0: set envelope
493 | - 1: set sweep
494 | - 2: wait
495 | - 3: wait for release
496 | - 4: loop
497 | - 5: loop until release
498 | 2 bytes: data
499 | - for set envelope:
500 | - 1 byte: parameter
501 | - bit 4-7: volume
502 | - bit 3: direction
503 | - bit 0-2: length
504 | - 1 byte: sound length
505 | - for set sweep:
506 | - 1 byte: parameter
507 | - bit 4-6: length
508 | - bit 3: direction
509 | - bit 0-2: shift
510 | - 1 byte: nothing
511 | - for wait:
512 | - 1 byte: length (in ticks)
513 | - 1 byte: nothing
514 | - for wait for release:
515 | - 2 bytes: nothing
516 | - for loop/loop until release:
517 | - 2 bytes: position
518 --- | **Game Boy extra flags** (>=106)
519 1 | use software envelope
520 1 | always init hard env on new note
521 --- | **ES5506 data** (>=107)
522 1 | filter mode
523 | - 0: HPK2_HPK2
524 | - 1: HPK2_LPK1
525 | - 2: LPK2_LPK2
526 | - 3: LPK2_LPK1
527 2 | K1
528 2 | K2
529 2 | envelope count
530 1 | left volume ramp
531 1 | right volume ramp
532 1 | K1 ramp
533 1 | K2 ramp
534 1 | K1 slow
535 1 | K2 slow
536 --- | **SNES data** (>=109)
537 1 | use envelope
538 1 | gain mode
539 1 | gain
540 1 | attack
541 1 | decay
542 1 | sustain
543 | - bit 3: sustain mode (>=118)
544 1 | release
545 --- | **macro speeds/delays** (>=111)
546 1 | volume macro speed
547 1 | arp macro speed
548 1 | duty macro speed
549 1 | wave macro speed
550 1 | pitch macro speed
551 1 | extra 1 macro speed
552 1 | extra 2 macro speed
553 1 | extra 3 macro speed
554 1 | alg macro speed
555 1 | fb macro speed
556 1 | fms macro speed
557 1 | ams macro speed
558 1 | left panning macro speed
559 1 | right panning macro speed
560 1 | phase reset macro speed
561 1 | extra 4 macro speed
562 1 | extra 5 macro speed
563 1 | extra 6 macro speed
564 1 | extra 7 macro speed
565 1 | extra 8 macro speed
566 1 | volume macro delay
567 1 | arp macro delay
568 1 | duty macro delay
569 1 | wave macro delay
570 1 | pitch macro delay
571 1 | extra 1 macro delay
572 1 | extra 2 macro delay
573 1 | extra 3 macro delay
574 1 | alg macro delay
575 1 | fb macro delay
576 1 | fms macro delay
577 1 | ams macro delay
578 1 | left panning macro delay
579 1 | right panning macro delay
580 1 | phase reset macro delay
581 1 | extra 4 macro delay
582 1 | extra 5 macro delay
583 1 | extra 6 macro delay
584 1 | extra 7 macro delay
585 1 | extra 8 macro delay
586 --- | **operator macro speeds/delay** × 4 (>=111)
587 1 | AM macro speed
588 1 | AR macro speed
589 1 | DR macro speed
590 1 | MULT macro speed
591 1 | RR macro speed
592 1 | SL macro speed
593 1 | TL macro speed
594 1 | DT2 macro speed
595 1 | RS macro speed
596 1 | DT macro speed
597 1 | D2R macro speed
598 1 | SSG-EG macro speed
599 1 | DAM macro speed
600 1 | DVB macro speed
601 1 | EGT macro speed
602 1 | KSL macro speed
603 1 | SUS macro speed
604 1 | VIB macro speed
605 1 | WS macro speed
606 1 | KSR macro speed
607 1 | AM macro delay
608 1 | AR macro delay
609 1 | DR macro delay
610 1 | MULT macro delay
611 1 | RR macro delay
612 1 | SL macro delay
613 1 | TL macro delay
614 1 | DT2 macro delay
615 1 | RS macro delay
616 1 | DT macro delay
617 1 | D2R macro delay
618 1 | SSG-EG macro delay
619 1 | DAM macro delay
620 1 | DVB macro delay
621 1 | EGT macro delay
622 1 | KSL macro delay
623 1 | SUS macro delay
624 1 | VIB macro delay
625 1 | WS macro delay
626 1 | KSR macro delay
627 ```
628
629 ## interpreting macro mode values
630
631 - sequence (normal): I think this is obvious...
632 - ADSR:
633 - `val[0]`: bottom
634 - `val[1]`: top
635 - `val[2]`: attack
636 - `val[3]`: hold time
637 - `val[4]`: decay
638 - `val[5]`: sustain level
639 - `val[6]`: sustain hold time
640 - `val[7]`: decay 2
641 - `val[8]`: release
642 - LFO:
643 - `val[11]`: speed
644 - `val[12]`: waveform
645 - 0: triangle
646 - 1: saw
647 - 2: pulse
648 - `val[13]`: phase
649 - `val[14]`: loop
650 - `val[15]`: global (not sure how will I implement this)
651