Tuesday, 19 November 2013

Audio Units on Mac OS X Mavericks (10.9) and Xcode 5

It's been a while since I've posted something here, but every once in a while I manage to figure out something the internet does not yet have a (coherent) answer for, so I thought it might worthwhile to add this to the accumulated knowledge of the swarm...

It all began with me being curious how Amplifier modeling works. So I started reading A Review of Digital Techniques for Modeling Vacuum-Tube Guitar Amplifiers by Jyri Pakarinen and David T. Yeh. The next step, of course, was to see and try if I can implement some of their simpler examples. It turns out, there is a nice tutorial available. However, it is quite dated and there have been many changes since this was written and so it can not be used directly anymore.

There is a long list of different instructions on what to do and how to get certain functionality back, but I was not able to get any of them to work on the most recent system, namely OS X Mavericks and Xcode 5. Eventually, I discovered Apple's audio unit examples which include the example from the tutorial, but adapted and ready for Mavericks. So, here's how you get into Audio Unit Programming (executive summary: get the right examples and set everything to 64-bit mode):

  1. Let's assume you already have the most recent version of Xcode installed and working.
  2. Get the latest Audio Tools, see https://developer.apple.com/library/ios/qa/qa1731/_index.html for instructions.
  3. Install the Audio Tools, be sure to untick the Open in 32-bit mode option for them (via File -> Get Info).
  4. Download the Audio Unit examples from https://developer.apple.com/library/mac/samplecode/sc2195/Introduction/Intro.html and put them somewhere convenient for you.
  5. Read https://developer.apple.com/library/mac/documentation/MusicAudio/Conceptual/AudioUnitProgrammingGuide/Introduction/Introduction.html. It's a bit outdated, but will probably still give you the main ideas. In particular, this tutorial for building a simple effect is helpful. You can find the code for the tutorial in the examples you just downloaded in the StarterAudioUnitExample folder.
  6. If you want to test your plugin, copy, e.g., the Tremolo.compononent file generated from the tutorial to the folder
    ~/Library/Audio/Plug-Ins/Components
    Then open the terminal and type in
    auval -64 -a
    and see if
    aufx TREM DEMO
    is listed. If so, type
    auval -64 -v aufx TREM DEMO
    to validate the audio unit.
  7. Finally, start AU Lab (remember to start it in 64-bit, i.e., having the 32-bit mode unticked as described in a previous step) and test your plugin as described in the tutorial.
  8. Have fun playing around with Audio Units and come up with some nice new effects, instruments, etc.

Please note, I just started with this and so I'm far from an expert. I don't claim this is the right or best way to do this, but this was the simplest way to get compiling Audio Unit code for me.