如何使用kAudioUnitType_Effect的kAudioUnitSubType_LowShelfFilter来控制核心音频中的低音? [英] How to use kAudioUnitSubType_LowShelfFilter of kAudioUnitType_Effect which controls bass in core Audio?

查看:817
本文介绍了如何使用kAudioUnitType_Effect的kAudioUnitSubType_LowShelfFilter来控制核心音频中的低音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还有一个与 BASS 相关的问题。我已经发布了这个问题 我们怎么办?控制iPhone中的音乐低音 ,但不会得到你应该得到的人们那么多的关注。但现在我已经做了一些搜索并阅读了 Core AUDIO 。我有一个示例代码,我想与您分享这里的人是下载它的链接 iPhoneMixerEqGraphTest 。在这段代码中看一下我所看到的是开发人员使用Apple在iPod中给出的预置均衡器。让我们看一些代码片段:----

i'm back with one more question related to BASS. I already had posted this question How Can we control bass of music in iPhone, but not get as much attention of your people as it should get. But now I have done some more search and had read the Core AUDIO. I got one sample code which i want to share with you people here is the link to download it iPhoneMixerEqGraphTest. Have a look on it in this code what i had seen is the developer had use preset Equalizer given by iPod in Apple. Lets see some code snippet too:----

// iPodEQ unit
CAComponentDescription eq_desc(kAudioUnitType_Effect, kAudioUnitSubType_AUiPodEQ, kAudioUnitManufacturer_Apple);

kAudioUnitSubType_AUiPodEQ的作用是从iPod的均衡器中获取预设值,然后在Xcode中返回我们的数组可以在PickerView / TableView中使用,并可以设置任何类别,如低音,摇滚,舞蹈等。这对我来说是无助的,因为它只返回均衡器类型的名称,如低音,摇滚,舞蹈等,因为我只想实现低音,并希望在UISLider上实现它。

What kAudioUnitSubType_AUiPodEQ does is it get preset values from iPod's equalizer and return us in Xcode in an array which we can use in PickerView/TableView and can set any category like bass, rock, Dance etc. It is helpless for me as it only returns names of equalizer types like bass, rock, Dance etc. as i want to implement bass only and want to implement it on UISLider.

要在滑块上实现Bass,我需要设置值,以便我可以设置最小值和最大值,以便可以更改移动滑块上的低音。

To implement Bass on slider i need values so that i can set minimum and maximum value so that on moving slider bass can be changed.

获得所有这些后,我开始阅读Core Audio的音频单元框架的类,并得到了这个
之后我开始搜索低音控制并得到这个

After getting all this i start reading Core Audio's Audio Unit framework's classes and got this after that i start searching for bass control and got this

所以现在我需要实现这个 kAudioUnitSubType_LowShelf过滤即可。但现在我不知道如何在我的代码中实现这个枚举,以便我可以控制低音作为书面文档。即使是Apple也没有写过我们如何使用它。 kAudioUnitSubType_AUiPodEQ 此类别返回一个数组,但 kAudioUnitSubType_LowShelfFilter 类别未返回任何数组。使用 kAudioUnitSubType_AUiPodEQ 此类别时,我们可以使用数组中的均衡器类型,但我们如何使用此类别 kAudioUnitSubType_LowShelfFilter 。任何人都可以以任何方式帮助我吗?这将是非常值得赞赏的。

So now i need to implement this kAudioUnitSubType_LowShelfFilter. But now i don't know how to implement this enum in my code so that i can control the bass as written documentation. Even Apple had not write that how can we use it. kAudioUnitSubType_AUiPodEQ this category was returning us an array but kAudioUnitSubType_LowShelfFilter category is not returning any array. While using kAudioUnitSubType_AUiPodEQ this category we can use types of equalizer from an array but how can we use this category kAudioUnitSubType_LowShelfFilter. Can anybody help me regarding this in any manner? It would be highly appreciable.

谢谢。

推荐答案

更新

虽然它已在iOS标头中声明,但实际上iOS上并不提供低架AU。

Although it's declared in the iOS headers, the Low Shelf AU is not actually available on iOS.

低架的参数与iPod EQ不同。

The parameters of the Low Shelf are different from the iPod EQ.

参数声明并记录在`AudioUnit / AudioUnitParameters.h':

Parameters are declared and documented in `AudioUnit/AudioUnitParameters.h':

// Parameters for the AULowShelfFilter unit
enum {
  // Global, Hz, 10->200, 80
  kAULowShelfParam_CutoffFrequency = 0,

  // Global, dB, -40->40, 0
  kAULowShelfParam_Gain = 1
};

因此,在创建低架AU后,使用 AudioUnitSetParameter <配置其参数/ code>。

So after your low shelf AU is created, configure its parameters using AudioUnitSetParameter.

您可以尝试的一些初始参数值为120 Hz(kAULowShelfParam_CutoffFrequency)和+6 dB(kAULowShelfParam_Gain) - 假设您的系统重现低音好吧,你的低频内容应该是两倍大。

Some initial parameter values you can try would be 120 Hz (kAULowShelfParam_CutoffFrequency) and +6 dB (kAULowShelfParam_Gain) -- assuming your system reproduces bass well, your low frequency content should be twice as loud.


你能告诉我怎么样我可以使用这个kAULowShelfParam_CutoffFrequency来改变频率。

Can u tell me how can i use this kAULowShelfParam_CutoffFrequency to change the frequency.

如果一切配置正确,这应该是所需的全部:

If everything is configured right, this should be all that is needed:

assert(lowShelfAU);
const float frequencyInHz = 120.0f;
OSStatus result = AudioUnitSetParameter(lowShelfAU,
                                        kAULowShelfParam_CutoffFrequency,
                                        kAudioUnitScope_Global,
                                        0,
                                        frequencyInHz,
                                        0);
if (noErr != result) {
  assert(0 && "error!");
  return ...;
}

这篇关于如何使用kAudioUnitType_Effect的kAudioUnitSubType_LowShelfFilter来控制核心音频中的低音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