You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
15-bit LFSR matching the SN76489AN — white feeds back bit0 ^ bit1, periodic
feeds back bit0 only. Pre-rendered into looping AudioBuffers at the three
documented shift rates (clock/512, clock/1024, clock/2048 against the BBC's
4 MHz chip clock). When channel === 0 the pitch envelope is skipped (chip
ignores PI/PN there) and the SOUND P arg is reinterpreted as a noise mode
via the low 3 bits. UI swaps the pitch input for an 8-option dropdown and
hides the pitch envelope subsection. P=3 / P=7 ("follows tone 2") are
decoded but currently audibly played as medium rate.
Six noise presets seeded (kick, snare, hat, cymbal, bass buzz, explosion).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- All four channels supported: tone (1..3) plus the noise channel (0). Noise is generated by a 15-bit LFSR matching the SN76489AN — white or periodic, at any of the three documented shift rates — selected by an 8-option dropdown when channel 0 is active.
14
+
- Game-sourced presets (Sentinel, Zalaga, Elite, Chuckie Egg, Thrust), BBC User Guide example envelopes (UG #1..#9), synth-design presets (Piano, Pluck, Bell, Pad, Bass, Drum, Laser, Vibrato, Trill, Siren, Arpeggio, Wobble), and noise-channel presets (kick, snare, hat, cymbal, bass buzz, explosion).
14
15
- Shareable URL: every change is reflected in the URL bar via `?env=…&sound=…`, so copying the address reproduces the exact state.
15
16
- "Run in BBC emulator" button that opens the current `ENVELOPE`/`SOUND` in [bbc.xania.org](https://bbc.xania.org/) (jsbeeb) for one-click A/B against the real BBC.
16
17
@@ -51,11 +52,11 @@ A few non-obvious quirks (also documented in `CLAUDE.md`):
51
52
- Pitch sections with `PN = 0` are not free — the OS hits `BEQ skipToNextChannel` after loading the empty section, so each empty section costs `T` cs of dead time. Loop wraps and non-empty section transitions are free.
52
53
- The MOS allocates exactly **4** envelope slots (`N = 1..4`); higher numbers aren't usable.
53
54
- Pitch is musically quantised to the BBC's own divider table (`pitchToHz()` in `src/envelope.ts`), not to equal temperament — higher octaves drift slightly sharp, matching the real machine.
55
+
- Channel 0 noise uses only the low 3 bits of the `SOUND``P` argument: bit 2 selects type (0 = periodic, 1 = white) and bits 1..0 select the LFSR shift rate (`clock/512`, `clock/1024`, `clock/2048` at the BBC's 4 MHz chip clock — i.e., ~7.8 / 3.9 / 2.0 kHz). PI/PN are ignored on the noise channel; the amplitude envelope works identically to tone channels.
54
56
55
57
## Future work
56
58
57
-
-**Channel 0 (noise).** This tool currently restricts `SOUND` channel to 1..3 and uses a square oscillator. Real BBC channel 0 is a separate noise generator with several modes selected by the pitch parameter (white / periodic at different rates, plus a mode that tracks channel 2's frequency).
58
-
-**Periodic noise as bass.** When channel 0 is set to one of the periodic modes — particularly the mode that tracks channel 2 — the result is a coloured tone an octave or two below the reference. This is the classic BBC "periodic bass" trick used by many games. Supporting it requires emulating the SN76489's noise LFSR rather than substituting a square wave.
59
+
-**Noise rate "follows tone 2".** Two of the eight noise modes (`P=3` and `P=7`) clock the LFSR from channel 2's tone period, letting you sweep noise pitch under tone-channel control. The tool decodes these modes but currently audibly plays them at the medium rate; supporting the cross-channel link properly needs a virtual channel-2 pitch.
59
60
-**Static amplitude.** Negative `SOUND` amplitude (-15..-1) selects a static volume bypassing the envelope. Currently disallowed in the UI.
60
61
-**Stereo / multi-channel mixing.** Real BBC sequences usually involve simultaneous notes across multiple channels; this tool is single-note only.
61
62
-**Authentic SN76489 timbre on tone channels.** The current square oscillator is a stand-in. A `PeriodicWave` or AudioWorklet implementation of the SN76489 tone generator would give a closer match.
{key: "amplitude",code: "A",label: "Amplitude",min: 1,max: 4,hint: "1..4 selects envelope number (negative static volumes are not supported by this tool)"},
57
58
{key: "pitch",code: "P",label: "Pitch",min: 0,max: 255,hint: "4 units per semitone, 48 per octave"},
58
59
{key: "duration",code: "D",label: "Duration",min: 1,max: 255,hint: "in 1/20 s"},
@@ -108,9 +109,14 @@ function setEnvelopeNumber(n: number): void {
0 commit comments