--- title: "RND" id: 50624 type: "computer_media" slug: "rnd" url: "http://localhost/computer_media/rnd/" markdown_url: "http://localhost/computer_media/rnd.md" published_at: "2023-06-23T11:26:01+00:00" modified_at: "2026-04-01T10:59:59+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2019/02/20230809-041332.jpg" excerpt: "A generative noise machine that fires random values into 14 sound parameters across 1,000 loops, creating an ever-changing wall of electronic sound." 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: "Music" slug: "music" taxonomy: "genre" url: "http://localhost/type/music/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/RND%20%28198x%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "198x" media_type_tags: "Music" --- # RND RND is a generative music program that drives multiple SOUND channels simultaneously using random parameter values drawn from DATA statements. Each iteration reads 20 random values covering channel registers for tone, volume, and envelope settings, with three PAUSE statements introducing variable timing between bursts of sound. The program loops 1,000 times (tracked by variable `a`) before silencing via a final SOUND command. A RESTORE at line 145 resets the DATA pointer back to line 160 each cycle, ensuring the RND expressions are re-evaluated on every pass. *** ## Program Analysis ### Program Structure The program is organized into three functional phases: initialization (line 5), a main performance loop (lines 10–150), and a termination handler (line 155). The loop counter variable `a` is incremented at line 12 and tested at line 20; after 1,000 iterations the program branches to line 155, which silences three channels and halts. A `RESTORE 160` at line 145 rewinds the DATA pointer before each `GO TO 10`, so the 20 DATA lines are re-read from the top on every cycle. ### DATA and RND Evaluation Lines 160–350 hold exactly 20 DATA items, each expressed as a parenthesized RND expression. Because BASIC evaluates expressions in DATA statements at READ time rather than at parse time, every `READ` call produces a freshly randomized value. The ranges are chosen to match the legal parameter widths of the SOUND command registers: - Channel/register selectors: `RND*63` and `RND*31` (6-bit / 5-bit fields) - Tone/frequency values: `RND*255` (8-bit) - Volume/envelope: `RND*15` (4-bit) - PAUSE durations: `RND*100` (arbitrary centisecond range) ### Timing Control Three `PAUSE` statements at lines 80, 100, and 120 use the values read into variables `O`, `P`, and `Q` respectively, each ranging from 0 to 99 centiseconds. This introduces irregular, unpredictable gaps between successive SOUND bursts, contributing to the generative, non-repeating character of the output. ### Notable Techniques - **RESTORE loop:** Using `RESTORE 160` rather than `RESTORE` alone pins the DATA pointer to a specific line, which is robust against any future DATA additions above line 160. - **Counter-driven termination:** Rather than running indefinitely, the loop counts to 1,000 via variable `a`, giving the piece a defined length. - **Graceful shutdown:** Line 155 explicitly zeros the amplitude on channels 8, 9, and 10 (`SOUND 8,0;9,0;10,0`) to silence the hardware cleanly on exit. ## Source Code ``` 5 LET a=0 10 READ A,B,C,D 12 LET a=a+1 20 IF a=1000 THEN GO TO 155 30 READ E,F,G,H,I 40 READ J,K,L,M,N 50 READ O,P,Q,R,S,T 60 SOUND 7,A;6,B 70 SOUND 0,C;1,D;8,E 80 PAUSE O 90 SOUND 2,F;3,G;9,H 100 PAUSE P 110 SOUND 4,I;5,J;10,K 120 PAUSE Q 130 SOUND 11,L;12,M;13,N 140 SOUND 8,R;9,S;10,T 145 RESTORE 160 150 GO TO 10 155 SOUND 8,0;9,0;10,0 160 DATA (RND*63) 170 DATA (RND*31) 180 DATA (RND*255) 190 DATA (RND*15) 200 DATA (RND*31) 210 DATA (RND*255) 220 DATA (RND*15) 230 DATA (RND*31) 240 DATA (RND*255) 250 DATA (RND*15) 260 DATA (RND*31) 270 DATA (RND*255) 280 DATA (RND*255) 290 DATA (RND*15) 300 DATA (RND*100) 310 DATA (RND*100) 320 DATA (RND*100) 330 DATA (RND*31) 340 DATA (RND*31) 350 DATA (RND*31) ```