234
The
VIC
20
User
Guide
Pressing the F5 key POKEs 0 into the middle and high tone registers and
208
into the low tone register.
Pressing the
F7 key turns off the sound by PO KEing 0 into the volume
control register. Pressing the
F7 key again turns the sound back on.
Since the tone registers are one octave apart, pressing the different
function keys will allow you to hear 340 Hz (high register),
170
Hz (middle
register),
or
85
Hz (low register). Once again,
see
Table
7-2
for a complete
listing
of
the frequencies
and
POKE
values.
SWEEPING
THE
SCALES
You can change the value in a tone register while it
is
on. This will
switch immediately from one note to another. This
is
especially useful for
sliding from one note to the next. Try the following example. There will be
no pause between notes.
10
POKE
36878,15
20
OET
AS:
IF
A
••
1111
THEN
20
30
IF
A
••
CHR'(133)
AND
PEEK(36878)=0
THEN
10
40
IF
A.
•
CHR'(133)
AND
PEEK(36878)-15
THEN
POKE
36878,O:
OOTO
20
50
A a
VAL(AS'*10+163
60
POKE
36875,R:
OOTO
20
This program accepts
data
from the keyboard in the form
of
single
numbers between 0
and
9. These numbers are converted into a value
between
128
and
254. The value
is
then
PO
KEd into the middle tone register
(location 36875). Pressing the
FI
key alternately turns the sound
on
and off.
By
using a
FOR-NEXT
loop, you can sweep up
or
down the scale. The
following sequence covers the entire tone range
of
the middle register:
10
POKE
36878,15
20
FOR
Ta128
TO
254
30
POKE
36875,T:
NEXT
40
POKE36878.,
0
Try combining three loops and sweeping all nine octaves.
MULTIPLE
TONES
By
sounding two
or
more tones at once, you can add depth to many
of
your sound effects. Adding this line to the sample program will play two
tones at once.
25
POKE
36876,T