psx.wiki

Sound Processing Unit (SPU)

24-voice ADPCM sound source and mixer of the PlayStation.

This is an old revision of this page, as edited by RemmyLee at 02:46, 23 October 2026. Edit this revision | Latest revision

Overview

The PlayStation sound system is composed of the SPU and the CD-ROM decoder. The SPU is a 24-voice ADPCM sound source that changes its operating parameters automatically over time, and the CPU operates it through its registers.12 The SPU plays ADPCM sample data from its own local memory at a sampling frequency of 44.1 kHz. It also has a digital reverb and a mixer, which mixes the audio output of the CD-ROM decoder with the SPU's own output before the final audio output.3

Table 1: SPU specifications
Item Specification
Sound data format ADPCM
Number of simultaneous sounds (number of voices) 24
Sampling frequency 44.1 kHz

psx-spx traces the SPU to the S-DSP that Sony designed for the SNES. The PlayStation part has no sound CPU of its own, and its sample memory grew from 64KB to 512KB. It also has 24 voices at 44100 Hz and 16-byte ADPCM blocks with five filters, and its stereo reverb replaced the SNES echo.4

The details are on the following pages:

Table 2: SPU pages
Page Contents
SPU Registers Every register, transfers to the sound buffer, the SPU interrupt
SPU ADPCM Sample block format, loop flags, decoding, interpolation
SPU ADSR and Volume Envelope and volume sweep encodings
SPU Reverb Reverb registers, formula, work area, templates

Sound Buffer

The sound buffer is a 512KB local memory that supplies waveform data to the sound source. It is not mapped in the CPU address space, so the CPU reaches it only through SPU registers or by DMA.35 The buffer holds the ADPCM sound data and is also the work area of the reverb. It also serves as a temporary buffer when sound data from the CD input or the SPU is sent to main memory. DMA from main memory to the sound buffer does not require sound generation to stop during the transfer.3

libspu does not manage the buffer actively, so data must not be transferred into the reserved areas.6 The layout is as follows:

Table 3: Sound buffer memory layout
Address Contents
00000h to 003FFh CD input left, before volume processing
00400h to 007FFh CD input right, before volume processing
00800h to 00BFFh Voice 1 output after envelope processing
00C00h to 00FFFh Voice 3 output after envelope processing
01000h to 0100Fh System reserved: the SPU IRQ clear block
01010h to reverb offset Waveform data
Reverb offset to 7FFFFh Reverb work area, size set by the reverb mode

Sony gives the first 1000h bytes as the SPU decoded data region and 01000h to 0100Fh as system reserved.6 psx-spx gives the four 1KB buffers within the decoded data region.5 The libspu memory functions SpuInitMalloc(), SpuMalloc(), SpuMallocWithStartAddr() and SpuFree() only keep a table of used areas, which allows simple management of the waveform area.67

Voices

Each of the 24 voices plays ADPCM data from the sound buffer, or the noise generator in its place. libspu sets the following attributes for each voice separately: left and right volume, pitch, the address of the waveform data, the envelope (ADSR) and the loop point. Key on and key off are also set voice by voice.8 These attributes may be changed while the voice is sounding. It is therefore possible to vary the interval continuously during a sound, or to change the loop point of looped waveform data while it plays.8

ADPCM or noise, the left and right volume and reverb on or off are set for each voice.3 The pitch of ADPCM data can be varied from -12 octaves to +2 octaves in steps of a half-tone or less.9 With two adjoining voices, the volume of one can vary the pitch of the next: NewPitch(n) = (1 + V(n-1)) x Pitch(n), where V(n-1) is the volume of voice n-1 and Pitch(n) is the pitch set for voice n. Sony calls this an LFO effect, and it uses two voices for one tone.98

The SPU has one noise generator, which uses pseudo random numbers and can replace the waveform data of any voice. The noise tone is varied by changing the noise generation clock, and the envelope still applies to a noise voice.98 The envelope has separate attack, decay, sustain and release rates and a sustain level. Linear or exponential curves can be chosen, except for decay, which is exponential only.9 The volume can also change over time apart from the envelope by linear increment, linear decrement, reverse indexed increment or indexed decrement.10

External Inputs

The SPU has two external inputs: the CD input and the external digital input. Both are sampled at 44.1 kHz and mixed digitally with the SPU output, and either one can be sent to the reverb.7 The CD-ROM decoder plays CD-DA or CD-ROM XA audio. Its output enters the SPU and is mixed with the SPU output, then passes through the reverb unit to the final audio output.2 The external digital input comes from the expansion port.11

The CD input volume is set with SpuSetCommonAttr(). SpuInit() resets the CD volume to zero. The order of initialization is therefore CDInit() and SpuInit() before the CD volume is set.7 On the CD-ROM side, four attenuators in the decoder set the mix of the left and right channels.12

Decoded Data Transfer

The SPU writes the first 1000h bytes of the sound buffer 16 bits at a time at each 44.1 kHz clock. It writes the CD input after volume processing and voices 1 and 3 after envelope processing. Each of the four buffers is 400h bytes and is divided into two halves.7 By choosing which half to read, a program can take up to 100 samples (100 / 44100 = 0.0022 seconds) at a time. SpuReadDecodeData() performs this transfer.7 DMA can then move the data to main memory, where the CD input or SPU output can be processed.10

Initialization

libspu is set up in the following order.713

Table 4: SPU initialization
Step Action
1 Call SpuInit() before any other libspu function
2 Transfer data to the sound buffer, set up reverb, and set the main volume, CD input and external input with SpuSetCommonAttr(), in any order
3 Set voice attributes with SpuSetVoiceAttr()
4 Key on voices with SpuSetKey() or SpuSetKeyOnWithAttr()
5 Call SpuQuit() to stop all SPU processing, and SpuStart() to restart it

libspu has no time control functions; libapi provides them. Between two calls that set the same function, at least 1/44100 second of SPU processing must pass.14

Audio Output

The standard audio cables carry separate left and right signals. A mono television receives only one of them, so psx-spx recommends an option that turns off stereo effects and sends equal volume to both sides.15

References


  1. ^ Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 1-4.

  2. ^ a b Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 4-3, Figure 4-1, Figure 4-2.

  3. ^ a b c d Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 4-4, Table 4-1, Figure 4-3.

  4. ^ psx-spx. Sound Processing Unit (SPU). https://psx-spx.consoledev.net/soundprocessingunitspu/

  5. ^ a b psx-spx. Sound Processing Unit (SPU), SPU Memory layout (512Kbyte RAM). https://psx-spx.consoledev.net/soundprocessingunitspu/

  6. ^ a b c Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 16-7, Figure 16-1.

  7. ^ a b c d e f Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 16-8.

  8. ^ a b c d Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 16-4, Table 16-1.

  9. ^ a b c d Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 4-5, Figure 4-4.

  10. ^ a b Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 4-6, Figure 4-5.

  11. ^ psx-spx. Sound Processing Unit (SPU), Additional Sound Inputs. https://psx-spx.consoledev.net/soundprocessingunitspu/

  12. ^ Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-5.

  13. ^ Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 16-9.

  14. ^ Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 16-3.

  15. ^ psx-spx. Sound Processing Unit (SPU), Mono/Stereo Audio Output. https://psx-spx.consoledev.net/soundprocessingunitspu/

Categories: Hardware