Music Flash Cards

Type
Education
Category
Music-reading drill (note names on the staff)
Author
James W. Brown
Published in
Antic, February 1985 (Vol. 3, No. 10), Education
Year
1985
Language
Atari BASIC
Requirements
Any Atari 8-bit, Atari BASIC
A blue screen with two five-line staves in green, a treble clef on the upper and a bass clef on the lower, and the text NOTE IS D below

About the program

James W. Brown wrote Music Flash Cards "when my daughter started taking piano lessons". A computer, he argued, can present drill "in a more interesting way than most human 'drill instructors'" and it "never gets bored or impatient". Brown supervised the Database System Engineering Group at Caltech's Jet Propulsion Laboratory and was librarian of the JPL Atari Computer Enthusiasts user group.

The program draws a note on the musical staff and the student presses the letter of its name. A right answer is rewarded by hearing the note played. The score runs from the high 90s for someone who really knows the notes down to zero for someone who isn't paying attention.

Typing it in

The title screen is a "marquee" built from asterisks, inverse characters and {CTRL-J} characters (hold CTRL and press J) in lines 123–127. Its colours rotate while a tune plays. {inv}…{/inv} means press the Atari key before and after, and {CLEAR} is ESC then SHIFT-CLEAR. The rest is plain. The magazine printed TYPO codes.

How to use it

Type RUN and answer the setup questions, pressing RETURN after each:

  1. How many notes the drill should have.
  2. G for the treble clef only, F for the bass clef only, or S for the whole staff, so a student can concentrate on whatever their lessons cover.

Then notes appear one at a time. Press the key for the note's name (A–G). There's no need for RETURN here. A countdown runs while you think. A wrong key gives a buzz, and after three wrong tries, or when the time runs out, the program shows the right answer. At the end you get your average score, and the program encourages you to beat it next time.

How it works

  • Three parallel tables in lines 1000–1020 hold, for each of the 23 staff positions, the SOUND pitch value, the note's letter and the keyboard code for that letter.
  • Reading keys quickly. Instead of GET, the timing loop (lines 420–450) watches location 764, which holds the code of the last key pressed (255 when none). It compares that with the stored code, so the countdown keeps running while the student thinks. POKE 702,64 (SHFLOK) sets the keyboard to capitals so the letters match.
  • Score. The time left on the countdown is added for each right answer (line 475), and the total is averaged over the number of notes (line 491).
  • Brown noted that the Atari's ordinary sound voices aren't exactly in tune. If you want to teach pitch too, he suggested coupling two voices for more precise tones.

Variations to try

DEL and MAXTIM in line 250 set the speed of the countdown. Raise them for younger children.

Listing

