I’m trying to make the Doppler effect work but I’m kinda confused how I should use the factors.
I get the position of the camera and the source in each frame (by frame I mean the same rate as the FMOD system update gets called), I also get the elapsed time and calculate both the listener and the source velocity.
The position of the sound and listener is considered to be in distance units of the world space of my engine, so I set the distance factor in set3DSettings to be 1.0f, which I suppose is reasonable. In each frame, I first set the source and listener properties and then I call the FMOD system update.
I didn’t know what I should choose for the Doppler scale factor, so I thought may be I should tune it manually to get the best result.
So here is what happens. When I choose the Doppler factor more than (10^(-5)), The sound gets destroyed as the listener moves toward and backward (with respect to the source).
When I choose it to be 10^(-5), I hear a little bit of of sound change as the listener moves, but it’s not what I’m looking for.
Is there anything that I’m missing? I’m pretty sure that the Doppler scale shouldn’t be that low.
Thank you for your help.
- You must login to post comments
Without knowing more about your game, I can’t say what the likely cause of your issue is, but I can give you some general troubleshooting steps.
First, make sure that you’ve set the distance factor to whatever value is required to convert from your game’s distance units to metres. I’m not sure what units your game engine uses, nor what your ‘f’ variable is, so I can’t say whether your value of 1.0f is appropriate. (If the ‘f’ is just a typo, then check that your game’s distance units are in fact metres; Many game engines default to very different unit lengths; The default length of Unreal Units, for example, has varied between 0.01508 metres and 0.02242 metres over the years; The actual length depends on the relative scale of modelled objects in your game.)
Next, be aware that the amount of pitch bending applied by FMOD Studio Doppler is dependant on the velocity of events relative to the listener, as measured in distance units per second. Make sure you’re not accidentally calculating distance units per frame, as this value will generally be considerably off from the units-per-second figure.
Finally, be aware that at very high speeds, the amount of Doppler applied to events will naturally be higher than it would be otherwise. The intended function of Doppler factor is to allow you to tweak this to taste; If your game features higher speeds than players are likely to experience in reality, the doppler effect may be exaggerated beyond the point of good taste; In such situations, tweaking Doppler factor down (or up!) is a reasonable and expected thing to do.
For more information about the Doppler effect in FMOD Studio, see http://www.fmod.org/documentation/#content/generated/overview/3dsound.html and http://www.fmod.org/docs/content/generated/FMOD_System_Set3DSettings.html.
Thank you so much for your reply.
Sorry for not being clear enough. By “f” I meant the float variable.
I started writing the code in a way that the the source moves in a circle in front of the listener. To be more accurate, the listener is at (0,0,-55) pointing at (0,0,0). The source is originally at (0,0,0) moving on an orbit in X-Z plane with the radius of 50.
The sound assigned to the source is a siren noise.
I played around with the distance factor and I found at that at the value of 0.9, I can hear a perfect Doppler effect.
The problem is that as the listener is moved towards or away from the listener the sound gets destroyed, I hear strange effects. In fact the Doppler effects only makes sense when the source is moving on a circle-like trajectory.
The velocity of the source and listener are exactly calculated on m/s so I’m not making a mistake.
Do you have any idea what the problem is?
Thank you so much.
Without more information about your set-up, it’s hard to say what the problem might be. That said, Doppler is calculated and applied be the same code regardless of the path the emitter and listener take, so whether or not the emitter is moving in a circle-like trajectory should be irrelevant. How are you moving the listener? Is it moving slowly, or is it ‘teleporting’ around in short jumps? Regardless of how it travels, when and how often are you checking its speed and location for the purposes of calculating its speed? If you change your code so that the emitter stays still and the listener moves in a circular path, do you get the same problem?
Sorry for delay in response I was busy making the reverberation work.
I know set the camera to move in a circular path. I put the emitter at (0,0,50) and the listener is moving on an orbit with (0,0,0) as the center and the radius of 50.
I can perfectly notice the doppler effect. But if the camera does not move in a circular path, and move like when it passes the source or gets closer to the source, the sound gets distorted.
I thinks the speed of camera is too fast, it is teleporting around in short jumps. I’m calcluating the speed of listener and the source and pass them to FMOD in each frame (frame is the time instance between to system::update callbacks.)
Is there anyway that I can avoid the distortion?
It seems that if I set the doppler factor to 0.01, then I don’t have any problem with listener moving, but I don’t get doppler effect as well. Seems that the movements of the camera are so fast that it ruins the doppler.
@GhPGame if the listener teleports, it’s effectively moving at near-infinite speed for a moment, which means it’s moving at near-infinite speed relative to the emitter. Since the amount of doppler applied to an event is dependant on the speed of its emitter relative to the listener, infinite doppler is the expected behaviour in that situation. If you don’t want extreme doppler, reduce the speed of your listener’s movement, feed FMOD Studio a false (or capped) velocity during that moment of teleportation, or disable doppler for that event.
- You must login to post comments
Please login first to submit.