A basic AU Effect

How to install Apple’s Audio Unit templates then build and test a basic minimal AU Effect

  1. You will need the latest Core Audio SDK for your version of OSX. The SDK will be installed with XCode Tools, and you can download updates from here.
  2. Get a 4 character (32 bit) creator code at Apple’s Creator Code Registration page.
  3. Install the Audio Unit Effect Templates from ADC. Install in
    "~/Library/Application\ Support/Apple/Developer\ Tools/Project\ Templates/"

    or

    "/Library/Application\ Support/Apple/Developer\ Tools/Project\ Templates/"
  4. Now, before you try making a new project in XCode, you will need to make a copy of the Resources folder in the Audio_Unit_Effect folder of the template, otherwise you will get one error as per below (copied from the build transcript in XCode):
/Users/.../English.lproj: No such file or directory

To fix this error, copy the folder English.lproj from the folder:

/Library/Application Support/Apple/Developer Tools/Project Templates/Audio_Units/Audio_Unit_Effect

or

~/Library/Application Support/Apple/Developer Tools/Project Templates/Audio_Units/Audio_Unit_Effect

to

/Library/Application Support/Apple/Developer Tools/Project Templates/Audio_Units/Audio_Unit_Effect/Resources

or

~/Library/Application Support/Apple/Developer Tools/Project Templates/Audio_Units/Audio_Unit_Effect/Resources

…and restart XCode. Now you can start a new project as follows:

Start XCode and make a new Audio_Unit_Effect project (menu: File > New Project). Now build the project. You will get a n error reminding you to use your new Manufacturer code in your Audio Unit - to uniquely identify the AU from those of other manufacturers. The following #error line and comments remind you to change the #define at the end of this code block:

#error A unique component subtype & manufacturer needs
        to be defined
// Mac OS X identifies your plug-in (components) through
        its signature, a unique four-character sequence.
// Registering your creator code with Apple helps ensure
        that your creator code is unique and
// will not conflict with the signature of any other
        application or plug-in.
// Please visit
        http://developer.apple.com/datatype/creatorcode.
        to register your creator code.

//~~~~~~~~~~~~~~  Change to your creator code ~~~~~~~~~//
#define wwdc05_template_example_COMP_MANF       'Demo'

Change the creator code to your unique registered code, then remove the #error line to prevent the build error.

There is one last error to fix in the Audio_Unit_Effect template before you get an error free build. If you build the project at the point we have reached, you will get the following link error:

/usr/bin/ld: Undefined symbols:
CAVectorUnit::CheckVectorUnit()
CAVectorUnit::sVectorUnitType
collect2: ld returned 1 exit status

To prevent this, you need to add links to the following existing files to the Source folder of the project:

/Developer/Examples/CoreAudio/PublicUtility/CAVectorUnit.cpp

and

/Developer/Examples/CoreAudio/PublicUtility/CAVectorUnit.h

Do this by control-clicking on the Source folder in XCode Groups & Files pane, and selecting the Add > Existing Files… context menu. The default dialog settings will add a link to the files as required.

One last thing: You may wish to rename the Build Configurations from “Development” and “Deployment” to “Debug” and “Release” as per XCode 2.1 standards. To do this select the menu: Project > Edit Project Settings, and use the Rename button at the bottom of the Configurations tab, for both configs. See XCode 2.1 Release Notes.

Now you can successfully build the project. The next stage is to test the basic Volume Control AU that you have created using the template. To do this you either need to copy the freshly built component bundle itself into either /Library/Audio/Plug-Ins/Components or the current user’s ~/Library/Audio/Plug-Ins/Components folder, or you can copy an alias (ie a symlink) of the component into either of these folders. You could create a new Copy Files Build Phase for your Target in the XCode project to automatically copy the built component as part of the build process (control-click on the red Targets icon in the Groups & Files pane, and select Add > New Build Phase > New Copy Files Build Phase).

Now we shall test the resulting Audio Unit Effect using the AU validation tool: auval. First you can list all installed Audio Units using the command:

auval -a

Then you can validate the desired unit, by copying the three codes that represent the unit and using them as follows:

auval -v aufx Pass Demo

Note that currently auval only validates mono AUs, or others that pass from N channels input to N channels output. It does NOT validate NxM units.