SID-Wizard module format (.swm family)
The native file family of sid-wizard: the .swm work module and its 2/3/4-SID siblings .sws/.swt/.swq, plus the .swi single-instrument file. The byte-exact layout below is from m64's duet research into Hermit's SW 1.97 sources (SWM-spec.src, SWMconvert.c's loader, player.asm), validated against 324/324 example .swi and 143/143 SW 1.97 module files (source: s-duet-research-sidwizard). From the user side, an .swm holds a whole SID-Wizard song — tracks, phrases, the instrument bank, subtunes and chord tables — and an .swi one instrument (source: s-duet-docs-formats). Not to be confused with the exported .sid, which packages tune plus player for playback.
One container, four extensions#
.swm/.sws/.swt/.swq are ONE format; the chip count is the magic's fourth byte ("SWM1"/"SWMS"/"SWMT"/"SWMQ"), which decides the track count (3 per SID) and the header layout. One field drives every layout difference: the mute/solo block is one byte per channel, growing 3 → 6 → 9 → 12 and shoving the rest of the header around it — 2SID still fits in 64 bytes, 3SID/4SID re-pack the header and grow it. AUTHORPOS == header size − 40 in all four: the 40-char author/title field is always the header's tail. The caps shrink with chip count — the C64 runs out of memory, not of numbering (source: s-duet-research-sidwizard):
1SID .swm | 2SID .sws | 3SID .swt | 4SID .swq | |
|---|---|---|---|---|
| chips / tracks | 1 / 3 | 2 / 6 | 3 / 9 | 4 / 12 |
| header size (bytes) | 64 | 64 | 65 | 69 |
| max instruments (selectable) | 37 (36) | 30 (29) | 27 (26) | 23 (22) |
| max patterns | 100 | 105 | 105 | 102 |
| max subtunes | 8 | 2 | 1 | 1 |
A .swt or .swq carrying two subtunes is a file SID-Wizard itself could not open. The SID2..4 address-ID bytes index SID-Wizard's own list of C64 addresses ($D420/$D440/$D460 by default) — a hardware setting with no meaning off a real commodore-64 (source: s-duet-research-sidwizard).
Module layout#
2-byte C64 load address, then the header: magic · frame speed 1..8 (the multispeed factor) · pattern highlight step · per-channel mute/solo ($FF = on) · default pattern length · sequence count (= subtunes × 3) · pattern and instrument counts · chord-table and tempo-table packed lengths · driver type (info only) · tuning type (0 = 440 Hz, 1 = 432 Hz Verdi, 2 = just intonation in C) · author/title. Payload in order: sequences (each: data, then 1 size byte) · patterns (data, size byte, row-count byte) · instruments (exact .swi layout) · chord table (chords separated by $7E/$7F) · tempo table (programs ending with a bit-7 byte) · subtune funktempo pairs (2 bytes per subtune; left byte bit 7 set = single tempo). The file is parsed backwards from EOF — every size byte trails its data (source: s-duet-research-sidwizard).
Orderlists are stored subtune-major, track-minor (track t of subtune s = sequence s×tracks + t); trailing empty subtunes are not written, so the sequence count on disk means "up to the last non-empty orderlist". The tempo table saves only the programs — an empty tune saves zero tempo bytes; runtime pairs are rebuilt at load (shuffle-funktempo; source: s-duet-research-sidwizard).
Limits (1SID): ≤ 100 patterns · ≤ 37 instruments · ≤ 8 subtunes · sequence ≤ 126 bytes · pattern ≤ 249 bytes / 248 rows · instrument ≤ 128 bytes (source: s-duet-research-sidwizard).
Pattern rows and orderlist bytes#
Pattern rows are variable-length: a note byte ($00 empty · $01–$5F note from C-0 · $60–$6F vibrato FX · $70–$77 packed empty rows · $78–$7E note-FX: portamento, sync/ring on/off, gate on/off), with bit 7 announcing an instrument/small-FX byte, whose bit 7 announces an FX byte ($01–$1F big-FX + one parameter byte, $20–$FF small-FX); $FF ends the pattern. Orderlist values: $01–$7F pattern · $80–$9F transpose · $A0–$AF volume · $B0–$EF track tempo · $F0–$FD separator · $FE end · $FF xx jump (xx ≥ $80 = subtune jump). $00 is not a value a song can carry — it is the zero-fill after a track's end, drawn as dots (orderlist; source: s-duet-research-sidwizard).
The .swi instrument file#
A 2-byte load address ($A1 $04) followed by the instrument exactly as it sits inside a module, ending in an 8-character name — so instruments move losslessly between .swi files and any module variant. Contents: the control byte (hard-restart timer/type, 1st-frame-waveform enable, vibrato type, PW/filter reset switches), HR ADSR and note ADSR, vibrato parameters, table speeds and multispeed flags, default chord, octave shift, table pointers, gate-off pointers, the 1st-frame waveform (default $09 = gate+test oscillator reset), and the three instrument-tables (WF-arp-detune, pulse, filter). Max size 128 bytes. All table pointers and jump targets are instrument-base-relative — the player is ground truth over SWM-spec.src's comments (source: s-duet-research-sidwizard; exact execution semantics: s-duet-research-sidwizard-deep).
Sibling extensions from the user side#
duet (m64's tracker, not yet published) treats the family as its second native song format: a .swm (.sws/.swt/.swq) it loads and saves again is byte for byte the same module, and a .swi likewise; its export picks .swm/.sws/.swt/.swq by the number of chips (source: s-duet-docs-formats). SID-Wizard's own SWMconvert converts .swm ↔ .sws and to/from XM and MID (sid-format).
Related#
sid-wizard · sid-format · instrument-tables · orderlist · duet · sid · commodore-64 · multispeed · it-format
Sources#
s-duet-research-sidwizard · s-duet-research-sidwizard-deep · s-duet-docs-formats