' Music Keys
' By, Richard Copeland 1993-95


' Music Keys was created by Richard Copeland 1993

' To run Music Key Press Shift+F5

' subs (2) total

DECLARE SUB Notes ()
DECLARE SUB Menu (KeyChoice$)

' ** Keys **

' Main Program

Start:
   CLS
    COLOR 7, 0
  DO
    CALL Menu(KeyChoice$)
 SELECT CASE KeyChoice$
    CASE "A"
      PLAY "A"
    CASE "S"
      PLAY "B"
    CASE "D"
      PLAY "C"
    CASE "F"
      PLAY "D"
    CASE "J"
      PLAY "E"
    CASE "K"
      PLAY "F"
    CASE "L"
      PLAY "G"
    CASE "Q"
      PLAY "A#"
    CASE "W"
      PLAY "D#"
    CASE "E"
      PLAY "C#"
    CASE "R"
      PLAY "D#"
    CASE "U"
      PLAY "C#"
    CASE "I"
      PLAY "F#"
    CASE "O"
      PLAY "G#"
    CASE "."
      PLAY "o1>": PRINT "Octave > "
    CASE ","
      PLAY "o6<": PRINT "Octave < "
    CASE ">"
      PLAY "o1>": PRINT "Octave > "
    CASE "<"
      PLAY "o6<": PRINT "Octave < "
    CASE "M"
      PLAY "MF": LOCATE 20, 1: PRINT "Music in Foreground"
    CASE "B"
      PLAY "MB": LOCATE 20, 1: PRINT "Music in Background"
    CASE "1"
      PLAY "ML": LOCATE 21, 1: PRINT "Music in legato    "
    CASE "2"
      PLAY "MN": LOCATE 21, 1: PRINT "Music in normal    "
    CASE "3"
      PLAY "MS": LOCATE 21, 1: PRINT "Music in staccato  "
    CASE "4"
      Notes
    CASE "5"
      ON ERROR GOTO 1000
       CHAIN "WorkFile\C29Play5"
    CASE "6"
      GOTO Loadingp
    CASE "0"
      PRINT "Quit"
  PRINT "Please Wait...": CHAIN "MoneyCga" 'Load Program Manager
    CASE ELSE
     LOCATE 23, 1: PRINT "An incorrect letter": SLEEP 1 ' Error message
 LOCATE 23, 1: PRINT "                   "
   
    END SELECT

LOOP


Loadingp:

ON ERROR GOTO 1000

OPEN "list.dat" FOR INPUT AS #1
    CLS
     PRINT "Entries in file:": PRINT

 DO WHILE NOT EOF(1)
    LINE INPUT #1, b$
    PRINT
    PRINT "* "; b$; " *"
LOOP
  CLOSE #1

    PRINT
 INPUT "Print the song"; c$
IF c$ = "Y" OR c$ = "y" THEN LPRINT b$ ELSE GOTO Start
                                                   
GOTO Start

1000 PRINT "There Is no Files Found": SLEEP 1
CHAIN "WorkFile/Music"
1001 PRINT "Not a valid music key!"
RESUME NEXT

GOTO Start

SUB Menu (KeyChoice$)

  LOCATE 1, 33: PRINT CHR$(14); " M U S I C  K E Y S "; CHR$(14);
  LOCATE 23, 33: PRINT "Enter Keys: "
  LOCATE 2, 1: PRINT "How to use Music Keys:"
  LOCATE 3, 1: PRINT "To play a note use keys (A-F) and (J-L)"
  LOCATE 4, 1: PRINT "Keys A-F will play notes (A-D)"
  LOCATE 5, 1: PRINT "Keys J-L will play notes (E-G)"
  LOCATE 6, 1: PRINT "To play sharp notes use keys (Q-R) (U-O)"
  PRINT
  LOCATE 8, 1: PRINT "To set the Octave use (`<' for Treble / `>' for Base)"
  LOCATE 9, 1: PRINT "(M) key Plays music in Foreground"
  LOCATE 10, 1: PRINT "(B) key Plays music in Background"
  LOCATE 11, 1: PRINT "(1) key Sets music legato"
  LOCATE 12, 1: PRINT "(2) key Sets music normal"
  LOCATE 13, 1: PRINT "(3) key Sets music staccato"
  LOCATE 14, 1: PRINT "(4) key Lets you write the notes before playing them"
  LOCATE 15, 1: PRINT "(5) key will let you play the demo songs"
  LOCATE 16, 1: PRINT "(6) key will let you see your saved Song(s)"
  LOCATE 17, 1: PRINT "(0) = Quit"
  LOCATE 18, 1: PRINT "To set the proper note status for this screen use option 4."
  KeyChoice$ = UCASE$(INPUT$(1))
  IF INSTR("ASDFJKL<>MB123456E", KeyChoice$) = 0 THEN EXIT SUB
END SUB

SUB Notes

10
1 CLS : LOCATE 25, 1: PRINT "("; a$; ")"

