views:

89

answers:

2

Pitch means "perceived frequency". Nice. But when I make pitch very low in OpenAL, sound plays a lot of times longer. If I make it very high, sound plays very short but with high frequency. For me, logically the consequence of making slower or faster.

Or is pitch != speed?

A: 

It's relatively easy to very pitch and rate together, since all you need to do is very the rate at which you play back samples. If you play samples back at half their intended rate then pitch will be halved and the sound will come out at half speed (think about a tape deck running at the wrong speed). Conversely playing samples back faster than intended will increase pitch and make everything faster.

You can vary pitch and rate independently, but it takes a lot more processing to do this, typically using some kind of analysis and re-synthesis algorithm (e.g. PSOLA for speech).

Paul R
is rate some AL property on the source?
dontWatchMyProfile
No - I was just trying to explain the underlying concepts of rate and pitch and how they are related when playing back sampled audio
Paul R
+1  A: 

Paul R has a pretty good answer, but I'd like to expand on it a bit. If you think of the sound as a series of pulses (and it kind of is), then a higher pitch will have more pulses per second (higher frequency) and a lower pitch will have fewer (lower frequency). To lower the pitch of an existing sound, you have to spread those pulses out (make them further apart from each other). As a result, the duration of the sound will increase because you haven't reduced the number of pulses, you've just made them further apart (fewer per second). The opposite happens if you try to increase the pitch: the pulses are closer together, thus making the sound shorter in duration.

If you want the duration to remain constant regardless of changes to the recorded pitch, you have to either throw information away (lower pitch) or manufacture information (higher pitch). This is where the fancy processing comes in. What can be safely discarded? What can be safely duplicated or constructed?

jadero
So I would have to interpolate samples?
dontWatchMyProfile
*"you have to either throw information away (lower pitch) or manufacture information (higher pitch)"* - erm, wouldn't that be the other way around?
BlueRaja - Danny Pflughoeft
@ mystify: Yes, for those cases where you want to raise the pitch while keeping the duration constant. I'm guessing that this is seriously non-trivial if you actually want a high quality output.
jadero
@BlueRaja: If you are lowering the pitch but maintaining the duration, you will have to throw away information. To continue with the terminology I used above, the number of pulses during the allotted period of time must be reduced (i.e. frequency lowered). If you are sticking to a fixed length of time, then you will have to throw away some of the pulses. It's probably way more complicated than that to implement an algorithm that produces good quality output.
jadero