Files
Lyrebird/RELEASES.md
T

391 lines
19 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.
---
## 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.