Dynamic sound on bge

Hello. Here is the current scenario of my game.

I have a spaceship that is making a constant noise of engine when is idle (stopped), and when I press W key, the sound pitch should go up linearly like a car engine, stay constant when the highest speed is achieved and when a release W key, it’s pitch should go down linearly till it stays constant (when the engine is just turned on, without accelerating).

How would I do that?

1: possibility - Python; How?

  • A python script which listens to user key strokes, when no key stroke is being used, it emits the sound of a turned on engine. When user hits W, gradually it should turn the sound’s pitch up, following the servo’s speed acceleration (I really wouldn’t know how to do this one without manual tries). And basically doing the same thing inversely.

That’s only one possibility… Anyone knows another?

Pitching sounds with BGE Python:
http://www.tutorialsforblender3d.com/GameModule/ClassKX_SoundActuator_8.html

Thanks for that, helped me a lot, is there another way to do it?

Yes, there is! I accidentally found out, while seting up my own spaceship.
If you have a CrystalSpaceToBlender Setup (it doesn’t work on 2.49b because of Python version), by using a simple Force actuator and Sound, it would do it automatically (at least I believe so).
What I did was to play a sound once the ship is active by speeding up the ship, surprisingly, the sound pitch went up too…

Well that’s pretty good… But how do I get CrystalSpaceToBlender Setup? And the sound you are using for you ship’s engine, can you upload it here? I can’t make the sound stay continuous… and can’t find one that is continuos, like a car engine, looping without noticing the loop stop neither start. Please contact me so we can chat more: MSN: [email protected]

Later, I will post the python code here, once I achieve the sound task.

If you could use skype, I’d chat with you!
Do a quick google search or go to Crystal to Blender site (use Yo Frankie’s site if you must).

I use skype: sa.carlos

my skype user name is the same

I feel that I have to point out that there is no sound in space.

Good point! But the battles happen inside earth… :slight_smile:

I feel that I have to point out that there is no sound in space.

Very nice of you! Indeed, sound is created when a conductor exists for instance air. Therefore, inside the cabin of a ship, you hear the sound of your engines, unless they have no physical or electromagnetic connection to the ship. Sound will not be heard by others though, unless you are in a space with dense gas.

A similar but different question…

Is it possable to have collisions sound according to how heavy they hit? (ie the velosity of the object at the point of collision) so that if an object os moving fast when it colides with another object it’s far louder?

@yogyog - Yes, use the velocity of the object to plug into the volume variable of the sound actuator that plays the sound (Python).