Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doppler Effect Cuts off at Certain Speed #38143

Open
Tracked by #76797
ngreve opened this issue Apr 23, 2020 · 3 comments
Open
Tracked by #76797

Doppler Effect Cuts off at Certain Speed #38143

ngreve opened this issue Apr 23, 2020 · 3 comments

Comments

@ngreve
Copy link

ngreve commented Apr 23, 2020

Godot version:
v3.2.2.beta.custom_build.c7ad8f539

OS/device including version:
Linux

Issue description:
When using the Doppler effect on an AudioStreamPlayer3D the audio gets cut off, when the object its used on reaches a certain speed.

This video shows a cube accelerating towards the camera, while playing a rocket engine sound. At the ~3rd second the Doppler effect stops abruptly.
doppler_audio_bug.zip

Steps to reproduce:

  1. Add AudioStreamPlayer3D to RigidBody
  2. Continue to call add_central_force() on the object while playing a sound with doppler_tracking activated (Idle or Physics).

Minimal reproduction project:
doppler_audio_bug.zip

@ellenhp
Copy link
Contributor

ellenhp commented Aug 29, 2021

I think this was intentional. The current doppler tracking code cuts out after shifting the sound three octaves. The tricky part is that at some point you have to do more than just pitch shift to accurately portray doppler shift. The easiest way to conceptualize this to think about how a sonic boom is more than just a pitch shift. As a workaround you can try and do that acoustic modeling yourself and adjust pitch_scale. It seems tricky though.

@Calinou
Copy link
Member

Calinou commented Sep 17, 2021

Should the doppler effect be clamped to 3 octaves instead of being cut abruptly? If not, I guess we should just document this in the class reference.

@ellenhp
Copy link
Contributor

ellenhp commented Sep 17, 2021

It is currently clamped, yeah. It's just hard to justify getting much closer to the speed of sound without actually doing the math to determine what it sounds like at that speed.

doppler_pitch_scale = CLAMP(doppler_pitch_scale, (1 / 8.0), 8.0); //avoid crazy stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants