THE VIRTUAL TO2026 / EXTENSIONS / EXT 26-102

The sound generator.

The EXT 26-102 module carries the TS-26 chip: four voices in the spirit of the Commodore 64 SID, a resonant filter and a sample channel. The sound is computed sample by sample in the browser, without stutter when the picture slows down.

TO2026 · EXT 26-102SOUND4 voices · filterSwitch the power offbefore plugging in.TS-26
Reference
TO2026 · EXT 26-102
Module
Sound generator
Chip
TS-26
Port
EXT 26-112 extension port, beside the screen
Plugging in
tick the module in EXTENSIONS, on the Explore the machine page
  • VOICES4 + 1

    four oscillators and a sample channel

  • FREQUENCY0,0596 Hz

    an oscillator step: 1 MHz / 2^24, like the SID

  • FILTER11 + 4 bits

    11-bit cut-off, 4-bit resonance, three combinable modes

  • REGISTERS&HA600

    64 bytes in the memory map

01 / WHAT IT DOES

A synthesiser with four voices.

Each voice is an oscillator producing a waveform: triangle (soft), sawtooth (brassy), pulse with adjustable duty cycle (from hollow to nasal) or noise (drums, explosions). An ADSR envelope shapes its volume over time: attack, decay, sustain level, release. Two voices can be synchronised or ring-modulated, for metallic tones.

The chosen voices go through a low-pass, band-pass or high-pass filter with adjustable resonance. A fifth channel plays 8-bit samples stored in memory, at the chosen rate. PLAY and BEEP, inherited from the MO6, play on voice 1; the BASIC 2026 statements give access to everything else.

02 / THE REGISTERS

64 bytes from &HA600.

Voice n (0 to 3) takes 8 bytes from &HA600 + 8 × n. The frequency in hertz is the FREQ register times 0.0596: for an A at 440 Hz, FREQ = 440 / 0.0596 = 7382, that is &H1CD6.

OFFSETREGISTERROLE
+0, +1FREQfrequency, low then high byte
+2, +3PWpulse width on 12 bits: duty cycle PW / 4096
+4CONTROLb0 gate, b1 sync, b2 ring, b3 test, b4 triangle, b5 sawtooth, b6 pulse, b7 noise
+5ADattack (high 4 bits), decay (low 4 bits)
+6SRsustain (high 4 bits), release (low 4 bits)
+32, +33FCfilter cut-off on 11 bits (3 low bits, then 8 high bits)
+34RESresonance (high 4 bits), filtered voices (bits 0 to 3)
+35MODEb4 low-pass, b5 band-pass, b6 high-pass, b7 voice 4 off; master volume (low 4 bits)
+36 – +42SAMPLESaddress (2 bytes), length (2 bytes), rate × 100 Hz, control (b0 play, b1 loop), volume
+44, +45READoscillator 4 output and voice 4 envelope, on 8 bits: for random numbers or to follow a sound

03 / IN BASIC

The statements of BASIC 2026.

STATEMENTEFFECT
VOICE v, forme$ [, largeur]waveform of voice 1 to 4: "tri", "saw", "pulse", "noise", with "+ring" or "+sync"
ENVELOPE v, a, d, s, rvolume envelope, each value 0 to 15
NOTE v, fréquence [, durée]plays a frequency in hertz, released after the duration in ms; NOTE v OFF stops it
FILTER coupure, résonance, mode$ [, voix]filter "lp", "bp", "hp" or "off"; voices = sum of 1, 2, 4, 8
VOLUME nmaster volume, 0 to 15
PLAY partition$MO6-style melody, in the background; PLAYING, WAIT PLAY
BEEPa short beep

A low sawtooth whose filter opens little by little: the classic synthesiser sound.

PROGRAM
voice 1, "saw" : envelope 1, 0, 0, 15, 2
note 1, 110
for fc = 100 to 1500 step 40
  filter fc, 12, "lp", 1
  wait vbl
next
note 1 off
print "balayage du filtre fini"
ON SCREEN
balayage du filtre fini

PLAY returns at once; WAIT PLAY waits for the end of the melody.

PROGRAM
play "T5 O4 L12 DO RE MI FA L24 SO"
print "en cours :"; playing
wait play
print "fini :"; playing
ON SCREEN
en cours :-1
fini : 0

04 / BY HAND

PEEK and POKE, as in 1986.

The registers answer POKE from both BASICs: a BASIC 128 program can play on the TS-26 with no new statement. Here, a 440 Hz A as a triangle on voice 1: frequency, envelope, then the gate that triggers the note and releases it when closed.

&H11 = triangle + gate open; &H10 = triangle, gate closed: the note enters its release.

PROGRAM
poke &HA600, &HD6 : poke &HA601, &H1C
poke &HA605, &H09 : poke &HA606, &HF0
poke &HA604, &H11
sleep 0.5
poke &HA604, &H10
print "controle :"; peek(&HA604); " volume :"; peek(&HA623) and 15
ON SCREEN
controle : 16  volume : 15