Feature Request: Doppler clamping

I’m making a dogfighting game, and doppler is used extensively.

Carefully setting the doppler levels is necessary, since any relative speed close to or above the speed of sound will lead to crackling, absent sounds or painfully high pitched instances.

The problem in our case is that the maximums speeds of all emitters, including that of the listener, is subject to rapid iteration and many edge cases.

It would be incredibly helpful to simply be able to set a maximum and minidum doppler pitch modification (equivalent to, say, 80% of the speed of sound) for the whole engine, or even per event.

A maximum calculated pitchFactor of two octaves would be dead simple:

pitchRatio=(c+signedRelativeSpeed)
clampedPitchRatio=Clamp(signedRelativeSpeed, 0.25, 4)

Setting it instead by a minimum and maximum relative speed is also easy

pitchRatio=c/(c+signedRelativeSpeed)
maxPitchRatio=c/(c-280)
minPitchRatio=c/(c+460)
clampedPitchRatio=Clamp(signedRelativeSpeed, minPitchRatio, maxPitchRatio)

a sound approaching at 280m/s would have the same pitch applied as a sound approaching at 800m/s (about 2 octaves up using default doppler value for c)

Right now, the only way to do this in unity is quite bad.

Solution 1: Every event needs a script to set the pitch by hand, either by automation or using setPitch, reimplementing the entire doppler system.

Solution 2: Every event needs a script that calls Set3DAttributes, using either the real velocity, or in case of a detected doppler overflow, invents a new velocity with the same direction but a reduced magnitude to avoid the overflow.

Hi,

I can definitely see the issue. To clarify, are you specifically looking to clamp the effect of doppler shift? Or would scaling it be sufficient? If it’s the latter, you can use System::set3DSettings to set a system-wide scaling factor for doppler shift.

Scaling it would not be enough, as it would either lead to really reducing doppler “just to be safe” or still facing potential unwanted “sonic booms”

Thanks for clarifying. Unfortunately, FMOD doesn’t have the ability to clamp doppler, but I can see the value in the functionality, so I’ve added it to our internal feature request/improvement tracker. In order to handle the clamping yourself, I would recommend going with your second solution, as it’d likely be far simpler than reimplementing the entire doppler system.