AudioQueueLevelMeterState 出现在 AudioQueueBuffer 中的什么位置?

发布于 2024-10-30 23:02:45 字数 335 浏览 2 评论 0原文


我想做一些像节拍切片这样的事情。

我可以设置一个计时器来定期获取 AudioQueueLevelMeterState。

但是,似乎没有办法将查询 AudioQueueLevelMeterState 的时间与 AudioQueueBuffer 的内容联系起来?

例如,假设我的缓冲区长度为 1 秒。我运行一个计时器,每秒查询仪表状态 60 次。 0.5 秒后我就达到了我想要的水平。因此,我想从获得级别开始(即剩余的 0.5 秒)获取该音频缓冲区的一部分。

有什么想法吗?可以说有什么方法可以在缓冲区中完成这一切吗?

非常感谢任何建议。

非常感谢,xj

I want to do something like beat slicing.

I can set up a timer to get the AudioQueueLevelMeterState periodically.

However, there doesn't seem to be a way to relate the time that the AudioQueueLevelMeterState is queried with the contents of the AudioQueueBuffer?

For example, let's say that my buffer is 1 second long. I run a timer that queries the meter state 60 times per second. At 0.5 seconds I get the level I want. Consequently, I want to take a chunk of that audio buffer from the point I get the level onwards, i.e. the remaining 0.5 seconds.

Any ideas? Any ways to do it all in the buffer so to speak?

Any advice much appreciated.

Many thanks, xj

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

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

发布评论

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

评论(2

氛圍 2024-11-06 23:02:45

最终解决了这个问题。我放弃了使用 AudioQueue 作为录制音频的方式,转而使用 AudioUnit。 AudioQueue 是如此困难,最终我不得不认真质疑它是否是用于我想做的事情的正确 API。在一些论坛上,人们说 AudioUnit 很难使用,但说实话,在我经历过 AudioQueue 的所有操作之后,AudioUnit 非常简单。

无论如何,回答我自己的问题。最终我必须解决计量和录音的同步问题,因此我放弃了计时器机制来对电平进行采样。我仍然使用 AudioQueue,但只是为了计量。在录音回调中,我从 AudioQueue 中获取 kAudioQueueProperty_CurrentLevelMeter。录制回调接收帧计数,这样我就可以将帧位置与仪表样本完美同步。

Got this sorted eventually. I ditched AudioQueue as a way to record the audio and instead went for an AudioUnit. AudioQueue was so difficult that eventually I had to seriously question if it was the correct API to use for what I wanted to do. In some forums people had said that AudioUnits were hard to work with, but to be honest after everything I'd been through with AudioQueue, AudioUnit was pretty straightforward.

Anyway, to answer my own question. Eventually I had to resolve synchronisation issues with the metering and recording, so I ditched the timer mechanism to sample the levels. I still use AudioQueue but just for the metering. In the recording callback I grab the kAudioQueueProperty_CurrentLevelMeter from the AudioQueue. The recording callback receives the frame count, so that way I can perfectly synchronise the frame position with the meter sample.

瀟灑尐姊 2024-11-06 23:02:45

查看 Apples Speak Here 示例项目。他们有类似的设置,你也许可以破解。

Check out Apples Speak Here example project. They have something similar set up that you maybe be able to hack.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文