EasyManua.ls Logo

Commodore 16 - Programming Concepts and Corrections

Commodore 16
94 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...
INTRODUCTION
M
BM
Here
Isa short program lo make music
on
your
Commodore 16.
Alic
you've typed
it
in,
when
you RUN It,
a
question mark will appear
on
your scree" Type
any number
trom
lo
1
01
5 as
your response
and
press
return
To
stop
the program, enter
a zero as
your value.
10 VOL 8
20 DO
30 INPUT
X
35 IF X > 1013 OR X<0
THEN PRINT
"0
TO 1015, PLEASE": GOTO 30
40 SOUND 1,X, 10
50
LOOP
UNTIL X-0
Pressing the
huh/stop
key also
stops the program
Here's how
to play a
single
note on your Commodore
1
6
First
Type VOL 8 and press
Second
Type
SOUND
1,266,60
and press
return
You should hear
a
note
play tor about
a
second and
Ihen stop. You
might consider this an unfinished symphony
in the most
extreme
sense
ot the word (one note
down. 3.500 lo go). II you don't hear anything,
turn up the volume of your television
or
monitor and
try
it
again
Tnese two steps are the only commands thai
you need to know
to
play
music
on your Commodore 1 6. Both commands
are easy to
understand
and easier to use
The
Volume
Command
The
VOL command controls the VOlume ol the notes
that
your
Commodore 1
6 plays. The number thai comes after
VOL
is the selting
tor the volume This
command works pretty much
like
the
volume
knob
on
your
TV When it is
set at zero (VOL 0).
the
volume
is
ott and you
won'l hear
anything When
you set it at 8 (VOL 8), the volume is
turned
up
all
the way. and your computer plays
as
loud
as it can.
i
i
i
i
(
i
i
i
i
i
f
i
i
i
i
1
r
I
i
i
i
i
i
i
i
!
I
I I
I
I
84
I
f
I
Try the
first example again and
use a
different number after the VOL
command. The larger the number, the
louder
the note is played.
The
Sound Command
The
SOUND
command tells your computer everything it needs to know
aboul
Ihe sound
you
want to otay The SOUND command is followed
by
three numbers thai describe the note
SOUND voce,
nolo value, duration
The
first
number In the
sound
command refers
lo
voice. The number
for
vo'ce can be
a
1
.2
or 3 The Commodore 1 6 sound is produced by
two
different "voices",
1 for Ihe first
voice
and 2
for
the
second vo»ce.
The third voice option applies
lu
voice
2's
capacity
to
produce either
a
lone
or
noise.
Voice
1
-
This voice
plays
only tones Select
INs
voce
wllh a 1
after
the SOUND command
Voice 2
-
This voice is like
voice i
, but
can
be used
lo play tones o'
noise tor sounds. Type
a 2 In the
command
lo use
this voice for tones,
or
a 3 to use
this voice for noise,
to
make sound
effects
like
thunder
and rain
The
second
number after the word SOUND is Ihe note
value
(frequency). This can bo
any number
from O lo
101
5.
It tells your
Commodore
1
6
how
low-
or high-pitched
a
note
to
play As the
numbers
get
larger, the noles get higher The highest values (in Ihe
1 01
5
neighborhood) are not audible
lo
Ihe human ear
Note:
Wnn voice 3, noise is "white"
only in the
range
ol 600-940
You can
use register
values outside this range
to
create interesting
sound
effects.
This displays
a! of the notes in one scale, along with Ihe note value to
use
There is
a
complete
chart ot notes
tor
the
Commodore 1
6
n Ihe
appendix.
85

Other manuals for Commodore 16

Related product manuals