The Tempo Statement; The Play Statement - Commodore 128D User Manual

Hide thumbs Also See for 128D:
Table of Contents

Advertisement

i
;
I
)
!
\
(
\
t
\
The next step in programming music is setting
the volume of the sound chip as follows:
20 VOL 8
The VOL statement sets the volume of the sound
chip between 0 and 15, where 15 is the maxi
mum and 0 is off (no volume).
The TEMPO
The next step in Commodore 128 music pro-
Statement
gramming is controlling the tempo, or speed of
your tune. The TEMPO statement does this for
you. Here's the format:
TEMPO n
where n is a digit between 1 and 255 (and 255
is the fastest tempo). If you do not specify the
TEMPO statement in your program, the Com
modore 128 automatically sets the tempo to 8.
Add this statement to your musical example
program:
30 TEMPO 10
The PLAY
Now it's time to learn how to play the notes in
Statement
your song. You already know how the PRINT
statement works. You play the notes in your tune
the same way as PRINTing a text string to the
screen, except you use the PLAY statement in
place of PRINT. PRINT outputs text, PLAY out
puts musical notes.
Here's the general format for the play statement:
PLAY"string of synthesizer control
characters and musical notes"
The total number of characters (including musi
cal notes and synthesizer control characters)
that can be put into a PLAY command is 255.
However, since this exceeds the maximum
number of characters (160) allowed for a single
program line in BASIC 7.0, you have to concate
nate (that is, add together) at least two strings to
reach this length. You can avoid the need to
concatenate strings by making sure your PLAY
commands do not exceed 160 characters, i.e.,
143
USING C128 MODE—Sound and Music in C128 Mode

Advertisement

Table of Contents
loading

Table of Contents