Files
Lyrebird/docs/auv3-extension-guide.md
T

8.4 KiB
Raw Blame History

AUv3 Extension Guide

How to ship a SynthesizerBase subclass as an AudioUnit v3 (.appex) plugin loadable by Logic, GarageBand, AUM, Loopy Pro, Ableton (via Bridge), and any other AUv3 host.

Demos/LyrebirdAUv3Demo/ is the working reference. Copy that template, swap in your synth, change the bundle IDs / component codes, build.

Prerequisites

  • macOS 15+ with Xcode 16+ (project targets MACOSX_DEPLOYMENT_TARGET = 15.0).
  • Apple Developer Team ID (any free or paid tier works for local testing; distribution needs paid).
  • Your synth is a SynthesizerBase subclass with one or more @LiveParam properties.
  • You understand the LyrebirdAudioUnit wrapper — see Sources/Lyrebird/Lyrebird.docc/AUv3.md.

Step-by-step

1. Duplicate the demo

cp -R Demos/LyrebirdAUv3Demo Demos/MyPluginDemo

Rename everything under Demos/MyPluginDemo to your plugin name. The xcodeproj internally references by GUID, not by path, so the folder rename is safe.

2. Replace the synth

In Demos/MyPluginDemo/LyrebirdFMExtension/LyrebirdFM.swift, replace the LyrebirdFM class with your own SynthesizerBase subclass.

Stereo output is recommended (mirror the same source onto bus 0 and bus 1) — most hosts expect stereo from aumu instruments.

3. Wire up the AU subclass

In LyrebirdFMAudioUnit.swift, change:

  • The class name (matching the principal class reference in Info.plist).
  • The makeSynthesizer() body to return your new synth.
  • The parameterMetadata() table to match your @LiveParam properties' actual bounds and units. Names must match the property names exactly — Mirror discovery is name-keyed.

4. Update the Info.plist

Change in LyrebirdFMExtension/Info.plist:

  • NSExtensionAttributes → AudioComponents:
    • name: Manufacturer: PluginName (this is what hosts display).
    • description: short blurb shown in some hosts.
    • subtype: 4-character code unique to your plugin (e.g. MFM1). Must differ from LBFM / any other AU you ship.
    • manufacturer: 4-character code unique to your organisation (e.g. ACME). Reuse the same code for every AU you ship.
  • NSExtensionPrincipalClass: must read <NewExtensionModuleName>.<NewViewControllerClassName>.

5. Update bundle identifiers

In Xcode's build settings (or directly in project.pbxproj), change:

  • Container app PRODUCT_BUNDLE_IDENTIFIER: com.yourorg.myplugindemo
  • Extension PRODUCT_BUNDLE_IDENTIFIER: com.yourorg.myplugindemo.MyExtension — must be a strict prefix match of the container.

The extension's AudioComponentBundle Info.plist entry is set to $(PRODUCT_BUNDLE_IDENTIFIER) so it follows automatically.

6. Signing

Set DEVELOPMENT_TEAM to your Apple Developer Team ID on both targets (Xcode → Target → Signing & Capabilities). Automatic signing takes care of provisioning profiles.

For local-only testing you can build with CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO from xcodebuild, but App Store / Notarization require real signing.

7. Build + run the container app once

Building the container app embeds the .appex into MyPluginDemo.app/Contents/PlugIns/. Running the app once is what registers the extension with the system AU registry (via LaunchServices → pluginkit). Without that step no host will find your AU.

8. Validate with auval

auval -v aumu <subType> <manufacturer>

For the demo: auval -v aumu LBFM RLZS.

Look for * * PASS in the output. If you see "didn't find the component", the registration step (7) did not complete — re-run the container app from Xcode, wait a moment, retry.

9. Host smoke test

Drop the plugin into Logic Pro / GarageBand:

  1. Track → New Software Instrument.
  2. Channel strip → Instrument slot → AU Instruments → your manufacturer → your plugin name.
  3. Open the plugin window. The host's generic UI shows the parameter list (until you populate the SwiftUI view).
  4. Move sliders, automate parameters, save / load presets — all work through the AUParameter + fullState plumbing.

