--- title: "Helicopter 2 Sound Example" id: 63149 type: "computer_media" slug: "helicopter-2-sound-example" url: "http://localhost/computer_media/helicopter-2-sound-example/" markdown_url: "http://localhost/computer_media/helicopter-2-sound-example.md" published_at: "2026-01-30T17:36:44+00:00" modified_at: "2026-04-03T07:57:58+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2019/02/20230809-041332.jpg" excerpt: "A compact looping sound effect that programs the AY-3-8910 chip's registers directly to produce a repeating helicopter-like audio pattern." 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/" 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" 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" --- This three-line program plays a musical or sound effect using the TS2068’s AY-3-8910 sound chip via the SOUND command, then loops continuously. The SOUND statement configures ten registers of the AY chip in a single call: registers 6 and 0–5 set noise period and tone/noise/envelope parameters, registers 9–10 and 8 set channel volumes, register 7 is the mixer control (value 48, enabling specific channel combinations), and registers 12–13 define the envelope period. The PAUSE 3 introduces a short delay of approximately 3/50ths of a second between repetitions before GO TO 1 restarts the loop. *** ## Program Structure The program consists of just three executable lines after the title REM, forming an infinite loop: 1. `10` — Fire a multi-register `SOUND` command to the AY-3-8910 chip 2. `20` — `PAUSE 3` (~60 ms delay at 50 Hz) 3. `30` — `GO TO 1` (jumps back to line 0’s REM, effectively restarting from line 10) `GO TO 1` targets line 0’s REM rather than line 10 directly. Since a REM executes as a no-op, the loop still works correctly, but it is a minor inefficiency — `GO TO 10` would be marginally faster as no line-search step is wasted. ## AY-3-8910 Register Programming The single `SOUND` statement on line 10 sets ten registers in one call using the TS2068 paired register syntax `register,value`: | Register | Value | Function | | --- | --- | --- | | 6 | 18 | Noise period (18 = relatively low-frequency noise) | | 0 | 250 | Channel A tone period (low byte) | | 1 | 7 | Channel A tone period (high byte) — combined ~1786 giving a low pitch | | 2 | 255 | Channel B tone period (low byte) | | 3 | 7 | Channel B tone period (high byte) | | 4 | 255 | Channel C tone period (low byte) | | 5 | 7 | Channel C tone period (high byte) | | 9 | 16 | Channel B amplitude — envelope-controlled (bit 4 set) | | 10 | 16 | Channel C amplitude — envelope-controlled (bit 4 set) | | 8 | 16 | Channel A amplitude — envelope-controlled (bit 4 set) | | 7 | 48 | Mixer: binary 00110000 — noise enabled on channels A & B, tones on all disabled | | 12 | 2 | Envelope period (low byte) — fast envelope cycle | | 13 | 0 | Envelope shape: single decay, no repeat | All three channels have their amplitude registers set to 16 (envelope mode). Envelope shape register 13 = 0 selects a one-shot decaying waveform. The mixer value 48 (0b00110000) enables noise on channels A and B while disabling all tone outputs, producing a purely noise-based percussive burst reminiscent of rotor noise — consistent with the “HELICO” (helicopter) title. ## Notable Techniques - Using a single `SOUND` call with multiple register pairs is the most efficient way to set up a complex AY sound in one atomic operation, avoiding audible gaps between register writes. - Setting all amplitude registers to 16 ties all three channels to the single hardware envelope generator, giving a unified volume contour without per-channel software timing. - The `PAUSE 3` acts as a minimal delay so the envelope has time to complete its decay before the next trigger, preventing the registers from being re-written mid-cycle. - The REM at line 0 serves as a program header/splash, storing the title and copyright in a location that costs nothing at runtime since the loop re-enters at line 10 after the first pass — though as noted, `GO TO 1` does needlessly scan past line 0 on each iteration. ## Source Code ``` 0 REM HELICO 2 WRITTEN BY K. BOISVERT ©1986 BYTE POWER 10 SOUND 6,18;0,250;1,7;2,255;3,7;4,255;5,7;9,16;10,16;8,16;7,48;12,2;13,0 20 PAUSE 3 30 GO TO 1 ```