#BBC BASIC, 332- 150 keyboard - 150 playing = 32#
Emulator at bbcbasic.co.uk
A$="C#D#EF#G#A#B0Mm+":X$=GET$:R=INSTR(A$,X$)-1:X$=GET$:IF X$="#"R=R+1:X$=GET$
C=INSTR(A$,X$):T=(R+4-C MOD2)MOD12:F=(R+C DIV2)MOD12:V=1:PRINT"______"
FORN=0 TO 11
C=1-(N=4)*12:B$=MID$(A$,N+1,1): IF B$="#" C=7: B$=MID$(A$,N,1)+B$
PRINT MID$(" __---|________",C,6);:IF(R-N)*(T-N)*(F-N)=0 PRINT B$;:SOUND V,-15,100+N*4,99:V=V+1
PRINT
NEXT
This is a similar concept to my Arduino answer, but I always new I could beat that byte count with BBC basic. Only recognises sharps, but considers B# invalid,you must put C. This could be fixed if it was really considered important.
I abandoned the idea of guitar and concentrated on improving the keyboard. It now runs from C to B, and I've added in the left side of the keyboard and the line between E and F. That costs 28 characters. The right hand side wouldn't be much more.
Here's some sample output, an A# diminished chord (which has a pretty freaky sound in this inversion) and a B major chord. Note that the input is not echoed to the screen. As per the Arduino answer, turn the screen anticlockwise to view.
![enter image description here][1]
**Ungolfed version**
A$="C#D#EF#G#A#B0Mm+" :REM Note names and chord type names fit very conveniently in the same string.
X$=GET$ :REM Get a character
R=INSTR(A$,X$)-1 :REM Root note = position of that char in A$. INSTR starts counting at 1, but we want 0, so subtract.
X$=GET$ :REM If the root note is natural, the next character will be the chord type. But...
IF X$="#"R=R+1:X$=GET$ :REM If this char is # we need to increment the root, and get another char for chord type.
C=INSTR(A$,X$) :REM C encodes for chord type
T=(R+4-C MOD2)MOD12 :REM even C=major third, odd C=minor third
F=(R+C DIV2)MOD12 :REM "Mm" gives C=14,15 means C DIV2=7 (perfect fifth.) C=13,16 give diminished and augmented: 6,8.
V=1 :REM V is the sound channel number ("voice")
PRINT"______" :REM left side of keyboard for cosmetic reasons
FORN=0 TO 11 :REM at the start of each iteration initialise C to 1, to point to the 4 spaces/2 underscores in the string below for drawing white notes.
C=1-(N=4)*12 :REM if the note is E, add 12 so it points to the 6 underscores to draw the line between E and F.
B$=MID$(A$,N+1,1) :REM load B$ with the name of the current note.
IF B$="#" C=7: B$=MID$(A$,N,1)+B$ :REM if the character encountered is a sharp, update C to point the characters for drawing a sharp. Find the previous character in A$ and join it to the beginning of B$ to complete the note name.
PRINT MID$(" __---|________",C,6); :REM print the key.
IF(R-N)*(T-N)*(F-N)=0 PRINT B$;:SOUND V,-15,100+N*4,99:V=V+1 :REM if N is equal to R,T or F, print the note name beside the key, play the note and increment the channel number.
PRINT :REM print a carriage return. It may be possible to golf this line out.
NEXT
[1]: https://i.sstatic.net/8g9ur.png