iOS/iPhoneOS Equalizer with libsox - making it a .framework

So i've spent the past few weeks with an issue i've been having for quite a while now: Equalization on iOS.

I've tried everything, from AudioUnit, OpenAL and FMod. None of which worked.

  • AudioUnit needs formulas which look like they've found on a ship at Roswell..
  • OpenAL seems to have all of it's effects ripped out by Apple..
  • FMod requires you to know it's own language..

Frustrating.. i even thought about having a Webservice do the job, but that seemed useless for offline usage.

I once again checked out all available options when one thing seemed ideal, sox! You may know sox if you've played around with Audiofile conversion on Linux, especially PBX Setups which require you to convert you favorite MP3s into something your PBX can play.

Anyway, i checked out all libraries, ffmpeg, libav and libsox. Since the command line version of sox delivered nice test results with my equalization attempts, i started to try to get the current release to compile on SDK 4.3. I had massive troubles at first, but then i found this post.

I have modified the script to make it work plus have it create you a SOX.framework:

Please excuse my lazyness, i didn't cleanup the script, but it works. ;)

It autocompiles the lib for armv6, armv7 and i386, therefore making one big massive framework for all 3 architectures using Apple's lipo utility (which is included in xcode).

With this script placed in your sox source folder you simply have to run it.

What you finally need to do is to add the SOX.framework and two headerfiles sox.h and soxstdint.h to your Xcode Project.

If you want all files seperately, i took the liberty to adjust the script's output path to $sox-srcdir/iOS-<Version>-<arch>. Every file needed will be in those folders from withint your sox sourcedir:

  • iOS-4.3-i386/
  • iOS-4.3-armv6/
  • iOS-4.3-armv7/

Having that done, you can do an #import "sox.h" in your project and start working on some effects.

In my next post i will be covering how to do those effects.

Flattr me!

Tell your friends!