--- title: "Musician Royal" id: 50519 type: "computer_media" slug: "musician-royal" url: "http://localhost/computer_media/musician-royal/" markdown_url: "http://localhost/computer_media/musician-royal.md" published_at: "2023-06-18T15:23:03+00:00" modified_at: "2026-03-31T19:16:07+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2023/07/Musician-Royal-Demo-screen-1.png" excerpt: "A full-featured music composition editor that lets you enter notes by name, handles key signatures, supports tempo changes, and saves your melody for later playback." 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: "Electret Scientific Company" slug: "electret-scientific-company" taxonomy: "post_tag" url: "http://localhost/tag/electret-scientific-company/" - 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: "Oleg D. Jefimenko" slug: "oleg-d-jefimenko" taxonomy: "indiv" url: "http://localhost/indiv/oleg-d-jefimenko/" genre: - name: "Music" slug: "music" taxonomy: "genre" url: "http://localhost/type/music/" media_type: "Program" programmers: - name: "Oleg D. Jefimenko" slug: "oleg-d-jefimenko" taxonomy: "indiv" url: "http://localhost/indiv/oleg-d-jefimenko/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Musician%20Royal%20%281986%29%28Electret%20Scientific%20Company%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "1986" producer_company: - id: 35305 title: "Electret Scientific Company" type: "company" url: "http://localhost/company/electret-scientific-company/" related_products: - id: 35306 title: "Musician Royal" type: "product" url: "http://localhost/product/musician-royal/" media_type_tags: "Music" --- Musician Royal is a comprehensive music transcription and performance program that allows users to enter, edit, and play single-voice musical compositions using standard note names (A–G), octave numbers, and accidentals. Notes are stored in a two-dimensional array `S(2,1512)`, with pitch values computed using a formula that converts note letter, octave, and sharp/flat status into semitone offsets for the BEEP command. The program supports key signatures of up to 7 sharps or flats, automatically applying accidentals based on the key, and allows up to 9 tempo changes within a composition. An on-screen staff display is rendered using user-defined graphics (loaded via DATA statements into UDG slots 65–79) along with PLOT and DRAW commands to draw staff lines. Compositions can be saved either as raw array data (“MELODY”) or as a self-contained BASIC program (“MUSIC”) with embedded DATA statements, and the editor supports note insertion, deletion, and duplication. *** ## Program Analysis ### Program Structure The program is organized into distinct functional regions identifiable by line number ranges: - **Lines 1–20:** Initialization, UDG loading, array allocation, and splash screen. - **Lines 21–79:** Input mode — key signature selection, note entry loop, and automatic accidental application. - **Lines 80–210:** Pitch encoding and duration input; note data written into array `S()`. - **Lines 236–430:** Playback engine, tempo sequencing, data export via LPRINT. - **Lines 500–700:** Introductory text, UDG definition routines (deleted after use). - **Lines 900–1430:** Edit mode — change, insert, and delete notes; tempo editing. - **Lines 1450–1611:** Duplication mode. - **Lines 4000–4100:** Shared UI subroutines for edit/insert/delete prompts. - **Lines 5000–5040:** Error/warning display subroutines. - **Lines 6000–6040:** Name-entry and caps-lock warning subroutines. - **Lines 7000–7620:** Staff display renderer using UDGs, PLOT, DRAW, and clef selection. - **Lines 8000–8120:** Play mode entry, save routines (array data and full BASIC program). - **Lines 9000–9999:** Utility subroutines (BEEP cue, playback display, tonality change, quit). ### Data Storage All note data is held in the two-dimensional array `S(2,1512)` declared at line 19. Row 1 stores note durations (as a fraction of a whole note), and row 2 stores the semitone pitch value for BEEP, or 99 as a sentinel value for rests. The array also doubles as save metadata: indices 1500–1512 are used at line 8080 to pack tempo waypoints (`W()`) and tempo durations (`T()`) before saving. Tempo section boundaries are tracked in `W(11)` (note-number waypoints) and `T(10)` (whole-note durations in seconds). Up to 9 tempo changes (`QQ` sections) are supported; a tenth triggers the error at line 5040. ### Pitch Encoding Formula At line 180, the semitone value stored in `S(2,J)` is computed as: `S(2,J) = -51 + C*2 + 12*D - (1 AND C>1) - (1 AND C>4) + (1 AND V$(3)="S")` where `C = CODE V$(1) - 65` (0=A … 6=G) and `D = VAL V$(2) - 1` (octave minus 1). The constants subtract 1 for note letters beyond B (index 1) and beyond E (index 4) to account for the missing semitones in the diatonic scale (B–C and E–F), effectively mapping letter+octave to a chromatic semitone offset compatible with BEEP’s pitch argument. A sharp adds 1. ### Key Signature and Accidental Application Lines 73–79 implement automatic accidental inference from the key signature. The variable `NM` holds the number of sharps or flats (0–7) and `S$` holds “S” or “F”. For each count of sharps or flats, the program applies the correct accidental to the appropriate scale degrees using Spectrum BASIC’s string Boolean idiom (e.g., `("S" AND condition)` evaluates to “S” or ” ” based on the truth of the condition). Flat conversion (lines 90–110) lowers a flatted note by stepping its letter down one ASCII value and adjusting the octave for A-flat. Sharp correction (line 120) handles B-sharp and E-sharp by raising them to C and F respectively. Line 121 defaults any unset accidental field to “N” (natural). ### Self-Deleting Initialization Code The program makes heavy use of `DELETE` to remove code that is no longer needed, freeing memory and preventing re-execution. The UDG loader (lines 610–700) is deleted at line 3 after running. The initialization lines 19–20 delete themselves. The intro/description block (lines 500–604) is deleted at line 710. When entering Play Mode at line 8040, a large swath of lines 10–8040 is deleted to reclaim memory for playback. The quit routine at line 9799 deletes itself and nearly all remaining code. ### User-Defined Graphics and Staff Rendering Lines 610–700 load 15 UDG characters (slots A–O, ASCII 65–79) with bitmap data from DATA statements. These are used in lines 7510–7620 to render note head and clef symbols on the staff display. Staff lines themselves are drawn with `PLOT`/`DRAW` commands in the loop at lines 7570–7592, with conditional ledger lines for high (`V$(3)="H"`) and low (`V$(3)="L"`) clef positions. The display supports treble clef (TC), treble clef high (TCH), treble clef low (TCL), bass clef (BC), bass clef high (BCH), and bass clef low (BCL) modes. ### Playback Engine Playback is handled in the loop at lines 340–370. For each note from `A` to `B`, the current tempo section is determined by comparing `K` against `W(I+1)`. The BEEP duration is calculated as `T/S(1,K)`, converting the whole-note duration `T(I)` (in seconds) and the note’s fractional value. A rest (sentinel value 99 in `S(2,K)`) triggers a `PAUSE` instead of BEEP. The variable `TON` allows transposition by adding a semitone offset to every pitch at play time (line 360 and configured at lines 9990–9999). ### Save Mechanisms Two save options are provided. Line 8090 uses `SAVE "MELODY" DATA S()` to store the raw note array, which can be reloaded into the program. Line 8120 uses `SAVE "MUSIC" LINE 9100` to save the entire BASIC program with an auto-run entry point at line 9100, which acts as a standalone playback loader — it checks available memory and returns to line 1 if insufficient. A separate LPRINT path (lines 406–430) exports the composition as BASIC DATA statements, suitable for embedding in another program. ### Input Validation and Error Handling The program uses `ON ERR GO TO` extensively as a self-referencing trap (e.g., `ON ERR GO TO 40` at line 40) to prevent crashes during INPUT statements. Numeric range checks are performed by inspecting `CODE` of the first character of a stringified number (e.g., `CODE L$<46 OR CODE L$>57` to reject non-numeric input). The subroutine at line 5000 displays a flashing “WRONG NUMBER” message with a BEEP, while line 5010 emits only the error BEEP. ### Notable Idioms and Techniques - `PAUSE 0` followed by `INKEY$` is used throughout as a keypress wait idiom (e.g., lines 23, 246, 930). - Computed `GO TO` at lines 400, 1010, and 8070 uses arithmetic on string comparisons to select branch targets, e.g., `GO TO (900 AND I$="0")+(300 AND I$="1")+...`. - String Boolean expressions (e.g., `("S" AND S$="S" AND V$(1)="F")`) are used at lines 73–79 to assign accidentals conditionally without IF statements. - `VAL "number"` in `GO SUB VAL "9000"` is not present here, but `VAL M$` and similar patterns appear for compact numeric conversion. - The variable `QJ` tracks the high-water mark of entered notes to correctly manage editing offsets and deletions. ### Potential Anomalies - Line 7600: The condition `V$(3)<>"H" OR V$(3)<>"L"` is always true (a value cannot simultaneously equal both “H” and “L”), so the ledger lines it draws are always rendered regardless of clef mode. This is likely a logic error; the intended condition was probably `AND`. - Line 7590: Contains a bare `PLOT 8,0` with no coordinates after a semicolon, likely a typo — the statement `PLOT 8,0` would plot at (8,0) rather than drawing the intended ledger line. - Line 1255: Branches to line 238 which does not exist in the listing; this is a well-known technique to exit a loop or subroutine cleanly by triggering `ON ERR`. - Line 277: The condition checks `A<>INT A` instead of the presumably intended `B<>INT B`, reusing the wrong variable for the last-note integer check. ## Source Code ``` 1 ON ERR GO TO 1: BORDER 4: PAPER 6: CLS : PAUSE 30 2 LET A$="ELECTERET": PRINT AT 10,9; PAPER 1; INK 7; FLASH 1;"stop the tape": GO SUB 9000 3 GO SUB 610: DELETE 610,700: DELETE 2,3 4 GO SUB 9000: CLS : FOR K=0 TO 10: PRINT INK 1;" MUSICIAN ROYAL "; INK 3;" MUSICIAN ROYAL ": NEXT K 5 PRINT ' PAPER 5;" mr * mr * mr **** mr * mr * mr " 7 PRINT PAPER 7;" "; PAPER 5;" \* 1986 Electret Scientific Co. ": GO SUB 500 19 DIM V$(3): DIM S(2,1512): DIM W(11): DIM T(10): DIM H(10) 20 LET TON=0: LET YY=1500: LET Q=1: LET QQ=1: LET QJ=1: DELETE 19,20 21 ON ERR GO TO 21: GO SUB 6010: LPRINT 'TAB 0;"INPUT MODE";TAB 0;"FOLLOWING NOTES ARE ENTERED" 22 CLS : GO SUB 9000: PRINT PAPER 5;"********** INPUT MODE **********": PRINT '''''''''" INPUT THE NUMBER OF SHARPS OR FLATS IN THE KEY SIGNATURE." 23 PAUSE 0: LET M$=INKEY$: IF CODE M$<48 OR CODE M$>55 OR LEN M$>1 THEN CLS : GO SUB 5000: GO TO 22 24 LET NM=VAL M$: LPRINT : LPRINT "Key Signature ";NM;: IF NM=0 THEN LPRINT ;0: LPRINT : GO TO 30 25 GO SUB 9000: PRINT ''" DOES THE SIGNATURE CONTAIN"," SHARPS (S) OR FLATS (F)?": PAUSE 0 27 IF CODE INKEY$>90 THEN GO SUB 6040: GO TO 25 28 IF INKEY$<>"S" AND INKEY$<>"F" THEN GO SUB 5010: CLS : GO TO 25 29 LET S$=INKEY$: LPRINT S$: LPRINT 30 CLS : LET V$="TC ": GO SUB 7500 32 FOR J=Q TO YY 40 ON ERR GO TO 40: PRINT PAPER 7;AT 20,0;" R Q K M P T Z TCH TCL BC BCH BCL TC ": BEEP 0.1,20: PRINT PAPER 5;AT 12,0;" INPUT NOTE OR REST NO. ";J;" "," ": IF QJ90 THEN GO SUB 6040: GO TO 30 52 IF V$(1 TO 2)="BC" OR V$(1 TO 2)="TC" THEN CLS : GO SUB 7500: GO TO 40 53 IF (CODE V$<65 OR CODE V$>71) AND V$(1)<>"Q" AND V$(1)<>"R" AND V$(1)<>("M" AND J>1) AND V$(1)<>("P" AND (J>1 OR QJ>1)) AND V$(1)<>("K" AND J>1) AND V$(1)<>("T" AND J>1) AND V$(1)<>("Z" AND J>1) THEN GO SUB 5010: GO TO 40 60 IF V$(1)="R" THEN LET S(2,J)=99: GO TO 130 62 IF V$(1)="Z" THEN LET J=J-1: GO TO 40 63 IF V$(1)="Q" THEN LPRINT TAB 0;"--------------------": GO TO 40 65 IF V$(1)="M" THEN GO TO 1450 66 IF V$(1)="P" THEN GO TO 236 67 IF V$(1)="T" AND QQ>9 THEN LET Q=J: GO SUB 5040: GO TO 30 68 IF V$(1)="T" THEN LET W(QQ+1)=J-1: LET QQ=QQ+1: LPRINT : LPRINT TAB 0;"TEMPO CHANGE AFTER NOTE ";J-1: LPRINT : GO TO 40 69 IF V$(1)="K" THEN LET Q=J: LPRINT : GO TO 22 70 IF CODE V$(2)<49 OR CODE V$(2)>57 THEN GO SUB 5010: GO TO 40 71 GO SUB 72: GO TO 130 72 IF V$(3)<>" " THEN GO TO 80 73 IF NM=1 THEN LET V$(3)= ("S" AND S$="S" AND V$(1)="F")+("F" AND S$="F" AND V$(1)="B") 74 IF NM=2 THEN LET V$(3)= ("S" AND S$="S" AND (V$(1)="F" OR V$(1)="C"))+("F" AND S$="F" AND (V$(1)="B" OR V$(1)="E")) 75 IF NM=3 THEN LET V$(3)= ("S" AND S$="S" AND (V$(1)="F" OR V$(1)="C" OR V$(1)="G"))+("F" AND S$="F" AND (V$(1)="B" OR V$(1)="E" OR V$(1)="A")) 76 IF NM=4 THEN LET V$(3)= ("F" AND S$="F" AND V$(1)<>"F" AND V$(1)<>"C" AND V$(1)<>"G")+("S" AND S$="S" AND V$(1)<>"B" AND V$(1)<>"E" AND V$(1)<>"A") 77 IF NM=5 THEN LET V$(3)= ("F" AND S$="F" AND V$(1)<>"F" AND V$(1)<>"C")+("S" AND S$="S" AND V$(1)<>"B" AND V$(1)<>"E") 78 IF NM=6 THEN LET V$(3)= ("F" AND S$="F" AND V$(1)<>"F")+("S" AND S$="S" AND V$(1)<>"B") 79 IF NM=7 THEN LET V$(3)=("F" AND S$="F")+("S" AND S$="S") 80 IF V$(3)<>"F" THEN GO TO 120 90 LET V$(3)=("S" AND (V$(1)<>"C" AND V$(1)<>"F"))+("N" AND (V$(1)="C" OR V$(1)="F")) 100 LET V$(2)=STR$ (VAL V$(2)-(1 AND V$(1)="A")) 110 LET V$(1)=(CHR$ (CODE V$(1)-1) AND V$(1)<>"A")+("G" AND V$(1)="A") 120 IF V$(3)="S" AND (V$(1)="B" OR V$(1)="E") THEN LET V$(1)=CHR$ (CODE V$(1)+1): LET V$(3)="N" 121 IF V$(3)=" " THEN LET V$(3)="N" 122 IF V$(3)<>"S" AND V$(3)<>"N" THEN GO SUB 5010: GO TO 40 125 RETURN 130 ON ERR GO TO 130: BEEP 0.1,10: BEEP 0.1,10: PRINT AT 12,1; PAPER 7;"INPUT THE VALUE (DURATION) OF": PRINT AT 13,3; PAPER 7;" THE NOTE OR REST NO. ";J;" " 140 INPUT "THE VALUE IS: ";S(1,J): LET L$=STR$ S(1,J): IF CODE L$<46 OR CODE L$>57 THEN GO SUB 5010: GO TO 130 145 LET S(1,J)=INT (S(1,J)*100+.5)/100: IF S(1,J)<.2 OR S(1,J)>128 THEN GO SUB 5000: GO TO 130 150 IF V$(1)="R" THEN GO TO 210 160 IF V$(3)=" " THEN LET V$(3)="N" 180 LET C=CODE V$(1)-65: LET D=VAL V$(2)-1: LET S(2,J)=-51+C*2+12*D-(1 AND C>1)-(1 AND C>4)+(1 AND V$(3)="S") 210 LPRINT J;" ";V$;" ";S(1,J);" ";S(2,J),: NEXT J 236 LET YY=1500: IF J>=1500 THEN GO SUB 5030 239 LPRINT TAB 0;" STOP ": LET J=QJ: LET W(QQ+1)=J-1: LET Q=J: LET XX=J-1: IF J=1 THEN LET QQ=1: GO TO 21 242 ON ERR GO TO 242: CLS : PRINT ''''''" PRESS ""ENTER"" IF YOU WANT TO PLAY THE COMPOSITION"'''" PRESS ""0"" IF YOU WANT TO EDIT THE COMPOSITION"'''" PRESS ""1"" IF YOU WANT TO ADD MORE NOTES" 246 PAUSE 0: IF INKEY$="0" THEN GO SUB 900 247 IF INKEY$="1" THEN GO TO 30 258 GO SUB 268: FOR K=2 TO QQ+1 259 IF W(K-1)+1>W(K) THEN GO TO 266 260 GO SUB 9220: PRINT W(K-1)+1;" TO NOTE NO. ";W(K),"OF THE MELODY." 263 INPUT "THE DURATION IS: ";T(K-1): LET I$=STR$ T(K-1): IF CODE I$<46 OR CODE I$>57 OR CODE I$=47 THEN GO SUB 5000: GO SUB 268: GO TO 260 264 LET T(K-1)=INT (T(K-1)*100+.5)/100: IF T(K-1)>10 THEN LET T(K-1)=10 265 IF T(K-1)<.1 THEN LET T(K-1)=.1 266 NEXT K: GO SUB 268: GO TO 271 268 CLS : PRINT PAPER 7;"THERE ARE ";J-1;" NOTES IN"; PAPER 6;AT 2,(31-LEN C$)/2;C$: RETURN 271 BEEP .1,12: LET D$="FIRST": LET E$="MELODY": GO SUB 9230 272 INPUT "THE FIRST NOTE IS NO. ";A: LET A$=STR$ A: IF CODE A$<49 OR CODE A$>57 THEN GO SUB 5000: GO SUB 268: GO TO 271 273 IF A<1 OR A>J-1 OR A<>INT A THEN GO SUB 5000: GO SUB 268: GO TO 271 275 BEEP .1,12: LET D$="LAST": GO SUB 9231 276 INPUT "THE LAST NOTE IS NO. ";B: LET B$=STR$ B: IF CODE B$<49 OR CODE B$>57 THEN GO SUB 5000: GO SUB 268: GO TO 275 277 IF B<1 OR B>J-1 OR BINT A THEN GO SUB 5000: GO SUB 268: GO TO 275 305 LET CC=0 310 LET B=VAL B$: LET I=0: GO SUB 9200 340 FOR K=A TO B: IF K>W(I+1) THEN LET I=I+1 341 IF INKEY$<>"" THEN GO TO 380 355 LET T=T(I): IF S(2,K)=99 THEN PAUSE T/S(1,K)*60: GO TO 370 360 BEEP T/S(1,K),S(2,K)+TON 370 NEXT K: IF CC=1 THEN GO TO 310 380 IF FREE >7000 THEN GO TO 8050 383 ON ERR GO TO 383: CLS : PRINT AT 6,0;"PRESS ""1"" TO PLAY AGAIN.","PRESS ""2"" TO PLAY DIFFERENTLY.","PRESS ""3"" TO PLAY CONTINUOUSLY.","PRESS ""4"" TO ADD MORE NOTES.","PRESS ""5"" TO SAVE THE MELODY.","PRESS ""6"" TO GO TO PLAY MODE.","PRESS ""7"" TO LPRINT MUSIC DATA.","PRESS ""0"" TO EDIT.": PAUSE 0 390 IF INKEY$="3" THEN LET CC=1: GO TO 310 395 LET I$=INKEY$: IF CODE I$<48 OR CODE I$>55 THEN GO TO 380 396 IF I$="6" THEN GO TO 8000 398 IF I$="7" THEN GO TO 406 400 GO TO (900 AND I$="0")+(300 AND I$="1")+(258 AND I$="2")+(30 AND I$="4")+(8080 AND I$="5")+(1990 AND I$="6") 406 LPRINT : LPRINT "DATA ";"""";C$;""", ";J-1;",";QQ;",";: FOR K=2 TO QQ: LPRINT W(K);",";T(K-1);",";: NEXT K: LPRINT W(K);",";T(K-1): LPRINT : LPRINT "DATA "; 408 LET P=1: FOR I=1 TO J-2: FOR K=2 TO QQ: IF I=W(K)+1 THEN LPRINT 100;",";100;","; 410 NEXT K: IF P=19 THEN LPRINT ((S(2,I)+TON) AND S(2,I)<>99)+(99 AND S(2,I)=99);",";INT (S(1,I)*100+.5)/100: LPRINT : LPRINT "DATA ";: LET P=1: NEXT I 420 LPRINT ((S(2,I)+TON) AND S(2,I)<>99)+(99 AND S(2,I)=99);",";S(1,I);",";: LET P=P+1 430 NEXT I: LPRINT S(2,J-1)+TON;",";INT (S(1,J-1)*100+.5)/100: GO SUB 9000: GO TO 380 500 PRINT ''" THIS PROGRAM TRANSCRIBES AND PLAYS ONE-VOICE MUSIC.": GO TO 609 607 PRINT PAPER 3;" THIS PROGRAM PLAYS " 608 PRINT ''TAB (31-LEN C$)/2;C$ 609 PRINT '' PAPER 7;" PRESS ""ENTER"" TO START ": PAUSE 0: CLS : IF A$="PLAY" THEN GO TO 305 610 FOR K=65 TO 79 620 FOR J=0 TO 7 630 READ Q 640 POKE USR CHR$ K+J,Q 650 NEXT J 660 NEXT K 670 DATA 0,0,0,0,0,0,56,68, 0,0,0,56,68,66,34,28, 56,68,66,34,28,0,0,0, 0,0,0,0,0,56,68,66, 0,0,56,68,66,34,28,0 680 DATA 0,0,0,0,0,0,0,56, 0,0,0,0,56,68,66,34, 0,56,68,66,34,28,0,0, 66,34,28,0,0,0,0,0, 34,28,0,0,0,0,0,0 690 DATA 68,66,34,28,0,0,0,0, 28,0,0,0,0,0,0,0, 16,40,40,40,16,48,80,146, 137,137,74,60,4,100,100,24, 112,137,200,200,9,16,32,64 700 RETURN 710 DELETE 500,604: DELETE 710,710 720 RETURN 900 GO SUB 4010 920 GO SUB 6000: PRINT '''''''' PAPER 5;" PRESS ""N"" TO CHANGE NAME"," OF COMPOSITION. PRESS ""T"""," TO CHANGE TEMPO SEQUENCES."," PRESS ""ENTER"" TO MAKE ANY"," OTHER CORRECTIONS. " 925 PRINT AT 21,7; BRIGHT 1; PAPER 6;"PRESS ""X"" TO EXIT" 930 PAUSE 0: IF INKEY$="N" THEN CLS : GO SUB 6010: GO TO 242 940 IF INKEY$="T" THEN CLS : GO TO 1140 945 IF INKEY$="X" THEN GO TO 242 950 CLS : LET A$="NOTE": GO SUB 4020 960 INPUT "THE FIRST NOTE IS NO. ";Q: LET W$=STR$ Q: IF CODE W$<49 OR CODE W$>57 THEN GO SUB 5010: GO TO 950 970 IF Q>J-1 THEN GO SUB 5000: GO TO 950 990 GO SUB 4000 1000 PAUSE 0: IF INKEY$<>"1" AND INKEY$<>"2" AND INKEY$<>"3" THEN GO SUB 5010: GO TO 1000 1010 GO TO (1020 AND INKEY$="1")+(1030 AND INKEY$="2")+(1300 AND INKEY$="3") 1020 LPRINT : LPRINT TAB 0;"NOTES CHANGED TO": LPRINT : GO TO 22 1030 LET A$="NOTES": GO SUB 4030 1040 INPUT "THE NUMBER OF NOTES IS: ";Y: LET Y$=STR$ Y: IF CODE Y$<48 OR CODE Y$>57 THEN GO SUB 5010: GO TO 1040 1045 IF Y>1500-J+1 THEN GO SUB 5000: GO TO 1030 1051 IF Y=0 THEN GO TO 240 1055 GO SUB 4040 1070 FOR K=J-1 TO Q STEP -1: LET S(1,K+Y)=S(1,K): LET S(2,K+Y)=S(2,K) 1080 LPRINT K+Y;" ";S(1,K);" ";S(2,K), 1100 FOR I=1 TO QQ: IF W(I)=K THEN LET W(I)=K+Y: GO SUB 1430 1125 NEXT I: NEXT K: LET QJ=QJ+Y 1127 FOR K=0 TO Y-1: LET S(1,Q+K)=8: LET S(2,Q+K)=0: NEXT K 1129 GO SUB 4100 1130 CLS : LET YY=Q+Y-1: GO TO 22 1140 GO SUB 9000: PRINT PAPER 5;" INPUT THE SEQUENTIAL NUMBER OF THE FIRST NOTE AFTER WHICH THE TEMPO IS TO BE CHANGED. " 1150 INPUT "THE FIRST NOTE IS NO. ";Z: LET Z$=STR$ Z: IF CODE Z$<49 OR CODE Z$>57 THEN GO SUB 5010: GO TO 1150 1155 IF Z>J-2 THEN GO SUB 5000: GO TO 1140 1170 GO SUB 9000: PRINT '' PAPER 3;"HOW MANY TIMES DOES THE TEMPO CHANGE AFTER NOTE NO. ";Z;"?","(ALL TEMPO CHANGES FOLLOWING","NOTE NO. ";Z;" MUST BE RESET)" 1180 INPUT "THE NUMBER OF CHANGES IS: ";O: LET O$=STR$ O: IF CODE O$<48 OR CODE O$>57 THEN GO SUB 5010: GO TO 1170 1185 IF O>J-Z-1 OR O>9 THEN GO SUB 5000: GO TO 1170 1200 IF QQ=1 THEN GO TO 1225 1209 FOR I=2 TO QQ: IF W(I)57 THEN GO SUB 5010: GO TO 1250 1255 IF NN>=J-1 THEN GO SUB 5000: GO TO 238 1260 IF NN10 THEN GO SUB 5040: GO TO 238 1280 NEXT I 1290 GO TO 238 1300 GO SUB 9000: PRINT '' PAPER 5;"HOW MANY NOTES OR RESTS STARTINGWITH NOTE NO. ";Q;" ARE TO BE","DELETED?" 1310 INPUT "THE NUMBER IS: ";X: LET X$=STR$ X: IF CODE X$<48 OR CODE X$>57 THEN GO SUB 5010: GO TO 1310 1315 IF X>J-Q THEN GO SUB 5000: GO TO 1300 1321 IF X=0 THEN GO TO 240 1325 LET QZ=0: GO SUB 4050 1327 FOR I=2 TO QQ: LET H(I)=W(I) 1328 IF QZ=0 THEN IF W(I)>=Q-1 THEN IF W(I)<=Q+X-1 THEN LET QZ=I: LET W(I)=Q-1: GO SUB 1430 1330 NEXT I: FOR K=Q+X TO J-1 1340 LET S(1,K-X)=S(1,K): LET S(2,K-X)=S(2,K) 1350 LPRINT K-X;" ";S(1,K);" ";S(2,K), 1370 FOR I=2 TO QQ: IF QZ=0 THEN LET QZ=I 1380 IF H(I)=K THEN LET W(QZ+1)=K-X: LPRINT : LPRINT TAB 0;"TEMPO CHANGE AFTER NOTE ";W(QZ+1): LPRINT : LET QZ=QZ+1 1402 NEXT I: NEXT K: IF QZ=0 THEN LET QZ=1 1420 LET Q=Q-X: LET QQ=QZ: LET J=J-X: LET QJ=QJ-X: CLS : GO TO 239 1430 LPRINT : LPRINT TAB 0;"TEMPO CHANGE AFTER NOTE ";W(I): LPRINT : RETURN 1450 GO SUB 4060: PRINT '"NOTE NO. ";J 1460 LET A$="NOTE": GO SUB 4070 1470 INPUT "THE FIRST NOTE IS NO. ";E: LET U$=STR$ E:: IF CODE U$<49 OR CODE U$>57 THEN GO SUB 5010: GO TO 1470 1480 IF E>J-1 OR E<1 THEN GO SUB 5000: GO TO 1460 1500 GO SUB 4080 1510 INPUT "THE LAST NOTE IS NO. ";D: LET R$=STR$ D: IF CODE R$<49 OR CODE R$>57 THEN GO SUB 5010: GO TO 1510 1520 IF D>J-1 OR DYY-J THEN GO SUB 5000: GO TO 1500 1532 LPRINT : LPRINT TAB 0;D-E+1;" NOTES ARE DUPLICATED FROM";TAB 0;E;" TO ";D: LPRINT 1550 GO SUB 7000: GO SUB 4090 1580 FOR I=J TO J+D-E: LET S(1,I)=S(1,E): LET S(2,I)=S(2,E): IF A$<>"O" THEN LPRINT I;" ";S(1,I);" ";S(2,I);" ",: 1610 LET E=E+1: NEXT I: LET Q=I: LPRINT TAB 0;"END": IF QJ30 THEN GO SUB 5010: PRINT FLASH 1; PAPER 3; INK 7;AT 20,0;" THE NAME IS TOO LONG, PLEASE MAKE IT SHORTER. ": PAUSE 180: CLS : GO TO 6010 6035 LPRINT "*";C$;"*": RETURN 6040 CLS : PRINT ''''''''''" please turn on the caps lock"," and press ""enter""": GO SUB 5010: INPUT A$: CLS : RETURN 7000 CLS : BEEP .1,24: BEEP .1,20: BEEP .1,16 : PRINT '''" PRESS ""O"" TO TURN"," THE PRINTER OFF. PRESS"," ""ENTER"" TO CONTINUE.": PAUSE 0: LET A$=INKEY$: RETURN 7510 PRINT AT 2,26;"\f \g \h" 7520 PRINT TAB 22;"\d \e \k \l" 7530 PRINT TAB 16;"\a \b \c \j" 7540 PRINT TAB 10;"\f \g \h \i" 7550 PRINT TAB 6;"\d \e \k \l" 7560 PRINT "\a \b \c \j"'"\i" 7570 FOR K=123 TO 147 STEP 6 7580 IF V$(3)<>"H" AND V$(3)<>"L" THEN PLOT 0,K: DRAW 255,0 7581 IF V$(3)="H" THEN PLOT 0,K-18: DRAW 255,0 7583 IF V$(3)="L" THEN PLOT 0,K+12: DRAW 255,0 7585 NEXT K 7588 IF V$(3)="H" THEN PLOT 192,147: DRAW 8,0: PLOT 208,147: DRAW 8,0: PLOT 224,147: DRAW 8,0: PLOT 240,147: DRAW 8,0: PLOT 160,141: DRAW 8,0: PLOT 176,141: DRAW 8,0: PLOT 192,141: DRAW 8,0: PLOT 208,141: DRAW 8,0: PLOT 224,141: DRAW 8,0: PLOT 240,141: DRAW 8,0 7589 IF V$(3)="H" THEN PLOT 128,135: DRAW 8,0: PLOT 144,135: DRAW 8,0: PLOT 160,135: DRAW 8,0: PLOT 176,135: DRAW 8,0: PLOT 192,135: DRAW 8,0: PLOT 208,135: DRAW 8,0: PLOT 224,135: DRAW 8,0: PLOT 240,135: DRAW 8,0 7590 IF V$(3)="L" THEN PLOT 0,123: DRAW 8,0: PLOT 16,123: DRAW 8,0: PLOT 8,0: PLOT 32,123: DRAW 8,0: PLOT 48,123: DRAW 8,0: PLOT 64,123: DRAW 8,0 7592 IF V$(3)="L" THEN PLOT 0,129: DRAW 8,0: PLOT 16,129: DRAW 8,0: PLOT 32,129: DRAW 8,0: PLOT 32,129: DRAW 8,0: PLOT 48,129: DRAW 8,0: PLOT 64,129: DRAW 8,0: PLOT 80,129: DRAW 8,0: PLOT 96,129: DRAW 8,0 7600 IF V$(3)<>"H" OR V$(3)<>"L" THEN PLOT 0,111: DRAW 8,0: PLOT 0,117: DRAW 8,0: PLOT 16,117: DRAW 8,0: PLOT 32,117: DRAW 8,0: PLOT 224,153: DRAW 8,0: PLOT 240,153: DRAW 8,0 7606 IF V$(1)="B" THEN GO TO 7612 7608 IF V$="TCL" THEN PRINT AT 0,0; PAPER 7;"D E F G "; PAPER 5;"A B C D E F G"; PAPER 7;" A B C D E "; PAPER 7;"4 4 4 4 "; PAPER 5;"5 5 5 5 5 5 5"; PAPER 7;" 6 6 6 6 6 " 7609 IF V$="TCH" THEN PRINT AT 0,0; PAPER 5;"G"; PAPER 7;" A B C D E F G "; PAPER 5;"A B C D E F G"; PAPER 7;" A "; PAPER 5;"5"; PAPER 7;" 6 6 6 6 6 6 6 "; PAPER 5;"7 7 7 7 7 7 7"; PAPER 7;" 8 " 7610 IF V$(3)<>"H" AND V$(3)<>"L" THEN PRINT AT 0,0; PAPER 5;"A B C D E F G"; PAPER 7;" A B C D E F G "; PAPER 5;"A B","5 5 5 5 5 5 5"; PAPER 7;" 6 6 6 6 6 6 6 "; PAPER 5;"7 7 " 7611 IF V$(1 TO 2)="TC" THEN PRINT INK 2;AT 2,1;"\m";AT 3,1;"\n treble clef": RETURN 7612 IF V$="BCH" THEN PRINT AT 0,0; PAPER 7;"B C D E F G "; PAPER 5;"A B C D E F G"; PAPER 7;" A B C "; PAPER 7;"4 4 4 4 4 4 "; PAPER 5;"5 5 5 5 5 5 5"; PAPER 7;" 6 6 6 " 7614 IF V$="BCL" THEN PRINT AT 0,0; PAPER 7;"F G "; PAPER 5;"A B C D E F G"; PAPER 7;" A B C D E F G"; PAPER 7;" 2 2 "; PAPER 5;"3 3 3 3 3 3 3"; PAPER 7;" 4 4 4 4 4 4 4 " 7618 IF V$(3)<>"H" AND V$(3)<>"L" THEN PRINT AT 0,0; PAPER 5;"C D E F G"; PAPER 7;" A B C D E F G "; PAPER 5;"A B C D","3 3 3 3 3"; PAPER 7;" 4 4 4 4 4 4 4 "; PAPER 5;"5 5 5 5 " 7620 IF V$(1 TO 2)="BC" THEN PRINT AT 2,1;" "; INK 2;AT 3,1;"\o bass clef ": RETURN 8000 CLS : PRINT PAPER 2; INK 7; FLASH 1;"*********** WARNING ************" 8010 PRINT '''''''"IN THE ""PLAY"" MODE YOU CAN PLAY","OR SAVE THE COMPOSITION, BUT YOUCAN NOT RETURN FROM IT TO THE INPUT MODE OR TO THE EDIT MODE." 8020 PRINT PAPER 7;'''''''" PRESS ""ENTER"" TO RETURN TO THE"," INPUT MODE. ENTER ""PLAY"" TO GO"," TO THE PLAY MODE. " 8030 INPUT A$: IF A$<>"PLAY" AND A$<>"play" THEN LET PP=0: GO TO 383 8040 DELETE 10,248: DELETE 383,400: DELETE 900,8040 8050 ON ERR GO TO 8050: CLS : PRINT AT 6,0;"PRESS ""1"" TO PLAY AGAIN.","PRESS ""2"" TO PLAY DIFFERENTLY.","PRESS ""3"" TO PLAY CONTINUOUSLY.","PRESS ""4"" TO CHANGE TONALITY.","PRESS ""5"" TO SAVE THE MELODY.","PRESS ""6"" TO SAVE COMPOSITION.","PRESS ""7"" TO LPRINT MUSIC DATA.","PRESS ""X"" TO QUIT MUSICIAN ROYAL": PAUSE 0 8060 LET I$=INKEY$: IF CODE I$<49 OR CODE I$>55 THEN IF I$<>"X" AND I$<>"x" THEN GO TO 8050 8064 IF I$="4" THEN GO TO 9990 8065 IF I$="3" THEN LET CC=1: GO TO 310 8066 IF I$="7" THEN GO TO 406 8068 IF I$="X" OR I$="x" THEN GO TO 9799 8070 GO TO (305 AND I$="1")+(258 AND I$="2")+(8080 AND I$="5")+(8120 AND I$="6") 8080 FOR K=1 TO 10: LET S(1,1500+K)=W(K+1): LET S(2,1502+K)=T(K): NEXT K 8090 LET S(2,1501)=QQ: LET S(2,1502)=J-1: SAVE "MELODY" DATA S( ): GO SUB 9000: GO SUB 9250: GO TO 380 8120 LET A$="PLAY": SAVE "MUSIC" LINE 9100: GO SUB 9000: GO SUB 9250: GO TO 8050 9000 BEEP .1,0: RETURN 9100 ON ERR GO TO 1: IF FREE <18000 THEN GO TO 1 9110 PRINT AT 10,9; PAPER 1; INK 7; FLASH 1;"stop the tape": GO SUB 9000: PAUSE 240: CLS : GO TO 1 9200 CLS : PRINT PAPER 5;"********* NOW PLAYING **********" 9210 PRINT AT 10,(31-LEN C$)/2;C$''''''''''' PAPER 5;"********* NOW PLAYING **********": 9212 PRINT PAPER 7;AT 20,0;" PRESS ""ENTER"" TO STOP ": PAPER 6: RETURN 9220 BEEP .1,12: PRINT AT 6,0;"INPUT THE DESIRED DURATION OF","A WHOLE NOTE IN SECONDS FROM","NOTE NO. ";: RETURN 9230 PRINT '''"INPUT THE SEQUENTIAL NUMBER OF THE ";D$;" NOTE FROM WHICH THE",E$;" SHOULD BE PLAYED.": RETURN 9231 PRINT '''"INPUT THE SEQUENTIAL NUMBER OF THE ";D$;" NOTE TO WHICH THE ",E$;" SHOULD BE PLAYED.": RETURN 9250 CLS : PRINT AT 10,9; PAPER 1; INK 7; FLASH 1;"stop the tape": PAUSE 180: RETURN 9799 ON ERR RESET : CLEAR : DELETE 1,9300: DELETE 9990, 9800 CLS : PRINT AT 10,8;"Come back soon!";TAB 4;"I'll be waiting for you.": BEEP .25,21: BEEP .38,23: BEEP .5,19: BEEP .15,21: BEEP .15,21: BEEP .15,21: BEEP .38,23: BEEP .1,21: BEEP .2,21: BEEP .5,19: PAUSE 300: CLS 9801 DELETE 9799,9799: DELETE 9801,9801 9990 CLS : PAPER 5: PRINT AT 6,0;"YOU CAN CHANGE THE TONALITY " 9991 PRINT "OF THE COMPOSITION. ENTER 0 TO " 9992 PRINT "RETAIN THE ORIGINAL TONALITY. " 9993 PRINT "ENTER A POSITIVE NUMBER TO MAKE " 9994 PRINT "THE TONALITY HIGHER. ENTER A " 9995 PRINT "NEGATIVE NUMBER TO MAKE IT " 9996 PRINT "LOWER. EACH UNIT CHANGES THE " 9997 PRINT "TONALITY BY ONE SEMI-TONE. " 9998 INPUT "ENTER THE TONALITY CHANGE ";TON: LET T$=STR$ TON: IF CODE T$<48 AND CODE T$>57 THEN GO SUB 5000: GO TO 9990 9999 PAPER 6: GO TO 305 ```