How can I make the sound of a car engine, like when Im steping on the gas the sound get stronger.
And I have other question since Im posting here, you guys know about any solution for the turning of the steering wheel? Im trying here but nothing look nice.
That all depends on how you plan to handle in game sound. It could be done with blender’s sound actuators, but is probably easier with pygame or something like that.
I’d have several sound loops for each gear/rev range/speed range then overlap and fade out old loops as the speed increases while starting new loops. For example:
1-10 mph - play sound loop 1
11-13 mph - start sound loop 2, fade out loop 1
14-20 mph - sound loop 1 stops, leaving sound loop 2
21-23 mph - start sound loop 3, fade out loop 3
and so on (I’d probably also overlay another sound over the change-over range, like some gear box noise to smooth over the transition).
Alternatively, you could have one sound of the engine power increasing that’s in sync with how fast the engine climbs up in speed. So while the player is accelerating, for examples sake lets say to 60mph, the engine power increasing sound plays, then when the player stops accelerating and levels off at 60mph play the engine sound associated with the 60-70mph range plays instead of the accelerating sound.
Both of these methods require a number of short sound loops, that if done with sound actuators would require a fair few of them. With pygame it would be easier to script the loading of different files into different channels, also pygame mixer module already has a fade in and out function. Both methods also would require careful synchronisation and experimenting to get the fades/cut off points sound right. Get a good audio editor/arranger to help get the lengths of the loops right and to get them looping smoothly.
Hope this helps!
thanks but my script skillls, suck, can you or someone else give me an example?
Sorry, really short of time at the moment, if I get a chance I’ll see, but I can’t promise anything.
Anyone else can help me with the engine sound problem?
well if you wanted to, you could use get the velocity of an object, and then turn that into the pitch of the sound, but i think either way you are stuck using python
thanks kendrick, but nobody on this forum saw any other guy that made this before? then I can use it, i need to make this, and the sound issue is the only one that i need to fix on the fisrt stage of my game.
ok i can put somthing together for you, what version of blender are you using? i can easily do it in 2.49, but im not used to scripting in 2.55 but im willing to learn
Here’s some basic code that will work in 2.5.
### Pitch Changer ###
###
gl = GameLogic
cont = gl.getCurrentController()
own = cont.owner
shiftUp = cont.sensors['shiftUp']
shiftDown = cont.sensors['shiftDown']
gas = cont.sensors['gas']
sound = cont.actuators['Sound']
### INIT
if not 'once' in own:
own['ST'] = 0.0
own['once'] = ''
###
ST = own['ST']
if gas.positive:
own['ST'] = (ST + 0.1)-(ST*0.003)
else:
own['ST'] = (ST - 0.08)
###
if sound.pitch > (ST/own['gear']):
sound.pitch = sound.pitch - 0.08
if sound.pitch < (ST/own['gear']):
sound.pitch = sound.pitch + 0.06
###
if ST < 0.8:
own['ST'] = (0.8)
###
if shiftUp.positive:# and own['gear'] != own['maxGears']:
cont.activate(gearS)
own['gear'] = own['gear'] + 3
if shiftDown.positive and own['gear'] != 1:
cont.activate(gearS)
own['gear'] = own['gear'] - 3
Im on 2.49 I ll put the game on burster for the comunity, but Im stuck here, I ll really aprecciate that kendrick, I can return the favor with some model if you want.
And thanks excalliber for the help!
ok i spent about 15 minutes setting up this EXTREMELY basic “car sound” blend file.
i am interested in doing a better one though
Attachments
Sound.blend (173 KB)
Thanks so mutch kendrick, as I said if you want somekind of help I can help please let me know.
Thanks again