Is pitch and speed the same thing in audio programming context?

拟墨画扇 提交于 2019-12-04 10:03:08

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?

Paul R

It's relatively easy to vary pitch and rate together, since all you need to do is vary 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).

Using the algorithm you're describing in OpenAL, pitch = f(speed), and speed = f'(pitch).

It is possible to vary these parameters somewhat independently using a different algorithm. There are a variety of algorithms for doing this.

The algorithms in question can exist in the frequency domain (vocoder, frequency domain convolution) or in the time domain (PSOLA, WSOLA, extended WSOLA) or in both at the same time (hybrid models that use time-domain methods for transient sections and vocoder methods for tonal sections).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!