Posts tagged 'Mac OS X'

2011

This part wraps up our tutorial on building an audio effect as Audio Unit for OS X Lion. Though it is not the craziest plug-in you'll ever built, it made us learn some basis about DSP programming, as well it introduced the XCode environment for developing Audio Units. Of course, there are numerous improvements we could do on this project. In this article, I'll make some remarks about my work and  also a few issues I met during development. Last but not least, we recall the GitHub repository URL for you to grab the code and make our own version.

Debugging an Audio Unit is not as straightforward as debugging a Cocoa application, because your freshly coded component doesn't show up until you insert it in a bus of your favorite DAW. In this article, we review some methods for automating your debugging sessions using XCode 4. Concerning the DAW, our preference goes for a free host available in the CoreAudio SDK: AU Lab. In only a few steps, you will be able to setup some breakpoints and look into all potential devilish bugs as if you were debugging a simple Cocoa application.

In this part of the tutorial, we are going to design a Cocoa UI in order to draw the spectrum graph computed by our unit, in which we'll create widgets so as to configure the FFT analysis. Why using Cocoa? Well, for two reasons: I didn't want to introduce a too complex API in this tutorial (such as OpenGL), and I would like to show you how to mix C++ and Objective-C in the same XCode project. Don't worry, it doesn't bother if you're not experienced with Objective-C: we'll make a straightforward use of it and we'll clearly explain all the interactions between our GUI classes and our C++ code.

We briefly introduced the FFT part of the Accelerated Framework in Part I of this tutorial. We are now going to focus on the vDSP library and create the C++ class responsible for doing the spectral analysis work of our input samples. We want to keep it simple, with a few public methods, however we would like to perform FFT analysis on different frame sizes. So, one of our challenges is to design a circular buffer as member variable, which is a common pattern in audio programming.

It's time to build up our first audio unit. For a start, I propose to create a spectrum analyzer which will help us to understand how we can realize basic sound analysis using the Fourier Transform. While this might sound scarily complex for non mathematician developers, you will smoothly read this tutorial if we first explain a few concepts about sound processing, without of course entering too deeply into the maths...

Apple usually takes care of their developers community.  Whereas they lately delivered an impressive update of their Xcode IDE with tons of new features (read a [cool  review here](http://pilky.me/view/28)), they surprisingly removed the project template for creating Audio Units. Nevertheless, let's see how to create a new unit from scratch...