Skip to content

Paula: The Amiga's Voice

Four channels of sampled sound, plus the disk, the serial port and the interrupts

Paula is the Amiga custom chip that plays sound. Each of its four channels feeds 8-bit samples from Chip memory to its own digital-to-analogue converter by DMA, at a pitch set by a period register and a volume from 0 to 64. The same chip runs the floppy disk controller, the serial port and the interrupt system.

Many computers of the day made their sound with a programmable tone generator, a chip that produced a waveform at whatever pitch the program asked for. The Amiga played recordings. CU Amiga put the difference plainly in 1992: “Instead of just bunging in a programmable voice generator which modulates a sine wave, the Amiga has what amounts to an 8-bit DAC”, a digital-to-analogue converter, “so the basic unit of sound on the Amiga is not a set of envelope instructions, but a sample.”

The chip that does it is Paula. It has four channels, and each one reads a stream of 8-bit samples out of memory by itself, through direct memory access (DMA), and sends them to its own converter. A program sets up a channel and then leaves it alone while the sound plays. The tracker, a program for arranging those samples into music, was born on the Amiga. In June 1990 Amiga Computing reckoned that “99.999 per cent” of game and demo tunes were written with Karsten Obarski’s SoundTracker “or one of its many derivatives”.

Sound is only half of Paula’s job. The same chip runs the floppy disk controller, the serial port and the interrupt system, which is why the Hardware Reference Manual’s glossary describes it as containing “audio, disk, and interrupt circuitry”.

Fast facts

  • Chip: Commodore 8364, one of the three original custom chips with Agnus and Denise. Commodore’s service parts lists and the A1200’s schematics carry the same part number, so the AGA machines of 1992 kept it. In 1992 CU Amiga noted that Paula “has not been updated since its original PAD inception”.
  • Channels: four, each with its own 8-bit converter, sample pointer, length, period and volume.
  • Samples: signed bytes from −128 to +127, fetched from Chip memory two at a time.
  • Stereo: each channel is wired to one side, and the two sources that say which disagree. The Hardware Reference Manual’s audio chapter says channels 1 and 2 go to the left jack and 0 and 3 to the right. The same manual’s serial-connector pin table labels its left audio signal as channels 0 and 3, and Abacus’s Amiga System Programmer’s Guide says Paula’s left output carries channels 0 and 3. Either way, channels 0 and 3 share one side and 1 and 2 the other, so a program that wants stereo pairs one channel from each group.
  • Pitch: a period register counts clock ticks between samples. The shortest usable period is 124 on NTSC machines and 123 on PAL ones, about 28,900 samples a second.
  • Volume: 0 to 64 per channel.
  • Also on the chip: the disk controller, a serial UART, and the interrupt enable and request registers.

Playing a sample

A channel needs four things: where the sample is, how long it is, how fast to play it and how loud. The registers for channel x sit at $DFF0A0 + x × $10:

Register Offset Purpose
AUDxLCH, AUDxLCL +$00, +$02 Start address of the sample (written as one long word)
AUDxLEN +$04 Length in words, so bytes ÷ 2
AUDxPER +$06 Period: clock ticks per sample
AUDxVOL +$08 Volume, 0 to 64
AUDxDAT +$0A Two samples, written by the DMA or by the processor

Then the program switches on the channel’s bit in DMACON, along with the master DMA bit, and Paula starts:

68000 assembly
; Loop a sample on channel 0 (a program that has taken over the hardware)
CUSTOM   equ $dff000
DMACON   equ $096
AUD0LCH  equ $0a0
AUD0LEN  equ $0a4
AUD0PER  equ $0a6
AUD0VOL  equ $0a8

    lea     CUSTOM,a0
    lea     sample,a1                   ; the sample must be in Chip memory
    move.l  a1,AUD0LCH(a0)              ; start address, high and low words at once
    move.w  #(sample_end-sample)/2,AUD0LEN(a0) ; length in words
    move.w  #428,AUD0PER(a0)            ; about 8,287 samples a second on PAL
    move.w  #64,AUD0VOL(a0)             ; full volume
    move.w  #$8201,DMACON(a0)           ; SET + DMAEN + AUD0EN

The audio DMA can reach only Chip memory, so that is where the sample has to be. The manual also insists that sample data start on a word boundary, because the channel fetches a word, two samples, at a time.

Why a sample loops

AUDxLC and AUDxLEN are location registers, not pointers. When the DMA starts, the channel copies them into internal back-up registers and plays from the copies. When the length runs out, it reloads the copies from the same registers and starts again. Left alone, a channel plays its sample round and round, which is exactly what a sustained note or a one-cycle waveform needs.

The copying is also what makes smooth playback possible. The manual explains that the channel raises its interrupt “immediately after the audio DMA channel has read the location and length registers”, so the program can write the next block’s address and length at once, without disturbing the block that is playing. The first interrupt therefore arrives almost as soon as DMA is switched on. After that, each one comes as the last word of a pass begins to play. A program that answers the interrupt is always setting up the block after the current one. The Amiga patterns Playing a Sample and One-Shot Samples build on this.

