--- title: "Phone Tone" id: 70814 type: "computer_media" slug: "phone-tone" url: "http://localhost/computer_media/phone-tone/" markdown_url: "http://localhost/computer_media/phone-tone.md" published_at: "2026-08-23T15:08:03+00:00" modified_at: "2026-08-23T21:30:15+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "Enter any phone number and hear each digit play back as authentic dual-tone DTMF signals, complete with inter-digit silence, using the sound hardware directly." 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: "James Palumbo" slug: "james-palumbo" taxonomy: "indiv" url: "http://localhost/indiv/james-palumbo/" genre: - name: "Sound" slug: "sound" taxonomy: "genre" url: "http://localhost/type/sound/" media_type: "Program" programmers: - name: "James Palumbo" slug: "james-palumbo" taxonomy: "indiv" url: "http://localhost/indiv/james-palumbo/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Phone%20Tone%20%281984%29%28Palumbo%2C%20James%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "1984" media_type_tags: "Sound" --- # Phone Tone Phone Tone simulates DTMF (dual-tone multi-frequency) telephone dialing by generating two simultaneous tones for each digit entered. The program accepts a phone number as a string and loops through each character, mapping it to a pair of frequency values (variables `a` and `b`) that correspond to the standard DTMF tone matrix rows and columns. The SOUND command is used with multiple channel parameters to produce the two-tone combinations, covering all twelve standard telephone keypad symbols: digits 0–9, asterisk (*), and hash (#). After each tone, a brief silence is inserted via a second SOUND call that resets the channels before advancing to the next digit. *** ### Program Structure The program is compact and linear. Line `10` prompts the user to enter a phone number using `INPUT ... LINE`, which captures the entire entry (including symbols like `*` and `#`) as a string `n$`. Lines `20`–`230` loop over each character with a `FOR`/`NEXT` construct, and line `240` sends execution back to `10` for another number. ### DTMF Frequency Mapping DTMF encodes each keypad symbol as a pair of audio frequencies — one from a low group (rows) and one from a high group (columns). The program approximates this with two hardware pitch values, `a` (low group) and `b` (high group): | Key | a (row) | b (column) | | --- | --- | --- | | 1 | 156 | 90 | | 2 | 156 | 81 | | 3 | 156 | 74 | | 4 | 142 | 90 | | 5 | 142 | 81 | | 6 | 142 | 74 | | 7 | 128 | 90 | | 8 | 128 | 81 | | 9 | 128 | 74 | | * | 116 | 90 | | 0 | 116 | 81 | | # | 116 | 74 | The row values (156, 142, 128, 116) decrease as you go down the keypad, and the column values (90, 81, 74) decrease left to right, reflecting the inverse relationship between the hardware pitch register values and actual audio frequency — higher register values correspond to lower pitches on this sound hardware. ### SOUND Channel Usage Line `205` issues a multi-parameter `SOUND` command: `SOUND 0,b;1,0;2,a;3,0;7,60;8,15;9,15`. Channels 0 and 2 carry the two tone pitches (`b` and `a` respectively), while channels 1 and 3 set their fine-tune registers to zero. Register 7 (the mixer control, set to 60) enables tone output on both channels. Registers 8 and 9 set the amplitude of channels A and B to 15 (maximum), producing audible output on both simultaneously. This is the key mechanism that generates the characteristic DTMF two-tone character. Line `220` silences all channels with `SOUND 0,0;1,0;2,0;3,0;7,63;8,0;9,0`, setting amplitudes to zero and disabling all outputs via mixer register 63. A `PAUSE 1` follows to create a brief inter-digit gap before the loop advances. ### Key BASIC Idioms - `INPUT ... LINE` is used instead of plain `INPUT` so that characters like `*` and `#` are accepted without triggering syntax errors. - Substring indexing via `n$(n)` extracts a single character at position `n` within the loop. - The tone duration is controlled by `PAUSE 5` (approximately 250 ms at 50 Hz), giving a reasonable approximation of a real dial tone burst. ### Anomalies and Limitations - There is no default case for unrecognized characters: if the user enters a letter or other symbol, variables `a` and `b` retain their values from the previous digit, causing that prior tone pair to replay unintentionally. - The `RESET` token appears in the line `5` REM comment only, and has no effect on program execution. - The twelve IF statements (lines `100`–`200`) are evaluated sequentially for every character, with no early exit on a match, making this slightly less efficient than a branching structure would be — though at these program sizes the impact is negligible. ## Source Code ``` 5 REM © 1984 by James Palumbo 10 INPUT "Enter # -->"; LINE n$ 20 FOR n=1 TO LEN n$ 100 IF n$(n)="1" THEN LET a=156:LET b=90 110 IF n$(n)="2" THEN LET a=156:LET b=81 120 IF n$(n)="3" THEN LET a=156:LET b=74 130 IF n$(n)="4" THEN LET a=142:LET b=90 140 IF n$(n)="5" THEN LET a=142:LET b=81 150 IF n$(n)="6" THEN LET a=142:LET b=74 160 IF n$(n)="7" THEN LET a=128:LET b=90 170 IF n$(n)="8" THEN LET a=128:LET b=81 180 IF n$(n)="9" THEN LET a=128:LET b=74 190 IF n$(n)="*" THEN LET a=116:LET b=90 195 IF n$(n)="0" THEN LET a=116:LET b=81 200 IF n$(n)="#" THEN LET a=116:LET b=74 205 SOUND 0,b;1,0;2,a;3,0;7,60;8,15;9,15 210 PAUSE 5 220 SOUND 0,0;1,0;2,0;3,0;7,63;8,0;9,0:PAUSE 1 230 NEXT n 240 GO TO 10 ```