What is a 'doppler effect'?

Miscellaneous Forums/General Discussion/What is a 'doppler effect'?

I have pondered this question before.

I bought FarCry a long time ago - Bloody great game - and I am currently replaying it.

In the sound settings there is a tick box for 'Doppler Effect'. However, they don't actually tell you what it does.

I know it affects the sound - but what exactly is it - what is the point of it?

It's when the pitch changes due to the movement of the sound source relative to the listener.

http://en.wikipedia.org/wiki/Doppler_effect

Yeh, when I Googled it - I saw something about pitch changing - but I still don't really get it. Is it something that you would really notice if it was enabled or not?

I can't remember seeing the option in any other computer game I have played. Certainly, it is not a common option I have seen.

Is it something that you would really notice if it was enabled or not?

It depends on what's going on in the game (I've never played FarCry.) The doppler shift on sound is mostly noticeable for loud noises being generated by vehicles as they speed by (eg. trains, ambulances, etc.)

what are you modeling puki... a moving train... or some other hi speed vehicle...

i think that in most circumstances, elements of a game don't move fast enough, and aren't detected far enough away as to take a doppler effect into consideration...

and even then, it's not the sound the vehicles are making... but usually the sound of an air horn going off as the object precedes and recedes from the observer...

this is just an off the top of the head viewpoint i'm putting up here, so i'm probably wrong... or off on a few things...

andways, it would be interesting to see such an effect well done in a game...

--Mike

Puki:
Any time a car drives by you, you hear the doppler effect, you just don't notice it normally. But if you think about it, I'm sure you've noticed when cars fly by it sounds something like RRRRRRRRRRRRaaaawwwwwwwwwwwwwwwww!

The aaa is the sound of the car at speed just sitting there, and the approach has the pitch increased, and when it receeds from you, the pitch is lower.

The pitch does not increase the closer it gets to you, nor does it decrease the farther it gets from you, but rather, the speed at which it is moving towards or away from you at a given time is what determines the pitch.

I couldn't tell you the formula to calculate how to translate this speed into a specifc shift of pitch though.

Besides cars, you'd also hear this on planes, boats, bullets, and missiles in a game.

Most games probably do not bother to simulate doppler shift, because something like a bullet whizzing past your head is done with a simple one shot sound effect that includes the doppler shifting in it. But you can't cheat so easily on car sounds, so if you want realism you should do it for those.

Ah, thanks guys.

Personally, I think it is all a bit faggoty - but I turned it on anyways. Give me surround sound any day - which is, in fact, what I have. Larging all the way.

heh far cry is awesome with a shader 3 card and HDR turned on. Made me want to play it all over again once I got my 6600GT :)

Best way to describe it i think, is when an ambulance passes you. You here the sound compressed slightly as it approaches you, then streched as it drives away from you. Isn't this due to the speed of the object emitting the sound, gets subtracted or added to the speed of the wave?

i encountered the doppler shift effect on my way back to earth last week...

... as we went sub light, the red shift in the stars directly ahead of us gave a fantastic lighting effect.

:)

--Mike

Personally, I think it is all a bit faggoty - but I turned it on anyways.


How you can find an effect caused by the laws of physics homoerotic eludes me. But hey: whatever floats your boat!

> whatever floats your boat!

Hello Sailor!

sniff

doppler effects are especially common in racing/driving games

There's even a doppler effect in Blitz3D :)

"whatever floats your boat!"

Don't you mean "Whatever churns your butter?" :-)


I couldn't tell you the formula to calculate how to translate this speed into a specifc shift of pitch though.



Heh, I was told this formula at one point- I bet CS_TBL knows! cuz i can't for the life of me remember.

it would be interesting to see it.

Basically sound has a wavelength- the car standing still will emit sound with nothing added to the wavelength, if the car is moving forward the (velocityofcar-velocityoflistener) is added to the wavelength-

Bleh, it's in my head, I just can't describe it sensibly.

If you travel at mach 1 (the speed of sound) away from the source, you'll be going the same speed as the soundwaves and will hear nothing. It stands to reason that travelling at half that speed would halve the frequency and travelling mach 1 towards would double it.

Therefore:

doppler_corrected_frequency = source_frequency * (1 + approach_speed / speed_of_sound)

EDIT: Whoops. This is incorrect. Something travelling towards you at mach 1 wouldn't be heard at double the frequency - it wouldn't be heard at all: SONIC BOOM!

Hm...

Let's say you had a sound wave at 1hz. One oscillation per second.

If you know the speed of sound, then you know how long a distance each oscillation in this sound wave must be streched out over.

In order to halve that distance, you must have to travel at half the speed of sound. That would double the sound frequency.

Google says:
speed of sound at sea level = 340.29 m / s

So...

If we want the frequency of the sound to double when the car is going at half the speed of sound then 170/340 = 0.5 and 340/170 is 2... The second is the result we want, but we want the frequency to approach infinity when the car reaches the speed of sound and neither of those will give us infinity at 340/340.

However, 340 / (340 - Speed_of_Car) will give us a value which approaches infinity as the car reaches the speed of sound, and will be 1 when the car is at rest.

If speed_of_car is negative when the car is moving away from the listener, then our value will halve when the car is moving away at the speed of sound... I think that is correct, I think that is how jets sound. Jets don't become silent because their sound waves stretch out to infinity when they reach mach 1 and they are receeding from you. And that would not make sense anyway because to strech a sound wave out infinitely would require an infinite distance, wheras to compress one to infinity requires no distance at all.

Obviously one needs to clamp this when the vehicle exceeeds Mach 1 though, at least when it is approaching. Otherwise you'll go past infinity and go negative.


So now we have the value you must multiply the frequency by to get the appropriate doppler shift.

Ie, if my car is traveling at 60mph, google says:
60 mph = 96 560.64 meters per hour

Which if we divide by 60 and then 60 again, gives us 26.8 meters per second.

340 / (340-26.8) = 1.08

Which sounds about right.

PS:
I wouldn't trust my own work, I'd look it up on the web to be sure. :-)

"sounds" valid to me. Sorry about the pun.