Page 1 of 1
SoundFrequency() - different per sound?
Posted: Wed Jun 23, 2004 10:59 pm
by kenmo
I am making a 2D sidescrolling game with bullet-time effects, but that doesnt matter. My problem is, when "time" slows down, I slow down all the sounds with SoundFrequency() and set them back to normal the same way. I found through simple testing that a frequency of 22000 sounds as close to the default as I could hear, so I am using that as the default frequency.
But in my game, I was wondering why some sounds sounded normal, some too slow, and some too fast. I tested more, and found out that 22000 is not the normal frequency of different sounds. So how would I go about halving and resetting sound speeds if they all have different base frequencies???
Thanks for any help!
Posted: Thu Jun 24, 2004 12:03 am
by Moonshine
There are a number of set bitrates with sounds. For short game sounds, the accurate bitrate is 22,050, not 22,000. Save all your wav sounds at this bitrate, as its the best compromise of size and quality. Use a free sound program, or even write one in PB. Basically the different sounds you are using must be saved at different bitrates. For example, they could be 44,100 (very common) or as low as 11,025. Save them all at 22,025 yourself and you should have no problems. To test, right click on any of your sound iles and select properties. On XP, select summary to see the sample rate of the file.
Heres a link to a free opensource sound etidor that Ive heard is a very good piece of free software, should be fine for you:
http://audacity.sourceforge.net/
Hope that helped

Posted: Thu Jun 24, 2004 12:34 am
by Froggerprogger
If you know the samplerate of your used sounds (44100, 22050, 11025,...) you should be able to store it in a variable or array and then set their frequency with a global time-factor (1.0 = normal, >1.0 = faster, <> 0.0):
Code: Select all
SetFrequency(#SoundID, BaseFrequency(#SoundID) * timeFactor)
I think it is possible for PB to play more than one sound at a time and all of them with a different frequency.
Posted: Thu Jun 24, 2004 4:09 am
by kenmo
Ahh, Moonshine you are right. The file bitrate is what is causing it. I didn't think that made a difference, I thought it just loaded any bitrate sound the same, like how different image file types are all (basically, you get the point Im making) the same once loaded into memory.
By the way are you the same Moonshine on the LLRGT forums?
edit - Yup frogger, thats basically how I was doing it, except I assumed they all had the same frequency.
Posted: Thu Jun 24, 2004 9:44 am
by Moonshine
Glad to hear its solved
And yes Im the same Moonshine from LLRGT
