# 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 ?

Fab

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?

getFrequency

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.