# The SPU Sources: psx-spx `soundprocessingunitspu.md` at `6d7d1bc` (tier 3, facts only); psxdev `wiki_eng/spu.md` (CC0); ps1-tests `spu/*` (MIT); PeterLemon `SPU/` EXEs (run only). ## The chip (DOC psx-spx) "A direct evolution of the S-DSP Sony designed for the SNES": 24 voices at 44.1 kHz, 512 KB sound RAM reached only through I/O and DMA4, 16-byte ADPCM blocks with 5 filters, ADSR envelopes, noise, pitch modulation, a stereo reverberator, and digital inputs from the CD (CD-DA and XA-ADPCM) and the expansion port. Sony never released register-level documentation; register names come from the SNES and PS2 counterparts (psx-spx). One output sample every 768 CPU cycles (33.8688 MHz / 44,100). ## Chip rule Single machine as far as the family's plans go (the PlayStation and its arcade derivatives, which use the same chip; the PS2's SPU2 is "basically two PS1 SPU cores", psx-spx). So **the SPU stays inside psx-python** (`psx_python.spu`) behind a pin-shaped interface, extracted only when a second board needs it. It shares no code with `s-dsp-python` (different block format, voices, envelopes and reverb); the S-DSP lineage is a reading aid, not a dependency. ## What the specification must model - Voice registers (1F801C00h + 16 x N), key on/off, ENDX, the ADPCM decoder and loop flags, the pitch counter with **4-point Gaussian interpolation** (psx-spx gives the table), ADSR in its exponential/linear modes with the "shift/step" rule, sweep volumes, noise generator, pitch modulation, the capture buffers (CD L/R, voices 1 and 3) in the first 4 KB of sound RAM. - The reverb unit (unofficial register names; psx-spx describes its algorithm). - SPU RAM transfer: TSA, the data FIFO (1F801DA8h: MAME's tap shows the BIOS writing it 48,329 times in its first second, OBSERVED), manual and DMA reads/writes, the "unstable" DMA read mode with DEV4 delay = 0 (psx-spx), the SPU IRQ address (IRQ9). - Bus quirks (memory-map.md): 16-bit bus, 8-bit odd writes ignored, 32-bit writes unreliable. - CD audio input: CD-DA at 44.1 kHz and XA-ADPCM at 37.8 / 18.9 kHz resampled by the CD side (psx-spx cdrom pages), mixed with the AVOL volumes. ## Modelling level (proposal) **Sample level** (one step per 44.1 kHz sample, 768 CPU cycles), with register reads returning the state at the CPU's cycle. The family's rule "sound: good enough" (Aubrey, 2026-11-13) applies to fine analogue detail, not to register-visible state (ENDX, ENVX, current volumes, the IRQ) that games poll. ## Unknowns - U1 The SPU's internal per-voice processing order within a sample (affects ENDX/ENVX reads mid-sample and the IRQ moment). ps1-tests `spu/memory-transfer` and `test` probe transfers only. - U2 The "unstable" register read/write delays (psx-spx "Unstable and Delayed I/O"). - U3 Reverb rounding and its exact resampling.