iDevGames Forums
OpenAL - Varying Pitch (for an engine sound) - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: OpenAL - Varying Pitch (for an engine sound) (/thread-2310.html)



OpenAL - Varying Pitch (for an engine sound) - SethWillits - Oct 11, 2008 06:43 PM

Using OpenAL, have any of you done any work to vary the pitch of a looping sound to mimic an engine running at different speeds?


OpenAL - Varying Pitch (for an engine sound) - Skorche - Oct 11, 2008 08:01 PM

Yeah, it's easy. There is a source property you can use to set the relative pitch.

Code:
alSourcef(source, AL_PITCH, 1.0f)



OpenAL - Varying Pitch (for an engine sound) - SethWillits - Oct 11, 2008 09:36 PM

And changing that in real-time at any point when a source is playing, (not just on the boundaries of a loop, for instance) doesn't lead to any popping sounds or nastiness?


OpenAL - Varying Pitch (for an engine sound) - SethWillits - Oct 12, 2008 12:29 PM

Got around to trying it myself now. It works fine, even while a source is playing. Yay!


OpenAL - Varying Pitch (for an engine sound) - FrazAli - Aug 17, 2009 06:29 AM

I have been trying to use AL_PITCH to change the pitch of car engine sound.
It is changing the pitch but the effect is very abnormal; it is not realistic at all.

Is there any suggestion from you on how do i change the pitch so that it mimics the engine sound going up and down as the speed increases or decreases respectively in a smooth way.

I will be very thankful for any sample codes and tutorials to accomplish this task.

Thanks in advance.