--- title: "Explosion Sound Example" id: 63152 type: "computer_media" slug: "explosion-sound-example" url: "http://localhost/computer_media/explosion-sound-example/" markdown_url: "http://localhost/computer_media/explosion-sound-example.md" published_at: "2026-01-30T17:36:44+00:00" modified_at: "2026-08-30T17:11:30+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/01/explosion.png" excerpt: "A compact looping tone built from a single SOUND statement hammering seven AY-3-8910 registers at once — hear what envelope shape 8 actually sounds like." 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: 63045 title: "Byte Power September 1986" type: "computer_media" url: "http://localhost/computer_media/byte-power-september-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/01/explosion.png" article_media: - id: 63031 title: "Better Programming" type: "article" url: "http://localhost/article/better-programming-4/" media_type_tags: "Sound" --- # Explosion Sound Example This program plays a continuous looping sound effect using the TS2068’s SOUND command, which directly controls the AY-3-8910 sound chip registers. Line 10 sets multiple registers in a single statement using semicolon-separated pairs: registers 6–10 configure the noise period and mixer settings, while registers 12 and 13 set the envelope period and shape. Line 20 pauses for approximately two seconds before line 30 silences the tone channels by zeroing registers 8–10 (the amplitude registers), and the loop restarts via GO TO 10. *** ## Program Structure The program is a four-line infinite loop with a straightforward flow: 1. `10` — Initialise and trigger sound via the AY-3-8910 chip 2. `20` — Wait approximately 2 seconds (`PAUSE 100` = 100 × 1/50 s) 3. `30` — Silence the output by zeroing amplitude registers 4. `40` — Loop back unconditionally to line `10` ## AY-3-8910 Register Usage Line `10` uses the TS2068 `SOUND` keyword (encoded as `}` in zmakebas source) with seven register/value pairs separated by semicolons. The registers addressed are: | Register | Value | Function | | --- | --- | --- | | 6 | 6 | Noise period | | 7 | 7 | Mixer control (enables noise on channels A & B, disables tone) | | 8 | 16 | Channel A amplitude — envelope mode enabled (bit 4 set) | | 9 | 16 | Channel B amplitude — envelope mode enabled (bit 4 set) | | 10 | 16 | Channel C amplitude — envelope mode enabled (bit 4 set) | | 12 | 56 | Envelope period (coarse byte), sets overall envelope duration | | 13 | 8 | Envelope shape — single attack, no hold/sustain (shape 8 = /___) | Setting amplitude registers 8–10 to 16 (binary `00010000`) enables envelope-controlled amplitude on all three channels simultaneously, delegating volume shaping entirely to the envelope generator rather than fixed levels. ## Notable Techniques - **Multi-register SOUND in one statement:** Semicolon chaining within a single `SOUND` call writes all seven registers atomically from BASIC’s perspective, minimising the gap between register updates and producing a cleaner sound onset. - **Envelope shape 8:** Register 13 value 8 selects a single-cycle rising ramp (attack only). Writing any value to register 13 re-triggers the envelope, so each loop iteration restarts the amplitude sweep from zero. - **Explicit silence on line 30:** Zeroing registers 8–10 after the pause cuts the noise burst cleanly before looping, creating a rhythmic on/off pattern rather than a continuous drone. - **Register 11 omitted:** The fine envelope period register (11) is not set, relying on whatever value it holds from a previous run or system initialisation. This could cause slight timing variability across sessions. ## Source Code ``` 10 SOUND 6,6;7,7;8,16;9,16;10,16;12,56;13,8 20 PAUSE 100 30 SOUND 8,0;9,0;10,0 40 GO TO 10 ```