Chapter
7:
Sound 235
You can also harmonize. Type NEW and enter the following program:
10
POKE
368741
0 :
POKE
368751
0 :
POKE
36876,
0
20
POKE
36878,
15
30
POKE
36876,
135
40
POKE
368751
207
50
POKE
36874,
235
70
POKE
36878,
0
80
END
GOSUI
100
GOSUI
100
GOSUI
100
100
FOR
Y • 0
TO
500
:
NEHT
:
RETURN
With careful planning, you can make listeners think they are hearing
more than three sound registers. Try adding this line.
68
POKE
36876,195:
GOSUI
18e
PUlSED
TONES
Another method
of
modifying the sound registers involves quickly
turning them on and off. This method, called pulsing, can create the effect
of
a buzzer.
To
get a better idea
of
how pUlsing works, look
at
Figure
7-1
in relation
to
the following program:
10
POKE
36878,15
20
FOR
T • 0
TO
50
30
POKE
36875,0
40
FOR
F • 0
TO
1:
NEXT
50
POKE
36875,240
60
NEXT
70
POKE
36875,0
Line
10
POKEs
15
into the volume register, but there
is
no sound
output until the tone register
is
turned on. Line
20
starts the loop that
determines the number of pulses produced (we've chosen
50).
Line
30
starts
the sound
at
0 (off), as shown in Figure 7-1. Line
40
is
the delay loop that
determines the off-time for the pulse. Line
50 turns the sound on. Line 60
completes the loop, sending the program back to line 20. In line 30, the
sound
is
immediately turned off again. After repeating
50
times, the loop
ends
at
line
70
by turning the sound register off.
By
increasing the length
of
the delays between pulses, you can tailor this
program to create the sound of a bouncing ping-pong ball. Change line
40
as
follows:
40
FOR
F •
0·TO
400:
NEXT