Common pitfalls

"Build settings: missing SWIFT_USE_INTEGRATED_DRIVER override"

On Xcode 26+ the explicit-module-build system breaks SPM dynamic framework module resolution: Xcode scans every target's dependencies before any module is built, and Lyrebird ships as a dynamic library product (type: .dynamic in Package.swift) whose module map does not yet exist at scan time. Set SWIFT_USE_INTEGRATED_DRIVER = NO on every target to fall back to the classic sequential driver, which resolves modules at compile time. The demo's project.pbxproj does not bake this in — add it in your project's User-Defined build settings or pass it on the command line. Revert when Apple fixes the explicit-module scanner to generate C target module maps before dependent Swift targets' dependency scans.

"Swift package target 'Lyrebird' is linked as a static library"

Only link the LyrebirdUI SPM product, not Lyrebird directly. LyrebirdUI declares Lyrebird as a transitive dependency, so the binary surface area is identical, but the static-vs-dynamic conflict disappears. The demo's LyrebirdFMExtension target links LyrebirdUI only — and that is enough; the Lyrebird module is still importable.

"AU instantiated but no audio"

  • Confirm the AU host is sending audio render calls (some hosts only render when a MIDI event has fired). The base demo ships no MIDI input handler — output is silent until you parameter-automate amp up AND a way to gate notes exists (which you have to build, since the demo's LyrebirdFM is a free-running oscillator that always sounds at the carrier frequency × amp).
  • Confirm parameterMetadata() names match your @LiveParam property names exactly.
  • Confirm both stereo channels receive output (output(bus: 0, ...) output(bus: 1, ...)).

"auval crashes / hangs"

Almost always the principal class is wrong. The NSExtensionPrincipal Class Info.plist string must read <ModuleName>.<ClassName> where the module name matches the extension target's PRODUCT_NAME (which is $(TARGET_NAME) by default, so the target name itself).

Aux output + sidechain input

  • Multi-output busses — override LyrebirdAudioUnit/lyrebirdOutputBusses with an array of LyrebirdAUBusSpec. Hosts (Logic, AUM, MainStage) expose each bus separately in their routing UI.
  • Multi-input busses — override LyrebirdAudioUnit/lyrebirdInputBusses for sidechain inputs. AUInput.Audio(busIndex: 0, channel: ch) reads main, busIndex: 1 reads sidechain.
  • Engine bus layout — outputs first, then inputs, each block contiguous; SynthesisEngine.auOutputBusOffsets / auInputBusOffsets maps AU bus index → engine bus index.
  • Single-bus subclasses are untouched — defaults derive from the existing lyrebirdOutputChannels / lyrebirdInputChannels class vars.

MIDI input, SwiftUI UI, presets, effect-type AU

  • MIDI input — au.midiHandler closure receives parsed MIDIMessage from the host's AURenderEvent chain. For polyphony use LyrebirdAUVoicePoolBinding with a VoicePool.
  • SwiftUI parameter UI — drop a LyrebirdSynthView into your AU view controller; it walks the synth's Mirror for @UIParam slots and renders one ParameterKnob per slot.
  • Source-slot preset serialisation — conform your slot-source generators to LyrebirdAUPresetCodable and register them with LyrebirdAUPresetSourceRegistry before instantiating the AU.
  • Effect-type AU (aufx) — override LyrebirdAudioUnit/lyrebirdInputChannels to a positive value and read host audio in build() via AUInput/Audio.

Out of scope

  • Aux output / sidechain busses — see the dedicated section above.
  • MIDI 2.0 UMP — AU base reports MIDI 1.0 protocol.
  • Per-sample AU parameter automation ramps — host writes still apply at the next sub-block boundary via the standard atomic ramp path.
  • App Store distribution / notarization workflow — outside Lyrebird's scope; follow Apple's standard Distributing your app on the App Store guide.

See also