Banjo Picker

Type
Sound
Category
Interactive music (bluegrass banjo)
Author
R. K. Lindgren
Published in
Antic, October 1985 (Vol. 4, No. 6)
Year
1985
Language
Atari BASIC (with a 16-byte machine-language routine)
Requirements
Any Atari 8-bit computer, any memory size, Atari BASIC
Banjo Picker screen: a diagram of the five-string banjo neck, instructions for OPTION, SELECT and START, and the keyboard layout of chords and pick patterns

About the program

"Play bluegrass music like a bionic Earl Scruggs!" promised Antic's October 1985 article (or "at least Steve Martin"). R. K. Lindgren's Banjo Picker imitates a five-string banjo rolling through picking patterns. All you do is press keys: one for the chord, one for the picking pattern. It plays 11 different eight-note patterns over 13 chords, and a bouncing marker on a picture of the banjo neck follows each string as it is plucked.

Typing it in

Most of the program is DATA (tunings, chords, patterns and a short machine-language routine). The screen text has inverse-video key labels: {inv} … {/inv} means press the Atari (inverse) key before and after. The REM in line 560 is there for a reason. Don't forget the semicolon at the end of that line, or the screen layout scrolls. Antic printed TYPO II checksums beside each line of the magazine listing. They are not part of the program.

How to play

RUN it and wait for "Tuning, please wait" to finish. Press START to start and stop playing. It begins on a G chord with pattern 1. OPTION speeds up the picking and SELECT slows it down.

  • Chords are laid out "autoharp style" in the left four columns of the keyboard, with four rows of four keys. Each row holds the four related chords of one key: subdominant, tonic, dominant seventh and relative minor. The top row (1–4) is the key of C (F, C, G7, Am), the next row is G (the bluegrass favourite), then D and A.
  • Picking patterns are on the right: 7, 8, 9, 0, then U, I, O, P, then J, K, L.

Lindgren's tip: rest your middle finger on W (the G chord), with the first and third fingers on E and Q. Bring the speed up with OPTION and accompany "Comin' Round the Mountain" with just those three keys. Each pattern is eight notes long, so change chords as the eighth note plays, and press the chord key slightly before the pattern key.

How it works

The banjo sound comes from overlapping decay. Each new note goes to the next of the four POKEY voices at volume 7, while the three older notes drop to volumes 4, 2 and 1. These are the AUDC values C1=167, C2=164, C3=162 and C4=161, which is pure tone (160) plus the volume. By the time the fifth string is plucked, the first has faded out and its voice is reused. Lines 80–110 rotate the voices. The 16-byte routine in SIMUL$ writes all four frequency/volume pairs in one go, so the notes change together without BASIC's delay between SOUND statements.

The keyboard is read through location 764. The array KB() maps each internal key code to a chord (positive) or a pattern (negative), so one PEEK and one array lookup handle every key (lines 180–240). The banjo's character comes from the short fifth "drone" string, tuned higher than the others.

Listing

