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

后端 未结 1 1455
逝去的感伤
逝去的感伤 2021-02-06 05:15

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

相关标签:
1条回答
  • 2021-02-06 05:55

    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 ...;
    }
    
    0 讨论(0)
提交回复
热议问题