How would i add a sound for the engine of the car? I just want to use one sound file for when the car is idle, then when the speed increases the pitch of the sound increases. I would also like to simulate the sound for gear changes. How would i go about this? I dont neeed the gear changes sound as long as i have the main sound working. Please help.
Unfortunately, sound control is one of the things that needs to be improved for the game engine. I think you’d be better off doing that in a post-processing program.
I did something similar for a tank game I’m making. It’s in fact 2 sound files (started from one sound) because the difference between idle and full throttle is too different to just tweak the pitch but here is what I did:
- I have a Throttle Manager that controls the engine revolution incrementally, by having a throttle property on the car and some python if statement, nothing complicated but, it needs comments
- My 2 sounds are both binded on a scripted that adjust the pitch and volume of each sound depending on the engine’s revolution.
Required a lot of tweak but the result is cool. The lower sound’s pitch goes up while its volume goes down and blends with the higher sound which pitch and volume goes up.
Then, if the sound script and the throttle manager are correctly done. You can gear up and down at specific revolution.
Use setPitch(pitch) and setGain(volume)