EasyManua.ls Logo

Commodore 128 - Random Sounds

Commodore 128
448 pages
Print Icon
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...
Here's a quick explanation of the program. Lines 10 and 20
PRINT the introductory messages on the screen. Lines 30
through 50 INPUT the voice, frequency and duration parameters.
Line 60 asks if you want to enter the optional SOUND
parameters, such as the sweep settings and waveform. If you
dont want to specify these parameters, press the N" key and
the program jumps to line 130 and plays the sound. If you do
want to specify the optional SOUND settings, press the Y key
and the program continues with line 80. Lines 80 through 110
specify the sweep direction, minimum sweep frequency, sweep
step value and waveform. Line 120 INPUTS the pulse width of the
variable pulse waveform only if waveform 2 (variable pulse) is
selected. Finally, line 130 plays the SOUND according to the
parameters that you specified earlier in the program.
Line 140 asks if you want to hear the SOUND again. If you do,
press the "Y key; otherwise, press the N key. Line 150 checks
to see if you pressed the Y" key. If you did, program control is
returned to line 130 and the program plays the SOUND again. If
you do not press the Y" key, the program continues with line
160, and the program reruns. To stop the Sound Player program,
press the RUN/STOP and RESTORE keys at the same time.
Random Sounds
The following program generates random sounds using the RND
function. Each SOUND parameter is calculated randomly. Type
the program into your computer, SAVE it and RUN it. This
program illustrates how many thousands of sounds you can
produce by specifying various combinations of the SOUND
parameters. Here’s the listing:
10 PRINT "VC FRQ DIR
MIN SV WF PW VOL 5
20 PRINT "*
.......
"
30 V = INT (RND (1)*3)+1
: REM VOICE
40 F = INT (RND (1)*65535)
: REM
FREQUENCY
50 D = INT (RND (1)*240)
: REM DURATION
60 DIR = INT (RND (1)*3)
: REM STEP DIRECTION
70 M=INT (RND (I)*65535)
: REM MINIMUM FREQUENCY
80 S = INT (RND (1)*32767)
: REM STEP VALUE
90 W=INT (RND (1)*4)
: REM WAVEFORM
100 P = INT (RND (1)*4095)
: REM
PULSE WIDTH
110 PRINT V; F ; DIR ;M ; S ;W
;P:PRINT:PRINT
: REM
DISPLAY VALUES
120 SOUND V,F,D,DIR,M,S
,W,P
: REM PLAY SOUND
130 SLEEP 4
: REM
WAIT A BIT
140 SOUND V,0,0rDIR,0,0
,W,P
: REM
SWITCH SOUND OFF
150 GOTO 10
7-9

Table of Contents

Other manuals for Commodore 128

Related product manuals