Pick a Chord
- Type
- Sound
- Category
- Music theory / chord player
- Author
- Karl E. Wiegers
- Published in
- Antic, November 1983 (Vol. 2, No. 8)
- Year
- 1983
- Language
- Atari BASIC
- Requirements
- Any Atari 8-bit, Atari BASIC
About the program
Antic's November 1983 issue was devoted to sound and music. In it Karl Wiegers pointed out that most common chords use only three to five different notes, so the Atari's four voices can play a great many of them. His program lets you hear twelve kinds of chord (major, minor, dominant 7th, major 7th, minor 7th, minor 7th flat 5, diminished 7th, augmented, 9th, minor 9th, 6th and suspended 4th) in any of the twelve keys. Along the way the article gives a short lesson in chord theory. A chord is defined by the intervals between its notes, not by the notes themselves, so the same pattern of positions in the chromatic scale gives a major chord in every key.
What you need
Any Atari with Atari BASIC. The voices play at volume 3 each, so you may need to turn the TV up a little.
Typing it in
Wiegers warned readers to count the spaces in lines 70 and 80 exactly. Each key name takes five characters of MENU1$ and each chord name six characters of MENU2$. If they are wrong the menus look odd and you can get ERROR 5 at line 230. Lines 190–200 are a 20-byte display-list interrupt routine in DATA. A mistake there can lock up the machine, so SAVE before you RUN. {BELL} in lines 300 and 340 is ESC then CTRL-2, as the REMs say. {inv} text is inverse video.
How to use it
Enter the number of a key (1–12) and then a chord type (1–12). The chord's name appears and arrows mark its notes on the chromatic scale down the left of the screen. If only three arrows appear, the fourth voice is doubling the root an octave up. The chord sounds for about two seconds. Then press RETURN for another chord or ESC to quit. Anything other than 1–12 gets a beep and a reminder.
How it works
- Lines 100–130 hold 37 pitch values, three octaves of the chromatic scale from Atari's BASIC Reference Manual.
- Lines 150–170 list four scale positions for each chord. A major chord is 1, 8, 13, 17: root, fifth, octave and the third an octave up. Line 370 adds the key number to each position to transpose it.
- Line 400 plays all four notes as pure tones (distortion 10). Wiegers advised keeping the total volume of all voices under 32 to avoid distortion.
- Lines 250–270 set up a text window in GRAPHICS 0 (
POKE 703,4), set the DLI bit on one display-list instruction and point the DLI vector (512–513) at page 6. The routine turns the lower part of the screen orange with white characters, a change from the green above.
Variations to try
The article lists more chords to put into the DATA, such as 7sus4 = 1,8,11,18; maj9 = 1,5,12,15; 6/9 = 1,5,10,15; min6 = 1,8,10,16. For a "chord organ" that holds each chord until you pick the next, delete lines 420–480 and change line 410 to GOTO 280.
Listing
10 REM ......CHORD PROGRAM......
20 REM ......by Karl E. Wiegers.....
30 REM .....ANTIC MAGAZINE 1983......
40 DIM MENU1$(60),MENU2$(72),PITCH(37),INTS(48),N(4)
50 GRAPHICS 0:SETCOLOR 1,0,0:SETCOLOR 2,12,8:POKE 752,1
60 POSITION 5,2:? "ONE MOMENT, PLEASE...."
70 MENU1$="C C#/DbD D#/EbE F F#/GbG G#/AbA A#/BbB "
80 MENU2$="major minor dom7 maj7 min7 min7b5dim7 aug 9th min9 6th sus4 "
90 FOR I=1 TO 37:READ A:PITCH(I)=A:NEXT I:REM Pitch values for musical notes
100 DATA 243,230,217,204,193,182,173,162,153,144
110 DATA 136,128,121,114,108,102,96,91,85,81
120 DATA 76,72,68,64,60,57,53,50,47,45
130 DATA 42,40,37,35,33,31,29
140 FOR I=1 TO 48:READ A:INTS(I)=A:NEXT I:REM Intervals for different chords
150 DATA 1,8,13,17,1,8,13,16,1,8,11,17,1,8,12,17
160 DATA 1,8,11,16,1,7,11,16,1,7,10,16,1,9,13,17
170 DATA 1,5,11,15,1,4,11,15,1,8,10,17,1,6,8,13
180 FOR I=0 TO 19:READ A:POKE 1536+I,A:NEXT I:REM Display list interrupt
190 DATA 72,138,72,169,14,162,248,141,10,212
200 DATA 141,23,208,142,24,208,104,170,104,64
210 ? CHR$(125):REM Clear the screen
220 POSITION 10,2:? "{inv}KEY{/inv}":POSITION 25,2:? "{inv}CHORD{/inv}"
230 FOR I=1 TO 12:POSITION 8-(I>9),3+I:? I;". ";MENU1$(5*I-4,5*I)
240 POSITION 23-(I>9),3+I:? I;". ";MENU2$(6*I-5,6*I):NEXT I
250 POKE 703,4:REM Set up a text window in this Graphics Mode 0 display
260 POKE (PEEK(560)+256*PEEK(561)+23),130:REM Set DLI on line 18 of display
270 POKE 512,0:POKE 513,6:POKE 54286,192:REM Enable display list interrupt
280 TRAP 300:? "Enter a Key: ";:INPUT KEY
290 IF KEY>0 AND KEY<13 THEN TRAP 40000:GOTO 310
300 ? "{BELL}{inv}ENTER A NUMBER FROM 1-12{/inv}":? :GOTO 280:REM ESC CTRL-2 FOR {BELL}
310 POSITION 14,18:? #6;MENU1$(5*KEY-4,5*KEY)
320 TRAP 340:? "Enter a Chord: ";:INPUT CHORD
330 IF CHORD>0 AND CHORD<13 THEN TRAP 40000:GOTO 350
340 ? "{BELL}{inv}ENTER A NUMBER FROM 1-12{/inv}":? :GOTO 320:REM ESC CTRL-2 FOR {BELL}
350 POSITION 20,18:? #6;MENU2$(6*CHORD-5,6*CHORD)
360 FOR I=4 TO 15:POSITION 6,I:? #6;" ":NEXT I
370 FOR I=1 TO 4:A=INTS((CHORD-1)*4+I)+KEY-1:N(I)=PITCH(A):REM Choose notes
380 POSITION 6,3+A-12*(A>12)-12*(A>24):? #6;CHR$(159):REM Draw arrows
390 NEXT I
400 FOR I=0 TO 3:SOUND I,N(I+1),10,3:NEXT I:REM Here is the chord
410 FOR I=1 TO 400:NEXT I:REM Play chord for about 2 seconds
420 FOR I=0 TO 3:SOUND I,0,0,0:NEXT I:REM Turn off sound channels
430 ? :? "PRESS {inv}RETURN{/inv} TO GO ON, {inv}ESC{/inv} TO QUIT"
440 OPEN #1,4,0,"K:"
450 GET #1,A:IF A=27 THEN 480
460 IF A<>155 THEN 450
470 CLOSE #1:? :GOTO 280
480 GRAPHICS 0:END
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: CHORDS.BAS.
Credits
- Program listing: Pick a Chord — program listing (Antic, November 1983 (Vol. 2, No. 8)) — Karl E. Wiegers
- Picture: The two menus. The DLI gives the text window its own colours; here the program is rejecting a mistyped chord number. — Karl E. Wiegers (program); screenshot by the site
- Antic article text (November 1983 - Vol. 2 No. 8) — Pick a Chord, music program — Karl E. Wiegers, 1983
- Antic Software Archive — disk files (November 1983 - Vol. 2 No. 8): CHORDS.BAS — AtariMagazines.com (Kevin Savetz), 1983