LOCATE 1, 10: PRINT "    W R I T I N G  Y O U R  O W N  M U S I C  L I N E S     ": COLOR 11
LOCATE 2, 5: PRINT " Octave and tone commnds:                                               "
LOCATE 3, 5: PRINT " (O)octave Sets the current octave (0 - 6)                              "
LOCATE 4, 5: PRINT " < or >    Moves up or down one octave.                                 "
LOCATE 5, 5: PRINT " A - G     Plays the specified note in the current octave.              "
LOCATE 6, 5: PRINT " (N)note   Plays a specified note (0 - 84) in the seven-octave          "
LOCATE 7, 5: PRINT "           range  (0 is a rest).                                        "
LOCATE 8, 5: PRINT " Duration and tempo commands:                                           "
LOCATE 9, 5: PRINT " (L)length    Sets the length of each note (1 - 64).  L1 is whole note, "
LOCATE 10, 5: PRINT "              L2 is a half note, etc.                                   "
LOCATE 11, 5: PRINT " ML           Sets music legato.                                        "
LOCATE 12, 5: PRINT " MN           Sets music normal.                                        "
LOCATE 13, 5: PRINT " MS           Sets music staccato.                                      "
LOCATE 14, 5: PRINT " (P)pause     Specifies a pause (1 - 64).  P1 is a whole-note pause,    "
LOCATE 15, 5: PRINT "              P2 is a half-note pause, etc.                             "
LOCATE 16, 5: PRINT " (T)tempo     Sets the tempo in quarter notes per minut (32 - 255).     "
LOCATE 17, 5: PRINT " Mode commands:                                                         "
LOCATE 18, 5: PRINT " MF        Plays music in foreground.                                   "
LOCATE 19, 5: PRINT " MB        Plays music in background.                                   "
LOCATE 20, 5: PRINT " Suffix commands:                                                       "
LOCATE 21, 5: PRINT " # or +    Turns preceding note into a sharp.                           "
LOCATE 22, 5: PRINT " -         Turns preceding note into a flat.                            "
LOCATE 23, 5: PRINT " .         Plays the preceding note 3/2 as long as specified.           "

a$ = PLAY$
 
  INPUT "Enter Music (I=Instructions)  ", a$
  IF a$ = "LIST" OR a$ = "list" THEN GOSUB MList
  IF a$ = "L" OR a$ = "l" THEN GOSUB Loading
  IF a$ = "S" OR a$ = "s" THEN GOSUB Saveing
  IF a$ = "I" OR a$ = "i" THEN GOSUB Instructions
  IF a$ = "0" THEN CLS : EXIT SUB

ON ERROR GOTO 1001
PLAY a$: SLEEP 1

ON ERROR GOTO 1000

OPEN "mlist.dat" FOR OUTPUT AS #2
    WRITE #2, a$
      CLOSE #2
  GOTO 1
ON ERROR GOTO 0

Saveing:
   
    PRINT "Please write in the notes you wish to save:"
    INPUT "Notes:  ", b$  'Read entries from the keyboard
OPEN "list.dat" FOR OUTPUT AS #1
DO
    WRITE #1, b$
     CLS
      INPUT "Add another Song"; r$
  LOOP WHILE UCASE$(r$) = "Y"
   PRINT "Saveing..."
    CLOSE #1
 GOSUB 1

Loading:

ON ERROR GOTO 1000

   OPEN "list.dat" FOR INPUT AS #1
     CLS
       PRINT "Song(s) in file:": PRINT
    DO WHILE NOT EOF(1)
       LINE INPUT #1, b$
    PRINT :
      PRINT "* "; b$; " *"
  LOOP
CLOSE #1
  PRINT :
    INPUT "Print the song"; c$
      PRINT : COLOR 12
  IF c$ = "Y" OR c$ = "y" THEN LPRINT b$ ELSE GOSUB 1
     GOSUB 1
ON ERROR GOTO 0

Instructions:

CLS
  PRINT TAB(25); "I N S T R U C T I O N S"
   PRINT
 PRINT " To save your music line            : At the entry line type (S)"
 PRINT " To list your music line            : At the entry line type (L)"
 PRINT " To look at the last song you wrote : At the entry line type  (LIST)"
 PRINT " To erase your last song            : At the entry line press (ENTER)"
    PRINT
 PRINT " To EXIT the music writing screen type - (0)."
  PRINT
 PRINT " NOTE:"
 PRINT "    When you save a entry the file is rewrote each time."
 PRINT "    When printing the file it will only print the first entry in"
 PRINT "    the list."

  LOCATE 23, 25: PRINT "Press Enter"
 INPUT "               ", e$
    GOSUB 1



MList:

ON ERROR GOTO 1000

    OPEN "mlist.dat" FOR INPUT AS #2
    CLS
    PRINT "Song in file:": PRINT
  DO WHILE NOT EOF(2)
    LINE INPUT #2, a$
      PRINT
    PRINT "* "; a$; " *"
  LOOP
CLOSE #2
   PRINT
     INPUT "Press <ENTER>", wait$
ON ERROR GOTO 0
 GOTO 1


END SUB

