238
The
VIC
20
User
Guide
All
of
the sounds we've produced so far have had a very fast attack
and
a very fast decay. When these parameters are changed, the sounds become
quite different. Here
is
the original ping-pong program again.
10
POKE
36878,15
20
FOR
T • 0
TO
~0
30
POKE
36875,0
40
FOR
F a 0
TO
400:
NEXT
50
POKE
36875,
240
60
NEXT
70
POKE
36875,~
Now let's add a decay.
57
FOR
DD
•
15
TO
"
STEP
-1:
POKE
36878,
DD:
NEXT
Since we're controlling the volume register within the decay loop,
we
can get rid ofline
10,
which originally turned the volume on.
If
we
also add a
line to provide attack, the program looks like this.
5
INPUT
"ATTACK";
A
7
INPUT
"DECAY";
D
10
FOR
T - 0
TO
50
20
POKE
36875,
0
30
FOR
F - 0
TO
400:
NEXT
40
POKE
36875,
240
58
FOR
AA
- 0
TO
15
STEP
A
55
POKE
36878,
AA:
NEXT
60
FOR
DD
•
15
TO
"
STEP
-D
70
POKE
36878,
DD
80
NEXT
90
POKE
36875,
0
Listen
to
the differences introduced by different attack/ decay ratios.
You can enter any positive number, including fractions, in the input state-
ment.
If
you enter 0 for either the attack
or
decay, however, the note will
never end.
Sustain can be added by including a delay between the attack and the
decay as follows:
8
INPUT
"SUSTAIN";S
57
FOR
SS-"
TO
S:NEXT
VIBRATO/TREMOLO
Vibrato and tremolo take place during the sustain portion
of
the tone.
Vibrato
is
a passage in which the volume
is
raised and lowered quickly to