AudioUnit Version 3 Test App

GitHub Repo for this project

I haven’t posted in quite awhile. I’ve been working on v3 AUs lately and because this stuff is sort of tangential to what I’m doing with MIDI, I’m posting this publicly on github.

Please note that in order to get this to do anything useful you have to build the Apple AudioUnit v3 Demo synth and effect.

Here are some notes I made while I was making the project:

Create (nondocument) app, no storyboard.

Add AUTestWindowController with XIB
Switch to using a windowcontroller with

var auTestWindowController: AUTestWindowController!

func applicationDidFinishLaunching(_ aNotification: Notification) {
auTestWindowController = AUTestWindowController(windowNibName: “AUTestWindowController”)

Make sure you delete the window from the original MainMenu.xib

In WindowController XIB add three buttons

– Show Synth
– Show Effect
– Play (key equivalent Return)

Add IBAction ‘play’ bound to Play button
Add IBOutlet and IBAction for showSynthButton and showSynth (and bind accordingly)
Add IBOutlet and IBAction for showEffectButton and showEffect (and bind accordingly)

Add NSPopover/View Controller to WindowController XIB but delete the ViewController.

Bind Popover to WindowController as IBOutlet

Fiddle with Window dimension info so it appears properly on the screen.


Create NSObject subclass AUController. There’s a lot of code and it’s on the github repo:

Looking at setupSynth, I’m honestly not too clear on the whole strongSelf/weak self thing. I think Apple’s example code has a reference cycle in OSXAUv3Host in a similar circumstance (the AVAudioUnit.instantiate call). However, I think it works.

When feeding MIDI to an AudioUnit that can accept it you hae have to do it via the audioUnit’s scheduleMIDIEventBlock. I culled that away into a property.

So the next step is to attach the synth AU to the engine, and then to the engine’s mainMixerNode.


One semi-gotcha is the au’s requestViewController property. This is defined in an AUAudioUnit extension in AUViewController.h. This file will be #included if you import CoreAudioKit to files that refer to it (in this case AUTestWindowController).

Leave a Reply

Your email address will not be published. Required fields are marked *