SIDin #6 — Inside DigiOrganizer, Polonius's 4-bit sample editor (Stefano Tognon, 2004)
Tognon's manual-plus-disassembly of digiorganizer, "a great peaces of software wrote by Polonius of Padua for making 4bit sample music using SID volume register": an editor that adds a fourth, sampled voice — drums, bass, voices — on top of a normal single-speed tune written in any other editor, playing packed 4-bit samples from $A000 upward through $D418 from a CIA #2 NMI. The article gives the editor's keys, its sample library, how to make your own samples with sox and a converter, and the whole player code with comments.
Key claims#
- What it is: "an editor that allow you to add a digi-sample music onto a normal (singlespeed) tune you had compose with other editors" — "you can use your favorite editor and extend the sound with full 4° voices in a easy way", with "some problems into this cohabitation" listed below (chip-samples).
- Using it with an external tune:
M,Mand the nameMODULE/DEMOloads the demo sample part;F1plays it;M,L,MUSIC/DEMOand the tune's play address ("usually $1000, but you can have music until $7500") loads the 3-voice tune;F1then plays all four voices. - Track menu (left): pairs of pattern number and repeats − 1:
01 04= pattern 1 five times,02 00= pattern 2 once;$FFrestarts from the beginning,$FEstops the samples (orderlist). - Patterns (right): up to 32 values;
$FFends a pattern early; a non-zero value is the sample to trigger,00= "not take any sample action" so a long sample keeps playing —01 00 00 02 03 FFplays sample 1 for three steps, then 2 and 3. - Sample menu (
S, thenL+ name): the disk holds about 90 named samples — toms ("tom 1", "synth tom", "dx tom", "electom"), "noise 1–6", zokks and lasers, snares ("small snare", "snare reverb", "snare sk.or die", "sanxionsnare", "kraftsnare", "triadsnare"), basses ("base 1–2", "base reverb", "sanxionbase", "kraftbase", "base x"), hi-hats, "dish 1", "crash", "triadcrash 1–2", "ride", "roadrunner", "scream", "bark", "little dog", "burp", "glass", "horse", "cork", "bell", "car", chords ("sanxionchord 1–3", "chord", "guitar accord"), "thank you robb", "bigbow", "nightmare", "boom", "touch", "destroyed egg", "bassguitar 1–2", "synthbass", "guitar 1–5", and vocal bits ("pueaaa", "puuu!!!", "paaaa!!!", "koud he", "uuuu!", "atsyou!", "arr!", "ayeea!", "arrh", "klack!", "oouuuooo!!", "paou!"). Each loaded sample shows its start and end page (e.g.A0–A7, the high bytes of its addresses); up to$2Fsamples fill memory from$A000; only the last sample can be deleted (L) because there is no compaction; the editor pads a sample's last page with$FF"so, volume will go to 15 after the sample is played". - Sample definitions (
CTRL+2):01: A7 AE A0= start page$A700, end page$AE00, speed$A0. A definition may span several loaded samples (A0 A9 A0plays samples 1–3 in a row).SHIFT+A..Isets the global tune speed. - Self-made samples: convert a WAV to 8-bit mono at 6 kHz —
sox sample16.wav -c1 -b -v .8 -r 6000 sample8.wav("reducing even the volume to 80%"; add low-pass filtering "as the down sampling can introduce some spurious upper sound") — then to 4-bit "C64 format (so, in 4+4 format: low nibble, high nibble of 2 samples)" with the DOS programS64_ENGby Reiter/Apidya (www.filety.prv.pl), and load it in the sample menu. - Inside (rights "copyrighted by Polonius and Padua group"): init at
$9000, play at$9003from the IRQ; a four-voice harness isJSR $1000 / JSR $9000for init andJSR $1003 / JSR $9003for play. Init clears memory, programs CIA #2 timer A ($70low byte) and timer B in cascade ($DD0E = $11,$DD0F = $51), enables the timer-B NMI ($DD0D = $82), writes$18to$D418(volume 8 with the low-pass bit) and points the NMI vector$FFFA/$FFFBatnmi_null. "The speed of NMI generation (=speed of sample as the parameter you can set into the editor) is governed by the low byte of timer A" — the definition's speed byte is stored to$DD04when a sample starts. - Constraints: the low-pass bit is or-ed into every volume write, so "if you use filter into music (not recommended by Polonius's note) only the low pass filter may be activate (as it is reseted at each NMI when playing a sample)" — "I don't know why this flag is set, as apparently it has no effect. Maybe you can hack the DigiOrganizer code"; and "make sure that your 3 voices player did not modify the volume during IRQ otherwise some very high noise sound will appears while playing the sample!" (filter-programming).
- The NMI: three handlers —
nmi_null(nothing; active at start and after a sample ends),nmi_sx(lda sample / lsr ×4 / ora #$10 / sta $D418, then armsnmi_dx),nmi_dx(and #$0F / ora #$10 / sta $D418, advances the address, compares the page with the sample's end page, armsnmi_sxornmi_null). The high nibble of each byte is played first. The IRQ side (Play) counts downcurSpeedfromSPEED = $05and, when it wraps, advances track/pattern; a pattern value triggers a sample by copying start page, end page and speed from thedigiSoundtable into the NMI code (self-modifying) and switching the NMI vector tonmi_sx. - Memory map of the listing: code
$9000–$91xxwith the banner "DIGI-ORGANIZER BY POLONUS/PADUA"; track at$9200(00 01 / 00 01 / 01 00 / 02 00 …, then$FF);digiSoundtable at$9300, four bytes per sample ($A0,$A7,$A0,$A0 / $A7,$AE,$A0,$A0 / $AE,$B5,$A0,$A0); patterns at$9500, 32 bytes each (01 00 00 00 01 00 00 00 …); samples from$A000("high page is filled with $FF for complete the samples"). Tognon reused this data "in the SidWine3 demo disk music". - Verdict: "very simple to use"; testing the four-voice result inside the editor is "a good characteristic"; missing are moving samples in memory and mnemonic names for loaded samples.
Practical takeaways#
- The 4-bit digi recipe on the C64, spelled out: 6 kHz 8-bit mono → 4-bit packed two per byte → page-aligned blocks → an NMI that alternately writes each nibble to the volume register; keep the 3-voice player away from
$D418and off the band/high-pass filter while a sample plays. - Sample definitions as (start page, end page, rate) triples mean one "instrument" can chain several raw blocks — a poor man's multisampling of drum hits.
Notable quotes#
"DigiOrganizer is very simple to use and I think you can add digi to your tune in an easy way."
Relevance to the wiki#
Creates digiorganizer; adds the concrete streaming-digi method (rates, packing, NMI, register constraints) that chip-samples so far only had as the scene's summary of Hülsbeck's NMI approach; a small four-voice harness for sid-player-routine.
To verify#
- (unverified, derived) With timer A's low byte
$70= 112 cycles the NMI runs at about 8.8 kHz on PAL; a sample speed of$A0= 160 cycles gives about 6.2 kHz, which matches the 6 kHz conversion rate — the article never states the rate in Hz. - (unverified, derived)
SPEED = $05with thedec / bmicountdown means the digi track steps every sixth IRQ call (about 8 Hz at 50 Hz), so a 32-step pattern is 192 frames; the article does not give the step rate. - (unverified) The PDF text spells the author "Polonius" in the prose and "POLONUS" in the code banner.
Pages touched#
digiorganizer · chip-samples · sid-player-routine · filter-programming · orderlist · sanxion · sidin · multisampling