Chapter
10
I
BASIC
Keywords
SOUND
Statement
SOUND
frequency,
duration[,
[uolumel [,[voice111
SOUND
ON
SOUND
OFF
Generates
a
sound with the
frequency
and
duration
specified.
When
a
SOUND statement is producing sound, the program con-
tinues
to
execute. See the PLAY statement
for
more information
about executing program lines during SOUND.
frequency
specifies the desired tone in Hertz, and is an integer in
the range
1
to 32767. The lowest frequency the multi-voice sound
chip can produce is 110 Hz. Any value below 110 Hz sounds at
110 Hz. The frequency 32767 is treated as the silence frequency.
To
create
periods
of
silence, use
SOUND
32767,
duration.
Possible frequencies are given later.
Duration
is an integer in the range
1
to 65535, specifying the
duration in clock ticks. Clock ticks occur
18.2
times per second.
The shortest sound is
1,
and the longest is 65535. If
duration
is
0, BASIC turns
off
any currently running SOUND statement.
Otherwise, BASIC completes the first SOUND statement before
executing the next one.
Volume
is an integer in the range 0 to 15, where 0 is the lowest
volume and 15 is the highest volume. If you omit
uolurne,
BASIC
uses
8.
You must execute
a
SOUND ON statement
to
use
uolurne.
Voice
is an integer in the range 0
to
2. If you omit
voice,
BASIC
uses 0. You must execute
a
SOUND ON statement to use
voice.
You can set each voice to
a
different tone to produce a 3-note
chord.
SOUND
ON
enables the external speaker that supports multi-
voice sounds using the PLAY
or
SOUND statements.
SOUND
OFF
disables the external speaker.
You can use SOUND with BEEP
to
direct sound to either the
computer’s speaker
or
external speaker. See also BEEP for the
results
of
the different combinations
of
BEEP and SOUND.
309