Stopping is blunter. Clearing the channel’s DMACON bit stops it, and switching it on again “almost always” starts from the top of the sample, not where it left off.

Period, pitch and the 28 kHz ceiling

Paula has no notion of notes. The period register holds a count of clock ticks, and each time the count runs out the channel moves to the next sample:

Code
samples per second = clock constant ÷ period

NTSC clock constant: 3,579,545 ticks a second
PAL clock constant:  3,546,895 ticks a second

A lower period means faster playback and a higher pitch. Halving the period raises a sound by an octave.

Period PAL samples a second
123 28,837 (shortest PAL period)
124 28,604
214 16,574
428 8,287
856 4,144

The ceiling comes from the DMA. Each channel gets one memory slot per scan line, and one slot fetches one word, two samples. The manual works out a theoretical limit of 31,469 samples a second on NTSC and then settles on 28,867, which a period of 124 gives on NTSC and 123 on PAL. Below that, the DMA “will not have had enough time to retrieve the next data sample and the previous sample will be reused.” The trackers treated the limit loosely: the ProTracker module documentation lets a note slide up to period 113.

Music programs used a fixed table of periods, one for each semitone. In ProTracker’s table, 856 is C in the lowest octave and 428 the C above it. A module file stores those period values directly, with volumes on the same 0-64 scale, which is why a MOD file and Paula’s registers look so alike (see MOD format).

The filter

A low-pass filter sits between the converters and the output jacks. The manual says it “becomes active around 4 KHz” and advises that, for a clean sound up to 7 kHz, a sample should play at 14,000 samples a second or more, a period of 256 or less. On A2000s with two-layer motherboards and later A500s, the filter can be bypassed with the bit of the 8520 CIA that also dims the power light.

Volume

Each channel has its own volume, from 0 to 64. Bits 0 to 5 of AUDxVOL select one of 64 levels, and bit 6 forces full volume. So any value from 64 to 127 plays at full volume; values above 64 do not wrap round to quiet ones. The manual calls these “65 linear volume levels”, and its table puts 32 at −6 dB and 16 at −12 dB, with 1 at −36.1 dB and 0 silent. The manual advises recording samples at full range and making quiet sounds with the volume register, which keeps the same accuracy at any loudness.

Four channels to share

Four voices had to cover the music and the sound effects. When The One previewed System 3’s Myth in December 1989, it reported that the Amiga version would carry 90K of music for each level, with the tune taking three channels and the sound effects the fourth, “so that you can have them both together”. The sample memory had to be shared too. System 3’s Doug Hare contrasted Myth with Barbarian, which “can have all the samples it wants because it’s not doing much”.

The stereo wiring is fixed. A tune that wants a bass line in the middle has to play it on one channel from each side, or live with it coming from one speaker.

One channel modulating another

A channel can stop making sound and drive another channel instead. The manual calls this attaching. An attached channel “ceases to produce sound and its data is used to modulate the sound of the next higher-numbered channel”: 0 drives 1, 1 drives 2 and 2 drives 3. Channel 3 has no channel above it, so setting its attach bits only silences it.

The attach bits are in ADKCON. The manual names them in two ways, ATVOL0 to ATVOL3 in the audio chapter and USE0V1, USE1V2, USE2V3 and USE3VN in the register list:

ADKCON bits Effect
0-2 Channel 0, 1 or 2 sets the volume of the channel above it
4-6 Channel 0, 1 or 2 sets the period of the channel above it
3, 7 Channel 3 “modulates nothing”: it is silenced

The modulating channel’s data is no longer read as pairs of samples. Each word becomes a new volume (bits 0-6) or a new period (all 16 bits), written into the other channel every time the modulator’s own period runs out. With both bits set, the words alternate: volume, period, volume, period. Volume modulation gives tremolo and period modulation gives vibrato, with the processor doing nothing.

In November 1989 Amiga Format’s music columnist was still waiting for a program that would “actually use the Paula chip to do a simple form of FM”, and asked software houses to get in touch.

Fourteen bits from eight

Paula’s volume control made one later trick possible. Amiga Format explained it in 1997: Christian Buchner’s CyberSound played each output on two channels, “one at one sixty fourth of the volume of the other”. The loud channel carried the top eight bits of a 14-bit sample and the quiet one added six more. The cost was two channels per side, leaving two 14-bit voices instead of four 8-bit ones, and it “monopolises the channel volume controls”, so fades had to be done by arithmetic on the data. Amiga Format called CyberSound the precursor of AHI, the free system that let Amiga programs send their sound to add-on sound cards, and in 1998 the magazine noted that AHI could still “generate 14-bit stereo through Paula”.

The disk controller

Paula’s disk controller does very little interpreting. The manual describes it this way:

It can DMA an entire track of raw MFM data into memory in a single disk revolution. Special registers allow the CPU to synchronize with specific data, or read input a byte at a time.

