Commodore 16 User Manual
Download Operation & user’s manual of Commodore 16 Desktop for Free or View it Online on All-Guides.com.
r
50 NEXT X
60FORX
=
RTO 1
STEP -1
70 SOUND
3, 600+30-X, 10
80 NEXT
X
90 T
=
INT(RND{0)
" 100) + 30
100 SOUND 3
r
600,
T
110 GOTO
20
Lines
30 and 60
sel up FOR . . NEXT loops lor the nole
value
(frequency)
ol Ihe sound, one increasing
and one decreasing,
based on
the
random number
from line 20. 11 Is Important
to have variation in
pilch, since windstorms have
different forces
of gusts of
wind.
Lines 40
and
70 are the SOUND commands
that creale
Ihe
noise.
Lines 9C and
100 sel up a random delay lo recreate
the uneven nature of
a
windstorm
wllh lime lapses between howls The
program selects
a
RaNDom number that is
used
for the
duration of another
SOUND
command. This
SOUND
command stays at ihe same pilch
and
provides
a
consistent
background noise
that serves
as a
counterpoint
to
the gusts of wind. This
may seem pretty complicated,
like you need
to
be an experienced programmer
to be able
10 do
li.
But
it's
really
nothing
more than experimenting, trying
different things, and seeing
what
noise comes out. Creating sound effects
using noise is
challenging,
trying
to capture Ihe right elements
of
the
sound
you
want
exactly To
be
good al
it.
you have lo be willing
lo
experiment
Making
Some Music
You may nol understand everything
that's going
on in these programs,
but type Ihem In anyway and
see what happens
This
program
simulates
a
piano
using the
Keys
Irom
1 through 8.
5 SCNCLR
10FORX-1TOB: READN(X):
NEXT
X
20 VOL 8
30 DO
40 GET
AS: IF A$=""
THEN 40
30 A=ASC(A$):
IF A<49
OR A
>56
THEN 90
60N-A-48
70 SOUND 1, NfN),
5
80 COLOR
4, N, 3
90 LOOP UNTIL A
=
32
100 VOL
0: COLOR
4, 2, 7
110 DATA
169, 262, 345.
383, 4S3, 516, 571, 596
I
I
(
I
I
f
I
I
(
f
I
Bfl
1
'
1
1
1
1 1
( !
1
Press numbers 1 Ihrough
8 to
play notes. The screen border even
changes colours with the different noles When
you
finish playing,
press Ihe space bar to slop me program.
Now thai your Commodore 1 6 can be used like a piano, you mighl feel
(he urge
to play a popular song.
Here
are Ihe numbers lo
press
lo play
a
well-known song that surely
must be
considered
a
classic.
115
5 6 6 5
4 4
3 3
2
2
5 5
4
4 3 3 2
5 5
4 4
3 3 2
115
5 6 6 5
4
4 3 3 2 2 1
i
mmm
This next
program
plays
a song by
reading
a list ol DATA
statements
Your
compute' READs
the numbers contained in
the DATA
statement
as
values for variables (in this
case X
and Y), changing the values with
each loop The DATA statements are in pairs. The first number Is the
note
value for the
SOUND
command
and the second
number
Is ihe
duration
for
the SOUND command
Row Boat
10 VOL
8
20 DO
30 READ X, Y
40 SOUND 1, X, Y
45 FOR
D=l TO Y'16+30:NEXT
50 LOOP UNTIL X=0
<—
60 END
100 DATA
169, 45, 169. 45, 169, 30
110 DATA 262, 15, 345,
45, 343,
30
120 DATA 262, IS, 345, 30, 383, 15
130 DATA 453, 60, 596, 45, 453, 45
140 DATA 345,
45, 169, 45, 453, 30
ISO DATA 383, IS, 345. 30, 262, 15
160 DATA 169, 60
200
DATA
0,
This loop
creates a
brief delay
between notes