How to use kAudioUnitSubType_LowShelfFilter of kAudioUnitType_Effect which controls bass in core Audio?

断了今生、忘了曾经 提交于 2019-12-03 03:13:09

Update

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


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

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
};

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

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.


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 ...;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!