How to achieve Equilizer Setting for iPhone in Audio Player

前端 未结 4 813
北荒
北荒 2021-02-10 18:21

How can i set the bass, or other kind of Equalizer programatically for my iphone app? Are there ready frameworks or methods available?? Kindly please provide a reference..

4条回答
  •  暖寄归人
    2021-02-10 18:56

    If you build your audio playback as an AudioUnit graph, you should be able to use the built-in iPod EQ AudioUnit, with presets like those in the iPod application. Have a look at this example which will hopefully help you understand how to do this.

    As you're reading the code, make sure you understand that Audio Units are nodes in a graph, where the audio signal flows through the graph by means of callbacks, and that each node can modify the signal on it's way towards the output node (essentially the speaker.) So what you do is you load your file into memory, and you then feed the PCM (sound sample) data to the audio unit in a callback that you have specified. When the buffer is empty, the callback will be invoked and you can fill it up.

    The linked example sets up a mixer node, an output node and the equalizer node, connects them together, and starts playing a number of sound files after having loaded them into memory.

    If the iPod EQ AU doesn't do what you want it to do, you can build your own AudioUnit and replace it later, but that requires some DSP knowledge. You may also be able to find some open-source equalizers out there that have been implemented as Audio Units (which is a common format on the Mac platform for effects used in music production tools for example.)

提交回复
热议问题