Add iPod Equalizer effect using AVPlayer

后端 未结 2 1825
猫巷女王i
猫巷女王i 2021-02-09 21:00

We are developing a music app using AVPlayer, which is at the end stage. Everything was on track until we started working on iPod Equalizer applying effects to

2条回答
  •  鱼传尺愫
    2021-02-09 21:34

    You can most certainly accomplish various EQ effects using an AUGraph and AudioUnits in iOS.

    Basically, you would insert the effect between the source and the output of your audio. You can use things like a multichannel mixer to have some control, or other, more complex audio units in an AUGraph to obtain much greater control over the Audio. Using AudioUnits, if you needed to, you could even get at each audio sample in the buffer. This would require you to re-code some of your audio processing, but it would certainly allow you to apply the EQ effects.

    You could use the iPod Effects Unit, which is exactly the same unit as iOS uses to apply those effects when it plays music. This will should give you the closest match for effect sounds, since it is exactly the same AudioUnit.

    From Apple:

    iPod EQ Audio Unit Description (scroll down the page)

    Type Definition for Audio Unit Subtype

    The iPod EQ unit provides a set of predefined tonal equalization curves as factory presets. Obtain the array of available EQ settings by accessing the audio unit’s kAudioUnitProperty_FactoryPresets property. You can then apply a setting by using it as the value for the kAudioUnitProperty_PresentPreset property.

    You would insert this unit between your audio source (be it a file, microphone input, etc.) and your audio output (speakers, headphones, etc.). You can then apply any of the iPod EQ effects to your audio.

    Here's the attributes to use when specifying the iPod EQ Unit:

    kAudioUnitType_Effect

    kAudioUnitSubType_AUiPodEQ

    kAudioUnitManufacturer_Apple

    Also, be sure to check out the Audio Unit Hosting Guide from Apple. This page contains links to much of the other relevant documentation that you will want to reference.

提交回复
热议问题