Playing A Song On The Commodore 64 - Commodore 64 User Manual

Hide thumbs Also See for 64:
Table of Contents

Advertisement

PLAYING A SONG ON THE COMMODORE 64
The following program can be used to compose or play a song (using
VOICEI). There are two important lessons in this program: First, note
how we abbreviate all the long control numbers in the first line of the
program ... after that, we can use the letter W for "Waveform" instead
of the number 54276.
The second lesson concerns the way we use the DATA. This program
is set up to let you enter 3 numbers for each note: the HIGH FREQUENCY
NOTE VALUE, the LOW FREQUENCY NOTE VALUE, and the DURATION
THE NOTE WILL BE PLAYED.
For this song, we used a duration "count" of 125 for an eighth note,
250 for a quarter note, 375 for a dotted quarter note, 500 for a half
note and 1000 for a whole note. These number values can be increased
or decreased to match a particular tempo, or your own musical taste.
To see how a song gets entered, look at Line 100. We entered 34
and 75 as our HIGH and LOW FREQUENCY settings to play a "C" note
(from the sample scale shown previously) and then the number 250 for a
quarter note. So the first note in our song is a quarter note C. The
second note is also a quarter note, this time the note is "E" ... and so
on to the end of our tune. You can enter almost any song this way,
adding as many DATA statement lines as you need. You can continue the
note and duration numbers from one line to the next but each line must
begin with the word DATA. DATA-1,-1,-1 should be the last line in your
program. This line "ends" the song.
Type the word NEW to erase your previous program and type in the
following program, then type RUN to hear the song.
MICHAEL ROW THE BOAT ASHORE - 1 MEASURE
2 FORL=54272TO54296 : POKEL,O:NEXT
5 V=54296:W=54276:A=54277 : HF=54273:LF=54272:5=54278:
PH =54275 : PL=54274
10 POKEY , 15:POKEA , 88:POKEPH , 15:POKEPL , 15:POKES,89
20 READH : IFH=-1THENEND
30 READL
40 READD
60 POKEHF , F:POKELF , L:POKEW,65
80 FORT=1 TOD : NEXT: POKEW,64
85 FORT = 1TO50:NEXT
88

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents