Commodore VIC-20 Programmer's Reference Manual page 114

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

The Octave Chart illustrates the three octaves contained in each
speaker register. It also shows how several octaves overlap . . . 1ar
i
instance, the lowest octave of Speaker 3 contains the same notes
as the middle octave of Speaker 2. Of course, the same note played
on different speakers may sound slightly different . . . just as the
same note played on a piano may sound different from the same
note played on a harpsichord. Also, some television sets and
speakers may cause varying results in terms of tonal qualities.
The Table of Musical Notes on page 97 is intended to help you
approximate note values in your computer program using the VIC.
The number values are approximate only and may be adjusted by
using values between those shown.
MUSIC PROGRAMMING TECHNIQUES
There are four basic parameters in programming music:
1. Voiume
I
2. Speaker/Sound Register Selection
3. Note
4. Duration
In other words, the things you have to consider when programming
music are which volume to set, which speaker(s) to use, the notes
.
being played by each speaker, and the duration of each note. Let's
consider some techniques -for putting these parameters in your
program:
EXAMPLE 1: MUSIC USING DATA STATEMENT
10 POKE 36878, 15
Set volume to highest ieve! (15).
20 S2 = 36875
Set speaker to equal S2 (any variable).
30 READ N,D
Read duration
&
note from
DATA
below.
40 IF N = — 1 THEN
Turn off speaker & end program at - 1.
POKES2h0:END
50 POKE S2.N
Play note N from DATA on Speaker S2.
60 FORT = 1 TOD:
Duration loop to set up time value.
NEXT
70 GOTO30
Keeps going back to DATA list to get
duration & note (NTD) values.
80 DATA 225,250,226,
DATA statements ... the first number
250,227,250,228,
is the note from the note value chart
250,229,250,230,
earlier
in
text,
and
the
second
250,231,250,232,
number is the duration the note is
250,233,250,234,
played.
250,235,250,-1.
98
I

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents