Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Basic - <b>play play music statement</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
PLAY                     Play Music                                 Statement

 PLAY string

    Plays a melody according to instructions specified as a string
    expression.

      string    A string expression containing one or more commands in the
                BASIC tune definition language.

    Tune Definition Language

      A to G    Name of a note to play. Case is not significant.

          Nn    Number of a note to play. Notes are numbered from 1,
                corresponding to the lowest C on a piano, to 84,
                corresponding to the highest B on a piano. A value of 0
                for n specifies a rest.

     #, +, -    Sharps and flats. The equivalent symbols # and + tell
                BASIC to raise the specified note by a half step. The
                symbol - tells BASIC to lower the specified note by a half
                step. Only those sharps and flats that correspond to black
                keys on a piano are valid; i.e., E# and B# are not valid
                notes. Append these symbols to the notes.

          On    Octave (register) in which to play a letter-named note.
                Octaves are numbered from 0 (lowest) to 6. The lowest note
                in each octave is C. The default is octave 4.

          Ln    Duration of note, as a reciprocal (but see MS, ML, and MN,
                below). A value of 4 indicates a quarter note, a value of
                16 indicates a sixteenth note, and so on. All values from
                1 through 64 are valid. An L command affects all notes
                that follow, until the next L command. But you may also
                specify a duration value in conjunction with a note name
                or number--as, for example, D#4 (a D-sharp quarter note);
                a duration specified in this manner affects only the note
                with which it is associated.

          Pn    A rest (pause) of specified duration. The duration is
                specified in the same manner as for a note--i.e., as a
                reciprocal. To generate a rest in the current value of L,
                you may simply indicate a note number of 0.

           .    Appended to a note name or number, or a rest, a dot
                (period) extends the current duration of the note (or
                rest) by one half. You may have more than one dot after a
                note or rest.

          Tn    Tempo, specified as a number of quarter notes per minute.
                Values of 32 to 255 are valid; the default is 120.

    >A to >G    Increment the octave value by 1 and play the named note.
                The octave value stays at the increased level. If the
                current octave is 6, > has no effect.

    <A to <G    Decrement the octave value by 1 and play the named note.
                The octave value stays at the decreased level. If the
                current octave is 0, < has no effect.

          MF    Run music in foreground.

          MB    Run music in background. Other program statements may be
                executed while music is running. Up to 32 notes may be
                held in the background music buffer at any time. See the
                $SOUND metastatement to adjust the music buffer.

          ML    Music legato: Notes are played for their full specified
                duration.

          MS    Music staccato: Notes are played for 3/4 of their
                specified duration.

          MN    Music normal: Notes are played for 7/8 of their specified
                duration. This mode is default.

"=" + VARPTR$(var)
                Get argument from variable. May be used to supply
                arguments to any of the foregoing commands.

"X" + VARPTR$(stringvar)
                Execute command sequence stored in a string variable. This
                command allows you to call "subtunes."

   --------------------------------------------------------------------------

      Notes:    To get arguments or instructions from variables, you must
                use VARPTR$(var) or VARPTR$(stringvar). Turbo Basic does
                not support the =variable; and Xstringvar formulations
                available with the Interpreter.

                Spaces between or within instructions are insignificant.

                Semicolons may be used between commands to enhance
                readability.

See Also: $SOUND BEEP ON PLAY SOUND

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson