Soundwaves: Speed of Sound (Delay) & Doppler

Hi :wave:

If you are looking for eye-candy, you are wrong here. I have been digging through some of my files and found an experiment related to 3D sound in the BGE I want to share. Think of the delay between lightning and thunder introduced by the difference in speed of light and sound. There is also a little siren demo, showing shifted frequency of an amulbance sound while moving.

I think the BGEs actuators don’t do the delay by default. Here we go:

BGE_SoundWave_v2.blend (1012.2 KB)

What it does:

  • on Keys 1,2,3 short soundfiles (gunshots) in different distances at the camera are triggered. An animated sphere shall show the travelling wave. You can observe different delays and different loudness.
  • on Key Left and Right, an ambulance siren moves around. You can observe frequency shift, varying loudness and direction.

It should work for moving emitters and listeners as well, as the math is basically just a distance check between two moving points. Maybe this is useful for somebody here.

Please note:

  • I am aware that the speed of sound is not physically correct in there - it’s just a demo.
  • Sound files are from freesound.org if I remember correctly.

Enjoy!

4 Likes

Isn’t aud taking this kind of sound propagation into account already?

Hi @WKnight02

I see some similar parameters in the API, but have never used it.

A test would be quite simple:

  • Place a sound source approx. 340 m from the listener (camera).
  • Play a sound at this location (e.g. gunshot).

If you hear it instantaneously, it doesn’t consider the travelling distance
If you hear it 1 second later, it does.

If someone wants to put this together, fine - it’s really late where I live and I’m out for today

:v:

Excellent demo!
Hmmm, I’m really hoping more games go down this route with audio, really helps with immersion.

Impressive. There are much to less Sound Demos around for this important Theme. Thank You for sharing.