--- title: "False Echo Example" id: 63287 type: "computer_media" slug: "false-echo-example" url: "http://localhost/computer_media/false-echo-example/" markdown_url: "http://localhost/computer_media/false-echo-example.md" published_at: "2026-02-01T02:31:02+00:00" modified_at: "2026-04-03T07:57:54+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/02/false-echo.png" excerpt: "A short melody player that drives the AY sound chip directly through DATA-encoded triplets, with silence events and smooth volume shaping built in." 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: "Kristian Boisvert" slug: "boisvert-kristian" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-kristian/" genre: - name: "Sound" slug: "sound" taxonomy: "genre" url: "http://localhost/type/sound/" media_contents: - id: 63046 title: "Byte Power November 1986" type: "computer_media" url: "http://localhost/computer_media/byte-power-november-1986/" media_type: "Program" programmers: - name: "Kristian Boisvert" slug: "boisvert-kristian" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-kristian/" mediadate: "1986" producer_company: - id: 25181 title: "Byte Power" type: "company" url: "http://localhost/company/byte-power/" images: - url: "http://localhost/wp-content/uploads/2026/02/false-echo.png" article_media: - id: 63105 title: "Better Programming!" type: "article" url: "http://localhost/article/better-programming-8/" media_type_tags: "Sound" --- # False Echo Example False Echo is a music playback program that reads note data from DATA statements and plays it using the SOUND command, available on the Timex Sinclair 2068. Each note is encoded as a triplet: a register-1 value (pitch high byte), a register-0 value (pitch low byte), and a duration multiplier. The program uses the AY-3-8912 sound chip’s registers directly — register 7 controls the mixer, register 8 sets the volume, and registers 0/1 set the tone period — to produce a melody with smooth note transitions. Silence/pause events are encoded with the special value 254, which lowers the volume and skips the SOUND note command, while value 255 terminates playback entirely. The piece was written by Kristian Boisvert and published by Byte Power in 1986. *** ## Program Structure The program is a simple sequential loop with no subroutines. Its logical flow is: 1. Lines 20–25: `DATA` statements holding the note stream as triplets. 2. Line 30: `READ a,b,c` — fetch the next triplet from `DATA`. 3. Line 40: Termination check — if `a=255`, `STOP`. 4. Line 50: Silence/pause check — if `a=254`, lower volume and skip to duration. 5. Line 60: Play the note via `SOUND`. 6. Line 70: Post-note volume shaping. 7. Line 80: `PAUSE c*10` for note duration. 8. Line 90: `GO TO 30` — unconditional loop back. ## Data Encoding Every note is stored as a three-value triplet `(a, b, c)`: | Field | Variable | Meaning | | --- | --- | --- | | 1st | `a` | AY register 1 (tone period high byte), or 254 = pause, 255 = end | | 2nd | `b` | AY register 0 (tone period low byte) | | 3rd | `c` | Duration multiplier (PAUSE = c×10 frames) | The terminator triplet is `255,0,0` and silence events use `254,0,n`. This is a compact encoding: two bytes define the 12-bit tone period for the AY-3-8912, and the third controls timing. ## AY-3-8912 Register Usage The `SOUND` keyword on the TS2068 maps directly to AY-3-8912 registers. The program uses four registers: - `SOUND 7,62` — Register 7 (mixer): value 62 (`%00111110`) enables tone on channel A only, disabling noise and other channels. - `SOUND 8,15` — Register 8 (channel A volume): set to maximum (15) before the note pitch registers are written. - `SOUND 1,a` — Register 1: tone period high byte (from triplet field `a`). - `SOUND 0,b` — Register 0: tone period low byte (from triplet field `b`). After the note is set, line 70 issues `SOUND 8,13` to reduce volume slightly from 15 to 13, creating a minor envelope effect that softens the tail of each note — the “false echo” of the title. ## Notable Techniques - **Chained SOUND parameters:** Line 60 uses semicolons to set registers 7, 8, 1, and 0 in a single statement (`SOUND 7,62;8,15;1,A;0,B`), which is more efficient than four separate calls. - **Volume-based articulation:** The step-down from volume 15 to 13 after each note, and a further drop to 10 during pause events (line 50), simulates a crude amplitude envelope without needing the AY’s hardware envelope generator. - **Pause event design:** Using the sentinel value 254 in the same `a` field as pitch — and using `GO TO 80` to skip the SOUND note command — keeps the data format uniform (always three values) while cleanly handling rests. - **Duration scaling:**`PAUSE c*10` maps small integers in the data to 50Hz frame counts (e.g., `c=1` → ~0.2 s, `c=4` → ~0.8 s), giving convenient granularity without large DATA values. ## Source Code ``` 10 REM FALSE ECHO WRITTEN BY KRISTIAN BOISVERT ©1986 BYTE POWER 15 REM DATA FOR MUSIC 20 DATA 4,92,1,254,0,1,3,117,1,2,232,1,254,0,1,3,117,1,3,68,1,254,0,1,3,117,1,3,226,1,254,0,2,3,226,1,254,0,1,3,68,1,3,68,1,254,0,1,3,226,1,3,117,1,254,0,1,3,226,1,4,92,1,254,0,2 25 DATA 4,92,1,254,0,1,3,117,1,2,232,1,254,0,1,3,117,1,3,68,1,254,0,1,3,117,1,3,226,1,254,0,2,2,232,1,254,0,1,2,232,1,2,232,1,254,0,1,3,68,1,3,117,1,254,0,1,3,226,1,4,92,4,255,0,0 26 REM READ NOTES 30 READ a,b,c 35 REM A=255 THEN MUSIC STOPS! 40 IF a=255 THEN STOP 45 REM PAUSE?,LOWER VOLUME AND GOTO LINE 80 (DURATION) 50 IF A=254 THEN SOUND 8,10: GO TO 80 55 REM PLAY NOTE! 60 SOUND 7,62;8,15;1,A;0,B 65 REM LOWER VOLUME FOR SMOOTHER DELIVERY 70 IF A<>254 THEN SOUND 8,13 75 REM DURATION OF NOTE 80 PAUSE C*10 85 REM COMPLETE LOOP 90 GO TO 30 ```