BBC Audio

The BBC Micro makes sound with a Texas Instruments SN76489 chip. It gives three square-wave tone channels and one noise channel, each with its own volume control. The operating system's SOUND and ENVELOPE commands wrap the chip, but the underlying registers can also be driven directly.

BBC Audio

Overview

The SN76489 is a self-contained sound generator. Once its registers are set it sustains the sound on its own, so music plays under a running program without the CPU toggling anything. It has four channels: three tone generators and one noise generator, each fed a fresh value to change pitch or volume. The chip is written through a single 8-bit latch, with the OS handling the timing.

The SN76489

Each of the three tone channels is a square-wave generator whose pitch is set by a 10-bit frequency divider: the smaller the divider, the higher the note. The noise channel produces pseudo-random noise, either at fixed rates or tracking tone channel three, useful for drums and effects. Every channel, tone and noise alike, has its own 4-bit attenuator that sets its volume, from full down to silent.

ChannelKindPitch controlVolume
0Tone10-bit divider4-bit attenuation
1Tone10-bit divider4-bit attenuation
2Tone10-bit divider4-bit attenuation
3NoiseRate bits, or tone 24-bit attenuation

Tone and noise channels

A tone channel divides the chip's clock by its 10-bit value to produce a square wave, so a value near zero gives the highest pitch and a large value a low rumble. The three tone channels are independent, giving three-note chords or three separate voices. The noise channel has a control that chooses white or periodic noise and one of three rates, or ties its rate to tone channel three so effects can sweep. Attenuation runs from 0, meaning full volume, up to 15, meaning off, in 2 dB steps.

Register format

The chip is written one byte at a time. A byte with bit 7 set is a latch byte: bits 6 and 5 pick the channel, bit 4 picks whether the write sets the pitch (tone) or the volume (attenuation), and the low four bits carry the first part of the value. For a 10-bit pitch, a following byte with bit 7 clear supplies the upper six bits.

ByteBit 7Bits 6–5Bit 4Bits 3–0
Latch1Channel (0–3)Type: 0 tone, 1 volumeLow 4 bits of value
Data0Upper 6 bits of a 10-bit pitch

So a full pitch write is two bytes: the latch byte holding the channel and the low four bits of the divider, then a data byte holding the top six bits. A volume write is a single latch byte, its low four bits the attenuation. The three tone channels and the noise channel are addressed by the two channel bits.

SOUND and ENVELOPE

Most programs reach the chip through the OS rather than the latch. SOUND channel,amplitude,pitch,duration plays a note: the channel picks one of the generators, the amplitude sets loudness or names an envelope, the pitch is in quarter-semitone steps, and the duration is in twentieths of a second. ENVELOPE defines a volume-and-pitch shape that an amplitude value can point to, letting a note attack, decay and release over time. The OS queues the requests so channels stay in step.

SOUND parameterMeaning
channelWhich generator, 0 noise, 1 to 3 tone
amplitudeVolume 0 to −15, or an envelope number
pitchNote in quarter-semitones
durationLength in twentieths of a second

Sequencer commands

The native operations a sequence drives on the SN76489, and whether each runs on its own once set or must be updated every tick. The chip latches pitch and volume and holds them, but it has no envelope hardware: the OS ENVELOPE is a software shape the operating system applies on its centisecond interrupt, so envelopes and vibrato are driven, not automatic.

CommandWhat it doesAutomatic or driven
Note / pitch10-bit divider per tone channelAutomatic
Volume4-bit attenuation per channelAutomatic (level held)
NoiseWhite or periodic, fixed rate or tone 3Automatic
Envelope (OS ENVELOPE)Amplitude and pitch shape over timeDriven (OS software)
Vibrato, slidesNo hardware; done in softwareDriven

Sampled audio

The SN76489 has no sample channel and no DAC, so digitised sound on the BBC is coaxed from the 4-bit attenuator. Setting a tone channel's divider so its square wave sits above hearing turns that channel's volume control into a crude 4-bit output, and streaming attenuation values into it from a cycle-counted loop or a timed interrupt plays a recorded waveform. It is 4 bits at best and holds the CPU, so it suits short speech and drums rather than continuous playback.

The machine also had an official Speech System, a Texas Instruments speech chip driven by phrase ROMs, which gives hardware LPC speech without touching the sound chip; and the user port or the 1 MHz bus could carry an add-on 8-bit DAC for cleaner sample playback.

MethodHow it worksDepthMax sample rate
Attenuator DACStream 4-bit volume writes to a silenced tone channel4 bits~10 kHz (CPU-bound)
Speech SystemOptional LPC speech chip with phrase ROMsLPC speech~8 kHz (LPC)
External DAC8-bit DAC on the user port or 1 MHz bus8 bits~20 kHz