Commodore 128 System Manual page 140

Hide thumbs Also See for 128:
Table of Contents

Advertisement

RUN this program. The Commodore 128 plays a short beep. You
must set the volume before you can play the sound statement, so
line 10 sets the VOLume of the sound chip. Line 20 plays voice 1
at a frequency of 4096 for a duration of 1 second (60 times
1 /60). Change the frequency with this statement:
30 SOUND 1,8192, 60
Notice line 30 plays a higher tone than line 20. This shows the
direct relationship between the frequency setting and the actual
frequency of the sound. As you increase the frequency setting,
the Commodore 128 increases the pitch of the tone. Now try this
statement:
40 SOUND 1, 0, 60
This shows that a FREQ value of 0 plays the lowest frequency
(which is so low it is inaudible). A FREQ value of 65535 plays the
highest possible frequency.
Now try placing the sound statement within a FOR...NEXT loop.
This allows you to play the complete range of frequencies within
the loop. Add these statements to your program:
50 FOR I = 1 TO 65535 STEP 100
60 SOUND 1 , 1 , 1
70 NEXT
This program segment plays the variable pulse waveform in the
range of frequencies from 1 through 65535, in increments of 100,
from lowest frequency to highest. If you don't specify the
waveform, the computer selects the default value of waveform 2,
the variable pulse waveform.
Now change the waveform with the following program line (60)
and try the program again:
60 SOUND 1 , 1 , 1 ,0 , 0, 0 ,0 ,0
Now the program plays voice 1, using the triangle waveform, for
the range of frequencies between 1 and 65535 in increments of
100. This sounds like a typical sound effect in popular arcade
games. Try waveform 1, the sawtooth waveform, and see how it
sounds with this line:
60 SOUND 1,1, 1 ,0 , 0, 0 ,1 ,0
7-6

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

128d

Table of Contents