8

does anyone know how to make a simple EQ audio unit (3 bands - low, mid, hi) with iOS ? I know how to add an iPod EQ Audio Unit to my AU Graph. But it only give you access to presets and I need proper control of the EQ.

I've looked around for some tutorials or explanations but no luck.

Thanks.

André

Nik Reiman
  • 39,067
  • 29
  • 104
  • 160
André
  • 671
  • 1
  • 7
  • 21

5 Answers5

14

The iPhone doesn't exactly support custom AudioUnits. Or, more precisely, it doesn't allow you to register an AudioUnit's identifier so you could load it in an AUGraph. You can, however, register a render callback, get raw PCM data, and process it accordingly. This is how I've implemented effect processing in the iPhone.

Nik Reiman
  • 39,067
  • 29
  • 104
  • 160
  • 1
    This is indeed what I do. Would you have any example of a simple EQ code to point me to by any chance ? Thanks. – André Oct 30 '10 at 09:05
  • 1
    The best resource for sample DSP code is musicdsp.org. Here you can find a sample 3-band EQ: http://musicdsp.org/archive.php?classid=3#236 Don't forget to mark an answer as correct if you find it helps solve your problem. ;) – Nik Reiman Oct 30 '10 at 12:46
  • 1
    People looking for example code on how to implement an equalizer in iOS should really check this out: https://github.com/bartolsthoorn/NVDSP/blob/master/Examples/Equalizer.mm This will save you quite some time figuring out the posts at musicdsp.org, since I already implemented the best filter method possible. – sougonde Mar 05 '13 at 12:58
6

I would highly recommend you to use my NVDSP library, it allows easy audio DSP'ing, including the filters required to make an equalizer in iOS: https://github.com/bartolsthoorn/NVDSP

sougonde
  • 3,438
  • 3
  • 26
  • 35
  • I'm quite certain it will answer your question, let me know if you have any problems with the library. I also added the pieces of code required to make a 10 band equalizer: https://github.com/bartolsthoorn/NVDSP/blob/master/Examples/Equalizer.mm Also, I see you've been trying to figure out CoreAudio lately, I recommend you to take a look at Novocaine, it might just be all you need: http://alexbw.github.com/novocaine/ You most likely already found out that CoreAudio is rather complex. – sougonde Oct 21 '12 at 16:10
3

I've written two Blog-Entries about this issue and how to get equalization on iOS working. It uses the libsox library (cross compiled).

First post explains how you build libsox: http://uberblo.gs/2011/04/iosiphoneos-equalizer-with-libsox-making-it-a-framework

The second explains how to use it: http://uberblo.gs/2011/04/iosiphoneos-equalizer-with-libsox-doing-effects

please up the answer if it helped you! thanks!

Franz Bettag
  • 437
  • 2
  • 8
  • You're first link got cut off. The correct link is http://uberblo.gs/2011/04/iosiphoneos-equalizer-with-libsox-making-it-a-framework The script works great btw. Thanks for posting that. – Ben Baron Jul 02 '11 at 04:46
  • 1
    You might be interested in my library I wrote for iOS to do all sorts of filters in just a few lines of code: https://github.com/bartolsthoorn/NVDSP – sougonde Oct 06 '12 at 17:07
2

you can implement using same classes as used in speak here sample code ,only to generate properties like peak powervalue and average powervalue you need to do calculation in callback function and it works.

1

This ancient Motorola AN2110 App Note explains how to write your own fully controllable 10-band equalizer (and 10 bands of real-time audio IIR filters will consume well under 10% of an iPod Touch's ARM CPU). Not sure about how to integrate this with an AU Graph, but this type of EQ can easily be integrated into PCM Audio Queue buffer callbacks.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153