10 REM MUSIC FLASHCARDS
20 REM BY JAMES W. BROWN
30 REM ANTIC MAGAZINE
100 DIM INOTE(23),CNOTE$(23),KCODE(23)
110 DIM N$(1),RNG$(1)
115 REM TITLE SCREEN
120 GRAPHICS 1
121 SETCOLOR 0,4,6:SETCOLOR 1,8,6:SETCOLOR 2,0,12:SETCOLOR 3,12,6
123 POSITION 0,1:? #6;"*{CTRL-J}{inv}*{CTRL-J}{/inv}*{CTRL-J}{inv}*{CTRL-J}{/inv}*{CTRL-J}{inv}*{CTRL-J}{/inv}*{CTRL-J}{inv}*{CTRL-J}{/inv}*{CTRL-J}{inv}*{CTRL-J}{/inv}"
124 POSITION 0,2:? #6;"{inv}{CTRL-J}{/inv}                  *"
125 POSITION 0,3:? #6;"{inv}*{/inv} Mu{inv}Si{/inv}C f{inv}La{/inv}Sh{inv}Ca{/inv}Rd{inv}S{/inv} {CTRL-J}"
127 POSITION 0,4:? #6;"{CTRL-J}                  {inv}*{/inv}"
130 POSITION 0,5:? #6;"*        {inv}b{/inv}Y        {inv}{CTRL-J}{/inv}"
132 POSITION 0,6:? #6;"{inv}{CTRL-J}{/inv}                  *"
135 POSITION 0,7:? #6;"{inv}*{/inv}  Ja{inv}Me{/inv}S w. Br{inv}Ow{/inv}N  {CTRL-J}"
137 POSITION 0,8:? #6;"{CTRL-J}                  {inv}*{/inv}"
140 POSITION 0,9:? #6;"*       1{CTRL-Y}{inv}8{CTRL-S}{/inv}       {inv}{CTRL-J}{/inv}"
141 REM ASTER,7 SPACES,CTRL-Y,INV 8,INV-CTRL-S,7 SPACES,INV-CTRL-J
142 POSITION 0,10:? #6;"{inv}{CTRL-J}{/inv}                  *"
144 POSITION 0,11:? #6;"{inv}*{/inv}                  {CTRL-J}"
145 POSITION 0,12:? #6;"{inv}*{/inv}{CTRL-J}*{inv}{CTRL-J}*{/inv}{CTRL-J}*{inv}{CTRL-J}*{/inv}{CTRL-J}*{inv}{CTRL-J}*{/inv}{CTRL-J}*{inv}{CTRL-J}*{/inv}{CTRL-J}*{inv}{CTRL-J}{/inv}"
200 REM SET UP NOTE VALUES
205 RESTORE 1000
210 FOR I=1 TO 23
215 READ N:INOTE(I)=N:NEXT I
220 FOR I=1 TO 23
225 READ N$:CNOTE$(I,I)=N$:NEXT I
230 FOR I=1 TO 23
235 READ N:KCODE(I)=N:NEXT I
236 FOR J=23 TO 1 STEP -1:SOUND 0,INOTE(J),10,8:FOR D=1 TO 50:NEXT D:GOSUB 500:NEXT J
238 FOR J=1 TO 21:SOUND 0,INOTE(J),10,8:FOR D=1 TO 50:NEXT D:GOSUB 500:NEXT J
240 CH=764:REM KEYCODE BUFFER
245 CRSINH=752:SHFLOK=702:OLDSCOR=-1
249 REM START MAIN LOOP
250 DEL=50:MAXTIM=100:SCORE=0
255 POKE CRSINH,1
260 ? "How many notes do you want";:GOSUB 1500
265 TRAP 1265:INPUT NRNDS:TRAP 40000
267 IF NRNDS<1 THEN 260
269 GRAPHICS 0:POKE SHFLOK,64
270 ? :? "Enter {inv} G {/inv} for treble (G clef) only."
275 ? :? "Enter {inv} F {/inv} for bass (F clef) only."
277 ? :? "Enter {inv} S {/inv} for whole staff."
280 GOSUB 1500:TRAP 1280:INPUT RNG$:TRAP 40000
285 IF RNG$<>"S" AND RNG$<>"F" AND RNG$<>"G" THEN 270
299 REM DRAW STAFF
300 GRAPHICS 7:COLOR 1
301 SETCOLOR 0,10,8:REM STAFF
302 SETCOLOR 1,7,10:REM NOTE (AND TEXT LUMINANCE)
303 SETCOLOR 2,8,2:REM TEXT WINDOW
304 SETCOLOR 4,8,2:REM BACKGROUND
305 FOR CLEF=1 TO 2
310 FOR LINE=1 TO 5
315 Y=6*LINE+36*CLEF-32
320 PLOT 1,Y:DRAWTO 159,Y
325 NEXT LINE
327 NEXT CLEF
330 RESTORE 1050:READ X,Y:PLOT X,Y
340 FOR POINT=1 TO 14
345 READ X,Y:DRAWTO X,Y
350 NEXT POINT
360 RESTORE 1060:READ X,Y:PLOT X,Y
365 FOR POINT=1 TO 14
370 READ X,Y:DRAWTO X,Y
375 NEXT POINT
380 PLOT 28,49:PLOT 28,55
385 POKE CRSINH,1
400 FOR ROUND=1 TO NRNDS
402 REM PICK A NOTE AND SHOW IT
405 N=1+INT(RND(0)*23):SOUND 0,0,0,0
406 IF RNG$="F" AND N<14 THEN 405
407 IF RNG$="G" AND N>13 THEN 405
410 GOSUB 900:REM DRAW IT
412 WRONG=0
413 REM WAIT FOR KEYPRESS
415 ITIM=MAXTIM
420 ITIM=ITIM-1:FOR D=1 TO DEL:NEXT D
422 IF ITIM<1 THEN 440
425 ? "{CLEAR}";ITIM,"NOTE? ":GOSUB 1500
430 IF PEEK(CH)=255 THEN 420
435 IF PEEK(CH)=KCODE(N) THEN 460
437 REM WRONG - BUZZ
439 WRONG=WRONG+1
440 SOUND 0,85,12,8:POKE CH,255
445 FOR D=1 TO DEL:NEXT D:SOUND 0,0,0,0
446 IF WRONG>2 THEN ITIM=0
447 IF ITIM<1 THEN 465
450 GOTO 420
459 REM RIGHT - PLAY THE NOTE
460 SOUND 0,INOTE(N),10,8
461 NN=INOTE(N):IF NN=0 THEN NN=254
462 SOUND 0,NN,10,8
464 REM RIGHT OR TIMEOUT -- SHOW IT
465 ? "{CLEAR}";ITIM,"NOTE IS ";CNOTE$(N,N)
470 FOR D=1 TO DEL*4:NEXT D:POKE CH,255
475 GOSUB 800:SCORE=SCORE+ITIM
480 NEXT ROUND
489 REM WRAP-UP
490 SOUND 0,0,0,0:GRAPHICS 0
491 SCORE=INT(SCORE/NRNDS)
492 ? :? :? :? :? "         SCORE = ";SCORE:? :? :? :REM 9 SPACES
493 IF SCORE>OLDSCOR AND OLDSCOR>=0 THEN ? "       THAT'S BETTER!"
494 IF SCORE<OLDSCOR AND OLDSCOR>=0 THEN ? "  YOU'RE NOT CONCENTRATING."
495 ? :? :? :? :? :? "  To play again, enter {inv} Y {/inv} {inv} RETURN {/inv}":OLDSCOR=SCORE
496 INPUT RNG$:IF RNG$="Y" THEN 250
497 ? "{CLEAR}":? :? :? :? :? :? "  Next stop:  The Lincoln Center!":? :? :? :?
499 END
500 REM ROTATE COLORS ON TITLE SCREEN
505 TEMP=PEEK(711)
510 FOR COLREG=2 TO 0 STEP -1:POKE COLREG+709,PEEK(COLREG+708):NEXT COLREG
515 POKE 708,TEMP
520 RETURN
700 REM DRAW LINE
720 PLOT X-2,Y:DRAWTO X+6,Y
799 RETURN
800 REM UNDRAW NOTE
820 COLOR 0:REM BACKGROUND
830 PLOT X,Y-2
840 DRAWTO X+4,Y-2:DRAWTO X+5,Y-1
845 DRAWTO X+5,Y+1:DRAWTO X+4,Y+2
850 DRAWTO X,Y+2:DRAWTO X-1,Y+1:DRAWTO X-1,Y-1:DRAWTO X,Y-2
855 IF N<>1 AND N<>13 THEN COLOR 1
860 IF N<>2*INT(N/2) THEN GOSUB 700
899 RETURN
900 REM DRAW NOTE
910 X=40+INT(RND(0)*80):Y=3*N+1
920 COLOR 2
930 PLOT X,Y-2
940 DRAWTO X+4,Y-2:DRAWTO X+5,Y-1
945 DRAWTO X+5,Y+1:DRAWTO X+4,Y+2
950 DRAWTO X,Y+2:DRAWTO X-1,Y+1:DRAWTO X-1,Y-1:DRAWTO X,Y-2
955 COLOR 1
960 IF N=1 OR N=13 THEN GOSUB 700
999 RETURN
1000 DATA 35,40,45,47,53,60,64,72,81,91,96,108,121,128,144,162,182,193,217,243,0,0,0
1010 DATA A,G,F,E,D,C,B,A,G,F,E,D,C,B,A,G,F,E,D,C,B,A,G
1020 DATA 63,61,56,42,58,18,21,63,61,56,42,58,18,21,63,61,56,42,58,18,21,63,61
1050 DATA 20,40,20,4,26,7,26,13
1051 DATA 20,16,14,19,8,22,8,28
1052 DATA 14,32,20,34,26,32,30,28
1053 DATA 26,24,20,22,17,24
1060 DATA 10,51,10,53,8,53,8,50
1061 DATA 12,48,17,46,22,48,26,52
1062 DATA 26,56,24,60,22,62,17,64
1063 DATA 15,65,12,66,8,67
1200 REM INPUT ERROR TRAPS
1265 ? "{inv} Please enter a number. {/inv}":GOTO 260
1280 ? "{inv} Please enter a single letter. {/inv}":GOTO 270
1500 DSBL=PEEK(16)-128:IF DSBL<0 THEN RETURN
1510 POKE 16,DSBL:POKE 53774,DSBL:RETURN

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: MUSFLASH.BAS.

Credits