* *
*
* * News
 • Daily news
 • Archived news

Columns
 • WildCard
 • Qbasic Articles
 • QB Comic!

Learning center
 • QB Books
 • Qbasic Lessons!
 • Qbasic FAQ
 • Newbies Section
 • Qbasic Tutorials

* *
*
*
*
*  
.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 "
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$
 
* * ** * * * *