[Openal] AL_POSITION affects Doppler Shift

Tristan Grimmer tri at tactile3d.com
Wed Nov 15 23:17:29 PST 2006


The doppler effect is not independent of position.  Imagine a fire truck 
moving towards you and passing you.  The truck maintains a constant 
velocity the whole time, however the pitch shift switches sign when it 
passes.  we-woo we-woo we-woo (passes) weeee-woooo weeee-woooo weeee-woooo

--tristan

Tim Mahrt wrote:
> I'm currently working with Doppler Shifts and I've run into a bit of a
> problem that has confused me.
>
> According to the formula in the OpenAL 1.1 Spec, the position of a
> source has no effect with the doppler effect--however, I was playing
> around with some code that was referenced on a newsgroup somewhere,
> altest.cpp where I derived the following:
>
> //carSirenZPos oscillates between 15 and -15
>     alDopplerFactor(4.f);
>     alSource3f(soundSource, AL_VELOCITY, 10.0, 0.0f, 0.0f);
>     alSource3f(soundSource, AL_POSITION, (float) carSirenZPos / 10, 
> 0.3f, 0.f);   
>
> When the position is positive, regardless of whether its increasing or
> decreasing, the f' > f.  When the position is negative, f' < f.
>
> But I thought the doppler effect was independent of position?  Did I
> do something wrong?
>
> Also, the listener sits at (0, 0, 0) and doesn't move--the only thing
> that changes is the soundSource.
>
> An executable of my code can be found here if that helps:
> https://netfiles.uiuc.edu/tmahrt2/shared/OpenGL/OpenAL/OpenAL%20Test.zip
>
> Just extract all of the contents of the file and run the exe.  "z" on
> the keyboard plays the sound with looping.  "x" plays it just once.
>
> Thanks,
> Tim
> _______________________________________________
> Openal mailing list
> Openal at opensource.creative.com
> http://opensource.creative.com/mailman/listinfo/openal
>
>


More information about the Openal mailing list