SIREN — FANCO-16 v6 SOUND PROTOTYPE =================================== One synthesis kernel, sixteen generators. Each generator has the same basic frequency/pulse/control/ADSR fields and advanced modulation/envelope controls. There is no music player, song table or PCM recording in the chip/VM firmware. CPU timing, chip parameter latching and 48-kHz audio integration are separate. The chip starts silent: saw selected, gate off, frequency zero/raw. One NOTE write plays a useful factory sound without installing a hidden patch. New v6 programs use the 0100 bank; limited 0040 aliases address the same first-three parameters for comparison/ports, not a second engine or app-version profile. Generator n: 0100 + n*10 hex (sixteen bytes) ----------------------------------------- Offset Size Function 0 word Frequency: raw linear by default; musical pitch under FLAGS bit0 2 word Pulse width, low twelve bits; upper four bits ignored 4 byte Wave/control: gate, sync, phase-ring, test and four waveform bits 5 byte Attack/decay: high nibble attack, low nibble decay 6 byte Sustain/release: high nibble sustain, low nibble release 7 byte EXTRA: sine bit0, constant bit1, combine method bits6–7 8 byte Modulation: source bits0–3, method bits4–6; bit7 ignored 9 byte Modulation depth A byte Self phase feedback B byte Shape: non-pulse phase warp / native noise color / constant level C word Custom envelope RAM pointer; zero chooses compact ADSR E byte FLAGS: formats, phase restart, curves, legato and retrigger command F byte NOTE command; reads FF after each CPU write, not stored note pitch Reset: frequency 0000, pulse 0800, control 20 (saw/gate off), AD00, SRF3, EXTRA0, depth/feedback0, shape80, pointer0, FLAGS0, NOTEFF. Source defaults for first three generators are 2/0/1; others use the previous generator. These are fixed defaults. NOTE does not guess whether a patch is "blank". WAVE/control bits ----------------- 0 gate (sampled held state) 1 sync: reset phase on source wrap 2 phase-ring: invert TRIANGLE from source oscillator phase, before its envelope 3 test: hold oscillator/noise clock at reset; waveform output zero 4 triangle 5 saw 6 pulse 7 noise Multiple waveform bits combine. Sync and phase-ring may both be selected. EXTRA adds sine/constant. Combine 0=average selected components, 1=product, 2=8-bit quantized XOR, 3=8-bit quantized AND. This digital combination model is not a claim of physical 6581 combined-waveform/analog equivalence. Frequency and shape ------------------- Raw frequency f uses increment f*985248/(2^24*48000), including exact zero. Musical pitch 8000 means A4/440 Hz, +0100 one semitone, +0C00 one octave. NOTE is a musical-note shortcut; low-level raw/fine pitch remains available. Pulse duty is raw12/4096, independent from Shape. Shape80 is neutral for sine/ triangle/saw; lower/higher values warp the phase split. Shape colors native noise or sets signed constant strength. Flags bit1 chooses colored xorshift noise; otherwise noise uses a 23-bit LFSR clocked sixteen times the oscillator rate. Noise and oscillator phases remain separate, including sync/ring use. Modulation methods ------------------ 0 none; 1 phase/FM; 2 audible/enveloped AM/ring; 3 phase sync; 4 pitch; 5 pulse width; 6 phase-ring; 7 simultaneous phase sync and phase-ring. CONTROL sync/ring and MODULATION share the selected source. Phase-ring flips only triangle, not every component of a combined waveform. Modulation input is pre-audible-output gain: an inaudible generator can still modulate another. Raw-frequency generators advance together before phase connections. Musical modulation retains the native ordered/delayed-source behavior; this prototype is not an exact transistor/analog chip simulation. FLAGS and NOTE -------------- FLAGS bit0: musical pitch (otherwise raw linear) bit1: native colored noise (otherwise clocked LFSR) bit2: restart phase on a rising gate/retrigger bit3: exponential compact-ADSR decay/release (attack remains linear) bit4: legato NOTE when already held bits5–6: ignored bit7: write-one envelope retrigger, self-cleared in CPU RAM NOTE 00–7F: set MIDI note, musical format, gate on and request retrigger. Legato flag skips retrigger while already held. FF releases; 80–FE are invalid and leave the previous valid desired state unchanged, setting status bit1. Reading NOTE returns FF immediately after a CPU write. Repeated equal writes are distinct commands, but commands within one chip tick collapse to latest. Gate-off/release after a trigger cancels the pending trigger. Retrigger while gate is off has no audible effect. These commands do not change waveform, ADSR, pan, routing, modulation, delay or envelope-pointer configuration. Gate is sampled state, not an edge FIFO. A gate-off/on pulse wholly between control ticks can disappear. Use NOTE or write-one retrigger when a new hit must be explicit. Image initialization clears NOTE/retrigger action bits; loaded configuration gates may be on, but initial NOTE bytes are not commands. Envelope paths -------------- Compact AD/SR rates use the familiar sixteen rate indices. Linear compact attack/decay/release preserves the current digital factory model. Optional exponential decay/release makes expressive instruments; native multisegment curves remain available through a custom record. Custom record: nine bytes — four (target level,time) byte pairs, then flags. Time0 is immediate; nonzero t is about 1 ms * 2^((t-1)/16), to about 60 seconds. Flags bits0–3 choose exponential curves per segment, bits4–5 sustain stage, bit6 sustain enabled, bit7 loop the first three stages while held. Release moves to stage four. Targets range 0–255. Modulator envelopes shape FM too. Pointer0 chooses compact ADSR for the next trigger. A nonzero pointer must be 0300–FFF7: the whole nine-byte record must fit ordinary RAM without wrapping. Writing pointer high byte commits; a word store commits once, atomically. The CPU reserves both register events and all ten snapshot events BEFORE any mutation. It copies nine bytes at retirement, adding nine virtual DMA cycles. The audio renderer consumes that historical snapshot, NEVER future guest RAM. The latest valid snapshot becomes the next-trigger configuration at a control tick; no automatic retrigger. Held notes retain their existing record. Editing RAM requires recommit. Invalid desired pointer bytes remain readable but set status bit0 and leave the last valid active configuration intact. Compact ADR updates do not replace a running custom snapshot; pointer0 plus the next hit selects the compact path again. Mixing and effects — retained, no fifteen-operator shortcut sacrifice ------------------------------------------------------------------- 0200–0227 Eight five-byte output slots: source/gain word (low4 source, high12 gain), signed pan byte, filter route byte, delay-send byte. 0228–0242 Three nine-byte filters: cutoff word (musical scale), resonance, mode (LP/BP/HP bits), level, signed pan, send, modulation source, modulation depth. Source bit7 enables cutoff modulation. 0243 Coarse master, low four bits, normalized 0–15 0244–02F3 Eight twenty-two-byte delay lines, two taps each 02F4–02F5 Chip control Hz word, default 600, zero freezes parameter latching 02F6 Status: bit0 invalid envelope pointer; bit1 invalid NOTE; bit2 invalid chip Hz. CPU write clears written bits; zero clears all. 02F7 Independent fine master, normalized 0–255 02F8–02FF Ordinary low-page scratch bytes, not mapped sound hardware Eight reset output slots target generators 0–7, gain maximum, centered, direct, no effects send. Unassigned generators remain inaudible but usable modulators. Mixing/filters/delays remain orthogonal to each selected generator's instrument. Master coarse/fine multiply. No limiter beyond ordinary output clipping is claimed; reduce gains when many loud voices/effects sum. Delay line offsets: 0=input gain,1=damping,2=mode,3=allpass gain; 4–12 tap0 and 13–21 tap1, each (position word,left,right,feedback,route-mask, negative-mask,mod-source,mod-depth). Positions are Q4 samples, gains signed bytes. Input bus is mono; independent taps feed stereo. Eight lines route feedback into one another to make multi-line reverbs. Buffers are internal, not guest RAM: the current pool is 16 MiB. CPU cost depends on active settings; no real-phone capacity benchmark is claimed here. Capture remains two twelve-byte descriptors at D0/DC: source, format, destination word, count word, destination-stride word, sample interval, map-low, map-high, flags. Sources 00–0F generators,20–22 filters,30 left, 31 right,32 mono. Format0 mapped unsigned byte; format1 signed16 LE. Stride0 chooses format width; interval0 means1. Max count4096 and bounded by 8192-sample history. Flags ENABLE1, ONESHOT2, DONE80. DMA writes only addresses >=0300, skipping wrapped low/control bytes. Both channels end at the same frame. Capture occurs at 120-Hz host frame boundaries, independent from the 50-Hz song. Clock model and limits ---------------------- Oscillators/filters/delays integrate at 48 kHz. Desired parameters are latched at default 600 Hz (80 samples/tick). Control-Hz low byte stages, high byte commits; 0–48000 valid. Invalid Hz sets status and preserves the last valid rate. Disabling latching leaves current audio state running; re-enabling restarts the latch epoch. Rational tick positions avoid cumulative batch drift. 600 is provisional and can be compared with 480 Hz, not a final hardware freeze. CPU timer Hz is independent. Retirement events are sample-quantized currently. The v6 comparison alias covers first-three basic voice fields, master at58 and sine extension5B only. Legacy filter/readback registers are not a complete SID contract here. The native layout covers all sixteen basic/fine controls; no restricted three-voice fine-width/ADSR extension banks are needed. The complete nineteen-selection prototype preserves original parameter-write sequences in bounded cold-init checks, but its 50-Hz tempo/control latch and digital wave/envelope model do NOT establish exact real-C64 sample fidelity. It is a working starting point for richer sound and easier programming.