I am trying to simulate the speed of sound by delaying the sound using algorithms of distance and stuff.
The problem is that I want this to be global (All sounds should be like that)
I hope it is clear.
Thanks
I am trying to simulate the speed of sound by delaying the sound using algorithms of distance and stuff.
The problem is that I want this to be global (All sounds should be like that)
I hope it is clear.
Thanks
AFAIK there is no build in logic for that. There is only the Doppler effect for the movement of sound sources. IMHO you have to take the distance for every sound to the camera and calculate the delay with the relation of sound to light speed.
I would use it only for a subset of sounds. Only very loud sounds can be heard in a distance where the delay would be perceptible.
What would be the purpose of such simulation?
Realistic stuff
I don’t know what that is. Can you elaborate?
I am trying to have a realistic audio in my project. Maybe not to all sounds but to the explosions. I just need to find a way to make it like an option or something similar, idk
This have a lot of controls, what kind of project are you building?
Plays audio with positional sound effects, based on the relative position of the audio listener.
How far could the explosions get from the listener?
There is no automatic parameter for a delay based on the speed of sound, AFAIK. But it would be the node to work with, trigger the sound with the manual calculated delay.
This generally sounds like a bad idea to have in a game. The most likely result would just look like the audio is out of sync with visuals.
Totally agree. In a lot of the “war porn” videos of realistic fights, the audio is “fixed” to not disturb the viewer.
I mean those numbers make sense for visual such as storm, but for explosion? It likely be very small on screen unless it’s some nuclear mushroom.
Be nice if OP explains a bit how it should works, as lots games just gimmick or fake physics include light and sounds.
It be much easier to just mix sound effects to fake sense of scene, if this would be for example war scene - it would be lots of audio sources, which would be same like for movie to only give it sense of battlefield, and only sync the sounds which are in frames.
In a lot of the videos of the drone attacks in Ukraine and Russia, you can clearly see the delay of the explosion to the sound. And in some of the videos this delay is “fixed”.
Same with fireworks on video, there you can see the delay, too. It’s not only in thunderstorm where you can perceive it.
war stuff
Let’s see the visuals you have.
i cannot access my computer and i am using a phone to type this
i also doubt i will manage to have visuals cuz this is for my pure amusement and i will never release it
The first time I have observed this effect was in school at 100m sprint. Where at the end of the 100m a starter with a clap (two plates with a hinge) has started the race. There was a clear delay between the clap hitting together and to hear the sound. The interesting part was that I could “feel” the delay for exact 100m. That was a nice reference how the speed of sound “feels”. Since than I count the seconds in a thunder to know how far away the impact was.
That’s about 1/3 of a second delay. You have good perception ![]()
I observed it in real life only with lightning/thunder (duh!)
When it comes to realistic sound phenomena dependent on distance/motion, pretty much the only thing worth simulating in a game is the doppler effect. It sounds cool, can be observed close-by, and always evokes the sense of high speed. That’s why it’s supported out of the box by most audio engines.
1/3 of a second is rel. long. Long enough to clearly observe it.
If you have only one listener, you can simply delay the audio from being played based on the distance to the listener:
func distance_based_play():
var distance = self.global_position.distance_to(listener.global_position)
var wait_time : float = # TODO: Calculate wait time based on distance
await get_tree().create_timer(wait_time).timeout
self.play()