音频队列 kAudioQueueParam_Pitch

发布于 2024-11-13 07:32:36 字数 294 浏览 10 评论 0原文

OS 10.6 下的音频队列服务文档现在包含音调参数:

kAudioQueueParam_Pitch 用于对音频队列的播放进行音调变换的音分数,范围为 -2400 到 2400 音分(其中 1200 音分对应于一个音乐八度音程。) 仅当启用时间/音调处理器时,此参数才可用。

同一文档的其他部分仍然说音量是唯一可用的参数,并且我找不到任何对上述时间/音调处理器的引用。

有谁知道这指的是什么?直接向参数写入值对播放没有影响(尽管不会抛出错误)。同样,写入音量设置也有效。

没有苹果的支持,一如既往的令人沮丧。

The documentation for Audio Queue Services under OS 10.6 now includes a pitch parameter:

kAudioQueueParam_Pitch
The number of cents to pitch-shift the audio queue’s playback, in the range -2400through 2400 cents (where 1200 cents corresponds to one musical octave.)
This parameter is usable only if the time/pitch processor is enabled.

Other sections of the same document still say that volume is the only available parameter, and I can't find any reference to the time/pitch processor mentioned above.

Does anyone know what this refers to? Directly writing a value to the parameter has no effect on playback (although no error is thrown). Similarly writing the volume setting does work.

Frustrating as usual with no support from Apple.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

十雾 2024-11-20 07:32:36

这仅在 iOS 7 之前的 OSX 上可用。如果您查看 AudioQueue.h,您会发现它仅在 iOS 7 上有条件地可用。[注意:在重读时,我发现您指的是 OS X,而不是 iOS,但是希望以下是跨平台的]

另外,您需要在设置time_pitch算法之前启用time_pitch队列,并且只有Spectral算法支持pitch(都支持rate)

result = AudioQueueNewOutput(&(pAqData->mDataFormat), aqHandleOutputBuffer, pAqData,
                             0, kCFRunLoopCommonModes   , 0, &(pAqData->mQueue));
// enable time_pitch
UInt32 trueValue = 1;
AudioQueueSetProperty(pAqData->mQueue, kAudioQueueProperty_EnableTimePitch, &trueValue, sizeof(trueValue)); 
UInt32 timePitchAlgorithm = kAudioQueueTimePitchAlgorithm_Spectral; // supports rate and pitch
 AudioQueueSetProperty(pAqData->mQueue, kAudioQueueProperty_TimePitchAlgorithm, &timePitchAlgorithm, sizeof(timePitchAlgorithm));

This is only available on OSX until iOS 7. If you look at AudioQueue.h you'll find it is conditionally available only on iOS 7. [note: on re-reading I see you were referring to OS X, not iOS, but hopefully the following is cross-platform]

Also, you need to enable the queue for time_pitch before setting the time_pitch algorithm, and only the Spectral algorithm supports pitch (all of them support rate)

result = AudioQueueNewOutput(&(pAqData->mDataFormat), aqHandleOutputBuffer, pAqData,
                             0, kCFRunLoopCommonModes   , 0, &(pAqData->mQueue));
// enable time_pitch
UInt32 trueValue = 1;
AudioQueueSetProperty(pAqData->mQueue, kAudioQueueProperty_EnableTimePitch, &trueValue, sizeof(trueValue)); 
UInt32 timePitchAlgorithm = kAudioQueueTimePitchAlgorithm_Spectral; // supports rate and pitch
 AudioQueueSetProperty(pAqData->mQueue, kAudioQueueProperty_TimePitchAlgorithm, &timePitchAlgorithm, sizeof(timePitchAlgorithm));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文