--- title: "Music" id: 59148 type: "computer_media" slug: "music-2" url: "http://localhost/computer_media/music-2/" markdown_url: "http://localhost/computer_media/music-2.md" published_at: "2025-02-28T00:59:02+00:00" modified_at: "2026-03-30T21:44:14+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2025/02/music.png" excerpt: "A compact music player that drives a three-voice sound chip with just one loop and 54 DATA values to perform an original 18-note melody." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Byte Power" slug: "byte-power" taxonomy: "post_tag" url: "http://localhost/tag/byte-power/" - 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: "Music" slug: "music" taxonomy: "genre" url: "http://localhost/type/music/" media_contents: - id: 50603 title: "Byte Power August 1986" type: "computer_media" url: "http://localhost/computer_media/byte-power-august-1986/" media_type: "Program" programmers: - name: "Kristian Boisvert" slug: "boisvert-kristian" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-kristian/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Music%20%281986%29%28Byte%20Power%20Aug%201986%29%28TS2068%29%28CA%29%28Program%29.zip" mediadate: "1986" producer_company: - id: 25181 title: "Byte Power" type: "company" url: "http://localhost/company/byte-power/" images: - url: "http://localhost/wp-content/uploads/2025/02/music.png" article_media: - id: 59141 title: "BETTER PROGRAMMING!" type: "article" url: "http://localhost/article/better-programming-3/" media_type_tags: "Music" --- # Music This program plays a short musical sequence using the TS2068’s SOUND command, reading note and duration data from a DATA statement to drive the AY-3-8910 sound chip. Each iteration of the FOR loop reads three values (a, b, c) and sets four channels of the sound chip: channels 0 and 2 share related pitches (a and a+2), while channels 1 and 3 share the same value b, creating a two-voice harmony effect. The PAUSE 10*c statement controls note duration before silencing channels 8 and 9 (amplitude registers) between notes. The sequence covers 18 notes drawn from six distinct pitch/amplitude combinations in the DATA block. *** ## Program Analysis ### Program Structure The program is minimal and linear, consisting of four numbered lines. Line 1 is a `REM` credit line. Line 10 opens a `FOR` loop iterating `z` from 1 to 18, reading three DATA values per iteration. Line 20 performs the sound output. Line 30 handles timing and loop control, then `STOP`s. All musical data is held in the single `DATA` statement on line 40. ### AY-3-8910 SOUND Register Usage The TS2068’s `SOUND` keyword writes directly to the AY-3-8910 programmable sound generator registers. Each call in line 20 sets four registers in one statement using the semicolon-separated multi-register form: | Register | Value | Function | | --- | --- | --- | | 7 | 60 | Mixer control — enables tone on channels A and B | | 8 | 15 | Channel A amplitude (maximum) | | 9 | 15 | Channel B amplitude (maximum) | | 0 | a | Channel A tone period (low byte) | | 1 | b | Channel A tone period (high byte) / Channel B pitch parameter | | 2 | a+2 | Channel B tone period — slightly offset from Channel A | | 3 | b | Channel B tone period (high byte), same as register 1 | Setting Channel B’s pitch to `a+2` while Channel A uses `a` creates a subtle detuning effect, giving the melody a slightly fuller, chorus-like timbre. Registers 8 and 9 are set to 0 in the silence step (`SOUND 8,0;9,0`) to mute both channels between notes without resetting the pitch registers. ### DATA Layout and Note Parameters The `DATA` statement encodes 18 triplets of the form `a, b, c` where `a` is the low-byte pitch component, `b` is the high-byte pitch component (giving a 12-bit period value), and `c` is a duration multiplier. Duration is computed as `PAUSE 10*c`, so `c=1` yields approximately 0.5 seconds and `c=4` approximately 2 seconds at 50 Hz. The distinct pitch values used are: - `a=92, b=4` — one pitch - `a=209, b=5` — a second pitch - `a=158, b=4` — a third pitch - `a=47, b=5` — a fourth pitch - `a=226, b=3` — a fifth pitch ### Key BASIC Idioms and Techniques - The semicolon-chained `SOUND` syntax allows multiple AY registers to be written in a single BASIC statement, reducing line count and execution overhead. - Using `a+2` for register 2 computes the detuned Channel B pitch inline without needing an extra variable. - The silence step `SOUND 8,0;9,0` targets only the amplitude registers, leaving pitch registers intact — a clean articulation technique. - `STOP` at the end of line 30 halts execution cleanly after the loop completes, avoiding a fall-through to the `DATA` line. ### Anomalies and Notes The `REM` on line 1 references “RESET 1986 BYTE POWER,” identifying the tune as likely an arrangement of a known piece for the BYTE POWER publication. Line 2 is an empty line, probably a spacer left from editing. The mixer register value of 60 (binary `00111100`) enables tones on channels A and B while disabling noise on all channels and leaving channel C muted — a standard two-voice melodic configuration. ## Source Code ``` 1 REM RESET 1986 BYTE POWER WRITTEN BY K. BOISVERT 2 10 FOR z=1 TO 18: READ a,b,c 20 SOUND 7,60;8,15;9,15;0,a;1,b;2,a+2;3,b 30 PAUSE 10*c: SOUND 8,0;9,0: NEXT z: STOP 40 DATA 92,4,2,209,5,2,92,4,2,209,5,2,92,4,1,158,4,1,47,5,1,158,4,1,92,4,4,226,3,2,209,5,2,226,3,2,209,5,2,226,3,1,209,5,1,47,5,1,209,5,1,92,4,4 ```