240
The
VIC
20
User
Guide
This will allow you to hear the effects
of
different notes (frequencies) on each
other. Listen for the
"beat"
that
occurs
at
certain frequencies. This
is
caused
by the interaction
of
the two tones.
The program plays notes
that
are
an
octave apart. This was done to
keep the program simple. Fortunately, beat frequencies work on different
octaves as well as on the same octave. Use Table 7-2 to locate the values
of
notes
of
the same frequency in the same octave. Experiment with some
of
these to
see
how changing octaves affects the sound produced.
USING
THE
NOISE
REGISTER
The noise register operates exactly like the tone registers. Here's the
ping-pong program one more time, this time using the noise register.
18
POKE
36878.1~
20
FOR
T-e
TO
1~
30
POKE
36877.0
48
FOR
F-0
TO
480:NEXT
~0
POKE
36877.240
60
POKE
35877.e:N!XT
N ow let's add some decay to the sound.
55
FOR
Y-15
TO
e
STEP-.l
57
POKE
36878.
Y:.NEXT
By
also modifying the repeat rate,
we
can create a sound similar to a
train as follows:
40
FOR
F
~
0
TO
400-26*T:
NEXT
55
FOR
..,'
=
15
TO
0
STEP
•
HIlT
By
mixing sound
we
can also add a train whistle.
To
do that we'll need
to maintain the volume at a constant level. Add the following routine to
your program:
70
FOR
G = e
TO
3
80
POKE
36877,
240
90
FOR
F = 0
TO
100:
NEXT
100
POKE
36877,
0
110
FOR
Q a 0
TO
10:
NEXT:
NEXT
120
IF
X=1
THEN
POKE
36875.
0:
POKE
36874,0:
X=0:
GOTO
70
130
IF
X-0
THEN
POKE
36875,220:
POKE
36874,240:
X-l
135
FOR
WW
= 0
TO
2
140
FOR
G a 0
TO
3
150
POKE
36877..
240