Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 23:07 18 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: Game Music and sound

Author Message
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 02:17am 07 Aug 2020
Copy link to clipboard 
Print this post

Ok, so trying to add music to my 285 Rush game...

I have a MOD file for the music.

I have a few sound effect WAV files.

I also currently use a PLAY SOUND that adjust the frequency of based on the speed of the player's car.

However, while I can play the MOD + Wav (as Play Effect) at the same time, I can't seem to do the PLAY TONE sin waves for the engine sound at the same time.

Am I having to do the engine sound as a WAV and how would I adjust the sound to match the player's car speed? I guess if I could record it at different frequencies and then use the Play Effect interrupt to then read the player's speed at that time and load the next frequency and start playing that one and so on... But geez that's kind of ugly...


Can PLAY TONE work at the same time as MOD playback?  And what's the real difference between PLAY TONE and PLAY SOUND?  They seem very similar in description although PLAY SOUND seems to have more options available to it...

Just trying to figure out the right way to do a game's background music while also having various types of sound effects in the game...
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8566
Posted: 07:32am 08 Aug 2020
Copy link to clipboard 
Print this post

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
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 12:17am 09 Aug 2020
Copy link to clipboard 
Print this post

  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
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024