[Openal] How to vary the speed of sound
Chris Robinson
chris.kcat at gmail.com
Sun May 18 14:28:32 PDT 2008
On Sunday 18 May 2008 04:43:05 am wassim_belhadj at topnet.tn wrote:
> I would like to know how to vary the speed of sound using OpenAL.
The global speed of sound is defined by the attribute AL_SPEED_OF_SOUND:
alSpeedOfSound(343.3f);
speedofsound = alGetFloat(AL_SPEED_OF_SOUND);
Note that this only affects sounds playing with a doppler effect.
> For example, at a click on a button the sound is played with a faster
> speed from the position where the action was made.
The speed of sound, however, doesn't sound like your problem here. This makes
me think you either have a pitch set on the source, or velocities set on the
source and/or listener (causing doppler to be applied). Or perhaps you called
alBufferData with the incorrect frequency.
Note also that there are some issues if you're using AL_SOURCE_RELATIVE for
the sound. It seems some implementations don't make the velocity relative, as
defined in the 1.1 spec (particularly, the old Windows version, and by
extension OpenAL Soft, and I think the SI). I can probably fix this for
OpenAL Soft, but I don't know about other implementations.
More information about the Openal
mailing list