EasyManua.ls Logo

Atari XL

Atari XL
262 pages
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...
90
The
Atari
XL
Handbook
up
a
series
of
numbers
corresponding
to
notes
but
we
need
a
way
of
storing
them.
One
way
is
to
store
them
in
a
string,
reading
them
one
at
a
time
as
parameters
for a
SOUND
command.
This
technique
is
illustrated
in
the
following
program.
10
DIM
TUNE$(ll)
20
TUNE$
=
"QQQQDHHQQUQ"
30 FOR Z=1
TO
LEN(TUNE$)
40 N = ASC(TUNE$(Z,Z»
50
SOUND
0,N,10,8
60 FOR D = ° TO 100:NEXT D
70
SOUND
0,0,0,0
80
NEXT
Z
The
main
limitation
with
this
method
is
that
the
notes
are
all
the
same
length,
which
renders
it
impractical
for
all
but
the
simplest
music.
There
are
several
ways
of
overcoming
this:
for
example,
a
second
string
could
be
used
to
hold
the
data
for
the
length
of
notes.
Add
these
lines
to
the
last
program
to
hear
this
technique
in
action.
15
DIM
L$(ll)
25
L$="32132121214"
60 FOR
D=O
TO
100*VAL(L$(Z,Z»:
NEXT
D
This
method
is
adequate
for
simple
tunes
but
a
better
way
is
to
hold
information
concerning
notes
and
note
lengths
in
DATA
statements
like
this:
10
FOR Z=1
TO
13
20
READ
NO,LE
30
SOUND
0,NO,10,8
40 FOR
DUR=O
TO 100*LE:NEXT
DUR
50
SOUND
0,0,0,0
60
NEXT
Z
70
SOUND
O,O,O,O:END

Related product manuals