Doppler effect

Hi everyone !

Today, I’m trying to use the doppler effect in the game engine.

I have added an actuator “sound” to a moving cube, and I hoped to heard a special sound effect…but nothing. The sound just play as if the object was not moving…

I have no idea how to resolve this problem.

Could someone help me ?

Thanks in advance !


Here is the .blend fle

Nobody can help me ?

Well, the doppler effect is this:
f’ = f*(v+v0)/(v-vs). The + and - will switch depending on the physical situation. v is the speed of the wave in the medium (sound is 343 m/s), v0 is the speed of the observer, vs is the speed of the source, f is the original frequency of the sound, and f’ is the final frequency of the sound.

So then you need to write a script to get these velocities, and use this to change the pitch given in the sound actuator.

F10 > Sound block buttons > Game Doppler Effect settinges ?

try them , i remeber that they were working on the old blender publisher …

[Edit Post]

made a simple tutorial for you …

It would be an easy thing to do in Python. I only wouldn’t know how I could get the frequency of the original sound.
There’s no getFrequency() function. So I think it’s not possible to do it using the Sound actuator. I’m not sure about pygame though. It might be possible.
Is it possible to get the frequency of a sound using pygame?


there were a fellow member of this forum who attempted to deal with such things , as far as i remember , he used something like get spectrum

here is his thread , his dancing dude [character dances depending on the wave file]

lucky you that the link in the thread is still working , maybe get spectrum will solve this issue …

regards .

i have a problem that’s the opposite of ! FaB !'s. i play my game, then i move and the sound coming from my gun gets incredibly distorted. the only way to fix that is to change the velocity, but whenever i start blender again, it’s back to 343. also its even worse for the runtime. any ideas?

Doppler worked in 2.48, but it doesn’t seem to in 2.49.

I detailed some sound bugs here and whether they’ll be fixed with 2.5’s new sound system, setting the pitch in python is broken too, as well as assigning a new file to a sound actuator after already giving it a file.

I don’t think we can expect anymore sound fixes in the 2.4x series, as 2.5 is getting a much better, proper, sound intergration in for both the BGE and the sequencer, the 2.4x sound implementation has been ripped out and replaced in 2.5.

only problem is, a few of the things I’m using weren’t in 2.48 and my deadline is oct. 1st. or was it the 10th?:confused:whatever.