10 REM BANJO PICKER
20 REM BY R.K.LINDGREN
30 REM (c) 1985, ANTIC PUBLISHING
40 DIM SC(22),PK(11,8),PL(13,5),SIMUL$(16),A$(30),CN$(39),KB(63)
50 GOTO 320
60 REM PICK ROUTINE
70 PS=PK(PP,I):N=PL(P,PS):ST1=ST-40*PS:POKE ST1,96:ON J GOTO 80,90,100,110
80 F1=N:X=USR(U,F1,C1,F4,C2,F3,C3,F2,C4):GOTO 120
90 F2=N:X=USR(U,F2,C1,F1,C2,F4,C3,F3,C4):GOTO 120
100 F3=N:X=USR(U,F3,C1,F2,C2,F1,C3,F4,C4):GOTO 120
110 F4=N:X=USR(U,F4,C1,F3,C2,F2,C3,F1,C4)
120 J=J+1:IF J>4 THEN J=1
130 I=I+1:IF I>PN THEN I=1
140 FOR X=1 TO W:NEXT X
150 IF PEEK(SKEY)<>7 THEN 270
160 REM START KEY, CHECK KEYBOARD
170 POKE ST1,0
180 X=PEEK(764):IF X=LST THEN 70
190 IF X>63 THEN X=LST:GOTO 70
200 Q=KB(X)
210 REM NEW CHORD
220 IF Q>0 THEN LST=X:P=Q:P2=P*3:P1=P2-2:POSITION 14,0:? CN$(P1,P2):GOTO 180
230 REM NEW PICK PATTERN
240 IF Q<0 THEN LST=X:PP=-Q:POSITION 27,0:? PP;" ":GOTO 180
250 GOTO 70
260 REM CHECK OPTION & SELECT
270 IF PEEK(SKEY)=3 THEN W=INT(W/2)+1:GOTO 170
280 IF PEEK(SKEY)=5 THEN W=W+5:GOTO 170
290 IF PEEK(SKEY)=6 THEN FOR II=0 TO 3:SOUND II,0,0,0:NEXT II:POKE ST1,0:GOTO 640
300 GOTO 170
310 REM INITIALIZATION
320 GRAPHICS 0:POKE 752,1:? "     (Tuning, please wait)"
330 POKE 710,4:POKE 712,4:POKE 709,2
340 POSITION 6,2:POKE 82,6
350 FOR I=1 TO 7:READ A$:? A$(2):NEXT I
360 ? :? "PRESS {inv}OPTION{/inv} TO SPEED UP":? "PRESS {inv}SELECT{/inv} TO SLOW DOWN"
370 ? "PRESS {inv}START {/inv} TO START & STOP"
380 REM READ SOUND POKE ROUTINE
390 FOR I=1 TO 16:READ X:SIMUL$(I)=CHR$(X):NEXT I
400 REM READ SOUND PARAMETERS
410 FOR I=1 TO 22:READ X:SC(I)=X:NEXT I
420 FOR I=1 TO 63:KB(I)=0:NEXT I
430 REM READ CHORDS
440 CN$=" ":CN$(39)=" ":CN$(2)=CN$:READ CC
450 FOR I=1 TO CC:READ X:KB(X)=I:FOR J=1 TO 5:READ X:PL(I,J)=SC(X):NEXT J:READ A$
460 P1=I*3-2:CN$(P1,P1+LEN(A$)-1)=A$:NEXT I
470 KB(47)=2:KB(63)=5:KB(23)=8
480 REM READ PICK PATTERNS
490 READ PP:FOR I=1 TO PP:READ X:KB(X)=-I:FOR J=1 TO 8:READ X:PK(I,J)=X:NEXT J:NEXT I
500 REM DISPLAY CHORD NAMES
510 POKE 82,2:? :? "   {inv}CHORDS:{/inv}         {inv}PICK PATTERNS:{/inv}"
520 POKE 710,14:POKE 712,14
530 ? :? "{inv}1{/inv}  {inv}2{/inv}  {inv}3{/inv}  {inv}4{/inv}         {inv}7{/inv}  {inv}8{/inv}  {inv}9{/inv}  {inv}0{/inv}"
540 ? CN$(1,12):? "                    {inv}U{/inv}  {inv}I{/inv}  {inv}O{/inv}  {inv}P{/inv}":? " ";CN$(4,6);CN$(13,21)
550 ? "                     {inv}J{/inv}  {inv}K{/inv}  {inv}L{/inv}":? "  ";CN$(13,15);CN$(22,30)
560 ? :? "   ";CN$(22,24);CN$(31,39);:REM DON'T FORGET THIS SEMI-COLON
570 C1=167:C2=164:C3=162:C4=161
580 P=5:PP=1:W=100
590 P2=P*3:P1=P2-2:PN=8
600 U=ADR(SIMUL$):F1=0:F2=0:F3=0:F4=0:LST=255:SKEY=53279
610 POSITION 7,0:? "{inv}CHORD:{/inv} ";CN$(P1,P2);" {inv}PATTERN:{/inv} ";PP
620 ST=PEEK(560)+256*PEEK(561)+356
630 REM WAIT FOR START KEY OFF THEN ON
640 IF PEEK(SKEY)<>7 THEN 640
650 IF PEEK(SKEY)<>6 THEN 650
660 FOR X=1 TO 25:NEXT X
670 POKE SKEY,8
680 I=1:J=1:GOTO 70
690 DATA "     {CTRL-.}
700 DATA "{CTRL-W}{CTRL-R}{CTRL-W}{CTRL-R}{CTRL-W}{CTRL-C}        {CTRL-.}  {CTRL-.}
710 DATA "{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-W}{CTRL-R}{CTRL-W}{CTRL-R}{CTRL-W}{CTRL-R}{CTRL-W}{CTRL-R}{CTRL-X}{CTRL-R}{CTRL-R}{CTRL-X}{CTRL-R}{CTRL-E}
720 DATA "{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-D}Banjo |
730 DATA "{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-S}{CTRL-R}{CTRL-D}Picker|
740 DATA "{CTRL-X}{CTRL-R}{CTRL-X}{CTRL-R}{CTRL-X}{CTRL-R}{CTRL-X}{CTRL-R}{CTRL-X}{CTRL-R}{CTRL-X}{CTRL-R}{CTRL-X}{CTRL-R}{CTRL-W}{CTRL-R}{CTRL-R}{CTRL-W}{CTRL-R}{CTRL-C}
750 DATA "              {CTRL-.}  {CTRL-.}
760 REM SOUND POKE ROUTINE
770 DATA 104,133,203,162,0,104,104,157,0,210,232,228,203,208,246,96
780 REM SOUND FREQ. VALUES
790 DATA 243,230,217,204,193,182,173
800 DATA 162,153,144,136,128,121,114,108,102,96,91,85,81,76,72
810 REM CHORD DATA
820 DATA 13
830 DATA 31,18,13,10,6,20,F
840 DATA 30,17,13,8,5,20,C
850 DATA 26,18,12,8,3,20,G7
860 DATA 24,17,13,10,5,20,Am
870 DATA 46,15,12,8,3,20,G
880 DATA 42,15,13,10,3,20,D7
890 DATA 40,17,12,8,5,20,Em
900 DATA 62,19,15,10,7,20,D
910 DATA 58,17,14,10,5,20,A7
920 DATA 56,19,15,12,7,22,Bm
930 DATA 22,17,14,10,5,22,A
940 DATA 18,17,15,12,5,22,E7
950 DATA 16,19,14,10,7,22,F#m
960 REM PICK PATTERNS
970 DATA 11
980 DATA 51,3,2,5,1,4,2,5,1
990 DATA 53,3,2,1,5,1,2,3,1
1000 DATA 48,3,1,5,3,1,3,4,1
1010 DATA 50,3,2,1,5,3,1,5,1
1020 DATA 11,3,1,5,3,1,5,3,1
1030 DATA 13,2,1,2,1,5,2,1,5
1040 DATA 8,1,2,3,1,5,2,1,5
1050 DATA 10,1,2,5,1,2,5,2,1
1060 DATA 1,1,2,1,5,1,2,1,5
1070 DATA 5,3,5,3,1,5,3,1,5
1080 DATA 0,2,3,2,1,2,3,2,1

Download

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

Credits