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.