REM
REM Piano application with the BEEP include file
REM
REM PvE - GPL - July 2009.
REM
REM ------------------------------------------------------------------------

REM Get the BEEP include file
INCLUDE "beep.bac"

REM Declare some arrays
GLOBAL notes[10]
GLOBAL keys[10]

REM Read notes and keyboard values
FOR i = 0 TO 7
    READ dat
    notes[i] = dat
    READ dat
    keys[i] = dat
NEXT

REM Explain to user
PRINT "Press Q W E R T Y U I to play the piano! ESC to quit."

REM Play piano until ESC key is pressed
REPEAT
    c = GETKEY
    FOR i = 0 TO 7
        IF keys[i] EQ c THEN
            BEEP(notes[i], 100)
            BREAK
        END IF
    NEXT
UNTIL c EQ 27

REM Contains note and keyvalue pairs
DATA 523, 113, 587, 119, 659, 101, 698, 114, 784, 116, 880, 121, 988, 117, 1046, 105