# LyrebirdAUv3Demo Reference AUv3 plugin built on Lyrebird's `LyrebirdAudioUnit`. Ships **Realized Sound: LyrebirdFM** — a two-operator FM synthesizer — as an `aumu` instrument loadable in any AUv3 host (Logic, GarageBand, AUM, Loopy Pro, etc.). Copy this directory as the starting point for your own Lyrebird-based AUv3 plugin. ## Layout ``` LyrebirdAUv3Demo/ LyrebirdAUv3Demo.xcodeproj Hand-written Xcode project (app + extension) LyrebirdAUv3Demo/ Container app target (.app) LyrebirdAUv3DemoApp.swift SwiftUI app entry — minimal ContentView.swift One-screen "installer" view Info.plist LyrebirdAUv3Demo.entitlements App sandbox LyrebirdFMExtension/ AUv3 extension target (.appex) LyrebirdFM.swift The two-op FM SynthesizerBase subclass LyrebirdFMAudioUnit.swift LyrebirdAudioUnit subclass (metadata + factory) LyrebirdFMAudioUnitViewController.swift AUViewController + AUAudioUnitFactory stub Info.plist AudioComponents (aumu / LBFM / RLZS) LyrebirdFMExtension.entitlements App-extension sandbox ``` ## Build ### From the command line ```bash xcodebuild \ -project Demos/LyrebirdAUv3Demo/LyrebirdAUv3Demo.xcodeproj \ -scheme LyrebirdAUv3Demo \ -configuration Release \ CODE_SIGN_IDENTITY="-" \ CODE_SIGNING_REQUIRED=NO \ CODE_SIGNING_ALLOWED=NO \ SWIFT_USE_INTEGRATED_DRIVER=NO \ build ``` `SWIFT_USE_INTEGRATED_DRIVER=NO` is the Xcode 26 workaround documented elsewhere in the Lyrebird build notes; it disables explicit-module-build so SPM dynamic-framework modules resolve correctly. The `CODE_SIGN_IDENTITY="-"` triple disables signing entirely for local builds — for distribution you must set `DEVELOPMENT_TEAM` to your Apple Developer Team ID and use `Automatic` signing. ### From Xcode 1. Open `LyrebirdAUv3Demo.xcodeproj`. 2. Pick the **LyrebirdAUv3Demo** scheme. 3. In each target's Signing & Capabilities tab, set your Team. The bundle ID `net.realizedsound.LyrebirdAUv3Demo` is a Realized-Sound placeholder — change to a prefix you own. 4. Add `SWIFT_USE_INTEGRATED_DRIVER = NO` under each target's Build Settings → User-Defined (or set it project-wide). Required on Xcode 26+. 5. **Build & Run** the container app once. This registers the embedded extension with the AU registry. ## Validate with auval After running the container app at least once so the extension is registered: ```bash auval -v aumu LBFM RLZS ``` A `PASS` summary is what you want. Common gotchas the wrapper already handles: - `latency` returns 0 (`LyrebirdAudioUnit.latency`). - `tailTime` returns 0 (instrument has no internal tail). - `parameterTree` is populated synchronously in `init`, so `auval` sees it before render. - `internalRenderBlock` returns `noErr` and writes valid samples. - `maximumFramesToRender` is honoured by `AUv3Driver` via ring sizing. If you see "Cannot get Component's Name strings" or "didn't find the component", the extension was not registered. Either the container app has not been launched yet, or `lsregister` did not pick it up. Re-run the container app from Xcode, then re-run `auval`. ## Smoke test in a host 1. **Logic Pro / GarageBand**: Track → New Software Instrument → AU Instruments → Realized Sound → LyrebirdFM. Play a few MIDI notes (this template ships no MIDI handler — the plugin instantiates and accepts parameter automation, but won't respond to note input until you wire `LyrebirdAudioUnit.midiHandler`; see [`AUv3.md`](../../Sources/Lyrebird/Lyrebird.docc/AUv3.md)). 2. **AUM / Loopy Pro** (iOS): same idea once the iOS variant of this demo lands. ## What's in the wrapper `LyrebirdFMAudioUnit` is the entire wrapper: ```swift public final class LyrebirdFMAudioUnit: LyrebirdAudioUnit { public override class func makeSynthesizer() -> SynthesizerBase { LyrebirdFM() } public override class func parameterMetadata() -> [String: LyrebirdAUParameterInfo] { [ "carrierFreq": .init(min: 20, max: 8000, unit: .hertz, displayName: "Carrier Freq"), "modRatio": .init(min: 0.25, max: 16, unit: .generic, displayName: "Mod Ratio"), "modIndex": .init(min: 0, max: 8, unit: .generic, displayName: "Mod Index"), "amp": .init(min: 0, max: 1, unit: .linearGain, displayName: "Output Amp"), ] } } ``` `LyrebirdAudioUnit` does the rest: parameter tree from `Mirror`, engine lifecycle, ring-buffered render, `fullState` save / restore. See [`Sources/Lyrebird/Lyrebird.docc/AUv3.md`](../../Sources/Lyrebird/Lyrebird.docc/AUv3.md) for the full API surface. ## Copying this template To ship your own AUv3 plugin: 1. Duplicate `Demos/LyrebirdAUv3Demo/` under a new name. 2. Replace `LyrebirdFM` with your own `SynthesizerBase` subclass. 3. Update `componentSubType` (4-char code, must be unique to your plugin) and `manufacturer` (your 4-char manufacturer code) in the extension's `Info.plist → NSExtension → NSExtensionAttributes → AudioComponents`. 4. Update `PRODUCT_BUNDLE_IDENTIFIER` in both targets' build settings to your own reverse-DNS prefix. 5. Replace `Realized Sound: LyrebirdFM` strings with your own manufacturer + plugin name. 6. Rebuild, run, `auval -v `. ## Not yet wired in this template The framework supports all of the following — this particular demo template just doesn't include them yet. Each is a follow-up exercise when copying the template: - MIDI note input — set `au.midiHandler` and dispatch via ``LyrebirdAUVoicePoolBinding``. - SwiftUI parameter UI in the view controller — drop in ``LyrebirdSynthView`` (see [`LyrebirdSynthView`](../../Sources/LyrebirdUI/LyrebirdSynthView.swift)). - Source-slot preset save/restore — conform any source generator to ``LyrebirdAUPresetCodable`` and register it. - Effect-type AU (`aufx`) — override ``LyrebirdAudioUnit/lyrebirdInputChannels`` and read host audio via ``AUInput/Audio``. - iOS container app target — duplicate the Mac app target and switch the platform. The demo deliberately ships the smallest cut that proves the wrapper loads and validates.