PLAY Statement

 

PLAY strex

 

The strex defines the tune and is made up of characters that have the following meanings:

 

A to G Play the note in the current octave, in the current tempo, and with the current dynamics. Optional # or + may follow to indicate a sharp; or a - may follow

to indicate a flat.

 

A n to G n Play the note in the current octave but with the length of this note given only by n (see L n, below.) Optional #, +, or - signs may be added, as in A#2.

 

O n Set current octave to that indicated by n. Octaves run from 0 to 7. A given octave runs from C to the next higher B. Middle C is the first note of octave 4. If

no "O" command has yet been executed, the default is octave 5.

 

> and < Move up (>) or down (<) one octave.

 

L n Set the length (duration) of the subsequent notes and rests. The lengths are the reciprocals of n - that is, 1 stands for a whole note, 2 for a half note, 4 for a

quarter note, and so on. Note that n must be a whole number. The default value for n is 4 - a quarter note.

 

. A dot after a note indicates that the note is to be played as a dotted note; that is, 1.5 times its normal length. Thus, "A4." means the note A played as a dotted

quarter. Several dots may be used to increasingly lengthen the note. Rests may also be dotted.

 

R n or P n Rest (pause) for length n. Lengths are measured as in the L command above.

 

T n Set the tempo. Here, n stands for the number of quarter notes in one minute. The default tempo is 120, or 120 quarter notes to the minute.

 

MF Subsequent music will be played "in the foreground"; that is, no other statement will be executed until the entire music string has been played. This is the

default.

 

MB Play subsequent music "in the background" - that is, your program will continue to run while the remainder of the music string is played.

 

MN Play the music with "normal" dynamics, as opposed to "legato" or "staccato." This means that each note plays for 7/8 of the time specified by the L

command; the remaining 1/8 is silence. This is the default.

 

ML Play the music with "legato" dynamics. This means that each note plays for the full time specified by the L command.

 

MS Play the music with "staccato" dynamics. This means that each note plays for 3/4 of the time specified by the L command.

 

Uppercase and lowercase letters are equivalent in play strings. Spaces may be inserted to improve legibility, but True BASIC ignores them. No characters, other

than those listed above, are allowed in play strings.

 

If the music is being played in the foreground, the program waits until the play string is finished before executing the next statement. If the music is being played

in the background, the music continues until it is completed or until it encounters another PLAY or SOUND statement.

 

If the system does not support sound, the PLAY statement is ignored.

 

Exception:

-4501 Error in PLAY string.