Commodore 128 System Manual page 142

Table of Contents

Advertisement

Now try changing some of the parameters in line 100. For
instance, change the direction of the sweep to 2 (oscillate);
change the minimum frequency of the sweep to 32768; and
increase the step value to 3000. Your new SOUND command
looks like this:
110 SOUND 1, 49152, 240, 2, 32768, 3000,1
Line 110 makes a siren sound as though the police were right on
your tail. For a more pleasant sound, try this:
110 SOUND 1, 65535, 250, 0, 32768, 3000, 2, 2600
This should remind you of a popular space-age TV show, when
the space crew unleashed their futuristic weapons on the
unsuspecting aliens.
Until now, you have been programming in only one voice. You
can produce interesting sound effects with the SOUND statement
using up to three voices. Experiment and create a program which
utilizes all three voices.
Here's a sample program that will help you understand how to
program the Commodore 128 synthesizer chip. The program,
when run, asks for each parameter, and then plays the sound.
Here's the program listing. Type it into your computer and RUN it.
10 S C N C L R : P R I N T
20 P R I N T
"
30
I N P U T
" V O I C E
40
I N P U T
" F R E Q U E N C Y
50
I N P U T
" D U R A T I O N
60
I N P U T
" W A N T TO S P E C I F Y O P T I O N A L
70
IF B $ = " N "
T H E N
80
I N P U T
" S W E E P
90
INPUT
" M I N I M U M S W E E P
100
I N P U T
" S W E E P
110
I N P U T
" W A V E F O R M
120
IF W = 2
T H E N
130
S O U N D V , F , D , D I R , M , S , W , P
140
I N P U T
"DO YOU W A N T TO H E A R TH E S O U N D
150
IF A $ = " Y "
160 RUN
7-8
"
I N P U T
S O U N D
P A R A M E T E R S
( 1 - 3 ) " ; V
( 0 - 6 5 5 3 5 ) " ; F
( 0 - 3 2 7 6 7 ) " ; D : P R I N T
130
D I R E C T I O N
( 0 = U P ,l = D O W N , 2 = O S C I L L ) " ; D I R
F R E Q U E N C Y
S T E P V A L U E
(0 = T R I ,1 = S A W , 2 = V A R
I N P U T
" P U L S E W I D T H
T H E N
130
S O U N D
P L A Y E R " : P R I N T :P R I N T : P R I N T
TO P L A Y " : P R I N T :P R I N T
P A R A M E T E R S
(0-65535) ";M
( 0 - 3 2 7 67 ) "; S
P U L ,3 = N O I S E )";W
(0-4095) ";P
A G A I N
Y / N " ;B $ :P R I N T
Y / N " ; A $

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

128d

Table of Contents