Files
Lyrebird/RELEASES.md
T
josh 24ea32e47c v2.2.0 release: live-parameter ramp origin primed at synth add
A @UIParam/@LiveParam value assigned after construction but before the first render
is now delivered flat on the first block instead of ramping from the property-
declaration default (fixes e.g. a NoiseGate restored from saved rig state latching
open and ignoring its threshold). Backed by a new internal-facing
LiveParameterValue._primeRampOrigin() (default no-op, source-compatible); live
changes after start still ramp. See RELEASES.md for the full behavior-change note.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-03 12:25:29 -08:00

942 lines
47 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Releases
Notable changes per release. Newest first.
This project follows semantic versioning: a minor bump (1.0 → 1.1) adds
functionality in a backward-compatible way.
---
## 2.2.0 — Live-parameter ramp origin primed at synth add
A small-but-behavioral release. One fix to how `@UIParam` / `@LiveParam` values
are delivered on a synth's first rendered block, plus the internal hook that
backs it. The public API is source-compatible — the one new protocol member is
internal-facing and ships with a default implementation — so this is drop-in
over 2.1.x, but the delivery change is observable and is called out below.
**Fix — a parameter set before the first render is now delivered flat.** When a
value is assigned to an `@UIParam` / `@LiveParam` *after the synth is
constructed but before it first renders* — most commonly when restoring saved
state onto a freshly built synth — the parameter is now delivered as a flat
block at that value from sample 0. Previously the first rendered block ramped
from the property-declaration default up to the assigned value over one
(sub-)block, because the property-wrapper setter advances the atomic target but
not the interpolation origin, which stayed at the construction-time default.
For most parameters that one-block (~a few ms) glide was benign. For a value
feeding a decision stage it was not: a `Schmidt` trigger fed a threshold that
swept up from the default would latch on the transient and, if the steady signal
sat inside the hysteresis band, never reset — e.g. a `NoiseGate` restored from a
saved rig would open on load and ignore its threshold. Priming the origin at add
removes the sweep.
Mechanically: `SynthesizerBase`, as part of the `Mirror`-based live-parameter
auto-registration it already runs at add time (`rebuildGraph()`, main thread,
before the node is visible to the RT thread), now also primes each parameter's
ramp origin to its current value via a new `LiveParameterValue._primeRampOrigin()`.
`ParameterNode` and `UIParamNode` implement it; external conformers inherit a
no-op default, so nothing is source-broken. A re-add (`remove` → change value →
`add`) likewise re-primes to the then-current value.
**Behavior change to be aware of.** Two deliveries changed, both toward "the
value you set before starting is the value you get":
- A value assigned between construction and first render is **flat** on block
one, not a ramp from the declaration default. Code that (knowingly or not)
relied on that opening glide will no longer see it. If you want an opening
ramp, drive the parameter from a source/envelope or change it after start.
- A synth removed, re-assigned while out of the tree, then re-added starts
**flat at the new value** rather than gliding from the value it last rendered.
Live changes made **while the synth is running** are unchanged — they still ramp
per (sub-)block from the last rendered value, as before. The source-slot /
crossfade path is unaffected (the source overwrites the origin each block).
Pinned by `LiveParamRampOriginTests` (flat delivery for `@UIParam` and
`@LiveParam`, live-change-still-ramps, remove/change/re-add, and source-slot
non-interference).
---
## 2.1.1 — Delay-click fix + internal consolidation
A patch release: one audible bug fix in the delay/comb/allpass family, plus a
large internal code-quality pass. No public API is removed or changed — the few
new types are internal-facing scaffolding — so this is drop-in over 2.1.0.
**Fix — allpass fractional-delay click under modulation.** The allpass
interpolation mode (`.allpass`) of `DelayLine`, `CombFilter`, `AllpassFilter`,
and `DelayLineFeedback` mishandled its recursive filter state when a modulated
delay crossed an exact integer-sample boundary: `AllpassFilter` and
`DelayLineFeedback` produced an audible click (a sample-to-sample step several
times the surrounding signal), and the four generators disagreed on the
behavior. All four now record the integer-delayed sample as the interpolator's
previous output, which is click-free and consistent. Only `.allpass`
interpolation under a *modulated* delay was affected; `.none` / `.linear` /
`.cubic` and static delays were already correct. Guarded by a per-generator
regression suite.
**Internal consolidation (no behavioral change).** Roughly 160 duplicated
call-site patterns and several near-identical generator shells were folded into
shared helpers and base classes — block-boundary input reads, the per-sample
phase wrap, the scalar mul/add fold, the held-constant control fill, the
single-input math operators (`UnaryMathBase`), the chaotic oscillators'
render body, the spectral FFT-size guards, the spectral feature analysers
(`SpectralFeatureControlBase`), and the ~96 block-rate control generators that
bypass sub-blocking (now a `BlockRateControlGenerator` marker protocol, which
also drops an unused ~4 KB per-instance buffer allocation). Output is
bit-identical across the generator library; the full test suite is unchanged.
---
## 2.1.0 — Swift 6.4 modernization
An internal-hardening release adopting modern Swift on the 6.4 toolchain. No
behavioral change, and the public surface stays source-compatible.
**Typed throws.** The closed-error-set APIs now declare their concrete error
type instead of untyped `throws`, so a caller gets an exhaustive `catch` with no
downcast: OSC (`OSCDecodeError` / `OSCServerError`), MIDI (`MIDIError`, on both
the CoreMIDI and ALSA backends), the engine's bus / config / parameter setters,
the public node-add surface — `add` / `schedule` — (`EngineAddError`), and the
self-contained file codecs (`WavFileError` / `RF64WriterError` /
`SpectralFileError`). Narrowing an API from `throws` to `throws(E)` is
source-compatible — existing `try` call sites are unaffected. The WAV and
Spectral codecs gain an `.ioFailure` case that funnels an underlying
`FileHandle` failure into the typed error.
**Concurrency & memory hardening (internal).** NSLock-guarded state in the
scheduling and MIDI classes moved into `Mutex<State>` for compiler-enforced lock
discipline, and the Spectral/FFT scratch owners moved from hand-managed raw
pointers to a `~Copyable` `RTScratchBuffer` (compiler-guaranteed single free, no
ARC on the handle). No API or behavioral change.
---
## 2.0.0 — Linux support
The major release: Lyrebird now runs on **Linux**, in addition to macOS and iOS.
Everything on Apple platforms is unchanged — the entire Linux surface is additive
— but the port is large enough to warrant a major version.
**Cross-platform core.** The engine, the full generator library, the CLI, the
REPL, offline render (NRT → WAV), and the interpreted graph DSL build and run on
Linux (Ubuntu 24.04, swift.org toolchain). A new `LyrebirdDSP` module provides
portable `vDSP`/`vv` implementations so the DSP that relied on Accelerate runs
off Apple; the portable FFT, biquad, and vector paths are golden-value verified.
CI covers x86_64; ARM64 (e.g. a Parallels VM) is a supported dev target.
**Live audio, MIDI, OSC on Linux.**
- **`ALSAAudioDriver`** — live full-duplex audio over ALSA. `makeDefaultAudioDriver()`
resolves to it on Linux; build with `LYREBIRD_DISABLE_ALSA=1` on boxes with no
sound stack.
- **ALSA-sequencer MIDI** and a **POSIX-UDP OSC** transport, replacing the
CoreMIDI / Network.framework backends off Apple.
- A **portable WAV codec** (`WavFileWriter` / `WavFileReader`) for soundfile I/O
and DiskIn where AudioToolbox is unavailable (CAF/AIFF/AAC stay Apple-only).
**GTK4 GUI.** `LyrebirdUI` is now one cross-platform module — SwiftUI on Apple,
GTK4 (on the SwiftOpenUI backend) on Linux. Ported controls: knob, slider, label,
button, XY pad, plus the oscilloscope, envelope, and CPU-status views, with
standalone windows and live mouse input (`Mouse.X` / `Mouse.Y` / `Mouse.Click`).
Every control bound to a `@UIParam` node stays in sync — the same parameter model
the macOS controls use.
**Live-coding scratchpad on Linux.** The `LiveCompile` live-coding subsystem runs
on Linux: a GtkSourceView editor with Swift highlighting and a gutter, `Ctrl+Space`
sourcekit-lsp completion, run-fresh / run-additive / line-evaluation, a Stop-audio
panic button, a live oscilloscope, and a native File menu (New / Open… / Save /
Save As…) with `Ctrl+N/O/S` accelerators and `GtkFileDialog` save/load.
**Behavioral change (all platforms).** `SynthesisEngine.stop()` now tears down the
node tree and unbinds every non-persistent synth it was hosting, so a stop → re-add
of the same instance needs no intervening `processBlock`.
See `LINUX_README.md` for Linux setup, build, and usage.
---
## 1.7.1 — Neural-amp model importer
A patch release. One backward-compatible addition:
- **`ProteusModelImporter`** — loads a GuitarML **Proteus / NeuralPi** model JSON (single-layer
LSTM capture) into a `NeuralAmpModel` for `LSTMAmp`. The state-dict tensors map straight onto
`NeuralAmpModel`'s layout (PyTorch gate order; `skip` → residual); unsupported topologies and
inconsistent tensor shapes throw. Model files are user-supplied — none are bundled (GuitarML
models are GPL-3.0). A binary NAM `.nam` importer remains future work.
---
## 1.7.0 — Amp-modeling core: tone stack, triode stage, neural amp
A minor release. Three new, backward-compatible generators — the DSP core for guitar-amp
modeling (consumed by the ShoeGaze 2.0 amp pedals):
- **`ToneStack`** — passive Fender/Marshall/Vox tone stack (bass/mid/treble). Models the
interactive RC network as a whole (Yeh & Smith closed form → bilinear → 3rd-order IIR), so the
controls load each other exactly as on the real amp. Model-selectable via `ToneStackModel`.
- **`TriodeStage`** — tube-style preamp gain stage: a biased asymmetric `tanh` soft-clip (grid
bias → even-harmonic warmth) evaluated at 2×/4× oversampling, with an output coupling
(DC-block) high-pass. A musically-voiced static waveshaper; a full wave-digital triode remains
future work.
- **`LSTMAmp`** + `NeuralAmpModel` — real-time neural amp-capture inference (single-layer LSTM,
GuitarML Proteus / NeuralPi topology), pure Swift, RT-safe (pre-allocated weights, no
render-thread allocation). `NeuralAmpModel` is a `Codable` weight container with a validating
decoder. An importer for external NAM `.nam` / Proteus JSON files is planned for a later release.
All three are additive; existing code is unaffected.
---
## 1.6.4 — `LookAheadLimiter` release time decoupled from look-ahead
A patch release. One backward-compatible library addition.
`LookAheadLimiter` gains a `releaseTime` parameter, independent of
`lookAheadTime`:
```swift
LookAheadLimiter(in:maxAmplitude:lookAheadTime:releaseTime:sampleRate:)
```
Previously the gain-release one-pole coefficient was derived from
`lookAheadTime` (default 5 ms), so the release was fast enough to modulate the
gain within a single cycle of a low-frequency signal — audible as distortion on
sustained bass when the limiter was driven hard. `releaseTime` (default
`0.050`) is now a separate control, read per block from a `ValidGeneratorInput`
so it can be driven by a live parameter / knob. The look-ahead window size and
the no-overshoot ceiling guarantee are unchanged.
The new parameter has a default, so existing call sites are source-compatible.
---
## 1.6.3 — Notarization-ready `macos-ui-xcode` template
A patch release. Project-scaffolding fixes; no library API changes.
The `macos-ui-xcode` template (`lyrebird new MyApp --template macos-ui-xcode`)
now scaffolds a distributable, notarization-ready macOS performance app out of
the box:
- **Entitlements shipped and wired** — `<name>.entitlements` grants
`com.apple.security.device.audio-input` (wired via `CODE_SIGN_ENTITLEMENTS`
in both build configs), plus `NSMicrophoneUsageDescription` in `Info.plist`.
Under the Hardened Runtime (already enabled) the OS hard-kills the process the
moment the AUHAL input bus opens without these. They are harmless for
output-only synths — no permission prompt fires until input is actually used.
The app is deliberately **unsandboxed**: a live-performance app needs
unrestricted audio-device / file / MIDI / OSC access the App Sandbox gates.
- **Compiles under Swift 6** — fixed a latent actor-isolation error that kept
the generated project from building: `NoteController` (calls the engine's
`@MainActor add(_:)`) and `AppDelegate` (constructs the main-actor controller
and synth) are now `@MainActor`. Xcode app templates are excluded from the
`swift build` CI matrix, so this had never been compile-checked; it is now
verified end-to-end with `xcodebuild`.
A normal Lyrebird app needs no module-bundling: Lyrebird is statically linked
from SPM source. (The swiftmodule / `LyrebirdC` bundling in `LyrebirdScratch`,
added in 1.6.2, is unique to its runtime `swiftc` scratchpad.)
---
## 1.6.2 — Live Scratch: distributable / notarized app
A patch release. Live Scratch packaging only; no library API changes.
A notarized, moved-off-the-build-machine `LyrebirdScratch.app` could not compile
snippets — the Swift scratchpad shells out to `swiftc`, and the modules it needs
(`LyrebirdSynth`, `LyrebirdLiveCompile`, and the `LyrebirdC` C-shim they depend on)
lived only in the dev build tree. Two failures surfaced in order — `no such module
'LyrebirdSynth'`, then `missing required module 'LyrebirdC'`. Both are now fixed:
- **Swiftmodules bundled** — a build phase copies the Lyrebird `.swiftmodule`s into
`Resources/LyrebirdArtifacts/Modules` inside the app, and the live compiler adds
that directory to its import search path.
- **LyrebirdC module relocatable** — the SPM *source* `module.modulemap` (relative
header path, so map + `include/` are self-contained) is bundled into
`LyrebirdArtifacts/LyrebirdC.build/`, and staging copies relative-header module
maps verbatim so the Clang module resolves from the bundle rather than the
absolute dev path Xcode's generated map baked in.
Verified end-to-end: a snippet compile resolving modules **only** from the app
bundle typechecks clean, and the notarized app runs the Swift scratchpad on a
machine without the dev tree.
---
## 1.6.1 — Live Scratch: Swift-toolchain detection
A patch release. Live Scratch quality-of-life; no library API changes.
The Swift scratchpad compiles snippets by shelling out to `swiftc` (Xcode or the
Command Line Tools). Previously a missing toolchain only surfaced as a compile
error in the console on the first Run. Now the app **detects it at launch** and
shows an alert with actionable install guidance:
- **Install Command Line Tools** — launches Apple's own installer (`xcode-select
--install`); the app never installs anything silently.
- **Get Xcode** — opens the App Store product page.
The check is alert-only and never blocks the app: the **Graph DSL mode needs no
toolchain**, so it's the zero-install fallback. (`ToolchainProbe` classifies the
toolchain into available / missing-developer-tools / missing-swiftc / missing-SDK,
with injectable resolvers so the missing states are unit-tested without uninstalling
anything.)
---
## 1.6.0 — Soundfile format expansion
A minor release. Backward-compatible — the existing default write formats are
unchanged; everything here is additive. One shared `AudioFileFormat` enum now
drives every writer (`LyrebirdBuffer.write`, offline `NRTDriver` renders, and the
real-time `DiskOut.Audio` recorder).
### New — audio output formats
```swift
// Buffer / NRT / DiskOut (PCM):
try buf.write(to: url, format: .wavInt24, sampleRate: 48000) // 16 / 24-bit WAV
try buf.write(to: url, format: .aiffFloat32, sampleRate: 48000) // AIFF-C float
try buf.write(to: url, format: .cafFloat32, sampleRate: 48000) // CAF (uncapped)
// Files past 4 GB — RF64/BW64, keeps the .wav extension:
try buf.write(to: url, format: .rf64Float32, sampleRate: 96000)
try buf.write(to: url, format: .rf64Int24, sampleRate: 96000)
// Compressed .m4a — offline writers only (LyrebirdBuffer.write / NRTDriver):
try buf.write(to: url, format: .aacHigh, sampleRate: 44100) // AAC ~256 kbps
try buf.write(to: url, format: .aacMedium, sampleRate: 44100) // AAC ~128 kbps
try buf.write(to: url, format: .alac, sampleRate: 44100) // Apple Lossless
```
- **WAV bit depths** — 16-bit and 24-bit signed-integer PCM alongside 32-bit float.
- **AIFF-C** and **CAF** float output across all writers.
- **RF64 / BW64** (EBU Tech 3306) — the 64-bit-sized WAV variant for files past the
4 GB limit, written by Lyrebird's own `RF64Writer` (CoreAudio has no RF64 *writer*;
it reads them back fine). Opt-in `.rf64Float32` / `.rf64Int24`.
- **Compressed AAC + Apple Lossless** (`.m4a`) — encoded natively through
`ExtAudioFile`/`AudioConverter`, no third-party dependency. **Offline writers only**
(`LyrebirdBuffer.write`, `NRTDriver`); `DiskOut.Audio` streams PCM/RF64 only. (MP3 is
not offered — CoreAudio has no MP3 encoder.)
- **Selectable NRT output** — `NRTDriver` / `NRTJob` take a `format:` (default CAF/float,
unchanged), so offline renders and the multi-engine batch pool can bounce to any format.
### New — large-file safety
Plain WAV and AIFF-C carry 32-bit size fields (a 4 GB cap). A write projected past
that now **throws `fileTooLargeForContainer`** (buffer / NRT) or stops cleanly and sets
a pollable `fileTooLarge` flag (streaming `DiskOut`) instead of silently producing a
truncated file. CAF and RF64 are 64-bit-sized and uncapped. `NRTDriver` also validates
its `duration` (finite, non-negative) — `NRTDriverError.invalidDuration`.
### New — Live Scratch: Render-to-File format picker
The Scratch **Render to File** (⌥⌘R) save dialog now carries a **Format** popup (WAV
32-bit float / 16-bit / 24-bit, AIFF, CAF, RF64 WAV, and compressed AAC / Apple
Lossless) plus the duration field, folded into one dialog. It remembers the last
format. Sample rate and channel count still mirror the live engine.
### Changed
- **`DiskOutFormat` is deprecated** — it is now a type alias for `AudioFileFormat`.
Existing `DiskOutFormat.wavFloat32` / `.aiff` / etc. spellings keep compiling (with a
deprecation warning); migrate to `AudioFileFormat` directly.
- `LyrebirdEventList.record(directory:format:)` now takes an `AudioFileFormat`. Stem
recording is PCM/RF64 only — a compressed format is rejected with a logged message
(stems stream through `DiskOut`, which does not do compressed).
---
## 1.5.0 — `LyrebirdRandom` + the Live Scratch editor grows up
A minor release. Backward-compatible — new public API plus a wave of Live Scratch
tooling. No changes to existing behavior.
### New — scalar draws from any distribution (`LyrebirdRandom`)
Lyrebird had distribution-tied **signals** (noise generators), **sequences**
(`Pattern`, `TemporalStream`), and the `DistributionKind` sampling math — but no
ergonomic way to get *one value* from a named distribution. `LyrebirdRandom`
fills that gap:
```swift
var r = LyrebirdRandom(seed: 42)
let freq: Double = r.exponentialRange(low: 200, high: 2000) // Hz, log-uniform
let dur: Double = r.uniform(low: 0.1, high: 0.5) // seconds
let jitter: Double = r.gauss(mean: 0, dev: 0.02)
let skew: Double = r.beta(low: 0, high: 1, alpha: 2, beta: 5)
let spike: Double = r.laplace(scale: 1.0)
```
- **`LyrebirdRandom`** — a seedable value type owning a xorshift64 state, so a
seed gives a fully reproducible stream of draws (what scored/rendered music
wants). Named methods for every family in `DistributionKind` (uniform, low/
high/mean-biased, exponential-range, exponential, gamma, laplace, asymmetric
laplace, half-cosine, logistic, poisson, arcsin, beta, cauchy, gauss), plus a
generic `value(_:parX:parY:parA:parB:)` reaching any kind.
- **`LyrebirdRandom.shared`** (`SharedRandom`) — a process-wide, thread-safe
source for throwaway draws (system-seeded, non-reproducible). The global
**`Random`** is a shorthand for it, for the common non-seeded case:
`Random.uniform(low: 0, high: 1)`. (Takes a lock — not RT-safe; use an owned
`LyrebirdRandom` inside a Generator.)
- **`DistributionKind.sample(parX:parY:parA:parB:using:)`** — the public
single-draw dispatcher, now the single source of truth for the case→sampler
mapping: `TemporalTendency` and `DemandTemporalTendency` were refactored onto it
(behavior pinned by the golden-value tests), so a scalar draw and a stream of
the same distribution agree given the same seed.
For a plain uniform scalar the Swift stdlib (`Double.random(in:)`) is still the
lightest choice; reach for `LyrebirdRandom` when you want a *shaped* distribution
or a reproducible seeded stream.
### Live Scratch — renamed and a lot more capable
The macOS live-coding scratchpad graduated from a demo to a shipping app:
**`LyrebirdScratchDemo` → `LyrebirdScratch`** (bundle id
`net.realizedsound.LyrebirdScratch`; project, scheme, entitlements renamed). New
in the editor:
- **Render to File (⌥⌘R)** — bounce the selection (or whole buffer) to a **CAF**
file offline instead of playing it live. Prompts for a path and duration, builds
the graph on a throwaway `NRTDriver` engine mirroring the live engine's settings
(so the bounce matches what you heard), renders faster-than-real-time off the
main thread, and reveals the file in Finder. Only **sample-clock** timing renders
(`engine.schedule`, in-graph triggers) — wall-clock routine/task waits don't.
- **Format Code (⌥⌘F)** — pretty-print the buffer with the toolchain's
`swift-format`. No-op on a blank buffer; parse errors go to the console.
- **Line-number gutter** — a floating `ScratchLineNumberGutter` overlay,
positioned from each row's line-fragment rect so numbers align on blank and
wrapped lines. (An `NSRulerView` attempt was abandoned — `rulersVisible`
mis-tiles the document view inside a SwiftUI `NSViewRepresentable`, blanking the
editor.)
- **`Foundation` in scope** — snippets can use `pow`, `sin`, `sqrt`, `Date`, … with
no `import` (a snippet can't declare one — its body is wrapped in the entry
function).
- **Manual code completion (Esc / F5)** — no more auto-trigger on `.` that
ambushed typing; completion replaces the partial word, not the receiver.
- **Fixed — editor scroll-jump**: the engine status readout refreshed via
`.id(engineTick)`, tearing down subviews every heartbeat and nudging the scroll
offset. Stats now update in place from an `@State` snapshot.
### New — compile artifacts stage into Application Support (no Documents prompt)
Swift-mode compilation points `swiftc` at the Lyrebird module artifacts, which in
a dev checkout live under `~/Documents` — tripping the macOS "wants to access your
Documents folder" gate. `LiveSession.stageArtifacts()` copies the minimal set into
`~/Library/Application Support/LyrebirdScratch/LiveCompile/` (ungated), rewriting
the C module map's absolute umbrella-header path to a staged copy so the compile
is self-contained. Idempotent (a receipt skips an unchanged source), best-effort
(falls back to the build dir). A **shipped** app carrying its artifacts in
`Contents/Resources/LyrebirdArtifacts` never reads a gated folder — groundwork for
a standalone `LyrebirdScratch.app` download.
### Docs
New guidance on snippet **timing / scheduling** — `engine.schedule`,
`LyrebirdRoutine` / `LyrebirdTask` (background-thread waits), `LyrebirdClock`,
in-graph triggers — the retention rule (the snippet is transient), and which
mechanisms survive an offline NRT render vs. which are wall-clock-only.
---
## 1.4.2 — Live-coding: Run Selection + graceful slot release
A minor release. Backward-compatible — additive conveniences to the (macOS-only)
live-coding editor that make per-fragment evaluation and voice lifecycle feel
like a proper live-coding environment. No changes to existing public API.
### New — Run Selection (⌘E)
Evaluate just the **highlighted text** and *add* it to whatever is already
playing — always additively, never a replace. It leaves the rest of the buffer
and the whole-buffer re-evaluation baseline (the clean/dirty badge still reflects
your last full run) untouched. This is the live-coding "evaluate this line/region,
keep going" gesture: audition a single voice, layer it in, iterate. Works in both
Swift and Graph DSL modes; no-op with no selection. ⌘↩ / ⌘⇧↩ (whole buffer) are
unchanged.
### New — Start a voice, release it later (`context.release(slot:)`)
Named slots are the persistent **handle** across evaluations — the slot *name* is
your reference (Swift `let`/`var` bindings can't carry from one snippet to the
next, since each ⌘↩/⌘E is a separately-compiled unit). Pair that with Run
Selection to start a voice in one evaluation and let it go in another:
```swift
// ⌘E this line — start a persistent, gated voice named "pad":
context.play(slot: "pad") { EnvGen(gate: 1, /* free-on-done */) * OscSaw.Audio(freq: 110) }
// …later, ⌘E this line — graceful release: the envelope tails out, then frees:
context.release(slot: "pad")
```
- `context.release(slot:)` triggers the voice's envelope **release** phase and
frees the name; the voice self-frees via its done-action (and, as a safety net,
stays reclaimable by **Clear Synths** if it never does).
- `context.free(slot:)` is the **immediate** hard stop — the counterpart, no tail.
### New — Engine panel (scope + status)
A panel at the bottom of the scratch window gives an always-on view of the
running engine: a live dual-channel **oscilloscope** of the output (fed by a
`ScopeCapture` the session attaches to the output buses), plus **CPU
average/peak** meter bars and **synth / group / snippet** counts.
### New — Reset Session + Restart to Reclaim Memory
Two Run-menu commands for the by-design snippet-dylib cost:
- **Reset Session** — an in-process, *non-destructive* reset: stops all snippet
audio, shuts down the code-completion server (freeing its subprocess and temp
files), and clears diagnostics. Your buffer is untouched.
- **Restart to Reclaim Memory…** — relaunches the app (with a confirmation), the
only way to actually free the mapped snippet dylibs, which cannot be unloaded
in-process.
### New — Console panel
An always-open panel down the right side logs everything: snippet
`context.reportMessage(_:)` output (the live-coding `print`), compile / Graph DSL
**errors** with their `line:col`, and a one-line notice per run — oldest first,
auto-scrolled, with a **Clear** button. Errors moved here from the old transient
bottom strip so they stay visible while you fix them.
### Faster typing
Cut the per-keystroke cost in the editor: syntax highlighting is debounced
(coalesced after a brief pause instead of a full-buffer re-tokenize on every
key), `updateNSView` fast-paths a pure text change, and redundant `@Published`
republishes (selection, re-eval state) are elided.
### Changed — code completion is now manual (Esc / F5)
Completion no longer auto-opens on `.`. The auto-trigger ambushed typing — after
`Pan2.` the popup opened and couldn't be dismissed by deleting, trapping the
caret until a candidate was picked. Invoke completion deliberately with **Esc**
(or **F5**); a member request after a dot still resolves. Wider default scratch
window too (75% of the visible screen width).
---
## 1.4.1 — "Learning Swift for Lyrebird" intro guide
A documentation-only release, continuing the doc improvements begun in 1.3. No
source or public-API changes. Adds a four-part introduction to Swift written
specifically for Lyrebird users coming from SuperCollider, Max/MSP, Csound, and
similar tools — people who want just enough Swift to be productive without
wading through iOS-development tutorials.
### New — `docs/learning-swift/`
Four short guides, meant to be read in order, each grounded in audio examples
rather than app-building:
1. **Hello, World** — from a one-line `print` to a working 440 Hz tone, every
line of a Lyrebird program explained (engine → synthesizer → generator graph
→ output bus).
2. **Swift Basics & Best Practices** — `let`/`var`, the scalar types, optionals
(and why Lyrebird forbids force-unwrap `!`), control flow, functions, error
handling, and `struct` vs `class`.
3. **Types & Functional Programming** — enums, protocols, operator overloading,
closures, and `map`/`filter`/`reduce` applied to building synthesis graphs;
`expand` as `map` for multichannel generators.
4. **Xcode, Packages & Debugging** — Xcode vs. SwiftPM, adding Lyrebird as a
package, **Debug vs. Release** build configurations (and why Debug audio can
glitch), and breakpoints — including the rule to never break or `print` on
the real-time render thread, using `debugTap`/`debugTag` instead.
Throughout, examples use explicit **type annotations** on every binding — the
same practice the Lyrebird codebase enforces — for readability and faster
compilation on large, generic audio-graph expressions.
Linked from `README.md` and `LYREBIRD_START_HERE.md` for discovery.
---
## 1.4.0 — Live-coding scratch editor, interpreted Graph DSL, `ClosureSynthesizer` + `SampleLoop`
A minor release. Fully backward-compatible — no changes to existing public API.
Adds a live-coding editor and an interpreted graph language on the tooling side,
two new core building blocks (`ClosureSynthesizer`, `SampleLoop`), and one
real-time correctness fix in the disk recorder.
### New — `ClosureSynthesizer`: play a graph without a subclass
The shortest path from a generator graph to sound. Instead of declaring a
`SynthesizerBase` subclass and overriding `build()`, hand a closure that returns
the output graph:
```swift
try engine.add(ClosureSynthesizer { OscSin.Audio(freq: 440, mul: 0.1) })
try engine.add(ClosureSynthesizer(bus: 0) { Pan2(input: saw, pan: 0) })
```
The closure runs once, inside `build()`, on the main thread when the synth is
added — so each instance builds its own graph (the usual
graph-copy-per-instance rule). A multi-channel source fans out across
consecutive buses from `bus`, exactly as `output(bus:source:)` does. This is
also the primitive the scratch editor's "play a bare graph" and Graph DSL paths
build on.
### New — `SampleLoop`: inline per-sample DSP + single-sample feedback
The RT-safe escape hatch for custom sample-accurate DSP — including
**single-sample feedback loops** (one-pole filters, waveguides, comb/allpass
structures) — without declaring a whole new `Generator` type.
- **No per-block allocation.** `SampleLoop` owns its pre-allocated output buffer
(inherited `_result`) and resolves its inputs once per block via the fan-out
cache, then hands both to your closure to fill the whole block in one pass —
unlike `Closure`, which allocates a fresh `[Double]` and evaluates one sample
at a time.
- **Typed `inout` feedback state.** State is built by `makeState(numChannels)`
and passed `inout` to the body, so a filter can carry `y[n-1]` across samples
and blocks correctly.
- **Channel inference + broadcast.** Output width is inferred from the inputs
(`max` of their channel counts, or `1` with none); each input is broadcast up
to that width, so the same body scales to any channel count. Mismatched
multi-row inputs precondition-trap at construction, matching
`BinaryOpGenerator`'s policy.
### New — Live-coding scratch editor (`LyrebirdLiveCompile`, macOS)
An interactive scratch pad that compiles and plays Swift snippets against a
running engine, with hot-swap and safety scaffolding built in:
- **Bare-graph & subclass play** — `context.play { … }` for a graph,
`context.play(synth)` for a declared `Synthesizer`.
- **Named slots (Pdef-style hot-swap)** — re-running a `play(slot:)` replaces
just that voice in place; other slots keep playing. Swaps can quantize to the
next beat/bar for glitch-free, on-grid transitions.
- **Re-evaluation readiness** — a status badge (empty / dirty / compiling /
clean / queued / failed) gates the Run controls.
- **Syntax highlighting** and a line-number gutter.
- **Code completion** via the toolchain's `sourcekit-lsp`: typing `.` resolves
the real symbols the snippet would see at compile time — `LyrebirdSynth`
generators (`OscSin.` → `Audio`, `Control`), the injected `context`, and the
standard library.
- **Fast first sound** — the module cache is prewarmed at launch, so the first
⌘↩ is ~0.1 s instead of a ~2 s cold build.
- **Snippet-memory safety** — each compiled snippet maps a dylib that can't be
safely unloaded; the editor surfaces a live "snippets: N" count and nudges a
restart (or a switch to the leak-free Graph DSL mode) past a threshold.
### New — Interpreted Graph DSL (`LyrebirdGraphDSL`, cross-platform)
A small text→graph language that plays **instantly — no swiftc, no dylib, no
leak** — and is the structural answer to the snippet-dylib cost:
```
bass = OscSawtooth.Audio(freq: 55, mul: 0.15)
Pan2(input: OscSin.Audio(freq: 440, mul: 0.1), pan: 0)
```
- **304 built-in generators**, code-generated from generator init signatures, so
new generators appear automatically. Audio- and control-rate variants and
buffer resources are supported.
- **Paste-compatible** — the rate suffix is the exact Swift nested-class name
(`OscSin.Control`), so a graph expression written in the editor pastes into a
Lyrebird project unchanged.
- A mode toggle in the scratch editor runs the buffer through this path on the
same track/slot machinery as the Swift path, with errors in the same gutter.
### Fixed — `DiskOut` real-time data race
`DiskOut`'s ring buffer was a Swift `[[Float]]` shared between the real-time
render thread (writer) and its background disk-writer thread (reader). Even at
disjoint frame ranges, Swift `Array` access is not race-free — the subscript and
`withUnsafeMutableBufferPointer` touch the array's shared storage pointer and
copy-on-write / refcount bookkeeping, which the frame-counter atomics did not
fence. Under load this corrupted the heap (surfacing as retain-count aborts).
The ring is now backed by raw contiguous `UnsafeMutableBufferPointer<Float>`
storage, so the existing release/acquire frame-counter fence alone makes the
single-producer/single-consumer handoff correct. Confirmed with ThreadSanitizer;
also eliminated the long-standing parallel-`swift test` teardown crash.
---
## 1.3.0 — Graceful-release fix, quickstart template, documentation accuracy pass
A minor release. Backward-compatible: one real-time behavior fix, one new
project template, and a large sweep that makes the documentation's code
examples verifiably correct.
### Fixed — graceful release now works for `SynthesizerBase` subclasses
`release(engine:)` and `free(engine:)` were `Synthesizer` protocol requirements
satisfied only by extension defaults; `SynthesizerBase` declared neither, so a
subclass override was unreachable through an `any Synthesizer` reference. Because
`Group.release(engine:)` cascades to its children through exactly that
existential, **every gated `SynthesizerBase` subclass was hard-freed instead of
released** — envelope release phases were skipped (audible as clicks and missing
release tails). `SynthesizerBase` now declares both as `open` members, so
overrides dispatch through the vtable. Pinned by `SynthesizerReleaseDispatchTests`.
### New — `quickstart` project template + demo
- `lyrebird new MyFirstSound --template quickstart` scaffolds the shortest path
to sound: a one-oscillator `SineTone`, the engine, and a `main` that plays a
440 Hz tone for ten seconds and exits. Featured as the fast option across the
CLI help, README, and getting-started docs.
- A matching bundled **`LyrebirdQuickstartDemo`** Xcode project ships in the
workspace so the same starting point is runnable without the CLI.
### Documentation — every example now typechecked or provably illustrative
- Extended the doc-snippet compile guard to the published entry-point articles,
the generator reference, and the root docs (`README` / `LYREBIRD_START_HERE` /
`INSTALLATION_AND_USAGE`), which were previously checked by nothing. Recorded
compilable examples rose from 426 to 542.
- Fixed roughly twenty copy-paste examples that never compiled — wrong parameter
labels and orders (`LinLin`, `SpringReverb`, `BufferGrain`), nonexistent APIs
(`LFNoise2`, `DoneAction.freeSynth`, `buildGraph()`, `midiNoteToHz`,
`LyrebirdBuffer(path:)`, a `>` operator on generators), missing required
arguments (`CombFilter`/`AllpassFilter` `maxDelay`), a Swift 6 concurrency
violation in the canonical routine example, and stale test counts. Removed an
unsupported NRT-replay workflow that documented a fabricated driver API.
### Fixed — demo terminal builds
`LyrebirdNRTDemo` and `LyrebirdScoreDemo` pinned a stale `package: "LyrebirdII"`
in their `Package.swift`, so standalone `swift build` / `swift run` from the demo
directory failed. Corrected to `Lyrebird`.
---
## 1.2.0 — Generator catalog expansion *(planned)*
A minor release. Adds roughly forty SuperCollider-parity generators —
triggers, time-domain analysis, chaotic oscillators, resonator banks, dynamics,
waveshaping, routing/morph, and psychoacoustic metering — plus an iOS path fix.
Fully backward-compatible; no changes to existing public API.
### New generators
**Trigger / timing.** `Trig` and `Trig1` (fixed-duration gate from a trigger),
`Schmidt` (hysteresis threshold), `Stepper` (trigger-advanced counter),
`PulseCount` (count triggers, reset on a second input), `TriggeredDelay` (hold
then re-emit a trigger).
**Phasor / slew.** `Phasor` (sample-accurate sweeping ramp with wrap bounds and
trigger-reset), `Slew` (asymmetric slew-rate limiter).
**Time-domain analysis.** `RunningMin`, `RunningMax` (running extrema, reset on
trigger), `Slope` (per-sample first difference), `ZeroCrossing` (zero-crossing
frequency estimator).
**Routing / morph.** `Select` (index-select one of N inputs), `CrossFade`
(equal-power two-input mix), `LinearCrossFade` (linear two-input mix).
**Waveshaping / distortion.** `Waveshaper` (transfer-function table lookup with
interpolation), `CrossoverDistortion` (dead-zone crossover), `Disintegrator`
(probabilistic sample mangling).
**Resonant filter / LFO.** `Formlet` (FOF-style resonant formant filter),
`LFGauss` (Gaussian-bell LFO).
**Chaotic oscillators.** `LorenzLinear`, `HenonStepped`, `QuadStepped`,
`LinCongStepped`, `GbmanStepped`, `StandardStepped`, `FBSineStepped`,
`LatoocarfianStepped`, `CuspStepped` — discrete chaotic maps, frequency-stepped
where SuperCollider steps them.
**Resonator banks.** `Klank` (fixed bank of fixed-frequency resonators) and
`Klang` (bank of sine partials), both runtime-respecifiable.
**Dynamics.** `Normalizer` (look-ahead peak normalizer) and `Balance` (RMS
level matcher, with `logDomain` for dB-domain gain and `smooth` for decoupled
gain lag).
**Metering.** `BeatTrack` (FFT-based tempo / beat tracker) and `Loudness`
(Zwicker / ISO 532 B psychoacoustic loudness in sones).
> `DFM1` (the remaining catalog candidate) is intentionally omitted: its source
> and lookup tables are GPL, incompatible with this project's MIT license.
### Tooling
- **ShoeGaze moved out of tree.** The guitar-pedalboard framework and its
project/pedal scaffolding now live in a standalone ShoeGaze repository that
depends on Lyrebird as a package. Lyrebird's CLI no longer ships the
`shoegaze` / `shoegaze-ios` project templates or the "ShoeGaze Pedal" Xcode
file template.
### Fixes
- **`LyrebirdPaths.home` on iOS** now returns the app's Documents directory
instead of `homeDirectoryForCurrentUser` (the sandbox root, which is not
writable on iOS). Unchanged on macOS.
### Internals (no API impact)
- The 4-point Catmull-Rom cubic interpolation duplicated across oscillator
table reads, `PlayBuffer`, and the fractional-delay lines is now a single
shared `catmullRomCubic` kernel.
- Generator tests regrouped by family.
---
## 1.1.1 — Real-time performance + score-timing fixes *(planned)*
A patch release: real-time CPU improvements to the synthesis engine's hot path,
internal generator consolidation, and two score-side timing fixes. Fully
backward-compatible — no public API changes.
### Real-time performance
The generator render path (`_computeSamples`) is now Accelerate-accelerated
where it was previously scalar. Wins are largest for the primitives that appear
in nearly every patch:
- **Unary math waveshapers** (`Sin` / `Cos` / `Exp` / `Log` / `Sqrt` / `Floor`
/ `Ceil` / `Abs`) — vectorized via vForce / vDSP (~3× faster on a typical
chained-op voice).
- **Arithmetic operators** (`+` `−` `×` `÷` on generators, via
`BinaryOpGenerator`) — vDSP dispatch, **bit-identical** to the scalar result
(divide uses true-division, never reciprocal-multiply). Roughly 2–3.5× faster;
applies to every `osc * gain + offset`-style graph.
- **`LinLin`** — single fused `vDSP_vsmsaD` affine map (~27% faster).
- **State-variable filter (`SVF`)** — shared per-block kernel; generator-driven
cutoff uses block-boundary coefficient interpolation instead of a per-sample
`sin()`.
- **`Chorus` / `Flanger`** — power-of-two delay lines (bitwise index wrap).
- **Butterworth band-pass / band-reject** — now use the same background-thread
vDSP biquad-cascade path the low-pass / high-pass filters already had.
All vectorized paths keep a scalar fallback for short upstream blocks, so output
is unchanged on every code path (transcendentals within tolerance; arithmetic
and filter sums bit-exact).
### Internals (no API impact)
- Generator consolidation: the duplicated Butterworth cascade machinery, SVF
block body, unary-math and binary-op inner loops, and power-of-two buffer
sizing are now shared helpers (`ButterworthSectionEngine`, `runSVFBlock`,
`UnaryMathVectorHelpers`, `BinaryOpVectorHelpers`, `lyrebirdNextPowerOfTwo`,
`computeButterworthQs`). Several hundred lines of duplication removed.
- New `LyrebirdBenchmark` target with before/after reference numbers
(`docs/benchmarks/gp-baseline.md`).
- Language-side consolidation: shared `isCounterExhausted` / `resetAll` Pattern
helpers, a `_RandomPatternBase` for the random pattern engines, a
`TemporalAlgorithmBase` for the counter-driven temporal algorithms, a shared
MusicXML `<direction>` / `<pitch>` emit helper, and a single
engine-mutation-to-main-queue dispatch helper shared by the routine/process
contexts.
### Score / MusicXML
- **`ScorePart` entrance offset** — a part can enter later than the start of its
section via `offset:` (`ScoreOffset.measures(_:)` / `.beats(_:)` /
`.fraction(_:)`). Resolved at build time into leading rests (the same way
`FillMeasure()` is resolved), so it flows through section sizing, MusicXML bar
splitting, and `flatten()` with no special handling.
- **MusicXML barline-fill fix** — corrected two emit-side defects in sectioned
scores with rest-padded short parts: a barline-crossing atom that exactly
filled a bar left the measure open (shifting every later note by one division,
rendering constant 4/4 as 5/4), and section auto-padding used meter-agnostic
rests that straddled barlines. Padding is now bar-grid aligned (clean
whole-measure rests; anacrusis-aware). Lowering/playback math was already
correct — both fixes are export-only.
---
## 1.1 — Enhanced algorithmic composition tools
Release 1.1 turns Lyrebird's score side from a thin event list into a full
**algorithmic composition and notation toolkit**: a spelling-aware music-theory
layer, a pattern/sequence library, a composable score DSL, and lossless MusicXML
and Standard MIDI File round-trips. The real-time synthesis engine is unchanged —
this release is additive and language-side.
### Music theory toolkit
- Spelling-aware **`Interval`**, **`Scale`**, and **`PitchCollection`** types
(cells, sets, 12-tone rows) built on the existing `Letter` / `Accidental` /
`NoteName` / `Pitch` foundation.
- Diatonic-vs-chromatic transposition that preserves enharmonic spelling
(`B♯` stays `B♯`, never collapses to `C`), scale-degree mapping between scales,
and conversion straight to Hz / seconds for synthesis.
- **`Pitch.mapIntoRange(low:high:)`** — fold a pitch into a register by whole
octaves while preserving pitch class and spelling.
- See [`docs/stdlib/theory.md`](docs/stdlib/theory.md).
### Patterns
- `Pattern<T>` factory catalog for sequences, series, random and stochastic
distributions (uniform, brownian, gaussian, cauchy, beta, weighted, shuffle…),
and combinators (map, filter, stutter, switching, interleave, round-robin…).
- **`Pattern.sequence(_:repeats:offset:)`** — start a sequence partway through
its list via `offset`.
- Euclidean rhythm generator.
- See [`Sources/Lyrebird/Lyrebird.docc/RoutineTask.md`](Sources/Lyrebird/Lyrebird.docc/RoutineTask.md).
### Score DSL and notation
- A result-builder score DSL — `Score`, `Part`, `Note`, `Rest`, `Chord`,
`Tuplet`, `Voice`, `Staff` — that flattens to sample-accurate `ScoreEvent`s and
plays back through `ScorePlayer`.
- Notation features: dynamics, articulations, **crescendo / diminuendo hairpins**,
**slurs** (a `Slur { }` block plus per-note `spanners:` for shared-boundary and
overlapping spans), authored ties, grace notes, repeats and volta endings,
mid-piece tempo changes, key signatures and transposing parts, mid-voice clef
changes, grand-staff `Staff` grouping, and sustain `Pedal` marks.
- Meter: `TimeSignature` + segmented `MeterMap`, mid-piece meter changes,
anacrusis (pickup) bars, and polymeter (per-part meter overrides).
- `ScoreTimeline` musical addressing (`BeatPosition`) with overlap policies and
multi-voice fills.
- See [`Sources/Lyrebird/Lyrebird.docc/ScoreSystem.md`](Sources/Lyrebird/Lyrebird.docc/ScoreSystem.md).
### Score structure and page layout
- **`Section { }`** blocks group parts into sequential sections, each with its
own local bar/beat numbering. Assembled into a `Score`, sections render
sequentially with continuous global measure numbers and a rehearsal mark per
section; tacet instruments are auto-filled so every staff stays bar-aligned.
`ScorePart` gains an `id` (defaults to `name`) to match the same instrument
across sections.
- **`PageLayout`** sets MusicXML page defaults: page size
(`letter` / `legal` / `tabloid` / `a4` / `a3` / custom mm), `portrait` /
`landscape` orientation, per-side odd/even margins, and `<scaling>`. Authored
in millimeters and converted to MusicXML tenths on export.
- **`NoteDisplay`** per-note display overrides via a `display:` parameter on
`Note` / `Chord`: custom notehead shape (`x`, `diamond`, `slash`, `.hidden`,
raw `.other(_)`, …), note size (`cue` / `large`), hidden stem, and hidden
beam.
- **Glissandos / slides** between two notes via the spanner API
(`.beginGlissando(_:)` / `.endGlissando`): glissando (wavy/curved) or slide
(straight) `kind`, a line type (`solid` / `dashed` / `dotted` / `wavy`), and an
optional text label.
### Import / export
- **MusicXML** export and import (`score-partwise` 4.0) with a spelling- and
event-faithful round trip across the notation features above.
- **Standard MIDI File** round-trip (`Score` ↔ SMF).
### API and internals
- `Score.timeSignature` and the `Score` initializers take a typed
`TimeSignature` (a `(numerator, denominator)` pair converts via
`TimeSignature(_:)`) instead of a raw tuple.
- Internal cleanups with no API impact: the MusicXML encoder and parser were
split from two monoliths into focused, grouped extension files, and the
parser's per-`<note>` state was extracted into a dedicated value type.
> **Namespace note:** the score DSL exposes capitalized free functions
> (`Note`, `Chord`, `Voice`, `Slur`, `Crescendo`, …). `Voice` in particular can
> collide with same-named types from other frameworks — qualify or alias if you
> hit an ambiguity.
---
## 1.0 — Initial release
First public release: the real-time synthesis engine, the `Generator` /
`Synthesizer` protocols and standard-library generators, the Core Audio and
non-real-time drivers, `LyrebirdUI`, the `lyrebird` CLI and project scaffolding,
and the AUv3 plug-in support.