AudioUnit 可以实现实时变调吗?
我正在 AudioUnit 的帮助下播放两个动态生成的正弦波音调。我需要为用户提供一个 UISlider,帮助他动态更改音调。我无法使用 AudioUnits 设置音调,请提供一些代码片段以在 AudioUnits 的帮助下更改音调。
I am playing two sine wave tone generated on the fly with the help of AudioUnit. I need to give the user a UISlider which helps him to change the pitch of the tone on the fly. I am stuck in setting pitch for the tone with AudioUnits, please provide some code snippet to change the pitch with help of AudioUnits.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改生成的波形(例如正弦波)的音调,并将其复制到 AudioUnit 回调缓冲区中,当然是可能的。具体如何更改它取决于您如何生成正弦波。如果通过表查找,则可以更改表步长并进行插值。如果通过调用 sinf() 函数,您可以更改函数调用中每个样本的增量相位变化,以匹配与滑块位置的某种关系。然而
,术语“实时音调变换”通常指另一种不同且更复杂的DSP处理,例如用于组合时间音调修改的相位声码器。你指的是哪一个?
Changing the pitch of a generated waveform, such as a sine wave, being copied into an AudioUnit callback buffer, is certainly possible. Exactly how to change it depends on how you are generating the sine wave. If by table look up, then you can change the table step size and interpolate. If by calling the sinf() function, you can change the delta phase change per sample in the function call to match some relationship with your slider position. etc.
However the term "real-time pitch shifting" often refers to another different and more complicated DSP process, such as a phase vocoder used for combined time-pitch modification. Which do you mean?