iOS: Setting Up a Basic Voice Processing I/O Audio Unit — Swift

If you’re one of the unlucky folks that needs to work with Apple’s AudioToolbox and the AudioUnit API, let me try to make your life a little bit easier. Apple’s lack of documentation and working examples make development with these tools a literal via crucis. Through a lot of trial-and-error, I managed to figure out how to set up a Voice Processing I/O audio unit in Swift.

This code also works to setup any other audio unit, you just need to replace the values for component type, subtype, and all other parameters based on the constants described in their poor “documentation”, which is located here.

With no further to say, here’s the code. In the sample, I also show how to set some of the unit’s properties like Automatic Gain Control and Bypass Voice Processing.

Hope it helps you out in your quest with working with AudioToolbox and the AudioUnit API with Swift. Happy coding 👨🏻‍💻

Image credit: Apple, Inc.