EasyManua.ls Logo

Commodore VIC-20 - Page 251

Commodore VIC-20
404 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 7 Sound 237
never exceed
15
(the highest allowable number in the volume register).
Next, POKE the loop value into the volume register by adding the
following line:
45
POKE
36878,
15-T
This causes the volume to decrease with each pass through the loop.
You can also use the loop variable
to
decrease the length of the delays
between pulses as the volume decreases. This produces a sound resembling a
dropping ball. Try changing line
40
to
49
FOR
F = 9
TO
400
-
T*26:
NEXT
The number
26
was chosen because
400
divided by
15
is
approximately
26.
This divides the steps of the delay into
15
even increments. Subtracting the
loop value from
400
reduces the delay in the increments each time through
the loop.
Try changing the tones used in the first ping-pong program to produce
the sound of a clock ticking. This can be accomplished by using two different
tone values on alternate loops.
AnACK/SUSTAIN/DECAY
When you
playa
note on a piano, the sound begins loudly and slowly
fades until it finally fades away completely. The start of the sound
is
called
the
attack. The portion of the sound in which the volume
is
maintained
is
called sustain, and the last part of the sound, in which it fades,
is
called
decay.
Sustain
..,
s
-E
>
Time

Other manuals for Commodore VIC-20

Related product manuals