10-24-2023, 02:07 PM
https://hwiegman.home.xs4all.nl/qb45-man/index.html <-- There's a basic copy of the old QB45 documentation, which is more or less the same as what we have.
In this case, it appears that the even older QUICKBASIC documentation is much clearer and easier to understand. From: https://www.qbasic.net/en/reference/qb11...AY-006.htm
Which from the QuickBASIC notes, it's obvious that we're doing what we're supposed to. P1 is a whole note. P2 is a half note. P4 is a quarter note. The pause is (1 / n) notes.
QB64 is correct. It's just the documentation here could use some tweaking to clarify what it's actually doing better.
Code: (Select All)
PLAY - a device I/O statement that plays music
Syntax
PLAY commandstring
- commandstring is a stringexpression that contains music commands:
------------------------- Set Octaves and Play Tones -------------------------
On Sets current octave (n = 0-6) | < or > Up or down one octave
Nn Plays note n (n = 0-84, 0 is a | A-G Plays A, B, ..., G in current
rest) | octave (+ = sharp, - = flat)
------------------------- Set Tone Duration and Tempo ------------------------
Ln Sets length of a note (L1 is | MS Each note plays 3/4 of length
whole note, L4 is quarter note, | MN Each note plays 7/8 of length
etc.) n = 1-64 | ML Each note plays full length
Tn Sets number of quarter notes per | Pn Pause for the duration of
minute (n = 32-255, 120 default | n quarternotes (n = 1-64)
------------------------------- Set Operation --------------------------------
MF Plays music in foreground | MB Plays music in background
------------------------------ Execute Substrings ----------------------------
X + VARPTR$(string-expression) | Executes another command string
See Also <SOUND> <BEEP> <ON PLAY(N)>
Other Uses of the PLAY Keyword
<PLAY ON, PLAY OFF, AND PLAY STOP> - to enable, disable, or suspend play
event trapping
<PLAY FUNCTION> - to return the number of notes in the background music
queue
In this case, it appears that the even older QUICKBASIC documentation is much clearer and easier to understand. From: https://www.qbasic.net/en/reference/qb11...AY-006.htm
Code: (Select All)
commandstring$ A string expression that contains one or more of the following PLAY commands:
Octave and tone commands:
Ooctave Sets the current octave (0 - 6).
< or > Moves up or down one octave.
A - G Plays the specified note in the current octave.
Nnote Plays a specified note (0 - 84) in the seven-octave
range (0 is a rest).
Duration and tempo commands:
Llength Sets the length of each note (1 - 64). L1 is whole note,
L2 is a half note, etc.
ML Sets music legato.
MN Sets music normal.
MS Sets music staccato.
Ppause Specifies a pause (1 - 64). P1 is a whole-note pause,
P2 is a half-note pause, etc.
Ttempo Sets the tempo in quarter notes per minute (32 - 255).
Mode commands:
MF Plays music in foreground.
MB Plays music in background.
Suffix commands:
# or + Turns preceding note into a sharp.
- Turns preceding note into a flat.
. Plays the preceding note 3/2 as long as specified.
To execute a PLAY command substring from a PLAY command string, use the "X" command:
PLAY "X"+ VARPTR$(commandstring$)
Which from the QuickBASIC notes, it's obvious that we're doing what we're supposed to. P1 is a whole note. P2 is a half note. P4 is a quarter note. The pause is (1 / n) notes.
QB64 is correct. It's just the documentation here could use some tweaking to clarify what it's actually doing better.