Files
Lyrebird/Demos/LyrebirdGUIDemo/README.md
T
josh ec72bd3a4c v2.4.1 release: scratchpad polish + demo cleanup
Maintenance release, no framework API changes.

Scratchpad: Kill All Sound (⌘K) rename, mode-switch desync fix,
code-completion prefix filtering restored (⌃Space Show Completions).
Demos: GUIDemo voices + CLI EventPattern BlipVoice moved into
Synthesizers/, EventPattern demo split into makeLead/makeBass, GUIDemo
doc drift fixed (conductor default). LyrebirdScratch gains a SwiftPM
package so the workspace shows it like GUIDemo (.xcodeproj kept for
distribution). Linux live-coding scratchpad documented.
2026-12-03 11:39:40 -08:00

64 lines
2.8 KiB
Markdown

<!--
README.md
Lyrebird
Copyright (c) 2026 Joshua Parmenter / realizedsound
SPDX-License-Identifier: MIT
-->
# LyrebirdGUIDemo — one GUI demo, two platforms
A live-controllable synth GUI that builds and runs from a single source tree on
**macOS** (AppKit + SwiftUI) and **Linux** (GTK4 + SwiftOpenUI). It is the
cross-platform counterpart to the richer, macOS-only `LyrebirdMacOSDemo` Xcode
project.
The split follows the "mostly in a package, thin entry points" shape:
| Piece | Where | Platform |
|---|---|---|
| Synths + views | `Sources/LyrebirdGUIDemoKit/` | shared — one source |
| App bootstrap | `Sources/LyrebirdGUIDemo/main.swift` | one `#if` (AppKit vs GTK4) |
The view bodies are written to the subset of the View DSL that SwiftUI and
SwiftOpenUI share, so there is **one** body per view — not a macOS copy and a
Linux copy. Both back ends bind the same core `@UIParam` / `UIParamNode` model,
so the controls, the oscilloscope, and the CPU meters are identical.
## Run it
```bash
swift run LyrebirdGUIDemo # event conductor (default)
LYREBIRD_DEMO=vector swift run LyrebirdGUIDemo # vector oscillator
LYREBIRD_DEMO=sine swift run LyrebirdGUIDemo # stereo sine tone
```
- **macOS** — no extra setup; a native window opens with live audio via Core Audio.
- **Linux** — needs `libgtk-4-dev` (GUI) and `libasound2-dev` + a sound device
(audio). Without a sound backend the window still opens and the controls work;
there is just no sound (`isLiveAudioAvailable` reports it, and the console says so).
## Open in an IDE
- **Xcode (macOS)** — open the folder (or `Package.swift`); Xcode treats it as a
SwiftPM package. Pick the `LyrebirdGUIDemo` scheme and Run. No `.xcodeproj` to
maintain — the package *is* the project.
- **VS Code (Linux)** — open the folder with the Swift extension
(`swiftlang.swift-vscode`); it picks up `Package.swift`. Run `LyrebirdGUIDemo`
from the test/run explorer or a terminal.
## What each demo shows
- **conductor** (default) — `ConductorDemoVoice` driven by an `EventConductor`:
start/stop the engine, then toggle a top and a bottom part, each entering on the
next beat and repeating while it runs, over a live oscilloscope. Showcases the
2.4.0 event system. Nothing plays until you start the engine and a part.
- **vector** — `VectorOscillatorUI`: an XY pad crossfades four corner wavetables
(sine / saw-ish / triangle / Hanning); frequency and amplitude knobs; a live
oscilloscope and CPU-load strip.
- **sine** — `SineToneUI`: a frequency slider, amplitude and pan knobs, a level
readout, the scope and CPU strip, and a static envelope plot.
Add a synth by dropping a `SynthesizerBase` subclass into
`LyrebirdGUIDemoKit/Synthesizers/` and a node-based view into `LyrebirdGUIDemoKit`,
then extend `DemoSelection` and the `demoContent()` switch in `main.swift`.