qb45advr.hlp (Topic list)
PLAY Statement Programming Example
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
PLAY Statement Programming Example
 
These examples use PLAY to play scales and a familiar melody.
 
Example 1
 
This example uses ">" to play the scales from octave 0 to octave 6,
then reverses with "<" to play the scales from octave 6 to octave 0:
 
SCALE$ = "CDEFGAB"
PLAY "o0 X" + VARPTR$(SCALE$)
FOR I = 1 TO 6
   PLAY ">X" + VARPTR$(SCALE$)
NEXT
PLAY "o6 X" + VARPTR$(SCALE$)
FOR I = 1 TO 6
   PLAY "<X" + VARPTR$(SCALE$)
NEXT
 
Example 2
 
This example plays the first few notes of Beethoven's Fifth Symphony:
 
LISTEN$ = "T180 o2 P2 P8 L8 GGG L2 E-"
FATE$ = "P24 P8 L8 FFF L2 D"
PLAY LISTEN$ + FATE$