iOS 上的自定义 EQ AudioUnit

发布于 2024-10-22 04:24:36 字数 771 浏览 1 评论 0原文

iOS 上唯一的 AudioUnit 效果是“iTunes EQ”,它只允许您使用 EQ 预设。我想在

我遇到的音频图中使用自定义均衡器 这个问题关于这个主题,看到一个答案建议使用 渲染回调中的 DSP 代码。这看起来很有希望,人们似乎在各种平台上有效地使用它。然而,即使使用平坦的均衡器,我的实现也会产生大量噪音。

的“MixerHostAudio”类中的 20 行代码(全部一次提交):

这是我集成到 Apple 的“MixerHost”示例应用程序 noreferrer">https://github.com/tassock/mixerhost/commit/4b8b87028bfffe352ed67609f747858059a3e89b

关于如何让它工作的任何想法?还有其他整合 EQ 的策略吗?

编辑:这是我遇到的失真的一个例子(EQ平坦): http://www.youtube.com/watch?v=W_6JaNUvUjA

The only effect AudioUnit on iOS is the "iTunes EQ", which only lets you use EQ pre-sets. I would like to use a customized eq in my audio graph

I came across this question on the subject and saw an answer suggesting using this DSP code in the render callback. This looks promising and people seem to be using this effectively on various platforms. However, my implementation has a ton of noise even with a flat eq.

Here's my 20 line integration into the "MixerHostAudio" class of Apple's "MixerHost" example application (all in one commit):

https://github.com/tassock/mixerhost/commit/4b8b87028bfffe352ed67609f747858059a3e89b

Any ideas on how I could get this working? Any other strategies for integrating an EQ?

Edit: Here's an example of the distortion I'm experiencing (with the eq flat):
http://www.youtube.com/watch?v=W_6JaNUvUjA

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

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

发布评论

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

评论(2

负佳期 2024-10-29 04:24:36

EQ3Band.c 的代码中,滤波器系数在未初始化的情况下使用。 init_3band_state 方法仅初始化增益和频率,但系数本身 - es->f1p0 等未初始化,因此包含一些垃圾值。这可能是输出不良的原因。

In the code in EQ3Band.c, the filter coefficients are used without being initialized. The init_3band_state method initialize just the gains and frequencies, but the coefficients themselves - es->f1p0 etc. are not initialized, and therefore contain some garbage values. That might be the reason for the bad output.

铃予 2024-10-29 04:24:36

这段代码似乎在不止一种方面是错误的。

数字滤波器通常由滤波器系数表示,它们是常数,滤波器内部状态历史(因为在大多数情况下,输出取决于历史)和滤波器拓扑,这是用于计算给定输入和滤波器(coeffs + 状态历史)的输出的算术。在大多数情况下,当然,在过滤音频数据时,如果您向输入提供 0,您预计会在输出处获得 0。

您链接到的代码中的问题:

  • 每次调用处理方法时,滤波器系数都会更改

    <块引用>

    es->f1p0 += (es->lf * (样本 - es->f1p0)) + vsa;

  • 输入样本通常乘以滤波器系数,而不是相加。它没有任何物理意义 - 样本和滤波器系数甚至没有相同的物理单位。

  • 如果输入 0,则输出不会得到 0,而只是一些没有任何意义的值。

我建议你寻找另一个代码 - 另一个选项是调试它,这会更难。

此外,您还可以阅读有关数字过滤器的内容:

http://en.wikipedia.org/wiki /Digital_filter

https://ccrma.stanford.edu/~jos/filters/< /a>

This code seems wrong in more then one way.

A digital filter is normally represented by the filter coefficients, which are constant, the filter inner state history (since in most cases the output depends on history) and the filter topology, which is the arithmetic used to calculate the output given the input and the filter (coeffs + state history). In most cases, and of course when filtering audio data, you expect to get 0's at the output if you feed 0's to the input.

The problems in the code you linked to:

  • The filter coefficients are changed in each call to the processing method:

    es->f1p0 += (es->lf * (sample - es->f1p0)) + vsa;

  • The input sample is usually multiplied by the filter coefficients, not added to them. It doesn't make any physical sense - the sample and the filter coeffs don't even have the same physical units.

  • If you feed in 0's, you do not get 0's at the output, just some values which do not make any sense.

I suggest you look for another code - the other option is debugging it, and it would be harder.

In addition, you'd benefit from reading about digital filters:

http://en.wikipedia.org/wiki/Digital_filter

https://ccrma.stanford.edu/~jos/filters/

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