The controller hands the program a whole track of encoded bits. Finding the sectors and decoding the MFM (modified frequency modulation) encoding is left to software, and the manual suggests using the blitter to decode it. The standard Amiga format marks the start of each sector with a sync word that the controller can watch for. The manual calls $4489 “the magic MFM sync mark value”.

Because the controller does so little, it can do a great deal. Commodore listed what it could read and write:

The controller can read and write virtually any double-density MFM encoded disk, including the Amiga V1.0 format, IBM PC (MS-DOS) 5.25”, IBM PC (MS-DOS) 3.5” and most CP/M formatted disks. The controller has provisions for reading and writing most disk using the Group Coded Recording (GCR) method, including Apple II disks. With motor speed tricks, the controller can read and write Commodore 1541/1571 format diskettes.

The 1541 is the awkward one. Its disk turns at a constant 300 rpm, and the drive writes the outer tracks faster than the inner ones: four zones, from 307,692 bits a second on tracks 1-17 down to 250,000 on tracks 31-35. The Amiga’s controller offers only two data rates, chosen by the FAST bit in ADKCON, so to read a 1541 disk it is the motor’s speed that has to change.

ADKCON holds the disk controls as well as the audio ones: write precompensation, MFM or GCR mode, synchronisation on a sync word or on each byte’s top bit, and the fast or slow data rate.

Serial port and interrupts

Paula contains the Amiga’s UART, the circuit behind the RS-232 serial port. The manual rates it from 110 to over 1,000,000 bits a second, with 8- or 9-bit words, although it puts the reliable limit over a sensible cable at 150,000 to 250,000. The rate register SERPER takes the clock constant divided by the baud rate, minus one: 371 for 9,600 baud on NTSC.

Paula also collects the machine’s interrupts. Requests from the custom chips and the two 8520 CIAs arrive at its INTREQ register, are masked by INTENA, and leave as six of the 68000’s seven interrupt levels. Paula’s own devices are spread among them: the four audio channels at level 4, a finished disk block and an empty serial transmit buffer at level 1, and a disk sync match and a full serial receive buffer at level 5.

Sources

  • Amiga Hardware Reference Manual, 3rd edition (Commodore-Amiga, Addison-Wesley, 1991): the three custom chips (p. 1); Paula and the I/O ports (p. 6); chapter 5, “Audio Hardware”: four channels and converters (pp. 136-137), stereo wiring (p. 137), sample format and word alignment (p. 138), location and length registers (p. 139), volume (pp. 139-140), period limits (pp. 140-141), starting and stopping DMA (pp. 144-145), back-up registers and interrupt timing (pp. 147-148), modulation (pp. 149-151), quiet sounds at full range (p. 154), the low-pass filter and its bypass (pp. 156-157), the equal-tempered scale (pp. 158-162), Table 5-9, decibel values (p. 163), the audio state machine (p. 164). Chapter 7: interrupts (pp. 217, 220-221). Chapter 8: the disk controller (p. 241), DSKSYNC and MFM decoding (p. 250), the UART (p. 255). Appendix A: ADKCON (p. 265), audio registers (pp. 265-266), INTENA and INTREQ (p. 280). Glossary: Paula (p. 449).
  • Amiga Hardware Reference Manual, 3rd edition, serial interface connector specification (J6 pin assignment): the AUDO pin, “Audio output from left (channels 0, 3) port”.
  • Amiga System Programmer’s Guide (Abacus, 1988), Paula’s pin description: “AUDL carries the internal sound channels 0 and 3, and AUDR the channels 1 and 2”; and the audio chapter: “Channels 0 and 3 are sent to the left stereo channel, while 1 and 2 are sent to the right”.
  • Commodore Tech Topics (Commodore Business Machines, 1993): A500/A2000 IC repair kit, “252127-02 PAULA 8364”. A1200 System Schematics, Service Addendum (Commodore, 1992): Paula, 8364.
  • CU Amiga, April 1992: guide to Amiga sound, on Paula and sampling. May 1992: guide to the custom chips, “The Paula chip is number 8364”.
  • Amiga Computing, June 1990, p. 99: public-domain music sequencers and SoundTracker.
  • The One, issue 15, December 1989: preview of System 3’s Myth.
  • Amiga Format, issue 4, November 1989, pp. 98-99: music column, on Paula and FM. Issue 102, October 1997, pp. 24-25: feature on AHI and CyberSound. Issue 118, Christmas 1998: AHI’s 14-bit output through Paula.
  • Richard Immers and Gerald G. Neufeld, Inside Commodore DOS (Datamost, 1984), pp. 29-30: the 1541’s four recording zones.
  • Lars Hamre and others, “Noisetracker/Soundtracker/Protracker Module Format”, 4th revision, published online by Andrew Scott (web, secondary): the period table, period 113 as the highest note, and volumes 0-64.

See also

Checked. Verified against primary sources and signed off by a person.