--- title: "A Matter of Time" id: 72700 type: "computer_media" slug: "a-matter-of-time" url: "http://localhost/computer_media/a-matter-of-time/" markdown_url: "http://localhost/computer_media/a-matter-of-time.md" published_at: "2026-10-26T23:19:29+00:00" modified_at: "2026-10-26T23:19:29+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/10/matteroftime-1.png" excerpt: "A sound-chip helper that converts a duration in seconds into the envelope generator's fine and coarse register values, then plays a tone for that time." 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: "Peter Ross" slug: "peter-ross" taxonomy: "indiv" url: "http://localhost/indiv/peter-ross/" genre: - name: "Music" slug: "music" taxonomy: "genre" url: "http://localhost/type/music/" media_type: "Program" programmers: - name: "Peter Ross" slug: "peter-ross" taxonomy: "indiv" url: "http://localhost/indiv/peter-ross/" download_url: "https://archive.org/download/timex-sinclair-software-archive/A%20Matter%20of%20Time%20%28198x%29%28Ross%2C%20Peter%29%28TS2068%29%28US%29%28Program%29.zip" tsrun_member: "A Matter of Time (198x)(Ross, Peter)(TS2068)(US)(Program)/A Matter of Time (198x)(Ross, Peter)(TS2068)(US)(Program).tap" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2026/10/matteroftime-1.png" - url: "http://localhost/wp-content/uploads/2026/10/matteroftime-2.png" - url: "http://localhost/wp-content/uploads/2026/10/matteroftime-3.png" media_type_tags: "Music" license: false --- # A Matter of Time A Matter of Time works out the register values needed to make the TS2068’s AY sound chip envelope last a given time. You enter a number of seconds, up to 9.5. The program shows the fine-tune and coarse-tune values for envelope registers 11 and 12, the frequency, and the matching PAUSE value, then plays a tone with that envelope so you can hear it, and asks again. The screen credits Peter Ross. ## Program Analysis The program is ten lines long. It takes the envelope frequency as `F=1/S` and the envelope period as `EP=1764000/(256*F)`, using the chip’s 1.764 MHz clock. The whole part of `EP/256` is the coarse value and the remainder, times 256, is the fine value. Line 50 then plays a tone on channel A (`SOUND 1,1;0,21;7,62;11,ft;12,ct;13,11;8,16`), waits `60*S` frames and turns it off. ### Notable Techniques - Envelope shape 11 is used for the test tone. - The prompt is printed in the lower screen with `PRINT #1`. This copy comes from a Larken disk, the TTSUC library disk “Music and Sound”. It was converted for tape (the disk command was removed from the save line) and tested in ZEsarUX. ## Source Code ``` 10 REM ** A MATTER OF TIME *** 15 PAPER 0: BORDER 0: INK 5: BRIGHT 1: CLS : PRINT AT 11,3;"THIS PROGRAM IS USEFUL IN FIG-URING OUT THE REQUIRED REGISTER VALUES FOR SETTING THE ENVELOPE GENERATOR TO A SPECIFIC AMOUNT OF SECONDS (UP TO 9.5).": PRINT #1;AT 1,0;"PRESS ANY KEY": PAUSE 0 20 INPUT "HOW MANY SECONDS ? ";S: LET F=1/S: PAPER 1: BORDER 1: BRIGHT 1: INK 6: CLS 25 LET EP=1764000/(256*F) 30 LET CT=INT (EP/256) 40 LET FT=INT (((EP/256)-INT (EP/256))*256) 45 PRINT INK 2; PAPER 0;AT 1,1;"CONTROLLING THE TIME ON THE EG"''' INK 6; PAPER 1;"SECONDS ";S'"FINE TUNE ";FT'"COARSE TUNE ";CT'"FREQ ";F'"PAUSE ";60*S; INK 3;AT 21,17;"by Peter Ross" 50 SOUND 1,1;0,21;7,62;11,ft;12,ct;13,11;8,16: PAUSE 60*s: SOUND 8,0;7,63: GO TO 20 9997 STOP 9998 SAVE "EnvGen.B1" LINE 1 ```