--- title: "Special Sound" id: 63147 type: "computer_media" slug: "special-sound" url: "http://localhost/computer_media/special-sound/" markdown_url: "http://localhost/computer_media/special-sound.md" published_at: "2026-01-30T17:36:44+00:00" modified_at: "2026-03-30T21:45:27+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2019/02/20230809-041332.jpg" excerpt: "A tight three-voice AY chip sweep that drives harmonically spaced pitches across all tone channels before silencing itself and looping forever." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Eric Boisvert" slug: "boisvert-eric" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-eric/" genre: - name: "Sound" slug: "sound" taxonomy: "genre" url: "http://localhost/type/sound/" media_contents: - id: 63045 title: "Byte Power September 1986" type: "computer_media" url: "http://localhost/computer_media/byte-power-september-1986/" media_type: "Program" programmers: - name: "Eric Boisvert" slug: "boisvert-eric" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-eric/" mediadate: "1986" producer_company: - id: 25181 title: "Byte Power" type: "company" url: "http://localhost/company/byte-power/" article_media: - id: 63031 title: "Better Programming" type: "article" url: "http://localhost/article/better-programming-4/" media_type_tags: "Sound" --- # Special Sound Special Sound is a short music/sound demonstration that sweeps three simultaneous tone channels of the TS2068’s AY-3-8912 sound chip through a rising frequency sequence. A FOR loop drives register pairs so that three voices play harmonically offset pitches (x, x+8, and x+12) while shared amplitude registers are held at maximum volume (15). After the sweep completes, a brief shutdown sequence silences all channels and an envelope register is set before the program waits for a keypress and loops indefinitely. *** ## Program Structure The program consists of just four logical sections compressed into three executable lines: 1. `REM` header (line 0) — title and copyright notice, no executable content. 2. Line 10: initialises `y=0` and opens a `FOR` loop, `x=0 TO 140`. 3. Line 20: issues a single multi-register `SOUND` statement per iteration, then `NEXT x` closes the loop. 4. Line 30: shutdown `SOUND` call, `PAUSE 0` to wait for a keypress, then `GO TO 1` — which targets the non-existent line 1, so execution falls through to line 10, effectively restarting the sweep. ## AY-3-8912 Register Usage The TS2068 exposes the AY sound chip through the `}` (`SOUND`) keyword. Each `SOUND` call accepts register/value pairs. The registers used here are: | Register | Function | Value in loop | | --- | --- | --- | | 0 | Channel A fine pitch | `x` (0–140) | | 1 | Channel A coarse pitch | `y` (0) | | 2 | Channel B fine pitch | `x+8` | | 3 | Channel B coarse pitch | `y` (0) | | 4 | Channel C fine pitch | `x+12` | | 5 | Channel C coarse pitch | `y` (0) | | 7 | Mixer (tone/noise enable) | 56 (all tones on, noise off) | | 8 | Channel A amplitude | 15 (maximum, no envelope) | | 9 | Channel B amplitude | 15 | | 10 | Channel C amplitude | 15 | Mixer value 56 in binary is `00111000`, which disables noise on all three channels while enabling tone output — a standard configuration for pure-tone music. ## Notable Techniques - **Harmonic offsets:** The three voices are pitched at `x`, `x+8`, and `x+12` respectively. Because AY pitch registers are inversely proportional to frequency, fixed additive offsets produce a consistent (though not perfectly equal-tempered) harmonic spread across the sweep. - **Single SOUND call per frame:** Grouping all ten register writes into one statement minimises interpreter overhead inside the loop, keeping the sweep reasonably smooth. - **Shutdown sequence (line 30):**`SOUND 10,16;8,16;9,16;12,20;13,0` sets channel amplitudes to 16 (envelope-driven mode), programs the envelope period (register 12), and resets the envelope shape (register 13 = 0), providing a tidy release rather than an abrupt cutoff. - **Restart via GO TO 1:**`GO TO 1` with no line 1 defined causes the interpreter to find the next available line (line 10), making this a concise infinite-loop idiom without needing `GO TO 10`. - **Variable `y=0` as coarse pitch:** Holding all coarse pitch registers at zero limits each voice to the lower 8-bit range of pitch values, keeping frequencies in the audible mid-to-high range during the sweep. ## Source Code ``` 0 REM Special Sound Written by Eric Boisvert ©1986 BYTE POWER 10 LET y=0: FOR x=0 TO 140 20 SOUND 0,x;1,y;2,x+8;3,y;4,x+12;5,y;8,15;10,15;9,15;7,56 30 NEXT x: SOUND 10,16;8,16;9,16;12,20;13,0: PAUSE 0: GO TO 1 ```