3.1 KiB
Lyrebird
Lyrebird is a native macOS audio synthesis framework written in Swift. Users write Swift code that implements the Generator and Synthesizer protocols against the Lyrebird engine — there is no separate scripting language. The framework handles Core Audio I/O, a pre-allocated bus memory system, and a node tree for ordering signal evaluation. The design is informed by 20+ years of SuperCollider practice, adapted to Swift idioms and a single-process architecture.
Development follows an interpret-then-compile workflow: sketch and perform in the Swift REPL with Lyrebird loaded, then graduate working code to a Swift Package project for compiled, optimized execution.
Locked Decisions
| Decision | Choice |
|---|---|
| Implementation language | Swift |
| Platform | macOS 15+ (requires Synchronization.Atomic for SPSCQueue) |
| Swift tools version | 6.0 (required for macOS 15 platform target) |
| Audio I/O | Direct Core Audio (kAudioUnitSubType_HALOutput) — no AVAudioEngine |
| NRT rendering | NRTDriver — fixed-duration tight loop, ExtAudioFile AIFF/WAV output; event-driven stop is a stretch goal |
| Execution model | Interpreted (REPL) → compiled (Swift Package) |
| Bus system | Pre-allocated, SC convention (128 audio / 4096 control) |
| Block size | Configurable at engine init |
| Testing | Swift Testing framework — no Xcode Playgrounds |
| REPL | Swift REPL + LineNoise |
| Hot reload | Interpret-then-compile |
| Inter-file modularity | Swift Package module system |
| Package targets | Lyrebird (library), LyrebirdDemo (executable smoke test), LyrebirdTests (test) |
SuperCollider Lineage
The designer has 20+ years of SC experience. SC concepts map to Lyrebird as follows:
| SuperCollider | Lyrebird |
|---|---|
| UGen | Generator protocol |
| SynthDef / Synth | Synthesizer protocol |
| Group | Group (node tree ordering) |
| Audio/control bus | Pre-allocated bus memory |
In / Out UGen |
In / Out generators |
| sclang | Swift |
| scsynth | SynthesisEngine |
Document Index
| Doc | Topic |
|---|---|
docs/00-working-order.md |
Phased implementation sequence |
docs/engine/synthesis-engine.md |
SynthesisEngine, Core Audio AUHAL |
docs/engine/bus-system.md |
Bus memory model, In/Out |
docs/engine/scheduling.md |
Sample-accurate scheduling, SPSCQueue, sub-block splitting |
docs/protocols/generator.md |
Generator protocol hierarchy |
docs/protocols/synthesizer.md |
Synthesizer protocol, node tree |
docs/signal-flow/signal-flow.md |
DAG evaluation, block processing |
docs/tooling/repl.md |
REPL, LineNoise, hot-swap |
docs/tooling/project-system.md |
Swift Package model, CLI |
docs/stdlib/generators.md |
Built-in generator library |
docs/ui/gui-system.md |
Native SwiftUI GUI, parameter binding, control windows |
Legacy Reference
legacy/Lyrebird/LyrebirdSynth/Lyrebird/ — a working prototype from ~10 years ago. Good source for: ValidGeneratorInput protocol pattern, operator overloading approach, sine table oscillator, envelope curve math, delay interpolation. Do not copy verbatim — modernize to Swift concurrency, add Core Audio integration, expand test coverage.