OpenAL - Varying Pitch (for an engine sound)

⌘-R in Chief
Posts: 1,260
Joined: 2002.05
Post: #1
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?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #2
Yeah, it's easy. There is a source property you can use to set the relative pitch.

Code:
alSourcef(source, AL_PITCH, 1.0f)

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
⌘-R in Chief
Posts: 1,260
Joined: 2002.05
Post: #3
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?
Quote this message in a reply
⌘-R in Chief
Posts: 1,260
Joined: 2002.05
Post: #4
Got around to trying it myself now. It works fine, even while a source is playing. Yay!
Quote this message in a reply
Nibbie
Posts: 1
Joined: 2009.08
Post: #5
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenAL looping sound problem Gillissie 0 3,863 Sep 16, 2010 12:31 AM
Last Post: Gillissie
  OpenAL - sound disappearing Madrayken 3 4,684 Jan 19, 2010 03:22 AM
Last Post: Madrayken
  sound file formats in OpenAL unknown 7 7,819 Nov 6, 2005 12:50 AM
Last Post: Skorche