CMM2: Game Music and sound


Author Message
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 12:17am 09 Aug 2020      

  matherp said  The sound system can do one thing at a time with the single exception of playing a WAV file at the same time as a MOD file is playing

  Quote  And what's the real difference between PLAY TONE and PLAY SOUND?


PLAY TONE only allows sine waves but does allow timed output and will start and finish at the mid-point audio level to avoid clicks. Play SOUND has the capability of different waveforms but it is up to the user to start and stop each channel and waveforms will stop immediately on instruction


Ah, that's why my previous sound routines had sounded rough, if I play each sound for a whole number of cycles it sounds more like I intended.

print "zap sound, rough"
for k=1 to 2
 for n=800 to 100 step -20
   play sound 1,B,q,n
   pause 10
 next n
next

play sound 1,B,O,300
pause 3000

print "zap sound, smooth"
for k=1 to 2
 ' multiples of 50 cycles per second
 for n=800 to 100 step -50
   play sound 1,B,q,n
   ' 20ms is a 50th of a second
   pause 20
 next n
next

play sound 1,B,O,300

end