Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
C# audioaudio-unitavaloniacpp20cross-platformdawdigital-audio-workstationdspjucelinux-audiomcp-servermidimusicmusic-productionpiano-rollplugin-hostsequencersynthesizervstvst3
Redesign of Aurora
Egor Khindikaynen64e0b9de6ad3
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex be818d8f..06c8e8d6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -19,6 +19,24 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.## [Unreleased]### Added+- **Nota Aurora grew performance wheels, eight macros and a switchable FX chain, and its+ editor is now the almanac's card.** A **pitch-bend** wheel with a selectable **range**+ (±2 / ±5 / ±12 semitones) joins the mod wheel in a rail that stays on screen on every+ tab. There are now **eight macros** instead of four, reaching **twelve** destinations+ (warp, osc 2 level, sub level, unison detune and drive on top of the old seven), each+ named after what it drives. **LFO 2** can lock to the tempo like LFO 1. The **unison**+ stack is stereo: detune is its own dial in cents and **spread** widens the stack across+ the field. The FX block became a chain of three switchable blocks: **drive** (Tube / Tape+ / Fold, with a tone tilt), **chorus** (1× / 2× / 4×) and **reverb** (Room / Hall / Plate,+ with size). The output also gets a **pan** control. The card lays the synth out as+ **Osc · Filter · Env · LFO · Mod · FX** tabs over a 186 px rail that switches between+ **Global** and **Macros**, with a status strip that reads the patch back in words.+ Projects saved before this load: the existing parameters keep their index, the new+ ones start at values that sound as before, and a macro saved against the old seven+ destinations still points at the same one. The one exception is unison (see Changed).+- **Nota Aurora ships 25 factory presets** (was 8): pads, keys, bells and plucks, leads,+ basses and motion patches, including the eight that existed before under their old+ names.- **Nota Volt grew performance wheels and wider macros, and its editor is now thealmanac's card.** A **pitch-bend** wheel with a selectable **range** (±2 / ±5 / ±12semitones) joins the mod wheel in a rail that stays on screen on every tab, and the@@ -150,6 +168,11 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.restart — and the choice is remembered.### Changed+- **Nota Aurora's unison dials now do what they say.** **Detune** is in cents (0–50) and+ no longer scales with the voice count, and **spread**, which the engine used to ignore,+ now pans the stack across the stereo field. Patches that use unison, including the+ default one, therefore sound wider and more detuned than before. Turn spread down to+ zero to get the old mono stack back.- **The top chrome is one row instead of two.** The transport bar and the toolbar under itwere a 48px row and a 34px row mixing four unrelated jobs; they are now a single 60pxbar, handing 22px back to the arrangement. It reads left to right: which view you arediff --git a/FEATURES.md b/FEATURES.mdindex a555c40f..125a1f44 100644--- a/FEATURES.md+++ b/FEATURES.md@@ -268,9 +268,12 @@ and user presets, automation, persistence and cloning.destinations, unison, glide, oscillator start phase, pitch-bend (±2/±5/±12) andmodulation wheels, VEL→AMP, VEL→FILTER, Mono/Poly. 25 factory presets.- **Nota Aurora** — wavetable synth: two wavetable oscillators (16 frames per bank, warp- Off/Sync/Bend/PWM/Fold) plus a sub oscillator and unison, two filters with routing, two- envelopes, two LFOs, an 8×7 mod matrix, 4 macros, built-in drive/chorus/reverb,- Mono/Poly.+ Off/Sync/Bend/PWM/Fold) plus a sub oscillator and a stereo unison stack (voices, detune+ in cents, spread), two filters (LP/HP/BP/Notch/Morph, 12/24 dB) with per-source routing,+ two envelopes, two tempo-syncable LFOs, an 8×7 mod matrix, 8 macros over 12+ destinations, pitch-bend (±2/±5/±12) and modulation wheels, output pan, a switchable FX+ chain (drive Tube/Tape/Fold with tone · chorus 1×/2×/4× · reverb Room/Hall/Plate with+ size), Mono/Poly. 25 factory presets.- **Nota Operator** — FM synth: 4 operators (wave, coarse ratio, fine detune, level andtheir own ADSR each), 11 algorithms with interactive diagrams and drag-to-reroute,feedback, a live harmonic spectrum, an LP/HP/BP filter with keyboard tracking, pitch-benddiff --git a/src/managed/Nota.App/Controls/AuroraLfoStrip.cs b/src/managed/Nota.App/Controls/AuroraLfoStrip.csnew file mode 100644index 00000000..84538543--- /dev/null+++ b/src/managed/Nota.App/Controls/AuroraLfoStrip.cs@@ -0,0 +1,70 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// The shape window under Nota Aurora's two LFO rows: one LFO's waveform drawn across a+// couple of seconds of its own rate, so "sin at 40 %" is a picture rather than a number.+// Depth scales the height, which is what makes a modulator at zero depth read as the flat+// line it is. Repaints only when the shape, the rate or the depth actually move.++using System;+using Avalonia;+using Avalonia.Controls;+using Avalonia.Media;++namespace Nota.App;++internal sealed class AuroraLfoStrip : Control+{+ private static readonly Pen Curve = new(NotaPalette.AccentBright, 1.6, lineCap: PenLineCap.Round, lineJoin: PenLineJoin.Round);+ private static readonly Pen Zero = new(NotaGraph.Grid, 1);+ private const int Samples = 180;++ private int _shape = -1;+ private double _cycles, _depth = -1;++ public AuroraLfoStrip() { ClipToBounds = true; MinHeight = 22; }++ /// <summary>Shape (0 sin · 1 tri · 2 sqr · 3 S&H), how many cycles fill the window,+ /// and the depth that sets the height.</summary>+ public void Set(int shape, double cycles, double depth)+ {+ cycles = Math.Clamp(cycles, 0.5, 16);+ if (shape == _shape && Math.Abs(cycles - _cycles) < 0.01 && Math.Abs(depth - _depth) < 0.005) return;+ _shape = shape; _cycles = cycles; _depth = depth;+ InvalidateVisual();+ }++ // The engine's own shapes (WavetableSynth::lfoValue); S&H is seeded so the window+ // shows the same staircase every time rather than flickering on each repaint.+ private static double Value(int shape, double ph, uint seed) => shape switch+ {+ 1 => ph < 0.5 ? 4 * ph - 1 : 3 - 4 * ph,+ 2 => ph < 0.5 ? 1 : -1,+ 3 => ((seed * 1664525u + 1013904223u) >> 8) / 8388608.0 - 1.0,+ _ => Math.Sin(2 * Math.PI * ph),+ };++ public override void Render(DrawingContext ctx)+ {+ double w = Bounds.Width, h = Bounds.Height;+ if (w <= 2 || h <= 2 || _shape < 0) return;+ NotaGraph.Window(ctx, new Rect(0, 0, w, h));+ double mid = h / 2, amp = (h / 2 - 3) * Math.Clamp(_depth, 0, 1);+ ctx.DrawLine(Zero, new Point(2, mid), new Point(w - 2, mid));+ if (amp < 0.5) return;++ var geo = new StreamGeometry();+ using (var g = geo.Open())+ {+ for (int i = 0; i <= Samples; i++)+ {+ double t = (double)i / Samples * _cycles;+ double ph = t - Math.Floor(t);+ double v = Value(_shape, ph, (uint)(int)Math.Floor(t) + 7u);+ var p = new Point(2 + (w - 4) * i / Samples, mid - v * amp);+ if (i == 0) g.BeginFigure(p, false); else g.LineTo(p);+ }+ }+ ctx.DrawGeometry(null, Curve, geo);+ }+}diff --git a/src/managed/Nota.App/Controls/AuroraStack.cs b/src/managed/Nota.App/Controls/AuroraStack.csindex 41556674..69a98f5e 100644--- a/src/managed/Nota.App/Controls/AuroraStack.cs+++ b/src/managed/Nota.App/Controls/AuroraStack.cs@@ -1,13 +1,19 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.//-// Nota Aurora wavetable display (mockup 2j): the 16 single-cycle frames drawn as a-// skewed 3-D stack, the position-selected frame lit accent-bright and the rest faint —-// "position is a place in a stack, not a number". Reconstructs each frame's waveform-// from the same additive recipe as WavetableSynth::harmAmp (low harmonic count → a-// representative shape, not sample-exact).+// Nota Aurora's wavetable window: the 16 single-cycle frames drawn as a skewed 3-D stack,+// the frame Position sits on lit brass and the rest fading back into the well — "position+// is a place in a stack, not a number". The shapes come from the same additive recipe as+// WavetableSynth::harmAmp (a low harmonic count → representative, not sample-exact).+//+// The recipe is fixed per bank, so all four banks' frames are computed ONCE per process+// and shared by every card: rebuilding them inside Render cost thirty thousand sines and+// a thousand line segments on every one of the thirty ticks a second the device panel+// runs, which is what made switching to an Aurora track stutter. Render now draws each+// frame as a single geometry, and Set only invalidates when the picture actually changes.using System;+using System.Threading;using Avalonia;using Avalonia.Controls;using Avalonia.Media;@@ -16,18 +22,57 @@ namespace Nota.App;internal sealed class AuroraStack : Control{- private static readonly IBrush Sunken = NotaPalette.BgSunken;- private static readonly IBrush BorderDef = NotaPalette.BorderDefault;- private static readonly IBrush Accent = NotaPalette.AccentBright;- private static readonly IBrush Faint = NotaPalette.Wash(NotaPalette.Accent, 0x42);- private const int Frames = 16, N = 72, HarmMax = 28;+ private const int Banks = 4, Frames = 16, N = 96, HarmMax = 28;++ private static readonly IBrush Lit = NotaPalette.AccentBright;+ private static readonly IBrush Dim = NotaPalette.TextDisabled;+ // Four depth steps from the back of the stack to the front, so the stack reads as+ // depth rather than as sixteen equal lines.+ private static readonly IBrush[] Depth =+ {+ NotaPalette.Wash(NotaPalette.Accent, 0x38), NotaPalette.Wash(NotaPalette.Accent, 0x58),+ NotaPalette.Wash(NotaPalette.Accent, 0x80), NotaPalette.Wash(NotaPalette.Accent, 0xB0),+ };++ private static readonly Pen[] DepthPens = MakePens(Depth);+ private static readonly Pen[] DimPens = MakePens(new[] { Dim, Dim, Dim, Dim });+ private static readonly Pen HotPen = new(Lit, 1.7, lineCap: PenLineCap.Round, lineJoin: PenLineJoin.Round);+ private static Pen[] MakePens(IBrush[] brushes)+ {+ var p = new Pen[brushes.Length];+ for (int i = 0; i < brushes.Length; i++) p[i] = new Pen(brushes[i], 1, lineJoin: PenLineJoin.Round);+ return p;+ }++ // [bank][frame][sample] — built on first use, read-only afterwards.+ private static readonly double[][][] Shapes = new double[Banks][][];+ private static readonly object ShapeLock = new();++ private int _bank = -1, _active = -1;+ private bool _dim;- private int _bank;- private double _pos;+ /// <summary>Space kept clear at the top of the window for a caption drawn over it.</summary>+ public double TopInset { get; set; }++ /// <summary>Greys the whole stack (the oscillator it belongs to is switched off).</summary>+ public bool Dimmed+ {+ get => _dim;+ set { if (_dim == value) return; _dim = value; InvalidateVisual(); }+ }public AuroraStack() { ClipToBounds = true; }- public void Set(int bank, double pos) { _bank = Math.Clamp(bank, 0, 3); _pos = Math.Clamp(pos, 0, 1); InvalidateVisual(); }+ /// <summary>Point the window at a bank and a position. Only a change of bank or of the+ /// frame the position lands on redraws — a knob moving inside one frame does not.</summary>+ public void Set(int bank, double pos)+ {+ int b = Math.Clamp(bank, 0, Banks - 1);+ int a = Math.Clamp((int)Math.Round(Math.Clamp(pos, 0, 1) * (Frames - 1)), 0, Frames - 1);+ if (b == _bank && a == _active) return;+ _bank = b; _active = a;+ InvalidateVisual();+ }private static double HarmAmp(int bank, double t, int n) => bank switch{@@ -38,48 +83,72 @@ internal sealed class AuroraStack : Control};private static double Sq(double x) => x * x;- private static double[] Frame(int bank, double t)+ private static double[][] Bank(int bank){- var buf = new double[N]; double peak = 1e-6;- for (int j = 0; j < N; j++)+ var got = Volatile.Read(ref Shapes[bank]);+ if (got is not null) return got;+ lock (ShapeLock){- double ph = (double)j / N, acc = 0;- for (int n = 1; n <= HarmMax; n++) { double a = HarmAmp(bank, t, n); if (a > 1e-4) acc += a * Math.Sin(2 * Math.PI * n * ph); }- buf[j] = acc; peak = Math.Max(peak, Math.Abs(acc));+ if (Shapes[bank] is { } already) return already;+ var frames = new double[Frames][];+ Span<double> amp = stackalloc double[HarmMax + 1];+ for (int f = 0; f < Frames; f++)+ {+ double t = (double)f / (Frames - 1);+ // The recipe depends on (bank, frame), not on the sample: evaluate the+ // harmonic amplitudes once and only sum the ones that carry anything.+ for (int n = 1; n <= HarmMax; n++) amp[n] = HarmAmp(bank, t, n);+ var buf = new double[N];+ double peak = 1e-6;+ for (int j = 0; j < N; j++)+ {+ double ph = 2 * Math.PI * j / N, acc = 0;+ for (int n = 1; n <= HarmMax; n++) if (amp[n] > 1e-4) acc += amp[n] * Math.Sin(n * ph);+ buf[j] = acc;+ peak = Math.Max(peak, Math.Abs(acc));+ }+ for (int j = 0; j < N; j++) buf[j] /= peak;+ frames[f] = buf;+ }+ Volatile.Write(ref Shapes[bank], frames);+ return frames;}- for (int j = 0; j < N; j++) buf[j] /= peak;- return buf;}public override void Render(DrawingContext ctx){- double w = Bounds.Width, h = Bounds.Height; if (w <= 0) return;+ double w = Bounds.Width, h = Bounds.Height;+ if (w <= 2 || h <= 2 || _bank < 0) return;NotaGraph.Window(ctx, new Rect(0, 0, w, h));- int active = Math.Clamp((int)Math.Round(_pos * (Frames - 1)), 0, Frames - 1);- // Skewed stack sized so every frame (centre ± amplitude) stays inside the bounds:- // frame 0 bottom-front, frame 15 top-back; each shifted up-right.- const double padX = 10, padY = 8;+ var frames = Bank(_bank);+ // The stack is skewed up-and-right: frame 0 sits bottom-front, frame 15 top-back,+ // sized so every frame's centre ± amplitude stays inside the window.+ const double padX = 9, padY = 7;+ double top = padY + TopInset;double waveW = (w - padX * 2) * 0.70, skewX = (w - padX * 2) * 0.30 / (Frames - 1);- double amp = (h - padY * 2) * 0.16;- double cyBottom = h - padY - amp, cyTop = padY + amp;+ double amp = (h - top - padY) * 0.15;+ double cyBottom = h - padY - amp, cyTop = top + amp;+ if (cyBottom <= cyTop) return;++ var pens = _dim ? DimPens : DepthPens;+ var hot = _dim ? DimPens[^1] : HotPen;- // Draw back-to-front so nearer frames overlap farther ones.+ // Back to front, so a nearer frame overlaps the one behind it.for (int f = Frames - 1; f >= 0; f--){- bool on = f == active;- var pen = new Pen(on ? Accent : Faint, on ? 1.7 : 1.0, lineJoin: PenLineJoin.Round);- var buf = Frame(_bank, (double)f / (Frames - 1));+ bool on = f == _active;+ var buf = frames[f];double ox = padX + f * skewX;double cy = cyBottom - (cyBottom - cyTop) * f / (Frames - 1);- Point? prev = null;- for (int j = 0; j <= N; j++)+ var geo = new StreamGeometry();+ using (var g = geo.Open()){- double s = buf[j % N];- var p = new Point(ox + (double)j / N * waveW, cy - s * amp);- if (prev is { } pp) ctx.DrawLine(pen, pp, p);- prev = p;+ g.BeginFigure(new Point(ox, cy - buf[0] * amp), false);+ for (int j = 1; j <= N; j++)+ g.LineTo(new Point(ox + (double)j / N * waveW, cy - buf[j % N] * amp));}+ ctx.DrawGeometry(null, on ? hot : pens[f * Depth.Length / Frames], geo);}}}diff --git a/src/managed/Nota.App/Controls/AuroraViz.cs b/src/managed/Nota.App/Controls/AuroraViz.csdeleted file mode 100644index 3c5e5822..00000000--- a/src/managed/Nota.App/Controls/AuroraViz.cs+++ /dev/null@@ -1,139 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-only-// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.--using System;-using System.Globalization;-using Avalonia;-using Avalonia.Controls;-using Avalonia.Media;--namespace Nota.App;-- // Live wavetable-morph display + low-pass response for Nota Aurora, drawn from- // normalized params. The waveform is reconstructed from the same additive recipe- // as the engine (representative, not sample-identical), so Position/Warp/Table- // moves animate the curve.- internal sealed class AuroraViz : Control- {- private static readonly IBrush Sunken = NotaPalette.BgSunken;- private static readonly IBrush BorderDef = NotaPalette.BorderDefault;- private static readonly IBrush AccentBright = NotaPalette.AccentBright;- private static readonly IBrush TextTertiary = NotaPalette.TextTertiary;- private static readonly IBrush TextSecondary = NotaPalette.TextSecondary;- public enum K { Wave, Filter }- private static readonly IBrush Grid = NotaGraph.Grid;- private static readonly Typeface Face = NotaFonts.Mono;- private readonly K _k;- private int _bank;- private double _pos, _warp, _cut, _res;- public AuroraViz(K k) { _k = k; MinWidth = 180; MinHeight = 40; }- public void Set(int bank, double pos, double warp, double cut, double res)- { _bank = bank; _pos = pos; _warp = warp; _cut = cut; _res = res; InvalidateVisual(); }-- private void Label(DrawingContext ctx, string text, double x, double y, IBrush brush, double size = 8)- => ctx.DrawText(new FormattedText(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, Face, size, brush), new Point(x, y));-- // Harmonic amplitude recipe, mirroring WavetableSynth::harmAmp.- private static double HarmAmp(int bank, double t, int n) => bank switch- {- 0 => n == 1 ? 1.0 : t * (1.0 / n),- 1 => (n % 2 == 1) ? (n == 1 ? 1.0 : t * (1.0 / n)) : 0.0,- 2 => Math.Exp(-Math.Pow((n - (1.0 + t * 16.0)) / (2.0 + t * 3.0), 2)) + (n == 1 ? 0.15 : 0.0),- _ => (1.0 / n) * Math.Abs(Math.Cos(Math.PI * n * (0.25 + 0.75 * t))),- };-- private static double WarpPhase(double phase, double d) => phase < d ? 0.5 * phase / d : 0.5 + 0.5 * (phase - d) / (1.0 - d);-- // One morphed cycle sampled at `samples` points (peak-normalized).- private double[] Cycle(double frame01, int samples)- {- const int nMax = 32;- double d = Math.Clamp(0.5 + (_warp - 0.5) * 0.9, 0.05, 0.95);- var buf = new double[samples];- double peak = 1e-6;- for (int j = 0; j < samples; j++)- {- double ph = WarpPhase((double)j / samples, d);- double acc = 0;- for (int n = 1; n <= nMax; n++)- {- double a = HarmAmp(_bank, frame01, n);- if (a > 1e-4) acc += a * Math.Sin(2 * Math.PI * n * ph);- }- buf[j] = acc;- peak = Math.Max(peak, Math.Abs(acc));- }- for (int j = 0; j < samples; j++) buf[j] /= peak;- return buf;- }-- public override void Render(DrawingContext ctx)- {- double w = Bounds.Width, h = Bounds.Height;- if (w <= 0) return;- NotaGraph.Window(ctx, new Rect(0, 0, w, h));- double pad = 6, x0 = pad, x1 = w - pad, top = pad + 11, bot = h - pad - 9;-- if (_k == K.Wave)- {- string[] banks = { "ANALOG", "PULSE", "FORMANT", "CHROMA" };- Label(ctx, "WAVETABLE", x0, pad - 1, TextTertiary);- Label(ctx, banks[Math.Clamp(_bank, 0, 3)], x1 - 46, pad - 1, TextTertiary);- int samples = 128;- double span = x1 - x0, mid = (top + bot) / 2, amp = (bot - top) * 0.42;- // Faint stack of neighbouring frames (behind), offset up-left to suggest depth.- var faint = new Pen(NotaPalette.Wash(NotaPalette.AccentBright, 0x40), 1);- for (int s = 2; s >= 1; s--)- {- double nf = Math.Clamp(_pos + s * 0.14, 0, 1) * 7.0;- var g2 = Cycle(nf, samples);- var geo = new StreamGeometry();- using (var gc = geo.Open())- {- double dx = -s * 6, dy = -s * 7;- gc.BeginFigure(new Point(x0 + dx, mid + dy - g2[0] * amp), false);- for (int j = 1; j < samples; j++)- gc.LineTo(new Point(x0 + dx + span * j / (samples - 1), mid + dy - g2[j] * amp));- }- ctx.DrawGeometry(null, faint, geo);- }- // Bright current morphed frame.- var cur = Cycle(_pos * 7.0, samples);- var pen = new Pen(AccentBright, 1.6, lineCap: PenLineCap.Round, lineJoin: PenLineJoin.Round);- var fig = new StreamGeometry();- using (var gc = fig.Open())- {- gc.BeginFigure(new Point(x0, mid - cur[0] * amp), false);- for (int j = 1; j < samples; j++)- gc.LineTo(new Point(x0 + span * j / (samples - 1), mid - cur[j] * amp));- }- ctx.DrawGeometry(null, pen, fig);- Label(ctx, $"pos {(int)Math.Round(_pos * 100)}\u2009%", x0, bot + 1, TextSecondary);- }- else- {- Label(ctx, "FILTER", x0, pad - 1, TextTertiary);- var gridPen = new Pen(Grid, 1);- for (int i = 1; i <= 3; i++)- {- double gy = top + (bot - top) * i / 4.0;- ctx.DrawLine(gridPen, new Point(x0, gy), new Point(x1, gy));- double gx = x0 + (x1 - x0) * i / 4.0;- ctx.DrawLine(gridPen, new Point(gx, top), new Point(gx, bot));- }- var pen = new Pen(AccentBright, 1.6, lineCap: PenLineCap.Round, lineJoin: PenLineJoin.Round);- double cx = x0 + _cut * (x1 - x0);- double flatY = top + (bot - top) * 0.35;- double bumpY = flatY - _res * (flatY - top) * 0.95;- double kx = Math.Max(x0, cx - 12);- ctx.DrawLine(pen, new Point(x0, flatY), new Point(kx, flatY));- ctx.DrawLine(pen, new Point(kx, flatY), new Point(cx, bumpY));- ctx.DrawLine(pen, new Point(cx, bumpY), new Point(x1, bot));- ctx.DrawLine(new Pen(TextTertiary, 1) { DashStyle = DashStyle.Dash }, new Point(cx, top), new Point(cx, bot));- double hz = 20.0 * Math.Pow(900.0, _cut);- string hzText = hz >= 1000 ? $"{hz / 1000.0:0.0}k" : $"{hz:0}";- Label(ctx, hzText, Math.Clamp(cx - 8, x0, x1 - 22), bot + 1, TextSecondary);- Label(ctx, "Hz", x1 - 14, pad - 1, TextTertiary);- }- }- }diff --git a/src/managed/Nota.App/Controls/VoltFilter.cs b/src/managed/Nota.App/Controls/VoltFilter.csindex a82180dd..5e5834f5 100644--- a/src/managed/Nota.App/Controls/VoltFilter.cs+++ b/src/managed/Nota.App/Controls/VoltFilter.cs@@ -95,6 +95,8 @@ namespace Nota.App;p.Add(new(x0, bot)); p.Add(new(kx, mid)); p.Add(new(cx, peakY)); p.Add(new(rx, mid)); p.Add(new(x1, bot)); break;case 3: // Notch: flat with a dipp.Add(new(x0, flatY)); p.Add(new(kx, flatY)); p.Add(new(cx, bot)); p.Add(new(rx, flatY)); p.Add(new(x1, flatY)); break;+ case 4: // Morph (Aurora): flat either side with a bell at the cutoff+ p.Add(new(x0, flatY)); p.Add(new(kx, flatY)); p.Add(new(cx, peakY)); p.Add(new(rx, flatY)); p.Add(new(x1, flatY)); break;default: // LP: flat to cutoff, resonance peak, roll offp.Add(new(x0, flatY)); p.Add(new(kx, flatY)); p.Add(new(cx, peakY)); p.Add(new((cx + x1) / 2, mid)); p.Add(new(x1, bot)); break;}diff --git a/src/managed/Nota.App/DeviceCards/Instruments/AuroraInstrumentCard.cs b/src/managed/Nota.App/DeviceCards/Instruments/AuroraInstrumentCard.csindex 5bd398ad..812a01dc 100644--- a/src/managed/Nota.App/DeviceCards/Instruments/AuroraInstrumentCard.cs+++ b/src/managed/Nota.App/DeviceCards/Instruments/AuroraInstrumentCard.cs@@ -1,12 +1,33 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.//-// Detail · Devices — built-in Nota Aurora editor (instrument kind 5), rebuilt to mockup-// 2j: body-only content on the shared shell (700×260) — a LIVE strip (Pos 1 · Cutoff ·-// Unison + Poly/Mono) over a 74px tab rail (Osc · Filter · Env · LFO · Mod · FX). The-// Osc tab shows the 16-frame wavetable stack + two oscillators + sub + unison + warp-// modes; Filter has two filters with per-source routing; Mod is an 8×7 matrix + macros;-// FX holds drive/chorus/reverb. Reuses AuroraStack / VoltFilter / VoltEnv / VoltMatrix.+// Detail · Devices — built-in Nota Aurora editor (instrument kind 5): a wavetable synth in+// the 700 × 260 card the almanac draws for it, the same body Operator and Volt wear.+//+// Wheels 56 pitch bend and mod wheel, on screen on every tab.+// Centre six tabs:+// Osc — the 16-frame wavetable stack beside the two oscillators, the sub+// and the unison stack; the strip on top carries the bank and the+// warp mode of whichever oscillator you are looking at.+// Filter — the selected filter's response as a drag pad, with its type,+// slope, cutoff, resonance, env / LFO / key amounts and where each+// source (Osc 1 / Osc 2 / Sub) is sent.+// Env — Env 1 (amp) and Env 2 (free) drawn and draggable.+// LFO — both LFOs as a table, each naming where it lands, over a window+// that draws the selected LFO's own shape.+// Mod — the 8 × 7 matrix: drag a cell up for +, down for −.+// FX — drive · chorus · reverb, each on its own switch.+// Rail 186 Global (voice mode, bend range, position, cutoff, unison, gain, pan and+// the track's meter) or Macros (eight, three to a page, each a value, an+// amount and one of twelve targets). Picking Mod brings the macros up, as+// the almanac draws that state.+//+// Brass is the parameter itself; teal is modulation and what receives it. Everything is a+// plugin param → automation / persist / clone, and the card follows automation live.+//+// The live tick runs thirty times a second, so Refresh first asks whether ANY parameter+// moved and returns at once when none did: the readouts, the four graphs and the matrix+// are only touched when there is something new to say.using System;using System.Collections.Generic;@@ -22,305 +43,1157 @@ namespace Nota.App;internal sealed class AuroraInstrumentCard : IInstrumentCard{- private static readonly IBrush CardBg = NotaPalette.BgApp;- private static readonly IBrush HdrBg = NotaPalette.SurfaceCard;- private static readonly IBrush RailBg = NotaPalette.SurfaceInset;- private static readonly IBrush Border2 = NotaPalette.BorderDefault;- private static readonly IBrush Inset = NotaPalette.BgSunken;- private static readonly IBrush Amber = NotaPalette.Accent;- private static readonly IBrush AmberLit = NotaPalette.AccentBright;- private static readonly IBrush TealC = NotaPalette.Teal;- private static readonly IBrush TxtC = NotaPalette.TextPrimary;- private static readonly IBrush MutedC = NotaPalette.TextTertiary;- private static readonly IBrush AmberSubtle = NotaPalette.Wash(NotaPalette.Accent, 0x28);+ public bool BodyOnly => true;+ public string Subtitle => "WAVETABLE";+ public double CardWidth => 700;++ private const double WheelsW = 56, RailW = 186, TabH = 20, StatusH = 18, BodyH = 186;+ private static readonly string[] TabNames = { "Osc", "Filter", "Env", "LFO", "Mod", "FX" };+ private static readonly string[] RailTabs = { "Global", "Macros" };private static readonly string[] Banks = { "Analog", "Pulse", "Formant", "Chroma" };+ private static readonly string[] BankWords = { "analog", "pulse", "formant", "chroma" };private static readonly string[] WarpModes = { "Off", "Sync", "Bend", "PWM", "Fold" };private static readonly string[] FiltTypes = { "LP", "HP", "BP", "Notch", "Morph" };- private static readonly string[] Routes = { "F1", "F2", "Both", "Dry" };- private static readonly string[] DestNames = { "Pitch", "Osc2", "Position", "Cutoff", "Reso", "Level", "Pan" };+ private static readonly string[] Routes = { "F1", "F2", "1+2", "Dry" };+ private static readonly string[] SubWaves = { "sin", "sqr", "tri" };+ private static readonly string[] ShapeNames = { "sin", "tri", "sqr", "S&H" };+ private static readonly string[] SyncNames = { "free", "1 bar", "1/2", "1/4", "1/8", "1/16", "1/32", "1/64" };+ private static readonly string[] BendNames = { "±2", "±5", "±12" };+ private static readonly float[] BendStops = { 1f / 11f, 4f / 11f, 1f };+ private static readonly string[] DriveModes = { "Tube", "Tape", "Fold" };+ private static readonly string[] ChorusVoices = { "1×", "2×", "4×" };+ private static readonly string[] ReverbModes = { "Room", "Hall", "Plate" };private static readonly string[] SrcNames = { "Env 1", "Env 2", "LFO 1", "LFO 2", "Velocity", "Key", "Mod Whl", "Random" };+ private static readonly string[] DestNames = { "Pitch", "Osc 2", "Position", "Cutoff", "Reso", "Level", "Pan" };- public bool BodyOnly => true;- public string Subtitle => "WAVETABLE";+ // The twelve macro targets in the engine's order (WavetableSynth::kMacroDests). The+ // seven matrix destinations sit at 0, 2, 4, 6, 7, 9 and 11, so a macro saved against+ // the old seven-entry list still points at the same one.+ private static readonly string[] MacroDests =+ {+ "Pitch", "Warp", "Osc 2 pitch", "Osc 2 level", "Position", "Sub level",+ "Cutoff", "Reso", "Unison", "Level", "Drive", "Pan",+ };+ // What a macro on that target is called on the patch — the word a player reads.+ private static readonly string[] MacroWords =+ {+ "PITCH", "SHAPE", "INTERVAL", "LAYER", "SHIMMER", "WEIGHT",+ "AIR", "EDGE", "WIDTH", "SWELL", "GRIT", "PLACE",+ };++ // The engine's own maps (WavetableSynth.h), so a readout says what it does.+ private static double ExpMap(float v, double lo, double hi) => lo * Math.Pow(hi / lo, Math.Clamp(v, 0f, 1f));+ private static string Hz(float v) => NotaNum.Hz(ExpMap(v, 20, 18000));+ private static string SlowHz(double hz) => hz >= 9.995 ? NotaNum.Hz(hz) : NotaNum.Unit(hz, hz < 0.995 ? "0.00" : "0.0", "Hz");+ private static string Secs(float v, double lo, double hi) => NotaNum.Time(ExpMap(v, lo, hi));+ private static string Pct(float v) => NotaNum.Pct(v);+ private static string Bip(float v) => NotaNum.Unit((v - 0.5f) * 200, "+0;−0;0", "%");+ private static string Oct(float v) => NotaNum.Str(Math.Round((v - 0.5) * 6), "+0;−0;0");+ private static string Semi(float v) => NotaNum.Str(Math.Round((v - 0.5) * 24), "+0;−0;0");+ private static string Cents(float v) => NotaNum.Unit(Math.Round((v - 0.5) * 100), "+0;−0;0", "c");+ private static string Detune(float v) => NotaNum.Unit(v * 50, "0", "c");+ private static string SubOct(float v) => NotaNum.Str(Math.Round((v - 0.5) * 4) - 1, "+0;−0;0");+ private static int Voices(float v) => 1 + (int)Math.Round(v * 6);+ private static int Frame(float v) => 1 + (int)Math.Round(v * 15);+ private static string FrameText(float v) => $"{Frame(v)}/16";+ private static string ChorusHz(float v) => SlowHz(ExpMap(v, 0.1, 6.0));+ private static int SyncDiv(float v) => Math.Clamp((int)Math.Round(v * 7), 0, 7);+ private static string SyncText(float v) => SyncNames[SyncDiv(v)];+ private static int BendRange(float v) => (int)Math.Round(1 + v * 11);+ private static string PanText(float v)+ {+ double p = (v - 0.5) * 200;+ return Math.Abs(p) < 0.5 ? "C" : (p < 0 ? "L" : "R") + NotaNum.Str(Math.Abs(p), "0");+ }public Control Build(DeviceCardContext ctx){- var engine = ctx.Engine; int track = ctx.TrackId;+ var engine = ctx.Engine;+ int track = ctx.TrackId;int pc = engine.PluginParamCount(track, -1);- var idx = new Dictionary<string, int>();+ var idx = new Dictionary<string, int>(pc * 2);for (int i = 0; i < pc; i++) idx[engine.PluginParamId(track, -1, i)] = i;- float G(string id) => idx.TryGetValue(id, out var i) ? engine.PluginParamGet(track, -1, i) : 0f;int I(string id) => idx.TryGetValue(id, out var i) ? i : -1;+ float G(string id) => I(id) is var i and >= 0 ? engine.PluginParamGet(track, -1, i) : 0f;void SetP(string id, float v) { if (I(id) is var i and >= 0) engine.PluginParamSet(track, -1, i, Math.Clamp(v, 0f, 1f)); }- (int, string) P(string id) => (I(id), id);+ void Begin(string id) { if (I(id) >= 0) engine.BeginAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id); }+ void End(string id) { if (I(id) >= 0) engine.EndAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id); }int Sel(string id, int n) => Math.Clamp((int)Math.Round(G(id) * (n - 1)), 0, n - 1);+ (int, string) P(string id) => (I(id), id);var readouts = new List<Action>();- var stack = new AuroraStack { VerticalAlignment = VerticalAlignment.Stretch };- var filtGraph = new VoltFilter(engine, track);- var env1 = new VoltEnv(engine, track);- var env2 = new VoltEnv(engine, track);- int fsel = 0;+ int tab = 0, railTab = 0, fsel = 0, osel = 0; // Osc · Global · Filter 1 · Osc 1- void Refresh()+ var stack = new AuroraStack { VerticalAlignment = VerticalAlignment.Stretch, MinHeight = 60 };+ var filtGraph = new VoltFilter(engine, track) { VerticalAlignment = VerticalAlignment.Stretch, MinHeight = 60 };+ var env1 = new VoltEnv(engine, track) { VerticalAlignment = VerticalAlignment.Stretch, MinHeight = 50 };+ var env2 = new VoltEnv(engine, track) { VerticalAlignment = VerticalAlignment.Stretch, MinHeight = 50, Accent = Teal };+ var lfoStrip = new AuroraLfoStrip { VerticalAlignment = VerticalAlignment.Stretch };++ var hint = new TextBlock{- stack.Set(Sel("table", 4), G("position"));- string pre = fsel == 0 ? "fil1" : "fil2";- if (fsel == 0) filtGraph.Target("FILTER 1", P("cutoff"), P("resonance"), Sel("fil1type", 5));- else filtGraph.Target("FILTER 2", P("fil2freq"), P("fil2reso"), Sel("fil2type", 5));- filtGraph.Refresh(); env1.Refresh(); env2.Refresh();- foreach (var a in readouts) a();+ FontSize = NotaType.Axis, Foreground = TextTertiary, FontFamily = NotaFonts.MonoFamily,+ VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Right,+ Margin = new Thickness(0, 0, 6, 0), TextTrimming = TextTrimming.CharacterEllipsis,+ };+ var status = new TextBlock { FontSize = 8, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis };+ var meta = new TextBlock { FontSize = 8, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center, FontFamily = NotaFonts.MonoFamily };+ Action applyFilter = () => { };+ Action applyOsc = () => { };+ Action showTab = () => { };++ // ---- the live tick's gate -------------------------------------------------+ // Thirty times a second the card is asked to follow automation. Reading the+ // parameter block is one cheap pass; repainting four graphs, a 56-cell matrix and+ // two hundred readouts is not — so do the pass, and stop there when nothing moved.+ var snapshot = new float[pc];+ bool primed = false;+ bool ParamsMoved()+ {+ bool moved = !primed;+ for (int i = 0; i < pc; i++)+ {+ float v = engine.PluginParamGet(track, -1, i);+ if (v != snapshot[i]) { snapshot[i] = v; moved = true; }+ }+ primed = true;+ return moved;+ }+ void Refresh(bool force)+ {+ if (!ParamsMoved() && !force) return;+ applyOsc(); applyFilter();+ stack.Set(Sel(osel == 0 ? "table" : "osc2table", 4), G(osel == 0 ? "position" : "osc2position"));+ stack.Dimmed = G(osel == 0 ? "osc1on" : "osc2on") < 0.5f;+ env1.Refresh(); env2.Refresh();+ lfoStrip.Set(Sel("lfo1shape", 4), LfoCycles(0), G("lfo1depth"));+ foreach (var r in readouts) r();+ hint.Text = Hint();+ status.Text = Summary();+ meta.Text = Meta();+ }+ void Touch() => Refresh(true);++ // ---- shared builders ------------------------------------------------------+ static TextBlock Cap(string t, IBrush? c = null) => new()+ {+ Text = t, FontSize = NotaType.KnobLabel, FontWeight = FontWeight.Bold,+ LetterSpacing = NotaType.KnobLabelTracking, Foreground = c ?? TextTertiary,+ VerticalAlignment = VerticalAlignment.Center,+ };+ static TextBlock Mono(string t, IBrush? c = null, double fs = 8) => new()+ {+ Text = t, FontSize = fs, Foreground = c ?? TextSecondary,+ VerticalAlignment = VerticalAlignment.Center, FontFamily = NotaFonts.MonoFamily,+ };+ static TextBlock Section(string t, IBrush? c = null) => new()+ {+ Text = t, FontSize = NotaType.DeviceSection, FontWeight = FontWeight.SemiBold,+ Foreground = c ?? TextPrimary, VerticalAlignment = VerticalAlignment.Center,+ };+ static Border Rule() => new() { BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0) };++ Control PKnob(string id, string label, string learn, Func<float, string> fmt,+ double size = 28, double cellW = 44, IBrush? arc = null)+ {+ if (!idx.TryGetValue(id, out var pi)) return new Panel();+ var value = new TextBlock+ {+ Text = fmt(G(id)), FontSize = NotaType.KnobValue, FontFamily = NotaFonts.MonoFamily,+ Foreground = TextPrimary, HorizontalAlignment = HorizontalAlignment.Center,+ TextAlignment = TextAlignment.Center, LineHeight = 10,+ };+ var knob = new Knob(G(id), 1.0)+ {+ Accent = true, ArcColor = arc, Default = engine.InstrumentParamDefault(track, pi),+ Width = size, Height = size, HorizontalAlignment = HorizontalAlignment.Center,+ };+ knob.ValueChanged += v => { engine.PluginParamSet(track, -1, pi, (float)v); value.Text = fmt((float)v); Touch(); };+ knob.GestureBegin += () => Begin(id);+ knob.GestureEnd += () => End(id);+ ctx.AddInstFader(pi, knob, value, fmt);+ MidiLearn.Bind(knob, MidiTarget.PluginParam(track, -1, pi), learn);+ return label.Length == 0+ ? new StackPanel { Width = cellW, Spacing = 0, Children = { knob, value } }+ : KnobCell(label, knob, value, cellW);+ }++ // A knob with no value line: a macro box prints both its numbers beside the name,+ // so the two knobs above them need none of their own.+ Control BareKnob(string id, string learn, Func<float, string> fmt, double size, IBrush? arc = null)+ {+ if (!idx.TryGetValue(id, out var pi)) return new Panel();+ var shadow = new TextBlock(); // not in the tree; AddInstFader needs somewhere to write+ var knob = new Knob(G(id), 1.0)+ {+ Accent = true, ArcColor = arc, Default = engine.InstrumentParamDefault(track, pi),+ Width = size, Height = size, VerticalAlignment = VerticalAlignment.Center,+ };+ knob.ValueChanged += v => { engine.PluginParamSet(track, -1, pi, (float)v); Touch(); };+ knob.GestureBegin += () => Begin(id);+ knob.GestureEnd += () => End(id);+ ctx.AddInstFader(pi, knob, shadow, fmt);+ readouts.Add(() => ToolTip.SetTip(knob, learn + " · " + fmt(G(id))));+ MidiLearn.Bind(knob, MidiTarget.PluginParam(track, -1, pi), learn);+ return knob;}- Control K(string id, string name, bool mod = false, double sz = 32, double cw = 42)- => InstrumentControls.InstKnob(ctx, idx, id, name, Refresh, sz, cw, mod ? TealC : null);- Control Row(double sp, params Control[] cs) { var r = new StackPanel { Orientation = Orientation.Horizontal, Spacing = sp, VerticalAlignment = VerticalAlignment.Center }; foreach (var c in cs) r.Children.Add(c); return r; }- Control Lbl(string t, double fs, IBrush c) => new TextBlock { Text = t, FontSize = fs, FontWeight = FontWeight.Bold, Foreground = c, VerticalAlignment = VerticalAlignment.Center };+ // A drag value: a caps label over a mono readout. Vertical drag moves it (a+ // stepped param snaps to its steps), double-click puts it back to its default.+ Control DragValue(string id, string label, string learn, Func<float, string> fmt, float step = 0, IBrush? ink = null)+ {+ if (!idx.TryGetValue(id, out var pi)) return new Panel();+ var cap = Cap(label); cap.HorizontalAlignment = HorizontalAlignment.Left;+ var value = Mono(fmt(G(id)), ink ?? TextPrimary, NotaType.RowLabel);+ var cell = new StackPanel+ {+ Spacing = 0, Background = Brushes.Transparent, Cursor = new Cursor(StandardCursorType.SizeNorthSouth),+ Children = { cap, value },+ };+ bool drag = false; double y0 = 0; float v0 = 0;+ cell.PointerPressed += (_, e) =>+ {+ if (!e.GetCurrentPoint(cell).Properties.IsLeftButtonPressed) return;+ if (e.ClickCount == 2)+ {+ Begin(id); SetP(id, engine.InstrumentParamDefault(track, pi)); End(id);+ Touch(); e.Handled = true; return;+ }+ drag = true; y0 = e.GetPosition(cell).Y; v0 = G(id);+ Begin(id); e.Pointer.Capture(cell); e.Handled = true;+ };+ cell.PointerMoved += (_, e) =>+ {+ if (!drag) return;+ float v = Math.Clamp(v0 + (float)((y0 - e.GetPosition(cell).Y) / 120.0), 0f, 1f);+ if (step > 0) v = MathF.Round(v / step) * step;+ if (v == G(id)) return;+ SetP(id, v); Touch();+ };+ void Stop(PointerEventArgs e) { if (!drag) return; drag = false; e.Pointer.Capture(null); End(id); }+ cell.PointerReleased += (_, e) => Stop(e);+ cell.PointerCaptureLost += (_, _) => { if (drag) { drag = false; End(id); } };+ readouts.Add(() =>+ {+ value.Text = fmt(G(id));+ bool moved = Math.Abs(G(id) - engine.InstrumentParamDefault(track, pi)) > 1e-4f;+ cap.Foreground = moved && ink is null ? AccentBright : TextTertiary;+ });+ ToolTip.SetTip(cell, learn + " · drag to change, double-click to reset");+ MidiLearn.Bind(cell, MidiTarget.PluginParam(track, -1, pi), learn);+ return cell;+ }- Control Chips(string id, string[] names, double fs = 9)+ Control Chips(string id, string[] names, Func<int>? current = null, Action<int>? pick = null, bool fill = false){int n = names.Length;- var seg = DeviceCardKit.Segments(names, () => Sel(id, n), iv => { SetP(id, iv / (float)(n - 1)); Refresh(); }, out var sync);+ var seg = Segments(names, current ?? (() => Sel(id, n)),+ pick ?? (iv => { SetP(id, iv / (float)(n - 1)); Touch(); }), out var sync, fill: fill);readouts.Add(sync);if (I(id) is var pi and >= 0) MidiLearn.Bind(seg, MidiTarget.PluginParam(track, -1, pi), id);return seg;}- // Local segmented toggle (not a param).- Control Seg(string[] names, int initial, Action<int> onPick, double fs = 9)- {- int cur = initial;- return DeviceCardKit.Segments(names, () => cur, iv => { cur = iv; onPick(iv); }, out _);- }- // Param-backed on/off pill.- Control Toggle(string id, string label)- {- var b = new Border { CornerRadius = NotaRadius.Control, BorderThickness = new Thickness(1), Padding = new Thickness(7, 1), Cursor = new Cursor(StandardCursorType.Hand), VerticalAlignment = VerticalAlignment.Center, Child = new TextBlock { Text = label, FontSize = 8, FontWeight = FontWeight.SemiBold } };- void Hi() { bool on = G(id) > 0.5f; b.Background = on ? NotaPalette.AccentSubtle : Inset; b.BorderBrush = on ? NotaPalette.BorderBrass : Border2; ((TextBlock)b.Child!).Foreground = on ? NotaPalette.AccentHover : MutedC; }- b.PointerPressed += (_, _) => { SetP(id, G(id) > 0.5f ? 0f : 1f); Hi(); Refresh(); };- readouts.Add(Hi); Hi();- if (I(id) is var pi and >= 0) MidiLearn.Bind(b, MidiTarget.PluginParam(track, -1, pi), label);- return b;- }- Control Slider(string id, string name, Func<double, string> fmt, double w)+ Control StopChips(string id, string[] names, float[] stops, bool fill = false)+ => Chips(id, names, () => NearestExact(G(id), stops), iv => { SetP(id, stops[iv]); Touch(); }, fill);++ Grid Slider(string label, string id, Func<string> text, double labelW = 0, double valueW = 40){int pi = I(id);- var row = DeviceCardKit.SliderRow(name, () => G(id), n => { if (pi >= 0) engine.PluginParamSet(track, -1, pi, (float)n); Refresh(); }, () => fmt(G(id)), out var sync,- begin: () => { if (pi >= 0) engine.BeginAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id); },- end: () => { if (pi >= 0) engine.EndAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id); },- trackWidth: w, valueWidth: 54);+ var row = SliderRow(label, () => G(id), v => { SetP(id, (float)v); Touch(); }, text, out var sync,+ begin: pi >= 0 ? () => Begin(id) : null,+ end: pi >= 0 ? () => End(id) : null,+ reset: pi >= 0 ? () => { SetP(id, engine.InstrumentParamDefault(track, pi)); Touch(); } : null,+ labelWidth: labelW, valueWidth: valueW);readouts.Add(sync);- if (pi >= 0) MidiLearn.Bind(row, MidiTarget.PluginParam(track, -1, pi), name);+ if (pi >= 0) MidiLearn.Bind(row, MidiTarget.PluginParam(track, -1, pi), label);return row;}- // ---- LIVE strip ----- string Hz(double v) { double f = 20 * Math.Pow(900, v); return f >= 1000 ? $"{f / 1000:0.0}\u2009k" : $"{f:0}\u2009Hz"; }- var monoSeg = Seg(new[] { "Poly", "Mono" }, G("mono") > 0.5f ? 1 : 0, i => { SetP("mono", i); }, 9);- DockPanel.SetDock(monoSeg, Dock.Right);- var liveStrip = new Border { Height = 34, Background = HdrBg, BorderBrush = Border2, BorderThickness = new Thickness(0, 0, 0, 1),- Child = new DockPanel { Margin = new Thickness(9, 0), LastChildFill = false, Children = { monoSeg,- new StackPanel { Orientation = Orientation.Horizontal, Spacing = 12, VerticalAlignment = VerticalAlignment.Center, Children = {- Slider("position", "POS 1", v => $"frame {1 + (int)Math.Round(v * 15)}/16", 76),- Slider("cutoff", "CUTOFF", Hz, 76),- Slider("unidetune", "UNISON", v => $"{v * 50:0}\u2009c", 56) } } } } };-- // ---- Osc tab ----- // Clickable label that cycles through an n-way selector param (for osc2's bank).- Control Cycle(string id, string[] names)- {- var b = new Border { CornerRadius = NotaRadius.Badge, BorderThickness = new Thickness(1), BorderBrush = Border2, Background = Inset, Padding = new Thickness(5, 1), Cursor = new Cursor(StandardCursorType.Hand), Child = new TextBlock { FontSize = 8, Foreground = AmberLit } };- void Hi() => ((TextBlock)b.Child!).Text = names[Sel(id, names.Length)];- b.PointerPressed += (_, _) => { SetP(id, (float)((Sel(id, names.Length) + 1) % names.Length) / (names.Length - 1)); Hi(); Refresh(); };- readouts.Add(Hi); Hi(); return b;+ Control Toggle(string label, string id, Func<string>? live = null)+ {+ var host = Switch(label, () => G(id) >= 0.5f, () => { SetP(id, G(id) >= 0.5f ? 0f : 1f); Touch(); }, out var sync, liveLabel: live);+ readouts.Add(sync);+ if (I(id) is var pi and >= 0) MidiLearn.Bind(host, MidiTarget.PluginParam(track, -1, pi), label);+ return host;+ }++ // Where a modulator actually lands: its strongest route in the matrix, or the+ // filter it is wired to by the fixed amounts. One that goes nowhere says so.+ string LfoDest(int src)+ {+ int best = -1; double mag = 0.02;+ for (int d = 0; d < DestNames.Length; d++)+ {+ double a = Math.Abs(G($"mtx{src}_{d}") - 0.5) * 2;+ if (a > mag) { mag = a; best = d; }+ }+ string fixedId = src == 2 ? "fil1lfo" : "fil2lfo";+ double fixedAmt = Math.Abs(G(fixedId) - 0.5) * 2;+ if (fixedAmt > mag) return $"→ Filter {(src == 2 ? 1 : 2)}";+ return best < 0 ? "unrouted" : "→ " + DestNames[best];}- // Compact drag value field (mockup SUB/UNI): a label over a field you drag- // horizontally; double-click resets to default. Takes less room than a gauge knob.- Control DragCell(string id, string name, Func<double, string> fmt)+ string EnvDest(int src){- int pi = I(id);- var val = new TextBlock { Text = fmt(G(id)), FontSize = 9, Foreground = TxtC, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };- val.BindResource(TextBlock.FontFamilyProperty, "Font.Mono");- var field = new Border { MinWidth = 40, Height = 17, Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Padding = new Thickness(3, 0), Cursor = new Cursor(StandardCursorType.SizeWestEast), Child = val };- bool drag = false; double sx = 0, sv = 0;- field.PointerPressed += (_, e) =>- {- if (e.ClickCount == 2) { if (pi >= 0) { float d = engine.InstrumentParamDefault(track, pi); engine.PluginParamSet(track, -1, pi, d); val.Text = fmt(d); } Refresh(); e.Handled = true; return; }- drag = true; sx = e.GetPosition(field).X; sv = G(id); if (pi >= 0) engine.BeginAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id); e.Pointer.Capture(field); e.Handled = true;- };- field.PointerMoved += (_, e) => { if (!drag) return; double v = Math.Clamp(sv + (e.GetPosition(field).X - sx) / 120.0, 0, 1); if (pi >= 0) engine.PluginParamSet(track, -1, pi, (float)v); val.Text = fmt(v); Refresh(); };- field.PointerReleased += (_, e) => { if (drag) { drag = false; if (pi >= 0) engine.EndAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id); e.Pointer.Capture(null); } };- readouts.Add(() => { if (!drag) val.Text = fmt(G(id)); });- return new StackPanel { Spacing = 2, HorizontalAlignment = HorizontalAlignment.Center, Children = { new TextBlock { Text = name, FontSize = 8, FontWeight = FontWeight.Bold, Foreground = MutedC, HorizontalAlignment = HorizontalAlignment.Center }, field } };+ var hits = new List<string>(2);+ for (int d = 0; d < DestNames.Length; d++)+ if (Math.Abs(G($"mtx{src}_{d}") - 0.5) * 2 > 0.02) hits.Add(DestNames[d]);+ if (src == 1)+ {+ if (Math.Abs(G("fil1env") - 0.5) * 2 > 0.02 && !hits.Contains("Cutoff")) hits.Add("Cutoff");+ else if (Math.Abs(G("fil2env") - 0.5) * 2 > 0.02 && !hits.Contains("Cutoff")) hits.Add("Cutoff");+ }+ if (src == 0) return "→ Amp";+ return hits.Count == 0 ? "unrouted" : "→ " + string.Join(" · ", hits);}- // Flat oscillator row (no island; rows separated by a divider, per the mockup).- Control OscRow(string title, Control? head, params Control[] knobs)+ // How many cycles of an LFO fill the shape window: about two seconds of it, or+ // four bars' worth when it is locked to the grid.+ double LfoCycles(int lfo){- var lab = new StackPanel { Width = 44, Spacing = 2, VerticalAlignment = VerticalAlignment.Center, Children = { new TextBlock { Text = title, FontSize = 9, FontWeight = FontWeight.Bold, Foreground = TxtC } } };- if (head != null) lab.Children.Add(head);- return new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, VerticalAlignment = VerticalAlignment.Center, Children = { lab, Row(2, knobs) } };+ string pre = lfo == 0 ? "lfo1" : "lfo2";+ int div = SyncDiv(G(pre + "sync"));+ if (div > 0) { double[] beats = { 0, 4, 2, 1, 0.5, 0.25, 0.125, 0.0625 }; return Math.Clamp(16.0 / beats[div] / 4.0, 0.5, 16); }+ return Math.Clamp(ExpMap(G(pre + "rate"), 0.05, 20.0) * 2.0, 0.5, 16);}- Control HDiv() => new Border { Height = 1, Background = Border2, Margin = new Thickness(2, 1) };- var tableCap = new TextBlock { FontSize = 8, FontWeight = FontWeight.Bold, Foreground = MutedC };- var frameCap = new TextBlock { FontSize = 8, Foreground = TxtC };- readouts.Add(() => { tableCap.Text = $"TABLE · {Banks[Sel("table", 4)].ToUpperInvariant()}"; frameCap.Text = $"{1 + (int)Math.Round(G("position") * 15)} / 16"; });- Control OscTab()- {- // 3-D wavetable view (238px) with the table/frame/mod labels overlaid on top.- stack.Margin = new Thickness(2);- var overlay = new StackPanel { Margin = new Thickness(9, 7), VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Left, Spacing = 1, IsHitTestVisible = false,- Children = { tableCap, frameCap, new TextBlock { Text = "env1 → pos", FontSize = 8, Foreground = TealC } } };- var view = new Border { Width = 238, Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Child = new Panel { Children = { stack, overlay } } };-- var bankWarp = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 12, Children = {- Chips("table", Banks),- new StackPanel { Orientation = Orientation.Horizontal, Spacing = 5, VerticalAlignment = VerticalAlignment.Center, Children = { Lbl("WARP", 8, MutedC), Chips("osc1warpmode", WarpModes, 8) } } } };- string OctF(double v) { int o = (int)Math.Round((v - 0.5) * 4) - 1; return $"{o:+0;−0;0}\u2009oct"; }- var subUni = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 5, VerticalAlignment = VerticalAlignment.Center, Children = {- Lbl("SUB", 9, TxtC), Chips("subwave", new[] { "sin", "sqr", "tri" }, 8),- DragCell("sublevel", "LEVEL", v => $"{v * 100:0}\u2009%"), DragCell("suboct", "OCT", OctF),- new Border { Width = 1, Height = 30, Background = Border2, Margin = new Thickness(3, 0) },- Lbl("UNI", 9, TxtC),- DragCell("unison", "VC", v => $"{1 + (int)Math.Round(v * 6)}"),- DragCell("unidetune", "DETUNE", v => $"{v * 50:0}c"),- DragCell("unispread", "SPREAD", v => $"{v * 100:0}\u2009%") } };- Control Kb(string id, string name) => K(id, name, false, 32, 54);- var rightCol = new StackPanel { Spacing = 2, VerticalAlignment = VerticalAlignment.Center, Children = {- bankWarp,- OscRow("OSC 1", Toggle("osc1on", "on"), Kb("position", "POSITION"), Kb("warp", "WARP"), Kb("osc1level", "LEVEL"), Kb("osc1semi", "PITCH")),- HDiv(),- OscRow("OSC 2", Cycle("osc2table", Banks), Kb("osc2position", "POSITION"), Kb("osc2warp", "WARP"), Kb("osc2level", "LEVEL"), Kb("osc2semi", "PITCH")),- HDiv(),- subUni } };- var g = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*"), ColumnSpacing = 8, VerticalAlignment = VerticalAlignment.Stretch };- g.Children.Add(view); Grid.SetColumn(rightCol, 1); g.Children.Add(rightCol);+ int RouteCount()+ {+ int n = 0;+ for (int s = 0; s < SrcNames.Length; s++)+ for (int d = 0; d < DestNames.Length; d++)+ if (Math.Abs(G($"mtx{s}_{d}") - 0.5) > 0.01) n++;+ return n;+ }+ int MacroDest(int m) => Math.Clamp((int)Math.Round(G($"mac{m}dest") * (MacroDests.Length - 1)), 0, MacroDests.Length - 1);+ bool MacroOn(int m) => Math.Abs(G($"mac{m}amt") - 0.5f) > 0.01f;+ int MacroAssigned() { int n = 0; for (int m = 0; m < 8; m++) if (MacroOn(m)) n++; return n; }+ static string Plural(int n, string one, string many) => n + " " + (n == 1 ? one : many);++ // ---- the wheels rail ------------------------------------------------------+ Control Wheel(string id, double def, bool spring)+ {+ var w = new PerformWheel { Default = def, Spring = spring, VerticalAlignment = VerticalAlignment.Stretch, Norm = G(id), HorizontalAlignment = HorizontalAlignment.Center };+ w.ValueChanged += v => { SetP(id, (float)v); Touch(); };+ w.GestureBegin += () => Begin(id);+ w.GestureEnd += () => End(id);+ if (I(id) is var pi and >= 0) MidiLearn.Bind(w, MidiTarget.PluginParam(track, -1, pi), id);+ readouts.Add(() => { if (!w.Dragging) w.Norm = G(id); });+ return w;+ }+ var bendWheel = Wheel("bend", 0.5, true);+ var modWheel = Wheel("modwheel", 0, false);+ var bendVal = Mono("", TextSecondary, NotaType.KnobValue);+ var modVal = Mono("", TextSecondary, NotaType.KnobValue);+ bendVal.HorizontalAlignment = modVal.HorizontalAlignment = HorizontalAlignment.Center;+ readouts.Add(() =>+ {+ int range = BendRange(G("bendrange"));+ double semis = (G("bend") - 0.5) * 2 * range;+ bool centred = Math.Abs(semis) < 0.05;+ bendVal.Text = centred ? $"±{range} st" : NotaNum.Unit(semis, "+0.0;−0.0;0", "st");+ bendVal.Foreground = centred ? TextSecondary : AccentBright;+ modVal.Text = NotaNum.Pct(G("modwheel"));+ modVal.Foreground = G("modwheel") > 1e-3f ? AccentBright : TextSecondary;+ });+ static Grid Pair(Control a, Control b)+ {+ var g = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*") };+ g.Children.Add(a); Grid.SetColumn(b, 1); g.Children.Add(b);return g;}+ var pitchCap = Cap("PITCH"); pitchCap.HorizontalAlignment = HorizontalAlignment.Center;+ var modCap = Cap("MOD"); modCap.HorizontalAlignment = HorizontalAlignment.Center;+ var wheelsCap = Cap("WHEELS"); wheelsCap.HorizontalAlignment = HorizontalAlignment.Center;+ var wheelsGrid = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto,Auto"), RowSpacing = 4, Margin = new Thickness(4, 5) };+ var wheelRows = new Control[] { wheelsCap, Pair(bendWheel, modWheel), Pair(pitchCap, modCap), Pair(bendVal, modVal) };+ for (int i = 0; i < wheelRows.Length; i++) { Grid.SetRow(wheelRows[i], i); wheelsGrid.Children.Add(wheelRows[i]); }+ var wheelsPanel = SectionBox(wheelsGrid);+ wheelsPanel.Width = WheelsW;- // ---- Filter tab (type/slope in a top strip; graph + knobs/routing below) ----- var filtTypeHost = new ContentControl { VerticalAlignment = VerticalAlignment.Center };- var filtSlopeHost = new ContentControl { VerticalAlignment = VerticalAlignment.Center };- var filtKnobsHost = new ContentControl { VerticalAlignment = VerticalAlignment.Center };- var filtCap = new TextBlock { FontSize = 8, Foreground = TealC, VerticalAlignment = VerticalAlignment.Center };- filtCap.BindResource(TextBlock.FontFamilyProperty, "Font.Mono");- readouts.Add(() => { string pre = fsel == 0 ? "fil1" : "fil2"; int en = (int)Math.Round((G(pre + "env") - 0.5) * 200); int lf = (int)Math.Round((G(pre + "lfo") - 0.5) * 200); filtCap.Text = $"← env2 {en:+0;−0;0} · lfo1 {lf:+0;−0;0}"; });- void ApplyFilterSel()- {- string pre = fsel == 0 ? "fil1" : "fil2"; string freq = fsel == 0 ? "cutoff" : "fil2freq", res = fsel == 0 ? "resonance" : "fil2reso";- filtTypeHost.Content = Chips(pre + "type", FiltTypes);- filtSlopeHost.Content = Seg(new[] { "12\u2009dB", "24\u2009dB" }, G(pre + "slope") > 0.5f ? 1 : 0, i => { SetP(pre + "slope", i); }, 8);- filtKnobsHost.Content = Row(2, K(freq, "FREQ"), K(res, "RESO"), K(pre + "env", "ENV", true), K(pre + "lfo", "LFO", true));- Refresh();+ // ---- Osc tab --------------------------------------------------------------+ // Both oscillators own a bank and a warp mode. Two chip strips per oscillator+ // would not fit, so ONE strip across the top carries them for whichever oscillator+ // is selected — the 1 / 2 pick leads it, and clicking an oscillator's name picks it+ // too. The pick and the bank names say what they are, so they go without captions. Under it: the table window on the left, the two oscillator rows on the+ // right, and a line of drag values for the sub and the unison stack.+ var oscTableHosts = new Panel[2];+ var oscWarpHosts = new Panel[2];+ for (int o = 0; o < 2; o++)+ {+ string pre = o == 0 ? "osc1" : "osc2";+ oscTableHosts[o] = new Panel { Children = { Chips(o == 0 ? "table" : "osc2table", Banks) } };+ oscWarpHosts[o] = new Panel { Children = { Chips(pre + "warpmode", WarpModes) } };}- Control RouteRow(string title, string id) => new StackPanel { Orientation = Orientation.Horizontal, Spacing = 5, VerticalAlignment = VerticalAlignment.Center, Children = { new TextBlock { Text = title, FontSize = 8, FontWeight = FontWeight.Bold, Foreground = MutedC, Width = 30, VerticalAlignment = VerticalAlignment.Center }, Chips(id, Routes, 8) } };- filtGraph.VerticalAlignment = VerticalAlignment.Stretch;- Control FilterTab()- {- ApplyFilterSel();- var strip = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, VerticalAlignment = VerticalAlignment.Center, Children = {- Lbl("FILTER", 9, TxtC), Seg(new[] { "1", "2" }, fsel, i => { fsel = i; ApplyFilterSel(); }, 9), filtTypeHost, filtSlopeHost } };- DockPanel.SetDock(strip, Dock.Left); DockPanel.SetDock(filtCap, Dock.Right);- var stripBar = new Border { Margin = new Thickness(0, 0, 0, 6), Child = new DockPanel { LastChildFill = false, Children = { strip, filtCap } } };- var routing = new StackPanel { Spacing = 4, Children = { Lbl("ROUTING", 8, TxtC), RouteRow("Osc 1", "routeosc1"), RouteRow("Osc 2", "routeosc2"), RouteRow("Sub", "routesub"),- new StackPanel { Orientation = Orientation.Horizontal, Spacing = 5, VerticalAlignment = VerticalAlignment.Center, Children = { Lbl("MODE", 8, MutedC), Seg(new[] { "Parallel", "Series" }, G("filseries") > 0.5f ? 1 : 0, i => { SetP("filseries", i); }, 8) } } } };- var right = new StackPanel { Width = 206, Spacing = 8, VerticalAlignment = VerticalAlignment.Center, Children = { filtKnobsHost, routing } };- var body = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 8, VerticalAlignment = VerticalAlignment.Stretch };- body.Children.Add(filtGraph); Grid.SetColumn(right, 1); body.Children.Add(right);- DockPanel.SetDock(stripBar, Dock.Top);- return new DockPanel { LastChildFill = true, Children = { stripBar, body } };+ var oscPick = Segments(new[] { "1", "2" }, () => osel, iv => { osel = iv; Touch(); }, out var oscPickSync);+ readouts.Add(oscPickSync);+ ToolTip.SetTip(oscPick, "The oscillator whose table and warp mode this strip edits");+ var oscTableStack = new Panel();+ foreach (var h in oscTableHosts) oscTableStack.Children.Add(h);+ var oscWarpStack = new Panel();+ foreach (var h in oscWarpHosts) oscWarpStack.Children.Add(h);+ var oscStrip = new StackPanel+ {+ Orientation = Orientation.Horizontal, Spacing = 4, VerticalAlignment = VerticalAlignment.Center,+ Children = { oscPick, oscTableStack, Cap("WARP"), oscWarpStack },+ };++ var oscGrid = new Grid+ {+ ColumnDefinitions = new ColumnDefinitions("40,*,*,*,*,*,*"),+ RowDefinitions = new RowDefinitions("Auto,Auto,Auto"),+ VerticalAlignment = VerticalAlignment.Top,+ };+ var oscNames = new TextBlock[2];+ for (int o = 0; o < 2; o++)+ {+ int ov = o;+ string pre = o == 0 ? "osc1" : "osc2";+ string nm = o == 0 ? "OSC 1" : "OSC 2";+ int row = o * 2;+ if (o > 0) { var rule = Rule(); rule.Margin = new Thickness(0, 1); Grid.SetRow(rule, 1); Grid.SetColumnSpan(rule, 7); oscGrid.Children.Add(rule); }+ var name = Section(nm);+ oscNames[o] = name;+ var head = new StackPanel+ {+ Spacing = 3, VerticalAlignment = VerticalAlignment.Center, Cursor = new Cursor(StandardCursorType.Hand),+ Children = { name, Toggle("", pre + "on", () => G(pre + "on") >= 0.5f ? "on" : "off") },+ };+ head.PointerPressed += (_, e) =>+ {+ if (!e.GetCurrentPoint(head).Properties.IsLeftButtonPressed) return;+ osel = ov; Touch();+ };+ void Cell(Control c, int col) { Grid.SetRow(c, row); Grid.SetColumn(c, col); oscGrid.Children.Add(c); }+ Cell(head, 0);+ // Position is what the modulators reach for on this synth, so it wears teal.+ Cell(PKnob(o == 0 ? "position" : "osc2position", "POSITION", nm + " Position", FrameText, 34, 42, Teal), 1);+ Cell(PKnob(o == 0 ? "warp" : "osc2warp", "WARP", nm + " Warp", Pct, 34, 42), 2);+ Cell(PKnob(pre + "level", "LEVEL", nm + " Level", Pct, 34, 42), 3);+ Cell(PKnob(pre + "oct", "OCT", nm + " Octave", Oct, 34, 42), 4);+ Cell(PKnob(pre + "semi", "SEMI", nm + " Semi", Semi, 34, 42), 5);+ Cell(PKnob(pre + "detune", "FINE", nm + " Fine", Cents, 34, 42, Teal), 6);}+ applyOsc = () =>+ {+ for (int o = 0; o < 2; o++)+ {+ oscTableHosts[o].IsVisible = oscWarpHosts[o].IsVisible = o == osel;+ oscNames[o].Foreground = o == osel ? AccentBright : TextPrimary;+ }+ };- // ---- Env tab ----- Control EnvPanel(string title, string route, VoltEnv gv, string[] ids)- {- gv.Target(title, P(ids[0]), P(ids[1]), P(ids[2]), P(ids[3])); gv.VerticalAlignment = VerticalAlignment.Stretch;- string[] lbl = { "A", "D", "S", "R" };- var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*,*"), ColumnSpacing = 4, Margin = new Thickness(0, 5, 0, 0) };- for (int k = 0; k < 4; k++) { var v = new TextBlock { Text = Pct(G(ids[k])), FontSize = 9, Foreground = TxtC, HorizontalAlignment = HorizontalAlignment.Center }; v.BindResource(TextBlock.FontFamilyProperty, "Font.Mono"); string pid = ids[k]; readouts.Add(() => v.Text = Pct(G(pid))); var cell = new Border { Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Padding = new Thickness(2, 2), Child = new StackPanel { Children = { new TextBlock { Text = lbl[k], FontSize = 8, FontWeight = FontWeight.Bold, Foreground = MutedC, HorizontalAlignment = HorizontalAlignment.Center }, v } } }; Grid.SetColumn(cell, k); grid.Children.Add(cell); }- DockPanel.SetDock(grid, Dock.Bottom);- var head = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, Children = { Lbl(title, 9, TxtC), new TextBlock { Text = route, FontSize = 8, Foreground = TealC, VerticalAlignment = VerticalAlignment.Center } } };- DockPanel.SetDock(head, Dock.Top);- return new Border { Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Padding = new Thickness(8, 6), Child = new DockPanel { LastChildFill = true, Children = { head, grid, gv } } };+ // The sub and the unison stack are drag values, as the almanac draws them: a caps+ // label over a mono readout, dragged up or down, double-clicked back to default.+ var subUni = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 9, VerticalAlignment = VerticalAlignment.Center };+ foreach (var c in new Control[]+ {+ Cap("SUB"), Chips("subwave", SubWaves),+ DragValue("sublevel", "LEVEL", "Sub Level", Pct),+ DragValue("suboct", "OCT", "Sub Octave", SubOct, 1f / 4f),+ new Border { Width = 1, Margin = new Thickness(2, 3), Background = NotaPalette.GraphBorder },+ Cap("UNI"),+ DragValue("unison", "VOICES", "Unison Voices", v => NotaNum.Str(Voices(v), "0"), 1f / 6f),+ DragValue("unidetune", "DETUNE", "Unison Detune", Detune, 0, Teal),+ DragValue("unispread", "SPREAD", "Unison Spread", Pct, 0, Teal),+ }) subUni.Children.Add(c);+ var subUniRow = new Border+ {+ BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0),+ Padding = new Thickness(0, 3, 0, 0), Child = subUni,+ };++ // The table window carries its own caption: which bank, which frame, and what is+ // steering the position.+ var tableCap = Mono("", TextTertiary, NotaType.Axis);+ var frameCap = Mono("", TextPrimary, NotaType.Axis);+ var posMod = Mono("", Teal, NotaType.Axis);+ readouts.Add(() =>+ {+ tableCap.Text = $"TABLE {osel + 1} · {Banks[Sel(osel == 0 ? "table" : "osc2table", 4)].ToUpperInvariant()}";+ frameCap.Text = "frame " + FrameText(G(osel == 0 ? "position" : "osc2position"));+ int best = -1; double mag = 0.02;+ for (int s = 0; s < SrcNames.Length; s++)+ {+ double a = Math.Abs(G($"mtx{s}_2") - 0.5) * 2;+ if (a > mag) { mag = a; best = s; }+ }+ posMod.Text = best < 0 ? "no modulation" : SrcNames[best].ToLowerInvariant() + " → pos";+ posMod.Foreground = best < 0 ? TextDisabled : Teal;+ });+ var tableOverlay = new StackPanel+ {+ Margin = new Thickness(7, 5), VerticalAlignment = VerticalAlignment.Top,+ HorizontalAlignment = HorizontalAlignment.Left, Spacing = 0, IsHitTestVisible = false,+ Children = { tableCap, frameCap, posMod },+ };+ stack.TopInset = 26; // the three caption lines the overlay puts in that corner+ var tableWindow = new Panel { Width = 128, Children = { stack, tableOverlay } };+ var oscMid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*"), ColumnSpacing = 6 };+ oscMid.Children.Add(tableWindow);+ Grid.SetColumn(oscGrid, 1); oscMid.Children.Add(oscGrid);+ var oscBodyGrid = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto"), RowSpacing = 3 };+ var oscRows = new Control[] { oscStrip, oscMid, subUniRow };+ for (int i = 0; i < oscRows.Length; i++) { Grid.SetRow(oscRows[i], i); oscBodyGrid.Children.Add(oscRows[i]); }+ var oscBody = new Border { Padding = new Thickness(5, 3), Child = oscBodyGrid };++ // ---- Filter tab -----------------------------------------------------------+ // Both filters share one column of controls; picking 1 or 2 swaps which set is on+ // screen — a knob is bound to one param index for its life.+ var filtCells = new Panel[5];+ var filtStack = new Control[2, 5];+ string[] filtIds = { "freq", "reso", "env", "lfo", "key" };+ string[] filtLbl = { "Freq", "Reso", "Env", "LFO", "Key" };+ var filtKnobRow = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*,*,*"), VerticalAlignment = VerticalAlignment.Center };+ for (int k = 0; k < 5; k++)+ {+ filtCells[k] = new Panel();+ Grid.SetColumn(filtCells[k], k);+ filtKnobRow.Children.Add(filtCells[k]);+ }+ for (int f = 0; f < 2; f++)+ {+ for (int k = 0; k < 5; k++)+ {+ // Filter 1's cutoff and resonance kept the ids the first Aurora shipped.+ string id = f == 0+ ? k switch { 0 => "cutoff", 1 => "resonance", _ => "fil1" + filtIds[k] }+ : "fil2" + filtIds[k];+ Func<float, string> fmt = k switch { 0 => Hz, 1 => Pct, 4 => Pct, _ => Bip };+ Control cell = PKnob(id, filtLbl[k].ToUpperInvariant(), $"Filter {f + 1} {filtLbl[k]}", fmt, 24, 33, k >= 2 ? Teal : null);+ cell.IsVisible = false;+ filtStack[f, k] = cell;+ filtCells[k].Children.Add(cell);+ }}- Control EnvTab()+ var filtTypeHosts = new Panel[2];+ var filtSlopeHosts = new Panel[2];+ for (int f = 0; f < 2; f++)+ {+ string pre = f == 0 ? "fil1" : "fil2";+ filtTypeHosts[f] = new Panel { Children = { Chips(pre + "type", FiltTypes) } };+ filtSlopeHosts[f] = new Panel+ {+ Children =+ {+ Chips(pre + "slope", new[] { "12 dB", "24 dB" }, () => G(pre + "slope") >= 0.5f ? 1 : 0,+ iv => { SetP(pre + "slope", iv); Touch(); }),+ },+ };+ }+ var filtPick = Segments(new[] { "1", "2" }, () => fsel, iv => { fsel = iv; Touch(); }, out var filtPickSync);+ readouts.Add(filtPickSync);+ var filtTypeStack = new Panel();+ foreach (var h in filtTypeHosts) filtTypeStack.Children.Add(h);+ var filtSlopeStack = new Panel();+ foreach (var h in filtSlopeHosts) filtSlopeStack.Children.Add(h);+ filtSlopeStack.HorizontalAlignment = HorizontalAlignment.Right;++ var filtHead = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,*"), ColumnSpacing = 5 };+ var filtHeadCells = new Control[] { Cap("FILTER"), filtPick, filtSlopeStack };+ for (int i = 0; i < filtHeadCells.Length; i++) { Grid.SetColumn(filtHeadCells[i], i); filtHead.Children.Add(filtHeadCells[i]); }++ Control RouteRow(string title, string id){- var g = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*"), ColumnSpacing = 8, VerticalAlignment = VerticalAlignment.Stretch };- var a = EnvPanel("ENV 1", "→ Amp", env1, new[] { "attack", "decay", "sustain", "release" });- var f = EnvPanel("ENV 2", "→ Position/Cutoff", env2, new[] { "env2attack", "env2decay", "env2sustain", "env2release" });- Grid.SetColumn(f, 1); g.Children.Add(a); g.Children.Add(f);+ var chips = Chips(id, Routes, fill: true);+ var g = new Grid { ColumnDefinitions = new ColumnDefinitions("32,*"), ColumnSpacing = 4 };+ g.Children.Add(Cap(title));+ Grid.SetColumn(chips, 1); g.Children.Add(chips);return g;}+ var modeChips = Chips("filseries", new[] { "Parallel", "Series" }, () => G("filseries") >= 0.5f ? 1 : 0,+ iv => { SetP("filseries", iv); Touch(); }, fill: true);+ var modeRow = new Grid { ColumnDefinitions = new ColumnDefinitions("32,*"), ColumnSpacing = 4 };+ modeRow.Children.Add(Cap("MODE"));+ Grid.SetColumn(modeChips, 1); modeRow.Children.Add(modeChips);- // ---- LFO tab ----- Control LfoLane(string title, Control? extra, params Control[] knobs)+ // No "ROUTING" caption: three rows named OSC 1 / OSC 2 / SUB over F1 · F2 · 1+2 ·+ // Dry say what they are, and the line it would cost is the line MODE needs.+ var routing = new StackPanel{- var head = new StackPanel { Width = 116, Spacing = 3, VerticalAlignment = VerticalAlignment.Center, Children = { Lbl(title, 9, TxtC) } };- if (extra != null) head.Children.Add(extra);- return new Border { Height = 64, Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Padding = new Thickness(8, 2), Child = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, VerticalAlignment = VerticalAlignment.Center, Children = { head, Row(2, knobs) } } };+ Spacing = 2, VerticalAlignment = VerticalAlignment.Center,+ Children = { RouteRow("OSC 1", "routeosc1"), RouteRow("OSC 2", "routeosc2"), RouteRow("SUB", "routesub"), modeRow },+ };+ var routingFrame = new Border+ {+ BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0),+ Padding = new Thickness(0, 3, 0, 0), Child = routing,+ };+ var filtRight = new Grid { RowDefinitions = new RowDefinitions("Auto,Auto,Auto,*"), RowSpacing = 3, Width = 186 };+ var filtRightRows = new Control[] { filtHead, filtTypeStack, filtKnobRow, routingFrame };+ for (int i = 0; i < filtRightRows.Length; i++) { Grid.SetRow(filtRightRows[i], i); filtRight.Children.Add(filtRightRows[i]); }++ applyFilter = () =>+ {+ string pre = fsel == 0 ? "fil1" : "fil2";+ string freq = fsel == 0 ? "cutoff" : "fil2freq", res = fsel == 0 ? "resonance" : "fil2reso";+ filtGraph.Target($"FILTER {fsel + 1}", P(freq), P(res), Sel(pre + "type", 5));+ filtGraph.Refresh();+ for (int f = 0; f < 2; f++)+ {+ filtTypeHosts[f].IsVisible = filtSlopeHosts[f].IsVisible = f == fsel;+ for (int k = 0; k < 5; k++) filtStack[f, k].IsVisible = f == fsel;+ }+ };+ var filtGrid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 7 };+ filtGrid.Children.Add(filtGraph);+ Grid.SetColumn(filtRight, 1); filtGrid.Children.Add(filtRight);+ var filtBody = new Border { Padding = new Thickness(7, 5), Child = filtGrid };++ // ---- Env tab --------------------------------------------------------------+ Control EnvPanel(string title, Func<string> route, VoltEnv view, string[] ids, Func<string> summary)+ {+ view.Target(title, P(ids[0]), P(ids[1]), P(ids[2]), P(ids[3]));+ string[] stage = { "A", "D", "S", "R" };+ Func<float, string>[] fmt = { v => Secs(v, 0.001, 2.0), v => Secs(v, 0.002, 3.0), Pct, v => Secs(v, 0.002, 4.0) };+ var cells = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*,*"), ColumnSpacing = 3 };+ for (int k = 0; k < 4; k++)+ {+ string id = ids[k];+ var fk = fmt[k];+ var v = Mono(fk(G(id)), TextPrimary, NotaType.RowLabel);+ v.HorizontalAlignment = HorizontalAlignment.Center;+ readouts.Add(() => v.Text = fk(G(id)));+ var cap = Cap(stage[k]); cap.HorizontalAlignment = HorizontalAlignment.Center;+ var cell = new Border+ {+ Background = NotaPalette.SurfaceRaised, BorderBrush = BorderDef, BorderThickness = new Thickness(1),+ CornerRadius = NotaRadius.Badge, Padding = new Thickness(2, 1),+ Child = new StackPanel { Children = { cap, v } },+ };+ if (I(id) is var pi and >= 0) MidiLearn.Bind(cell, MidiTarget.PluginParam(track, -1, pi), title + " · " + stage[k]);+ Grid.SetColumn(cell, k); cells.Children.Add(cell);+ }+ var sum = Mono("", TextSecondary, NotaType.Axis);+ sum.HorizontalAlignment = HorizontalAlignment.Right;+ readouts.Add(() => sum.Text = summary());+ var dest = Mono("", Teal, NotaType.Axis);+ readouts.Add(() => dest.Text = route());+ var head = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,*"), ColumnSpacing = 5, Height = 11 };+ head.Children.Add(Cap(title));+ Grid.SetColumn(dest, 1); head.Children.Add(dest);+ Grid.SetColumn(sum, 2); head.Children.Add(sum);+ var g = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto"), RowSpacing = 4 };+ g.Children.Add(head);+ Grid.SetRow(view, 1); g.Children.Add(view);+ Grid.SetRow(cells, 2); g.Children.Add(cells);+ return g;+ }+ string AdsrSum(string a, string d, string s, string r)+ => $"{Secs(G(a), 0.001, 2.0)} · {Secs(G(d), 0.002, 3.0)} · {Pct(G(s))} · {Secs(G(r), 0.002, 4.0)}";+ var envPanel1 = EnvPanel("ENV 1", () => "→ Amp", env1, new[] { "attack", "decay", "sustain", "release" },+ () => AdsrSum("attack", "decay", "sustain", "release"));+ var envPanel2 = EnvPanel("ENV 2", () => EnvDest(1), env2, new[] { "env2attack", "env2decay", "env2sustain", "env2release" },+ () => AdsrSum("env2attack", "env2decay", "env2sustain", "env2release"));+ var env2Host = new Border+ {+ BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(1, 0, 0, 0),+ Padding = new Thickness(6, 0, 0, 0), Child = envPanel2,+ };+ var envGrid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*"), ColumnSpacing = 6 };+ envGrid.Children.Add(envPanel1);+ Grid.SetColumn(env2Host, 1); envGrid.Children.Add(env2Host);+ var envBody = new Border { Padding = new Thickness(7, 5), Child = envGrid };++ // ---- LFO tab --------------------------------------------------------------+ var lfoGrid = new Grid+ {+ ColumnDefinitions = new ColumnDefinitions("48,Auto,*,*,*,Auto"), ColumnSpacing = 5,+ RowDefinitions = new RowDefinitions("*,*"),+ };+ for (int l = 0; l < 2; l++)+ {+ string pre = l == 0 ? "lfo1" : "lfo2";+ string nm = l == 0 ? "LFO 1" : "LFO 2";+ int src = l + 2;+ if (l > 0) { var rule = Rule(); Grid.SetRow(rule, 1); Grid.SetColumnSpan(rule, 6); lfoGrid.Children.Add(rule); }+ void Cell(Control c, int col) { Grid.SetRow(c, l); Grid.SetColumn(c, col); lfoGrid.Children.Add(c); }+ Cell(Section(nm), 0);+ Cell(Chips(pre + "shape", ShapeNames), 1);+ string rateId = pre + "rate", syncId = pre + "sync";+ Cell(PKnob(rateId, "RATE", nm + " Rate", v => SyncDiv(G(syncId)) > 0 ? SyncText(G(syncId)) : SlowHz(ExpMap(v, 0.05, 20)), 28, 46), 2);+ Cell(PKnob(pre + "depth", "DEPTH", nm + " Depth", Pct, 28, 46, Teal), 3);+ Cell(PKnob(syncId, "SYNC", nm + " Sync", SyncText, 28, 46), 4);+ var dest = Mono("", Teal, NotaType.Axis);+ dest.Width = 58; dest.TextAlignment = TextAlignment.Right;+ readouts.Add(() => dest.Text = LfoDest(src));+ Cell(dest, 5);}- Control LfoTab() => new StackPanel { Spacing = 6, VerticalAlignment = VerticalAlignment.Center, Children = {- LfoLane("LFO 1", Chips("lfo1shape", new[] { "sin", "tri", "sqr", "S&H" }, 8), K("lfo1rate", "RATE"), K("lfo1depth", "DEPTH", true), K("lfo1sync", "SYNC")),- LfoLane("LFO 2", Chips("lfo2shape", new[] { "sin", "tri", "sqr", "S&H" }, 8), K("lfo2rate", "RATE"), K("lfo2depth", "DEPTH", true)) } };+ // The shape window follows whichever LFO you last touched — the pick doubles as+ // the label, so the picture is never anonymous.+ int lfoShown = 0;+ var lfoShapeCap = Cap("SHAPE · LFO 1");+ var lfoShapeSum = Mono("", TextSecondary, NotaType.Axis);+ var lfoPick = Segments(new[] { "1", "2" }, () => lfoShown, iv => { lfoShown = iv; Touch(); }, out var lfoPickSync);+ readouts.Add(lfoPickSync);+ readouts.Add(() =>+ {+ string pre = lfoShown == 0 ? "lfo1" : "lfo2";+ lfoShapeCap.Text = $"SHAPE · LFO {lfoShown + 1}";+ lfoStrip.Set(Sel(pre + "shape", 4), LfoCycles(lfoShown), G(pre + "depth"));+ lfoShapeSum.Text = $"{ShapeNames[Sel(pre + "shape", 4)]} · "+ + (SyncDiv(G(pre + "sync")) > 0 ? SyncText(G(pre + "sync")) : SlowHz(ExpMap(G(pre + "rate"), 0.05, 20)))+ + $" · depth {Pct(G(pre + "depth"))}";+ });+ var lfoShapeRow = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,*,Auto"), ColumnSpacing = 6, Height = 40 };+ var lfoShapeCells = new Control[] { lfoShapeCap, lfoPick, lfoStrip, lfoShapeSum };+ for (int i = 0; i < lfoShapeCells.Length; i++) { Grid.SetColumn(lfoShapeCells[i], i); lfoShapeRow.Children.Add(lfoShapeCells[i]); }+ lfoStrip.Margin = new Thickness(0, 5);+ var lfoShapeFrame = new Border+ {+ BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0), Child = lfoShapeRow,+ };+ var lfoOuter = new Grid { RowDefinitions = new RowDefinitions("*,Auto") };+ lfoOuter.Children.Add(lfoGrid);+ Grid.SetRow(lfoShapeFrame, 1); lfoOuter.Children.Add(lfoShapeFrame);+ var lfoBody = new Border { Padding = new Thickness(7, 3), Child = lfoOuter };- // ---- Mod tab (matrix + macros) ----- var mtxIdx = new int[8, 7];- for (int s = 0; s < 8; s++) for (int d = 0; d < 7; d++) mtxIdx[s, d] = I($"mtx{s}_{d}");+ // ---- Mod tab --------------------------------------------------------------+ var mtxIdx = new int[SrcNames.Length, DestNames.Length];+ for (int s = 0; s < SrcNames.Length; s++)+ for (int d = 0; d < DestNames.Length; d++) mtxIdx[s, d] = I($"mtx{s}_{d}");var matrix = new VoltMatrix(engine, track, mtxIdx, SrcNames, DestNames) { VerticalAlignment = VerticalAlignment.Stretch };+ matrix.Changed += Touch;readouts.Add(matrix.Refresh);- Control MacroCell(int m)+ var modHint = new TextBlock+ {+ Text = "drag a cell — up adds, down subtracts · double-click clears", FontSize = NotaType.Axis,+ Foreground = TextDisabled, VerticalAlignment = VerticalAlignment.Center,+ };+ var modGrid = new Grid { RowDefinitions = new RowDefinitions("*,Auto"), RowSpacing = 1 };+ modGrid.Children.Add(matrix);+ Grid.SetRow(modHint, 1); modGrid.Children.Add(modHint);+ var modBody = new Border { Padding = new Thickness(7, 3), Child = modGrid };++ // ---- FX tab ---------------------------------------------------------------+ Control FxBlock(string title, string onId, string[] modes, string modeId, params Control[] knobs){- var dest = new TextBlock { FontSize = 8, Foreground = TealC, HorizontalAlignment = HorizontalAlignment.Center, Cursor = new Cursor(StandardCursorType.Hand) };- void SyncDest() => dest.Text = "→ " + DestNames[Sel($"mac{m}dest", 7)];- dest.PointerPressed += (_, _) => { SetP($"mac{m}dest", ((Sel($"mac{m}dest", 7) + 1) % 7) / 6f); SyncDest(); };- readouts.Add(SyncDest); SyncDest();- return new Border { Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Padding = new Thickness(4, 4), Child = new StackPanel { Spacing = 1, HorizontalAlignment = HorizontalAlignment.Center, Children = { Row(2, K($"mac{m}val", $"M{m + 1}"), K($"mac{m}amt", "AMOUNT", true)), dest } } };+ var chips = Chips(modeId, modes, fill: true);+ var head = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") };+ var cap = Cap(title, NotaPalette.TextStrong);+ head.Children.Add(cap);+ var sw = Toggle("", onId);+ Grid.SetColumn(sw, 1); head.Children.Add(sw);+ var row = new StackPanel+ {+ Orientation = Orientation.Horizontal, Spacing = 2, VerticalAlignment = VerticalAlignment.Center,+ HorizontalAlignment = HorizontalAlignment.Center,+ };+ foreach (var k in knobs) row.Children.Add(k);+ var g = new Grid { RowDefinitions = new RowDefinitions("Auto,Auto,*"), RowSpacing = 4 };+ g.Children.Add(head);+ Grid.SetRow(chips, 1); g.Children.Add(chips);+ Grid.SetRow(row, 2); g.Children.Add(row);+ var box = new Border+ {+ Background = NotaPalette.SurfaceRaised, BorderBrush = BorderDef, BorderThickness = new Thickness(1),+ CornerRadius = NotaRadius.Control, Padding = new Thickness(6, 5), Child = g,+ };+ readouts.Add(() =>+ {+ bool on = G(onId) >= 0.5f;+ box.Background = on ? NotaPalette.SurfaceRaised : NotaPalette.BgSunken;+ box.BorderBrush = on ? BorderDef : NotaPalette.GraphBorder;+ cap.Foreground = on ? NotaPalette.TextStrong : TextDisabled;+ });+ return box;}- Control ModTab()- {- var macros = new StackPanel { Width = 130, Spacing = 5, VerticalAlignment = VerticalAlignment.Center, Children = { Lbl("MACROS", 8, TxtC) } };- for (int m = 0; m < 4; m++) macros.Children.Add(MacroCell(m));- var clear = new Border { Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Padding = new Thickness(7, 1), Cursor = new Cursor(StandardCursorType.Hand), VerticalAlignment = VerticalAlignment.Center, Child = new TextBlock { Text = "Clear all", FontSize = 9, Foreground = MutedC } };- clear.PointerPressed += (_, _) => matrix.ClearAll();- var head = new DockPanel { Margin = new Thickness(0, 0, 0, 4), LastChildFill = false, Children = { clear, Lbl("MOD MATRIX", 9, TxtC) } };- DockPanel.SetDock(clear, Dock.Right); DockPanel.SetDock(head, Dock.Top);- var left = new DockPanel { LastChildFill = true, Children = { head, matrix } };- var g = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 8, VerticalAlignment = VerticalAlignment.Stretch };- g.Children.Add(left); Grid.SetColumn(macros, 1); g.Children.Add(macros);- return g;+ var fxGrid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*"), ColumnSpacing = 6 };+ var fxBlocks = new[]+ {+ FxBlock("DRIVE", "fxdriveon", DriveModes, "fxdrivemode",+ PKnob("fxdrive", "AMOUNT", "Drive", Pct, 32, 48),+ PKnob("fxtone", "TONE", "Drive Tone", Bip, 28, 44)),+ FxBlock("CHORUS", "fxchoruson", ChorusVoices, "fxchorusvoices",+ PKnob("fxchorus", "AMOUNT", "Chorus", Pct, 32, 48),+ PKnob("fxchorusrate", "RATE", "Chorus Rate", ChorusHz, 28, 44)),+ FxBlock("REVERB", "fxreverbon", ReverbModes, "fxreverbmode",+ PKnob("fxreverb", "AMOUNT", "Reverb", Pct, 32, 48),+ PKnob("fxreverbsize", "SIZE", "Reverb Size", Pct, 28, 44)),+ };+ for (int i = 0; i < fxBlocks.Length; i++) { Grid.SetColumn(fxBlocks[i], i); fxGrid.Children.Add(fxBlocks[i]); }+ var fxBody = new Border { Padding = new Thickness(7, 5), Child = fxGrid };++ // ---- the tab strip --------------------------------------------------------+ var bodies = new Control[] { oscBody, filtBody, envBody, lfoBody, modBody, fxBody };+ var tabCells = new Border[TabNames.Length];+ var tabTexts = new TextBlock[TabNames.Length];+ var clearAll = TextButton("Clear all");+ clearAll.Margin = new Thickness(0, 0, 6, 0);+ ToolTip.SetTip(clearAll, "Zero every route in the matrix");+ clearAll.PointerPressed += (_, e) =>+ {+ if (!e.GetCurrentPoint(clearAll).Properties.IsLeftButtonPressed) return;+ matrix.ClearAll(); Touch(); e.Handled = true;+ };+ var tabRow = new StackPanel { Orientation = Orientation.Horizontal };+ for (int i = 0; i < TabNames.Length; i++)+ {+ int iv = i;+ var tb = new TextBlock { Text = TabNames[i], FontSize = NotaType.DeviceSection, VerticalAlignment = VerticalAlignment.Center };+ var cell = new Border+ {+ Padding = new Thickness(7, 0), BorderThickness = new Thickness(0, 0, 0, 2),+ Cursor = new Cursor(StandardCursorType.Hand), Child = tb,+ };+ cell.PointerPressed += (_, e) =>+ {+ if (!e.GetCurrentPoint(cell).Properties.IsLeftButtonPressed) return;+ tab = iv; showTab(); e.Handled = true;+ };+ tabCells[i] = cell; tabTexts[i] = tb; tabRow.Children.Add(cell);+ }+ var tabStrip = new Grid { Height = TabH, ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto") };+ tabStrip.Children.Add(tabRow);+ Grid.SetColumn(hint, 1); tabStrip.Children.Add(hint);+ Grid.SetColumn(clearAll, 2); tabStrip.Children.Add(clearAll);++ Action showRailTab = () => { };+ showTab = () =>+ {+ for (int i = 0; i < TabNames.Length; i++)+ {+ bool on = i == tab;+ tabCells[i].Background = on ? NotaPalette.SurfaceRaised : Brushes.Transparent;+ tabCells[i].BorderBrush = on ? Brass : Brushes.Transparent;+ tabTexts[i].Foreground = on ? AccentBright : TextTertiary;+ tabTexts[i].FontWeight = on ? FontWeight.SemiBold : FontWeight.Normal;+ bodies[i].IsVisible = on;+ }+ clearAll.IsVisible = tab == 4;+ // The matrix and the macros are one subject: opening Mod brings the macros up+ // beside it, the way the almanac draws that state.+ if (tab == 4 && railTab != 1) { railTab = 1; showRailTab(); return; }+ Touch();+ };+ var tabHost = new Panel { MinHeight = BodyH - TabH };+ foreach (var b in bodies) tabHost.Children.Add(b);+ var tabGrid = new Grid { RowDefinitions = new RowDefinitions("Auto,*") };+ tabGrid.Children.Add(HeaderStrip(tabStrip));+ Grid.SetRow(tabHost, 1); tabGrid.Children.Add(tabHost);+ var tabPanel = SectionBox(tabGrid);++ // ---- rail · Global --------------------------------------------------------+ var monoChips = Chips("mono", new[] { "Poly", "Mono" }, () => G("mono") >= 0.5f ? 1 : 0, iv => { SetP("mono", iv); Touch(); });+ monoChips.HorizontalAlignment = HorizontalAlignment.Right;+ var monoRow = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") };+ monoRow.Children.Add(Cap("VOICES"));+ Grid.SetColumn(monoChips, 1); monoRow.Children.Add(monoChips);++ var bendChips = StopChips("bendrange", BendNames, BendStops);+ bendChips.HorizontalAlignment = HorizontalAlignment.Right;+ var bendRow = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") };+ bendRow.Children.Add(Cap("BEND"));+ Grid.SetColumn(bendChips, 1); bendRow.Children.Add(bendChips);++ var meter = new MeterBar { VerticalAlignment = VerticalAlignment.Stretch, Width = MeterScale.StereoWidth };+ ctx.AddDeviceRefresher(() => { if (engine.TryGetTrackMeter(track, out var m)) meter.Push(m); });+ var meterScale = new Grid+ {+ VerticalAlignment = VerticalAlignment.Stretch,+ RowDefinitions = new RowDefinitions(string.Join(",", ScaleRows(0, -12, -48))),+ };+ for (int i = 0; i < 3; i++)+ {+ var c = Mono(i == 0 ? "0" : i == 1 ? "−12" : "−48", NotaPalette.TextAxis, NotaType.Axis);+ Grid.SetRow(c, i * 2 + 1); meterScale.Children.Add(c);+ }+ var meterBlock = new Grid+ {+ ColumnDefinitions = new ColumnDefinitions("Auto,Auto"), ColumnSpacing = 4,+ HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(0, 0, 0, 7),+ };+ meterBlock.Children.Add(meter);+ Grid.SetColumn(meterScale, 1); meterBlock.Children.Add(meterScale);++ var globalBottom = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,*"), VerticalAlignment = VerticalAlignment.Stretch };+ var gainCell = PKnob("gain", "GAIN", "Gain", Pct, 38, 46);+ var panCell = PKnob("outpan", "PAN", "Out Pan", PanText, 30, 42);+ globalBottom.Children.Add(gainCell);+ Grid.SetColumn(panCell, 1); globalBottom.Children.Add(panCell);+ Grid.SetColumn(meterBlock, 2); globalBottom.Children.Add(meterBlock);++ var globalTop = new StackPanel+ {+ Spacing = 4, Margin = new Thickness(8, 5, 8, 0),+ Children =+ {+ monoRow,+ bendRow,+ Slider("POS 1", "position", () => FrameText(G("position")), labelW: 42, valueW: 42),+ Slider("CUTOFF", "cutoff", () => Hz(G("cutoff")), labelW: 42, valueW: 42),+ Slider("UNISON", "unidetune", () => Detune(G("unidetune")), labelW: 42, valueW: 42),+ },+ };+ var globalGrid = new Grid { RowDefinitions = new RowDefinitions("Auto,*") };+ globalGrid.Children.Add(globalTop);+ var globalBottomFrame = new Border+ {+ BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0),+ Margin = new Thickness(8, 4, 8, 4), Padding = new Thickness(0, 3, 0, 0), Child = globalBottom,+ };+ Grid.SetRow(globalBottomFrame, 1); globalGrid.Children.Add(globalBottomFrame);++ // ---- rail · Macros --------------------------------------------------------+ // Three to a page, as the almanac draws them: a value knob, an amount knob and the+ // target it names. The dashed strip under them names the next page and whether+ // anything on it is in use; clicking it turns the page (right-click turns back).+ const int MacrosPerPage = 3;+ int macroPage = 0;+ int MacroPages() => (8 + MacrosPerPage - 1) / MacrosPerPage;+ var macroBoxes = new Border[8];+ var macroList = new StackPanel { Spacing = 3 };+ for (int m = 0; m < 8; m++)+ {+ int mv = m;+ string destId = $"mac{mv}dest";+ var name = new TextBlock+ {+ FontSize = NotaType.KnobLabel, FontWeight = FontWeight.Bold, LetterSpacing = NotaType.KnobLabelTracking,+ Foreground = NotaPalette.TextStrong, TextTrimming = TextTrimming.CharacterEllipsis,+ };+ var dest = new TextBlock+ {+ FontSize = NotaType.Axis, Foreground = Teal, Background = Brushes.Transparent,+ Cursor = new Cursor(StandardCursorType.Hand), TextTrimming = TextTrimming.CharacterEllipsis,+ };+ var nums = Mono("", TextSecondary, NotaType.Axis);+ ToolTip.SetTip(dest, "Click for the next target, right-click for the previous");+ void Step(int dir)+ {+ int n = MacroDests.Length;+ Begin(destId);+ SetP(destId, ((MacroDest(mv) + dir % n + n) % n) / (float)(n - 1));+ End(destId);+ Touch();+ }+ dest.PointerPressed += (_, e) =>+ {+ var pt = e.GetCurrentPoint(dest).Properties;+ if (pt.IsLeftButtonPressed) { Step(+1); e.Handled = true; }+ else if (pt.IsRightButtonPressed) { Step(-1); e.Handled = true; }+ };+ if (I(destId) is var dpi and >= 0) MidiLearn.Bind(dest, MidiTarget.PluginParam(track, -1, dpi), $"Macro {mv + 1} Dest");++ var words = new StackPanel { Spacing = 0, VerticalAlignment = VerticalAlignment.Center, Children = { name, dest, nums } };+ var row = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,*"), ColumnSpacing = 3 };+ var valKnob = BareKnob($"mac{mv}val", $"Macro {mv + 1}", Pct, 34);+ var amtKnob = BareKnob($"mac{mv}amt", $"Macro {mv + 1} Amount", Bip, 34, Teal);+ row.Children.Add(valKnob);+ Grid.SetColumn(amtKnob, 1); row.Children.Add(amtKnob);+ words.Margin = new Thickness(3, 0, 0, 0);+ Grid.SetColumn(words, 2); row.Children.Add(words);+ var box = new Border+ {+ Background = NotaPalette.SurfaceRaised, BorderBrush = BorderDef, BorderThickness = new Thickness(1),+ CornerRadius = NotaRadius.Control, Padding = new Thickness(3, 2), Child = row,+ };+ readouts.Add(() =>+ {+ bool on = MacroOn(mv);+ int d = MacroDest(mv);+ name.Text = on ? $"M{mv + 1} · {MacroWords[d]}" : $"M{mv + 1}";+ name.Foreground = on ? NotaPalette.TextStrong : TextDisabled;+ dest.Text = on ? "→ " + MacroDests[d] : "→ " + MacroDests[d] + " · off";+ dest.Foreground = on ? Teal : TextDisabled;+ nums.Text = $"{Pct(G($"mac{mv}val"))} · {Bip(G($"mac{mv}amt"))}";+ nums.Foreground = on ? TextSecondary : TextDisabled;+ box.Background = on ? NotaPalette.SurfaceRaised : NotaPalette.BgSunken;+ box.BorderBrush = on ? BorderDef : NotaPalette.GraphBorder;+ box.IsVisible = mv / MacrosPerPage == macroPage;+ });+ macroBoxes[m] = box;+ macroList.Children.Add(box);}+ var pagerText = new TextBlock+ {+ FontSize = NotaType.Axis, Foreground = TextTertiary,+ HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,+ };+ var pager = new Panel+ {+ Height = 20, Background = Brushes.Transparent, Cursor = new Cursor(StandardCursorType.Hand),+ Children =+ {+ new Avalonia.Controls.Shapes.Rectangle+ {+ Stroke = BorderDef, StrokeThickness = 1, RadiusX = 4, RadiusY = 4,+ StrokeDashArray = new Avalonia.Collections.AvaloniaList<double> { 3, 2.5 },+ },+ pagerText,+ },+ };+ ToolTip.SetTip(pager, "Click for the next macros, right-click for the previous");+ pager.PointerPressed += (_, e) =>+ {+ var pt = e.GetCurrentPoint(pager).Properties;+ int n = MacroPages();+ if (pt.IsLeftButtonPressed) macroPage = (macroPage + 1) % n;+ else if (pt.IsRightButtonPressed) macroPage = (macroPage + n - 1) % n;+ else return;+ e.Handled = true; Touch();+ };+ readouts.Add(() =>+ {+ int next = (macroPage + 1) % MacroPages();+ int first = next * MacrosPerPage, last = Math.Min(8, first + MacrosPerPage) - 1;+ int used = 0;+ for (int m = first; m <= last; m++) if (MacroOn(m)) used++;+ pagerText.Text = $"M{first + 1} — M{last + 1} · " + (used == 0 ? "free" : $"{used} in use");+ pagerText.Foreground = used == 0 ? TextTertiary : Teal;+ });+ var macroGrid = new Grid { RowDefinitions = new RowDefinitions("*,Auto"), RowSpacing = 3, Margin = new Thickness(6, 4) };+ macroGrid.Children.Add(macroList);+ Grid.SetRow(pager, 1); macroGrid.Children.Add(pager);- // ---- FX tab ----- Control FxTab() => new StackPanel { Orientation = Orientation.Horizontal, Spacing = 16, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Children = {- new Border { Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Padding = new Thickness(10, 8), Child = new StackPanel { Children = { Lbl("DRIVE", 8, TxtC), Row(2, K("fxdrive", "AMOUNT", false, 44, 60)) } } },- new Border { Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Padding = new Thickness(10, 8), Child = new StackPanel { Children = { Lbl("CHORUS", 8, TxtC), Row(2, K("fxchorus", "AMOUNT", false, 44, 60), K("fxchorusrate", "RATE", false, 44, 60)) } } },- new Border { Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Padding = new Thickness(10, 8), Child = new StackPanel { Children = { Lbl("REVERB", 8, TxtC), Row(2, K("fxreverb", "AMOUNT", false, 44, 60)) } } } } };-- // ---- tab rail + body ----- var tabHost = new ContentControl { VerticalAlignment = VerticalAlignment.Stretch };- var tabCache = new Control?[6];- Control TabBody(int t) => tabCache[t] ??= t switch { 1 => FilterTab(), 2 => EnvTab(), 3 => LfoTab(), 4 => ModTab(), 5 => FxTab(), _ => OscTab() };- string[] tabs = { "Osc", "Filter", "Env", "LFO", "Mod", "FX" };- bool[] tealTab = { false, false, false, true, true, false };- int tabSel = 0; var tabBtns = new Border[tabs.Length];- void HiTabs() { for (int i = 0; i < tabs.Length; i++) { bool on = i == tabSel; tabBtns[i].Background = on ? NotaPalette.SurfaceRaised : Brushes.Transparent; tabBtns[i].BorderBrush = on ? (tealTab[i] ? TealC : Amber) : Brushes.Transparent; ((TextBlock)tabBtns[i].Child!).Foreground = on ? TxtC : MutedC; } }- var railCol = new StackPanel { Spacing = 2 };- for (int i = 0; i < tabs.Length; i++)+ // ---- the rail's own two tabs ----------------------------------------------+ var railBodies = new Control[] { globalGrid, macroGrid };+ var railCells = new Border[RailTabs.Length];+ var railTexts = new TextBlock[RailTabs.Length];+ var railCount = Mono("", TextTertiary, NotaType.Axis);+ railCount.HorizontalAlignment = HorizontalAlignment.Right;+ railCount.Margin = new Thickness(0, 0, 7, 0);+ readouts.Add(() => railCount.Text = railTab == 1 ? $"{MacroAssigned()} / 8 in use" : "");+ var railTabGrid = new Grid { Height = TabH, ColumnDefinitions = new ColumnDefinitions("Auto,Auto,*") };+ showRailTab = () =>+ {+ for (int i = 0; i < RailTabs.Length; i++)+ {+ bool on = i == railTab;+ railCells[i].Background = on ? NotaPalette.SurfaceRaised : Brushes.Transparent;+ railCells[i].BorderBrush = on ? Brass : Brushes.Transparent;+ railTexts[i].Foreground = on ? AccentBright : TextTertiary;+ railTexts[i].FontWeight = on ? FontWeight.SemiBold : FontWeight.Normal;+ railBodies[i].IsVisible = on;+ }+ Touch();+ };+ for (int i = 0; i < RailTabs.Length; i++){int iv = i;- var b = new Border { Height = 22, CornerRadius = NotaRadius.Control, Padding = new Thickness(8, 0), BorderThickness = new Thickness(2, 0, 0, 0), BorderBrush = Brushes.Transparent, Child = new TextBlock { Text = tabs[i], FontSize = 9, FontWeight = FontWeight.Medium, Foreground = MutedC, VerticalAlignment = VerticalAlignment.Center } };- b.PointerPressed += (_, _) => { tabSel = iv; HiTabs(); tabHost.Content = TabBody(iv); };- tabBtns[i] = b; railCol.Children.Add(b);+ var tb = new TextBlock+ {+ Text = RailTabs[i], FontSize = NotaType.DeviceSection,+ HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,+ };+ var cell = new Border+ {+ Padding = new Thickness(9, 0), BorderThickness = new Thickness(0, 0, 0, 2),+ Cursor = new Cursor(StandardCursorType.Hand), Child = tb,+ };+ cell.PointerPressed += (_, e) =>+ {+ if (!e.GetCurrentPoint(cell).Properties.IsLeftButtonPressed) return;+ railTab = iv; showRailTab(); e.Handled = true;+ };+ railCells[i] = cell; railTexts[i] = tb;+ Grid.SetColumn(cell, i); railTabGrid.Children.Add(cell);+ }+ Grid.SetColumn(railCount, 2); railTabGrid.Children.Add(railCount);+ var railHost = new Panel();+ foreach (var b in railBodies) railHost.Children.Add(b);+ var railGrid = new Grid { RowDefinitions = new RowDefinitions("Auto,*") };+ railGrid.Children.Add(HeaderStrip(railTabGrid));+ Grid.SetRow(railHost, 1); railGrid.Children.Add(railHost);+ var rail = SectionBox(railGrid);+ rail.Width = RailW;++ // ---- status strip ---------------------------------------------------------+ string RouteWord(string id) => Routes[Sel(id, 4)];+ string OscWord(int o) => BankWords[Sel(o == 0 ? "table" : "osc2table", 4)];+ string FiltPre() => fsel == 0 ? "fil1" : "fil2";+ string FiltFreqId() => fsel == 0 ? "cutoff" : "fil2freq";+ string FiltResoId() => fsel == 0 ? "resonance" : "fil2reso";++ string Hint() => tab switch+ {+ 0 => $"{OscWord(0)} · {OscWord(1)} · sub {SubWaves[Sel("subwave", 3)]}",+ 1 => $"{FiltTypes[Sel(FiltPre() + "type", 5)]} {(G(FiltPre() + "slope") >= 0.5f ? "24" : "12")} dB/oct",+ 2 => "amp · free",+ 3 => $"{(SyncDiv(G("lfo1sync")) > 0 ? SyncText(G("lfo1sync")) : "free")} · {(SyncDiv(G("lfo2sync")) > 0 ? SyncText(G("lfo2sync")) : "free")}",+ 4 => Plural(RouteCount(), "route", "routes"),+ _ => $"{(G("fxdriveon") >= 0.5f && G("fxdrive") > 1e-3f ? "drive" : "—")} → "+ + $"{(G("fxchoruson") >= 0.5f && G("fxchorus") > 1e-3f ? "chorus" : "—")} → "+ + $"{(G("fxreverbon") >= 0.5f && G("fxreverb") > 1e-3f ? "reverb" : "—")}",+ };+ string Summary() => tab switch+ {+ 0 => $"Osc 1 {OscWord(0)} {FrameText(G("position"))} {Pct(G("osc1level"))} → {RouteWord("routeosc1")} · "+ + $"Osc 2 {OscWord(1)} {FrameText(G("osc2position"))} {Pct(G("osc2level"))} → {RouteWord("routeosc2")} · "+ + $"sub {SubWaves[Sel("subwave", 3)]} {SubOct(G("suboct"))} oct {Pct(G("sublevel"))} · "+ + $"unison ×{Voices(G("unison"))} {Detune(G("unidetune"))} spread {Pct(G("unispread"))}",+ 1 => $"Filter {fsel + 1} · {FiltTypes[Sel(FiltPre() + "type", 5)]} "+ + $"{(G(FiltPre() + "slope") >= 0.5f ? "24" : "12")} dB/oct · {Hz(G(FiltFreqId()))} · "+ + $"reso {Pct(G(FiltResoId()))} · env {Bip(G(FiltPre() + "env"))} · lfo {Bip(G(FiltPre() + "lfo"))} · "+ + (G("filseries") >= 0.5f ? "series" : "parallel"),+ 2 => $"Env 1 → amp {AdsrSum("attack", "decay", "sustain", "release")} · Env 2 {EnvDest(1)}",+ 3 => $"LFO 1 {ShapeNames[Sel("lfo1shape", 4)]} {(SyncDiv(G("lfo1sync")) > 0 ? SyncText(G("lfo1sync")) : SlowHz(ExpMap(G("lfo1rate"), 0.05, 20)))} {LfoDest(2)} · "+ + $"LFO 2 {ShapeNames[Sel("lfo2shape", 4)]} {(SyncDiv(G("lfo2sync")) > 0 ? SyncText(G("lfo2sync")) : SlowHz(ExpMap(G("lfo2rate"), 0.05, 20)))} {LfoDest(3)}",+ 4 => RouteCount() == 0 ? "no routes — drag a cell to make one" : Plural(RouteCount(), "route", "routes") + " in the matrix",+ _ => $"Drive {(G("fxdriveon") >= 0.5f ? DriveModes[Sel("fxdrivemode", 3)].ToLowerInvariant() + " " + Pct(G("fxdrive")) : "off")} · "+ + $"chorus {(G("fxchoruson") >= 0.5f ? ChorusVoices[Sel("fxchorusvoices", 3)] + " " + Pct(G("fxchorus")) : "off")} · "+ + $"reverb {(G("fxreverbon") >= 0.5f ? ReverbModes[Sel("fxreverbmode", 3)].ToLowerInvariant() + " " + Pct(G("fxreverb")) : "off")}",+ };+ string Meta()+ {+ string mode = G("mono") >= 0.5f ? "MONO" : "POLY 16";+ return $"{mode} · ±{BendRange(G("bendrange"))} ST · GAIN {Pct(G("gain"))}";}- var rail = new Border { Width = 74, Background = RailBg, BorderBrush = Border2, BorderThickness = new Thickness(0, 0, 1, 0), Padding = new Thickness(5, 8), Child = railCol };- DockPanel.SetDock(rail, Dock.Left);- var body = new DockPanel { LastChildFill = true, Children = { rail, new Border { Padding = new Thickness(9, 8), Child = tabHost } } };+ var statusBar = new Grid { Height = StatusH, ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 10 };+ statusBar.Children.Add(status);+ Grid.SetColumn(meta, 1); statusBar.Children.Add(meta);+ var statusHost = new Border+ {+ Height = StatusH, BorderBrush = BorderDef, BorderThickness = new Thickness(0, 1, 0, 0),+ Background = NotaPalette.SurfaceAbyss, Padding = new Thickness(8, 0), Child = statusBar,+ };- DockPanel.SetDock(liveStrip, Dock.Top);- var dockRoot = new DockPanel { LastChildFill = true, Background = CardBg, Children = { liveStrip, body } };+ // ---- assembly -------------------------------------------------------------+ var body = new Grid+ {+ ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto"), ColumnSpacing = NotaSpace.DeviceGap,+ Margin = new Thickness(NotaSpace.DeviceGap),+ };+ body.Children.Add(wheelsPanel);+ Grid.SetColumn(tabPanel, 1); body.Children.Add(tabPanel);+ Grid.SetColumn(rail, 2); body.Children.Add(rail);- HiTabs(); tabHost.Content = TabBody(tabSel);- ctx.SetInstLiveViz(Refresh);- Refresh();- return dockRoot;+ DockPanel.SetDock(statusHost, Dock.Bottom);+ var root = new DockPanel+ {+ LastChildFill = true, Background = NotaPalette.Gutter,+ Children = { statusHost, body },+ };++ ctx.SetInstLiveViz(() => Refresh(false));+ showRailTab();+ showTab();+ return root;+ }++ // A device section: card ground, hairline, radius 6 — the almanac's section box.+ private static Border SectionBox(Control child) => new()+ {+ Background = NotaPalette.SurfaceCard, BorderBrush = BorderDef, BorderThickness = new Thickness(1),+ CornerRadius = NotaRadius.Tile, ClipToBounds = true, Child = child,+ };++ // A section's own header strip: a hairline under it, nothing else.+ private static Border HeaderStrip(Control child) => new()+ {+ BorderBrush = BorderDef, BorderThickness = new Thickness(0, 0, 0, 1), Child = child,+ };++ /// <summary>Row definitions that put a caption for each dB mark at its place on the+ /// meter's scale: a star gap, the caption (Auto), … and a star gap for the remainder.</summary>+ private static IEnumerable<string> ScaleRows(params double[] dbs)+ {+ double prev = 0;+ foreach (var db in dbs)+ {+ double fromTop = 1.0 - MeterScale.NormDb(db);+ yield return Math.Max(0, fromTop - prev).ToString("0.000", NotaNum.Culture) + "*";+ yield return "Auto";+ prev = fromTop;+ }+ yield return Math.Max(0, 1.0 - prev).ToString("0.000", NotaNum.Culture) + "*";}}diff --git a/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs b/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.csindex 96480e87..8ff919d6 100644--- a/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs+++ b/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs@@ -66,24 +66,179 @@ public sealed class FactoryPresetCatalog : IFactoryPresetsInst("physical", 2, "Wood Block", ("malletvol", 0.9f), ("malletstiff", 0.7f), ("r1type", 0.0f), ("r1decay", 0.14f), ("r1material", 0.82f), ("r1bright", 0.5f), ("r1hit", 0.3f), ("volume", 0.82f));Inst("physical", 2, "Membrane", ("malletvol", 0.85f), ("malletstiff", 0.5f), ("r1type", 0.6f), ("r1decay", 0.32f), ("r1material", 0.62f), ("r1bright", 0.5f), ("r1inharm", 0.1f), ("r1hit", 0.4f), ("volume", 0.8f));- // ---- Nota Aurora (kind 5) — table: Analog 0 / Pulse .33 / Formant .66 / Chroma 1- Inst("aurora", 5, "Warm Pad", ("table", 0f), ("position", 0.30f), ("warp", 0.50f), ("unison", 0.60f), ("attack", 0.50f), ("decay", 0.40f), ("sustain", 0.85f), ("release", 0.60f), ("cutoff", 0.50f), ("resonance", 0.10f), ("gain", 0.80f));- Inst("aurora", 5, "Glass Bells", ("table", 0.66f), ("position", 0.70f), ("warp", 0.55f), ("unison", 0.20f), ("attack", 0.02f), ("decay", 0.50f), ("sustain", 0.20f), ("release", 0.42f), ("cutoff", 0.80f), ("resonance", 0.16f), ("gain", 0.80f));- Inst("aurora", 5, "Detuned Lead",("table", 0.33f), ("position", 0.40f), ("warp", 0.60f), ("unison", 0.90f), ("attack", 0.02f), ("decay", 0.30f), ("sustain", 0.75f), ("release", 0.25f), ("cutoff", 0.76f), ("resonance", 0.20f), ("gain", 0.78f));- Inst("aurora", 5, "Motion Keys", ("table", 1f), ("position", 0.50f), ("warp", 0.70f), ("unison", 0.50f), ("attack", 0.05f), ("decay", 0.42f), ("sustain", 0.60f), ("release", 0.40f), ("cutoff", 0.66f), ("resonance", 0.20f), ("gain", 0.80f));- // v2: two oscillators + sub + FX + Env2/LFO modulation. Warp mode: Off 0 / Sync .25 / Bend .5 / PWM .75 / Fold 1.- Inst("aurora", 5, "Glass Choir", ("table", 0.66f), ("position", 0.55f), ("osc2on", 1f), ("osc2table", 0.0f), ("osc2level", 0.55f), ("osc2oct", 0.667f), ("osc2detune", 0.56f),- ("unison", 0.5f), ("unidetune", 0.4f), ("cutoff", 0.72f), ("resonance", 0.12f), ("fil1env", 0.62f),- ("attack", 0.35f), ("decay", 0.5f), ("sustain", 0.8f), ("release", 0.6f), ("env2attack", 0.4f), ("env2sustain", 0.6f),- ("mtx1_2", 0.78f), ("fxchorus", 0.4f), ("fxreverb", 0.4f), ("gain", 0.78f));- Inst("aurora", 5, "Super Saw", ("table", 0.0f), ("position", 0.9f), ("osc2on", 1f), ("osc2table", 0.0f), ("osc2position", 0.9f), ("osc2level", 0.8f), ("osc2detune", 0.62f),- ("unison", 1f), ("unidetune", 0.7f), ("unispread", 0.9f), ("cutoff", 0.8f), ("resonance", 0.14f), ("fil1env", 0.55f),- ("attack", 0.0f), ("decay", 0.4f), ("sustain", 0.85f), ("release", 0.28f), ("fxdrive", 0.2f), ("gain", 0.72f));- Inst("aurora", 5, "Sub Bass", ("table", 0.0f), ("position", 0.6f), ("osc1oct", 0.333f), ("sublevel", 0.85f), ("suboct", 0.5f),- ("cutoff", 0.42f), ("resonance", 0.2f), ("fil1env", 0.72f), ("fil1slope", 1f),- ("attack", 0.0f), ("decay", 0.3f), ("sustain", 0.6f), ("release", 0.18f), ("mono", 1f), ("gain", 0.85f));- Inst("aurora", 5, "Fold Lead", ("table", 0.33f), ("position", 0.5f), ("osc1warpmode", 1f), ("warp", 0.6f), ("cutoff", 0.82f), ("resonance", 0.22f),- ("attack", 0.01f), ("decay", 0.3f), ("sustain", 0.7f), ("release", 0.22f), ("lfo1depth", 0.6f), ("mtx2_3", 0.35f), ("fxdrive", 0.3f), ("gain", 0.72f));+ // ---- Nota Aurora (kind 5) — 25 patches: pads, keys, leads, basses, plucks and+ // motion. Table: Analog 0 / Pulse .333 / Formant .667 / Chroma 1 · warp mode+ // Off 0 / Sync .25 / Bend .5 / PWM .75 / Fold 1 · filter type LP 0 / HP .25 /+ // BP .5 / Notch .75 / Morph 1 · slope 12 dB 0 / 24 dB 1 · route F1 0 / F2+ // .333 / Both .667 / Dry 1 · sub wave sin 0 / sqr .5 / tri 1 · LFO shape sin+ // 0 / tri .333 / sqr .667 / S&H 1 · LFO sync free 0 then 1 bar … 1/64 at n/7+ // (1/4 = .4286, 1/8 = .5714, 1/16 = .7143) · drive Tube 0 / Tape .5 / Fold 1 ·+ // chorus 1× 0 / 2× .5 / 4× 1 · reverb Room 0 / Hall .5 / Plate 1.+ // Bipolar knobs (oct/semi/fine/env/lfo/pan/tone/macro amount) are neutral at+ // .5; octave spans ±3 (.333 = −1 oct), semi ±12 (.5 + n/24), fine ±50 cents.+ // unison = voices (1 + n×6, so .333 = 3), unidetune = cents / 50.+ // Matrix cells are mtx{src}_{dst}: src 0 env 1 · 1 env 2 · 2 LFO 1 · 3 LFO 2 ·+ // 4 velocity · 5 key · 6 mod wheel · 7 random; dst 0 pitch · 1 osc 2 pitch ·+ // 2 position · 3 cutoff · 4 reso · 5 level · 6 pan. A macro's dest is n/11 over+ // the twelve targets (1 warp, 4 position, 6 cutoff, 8 unison, 11 pan).++ // Pads+ Inst("aurora", 5, "Warm Pad", ("table", 0f), ("position", 0.30f), ("warp", 0.50f),+ ("unison", 0.333f), ("unidetune", 0.26f), ("unispread", 0.55f),+ ("attack", 0.50f), ("decay", 0.40f), ("sustain", 0.85f), ("release", 0.60f),+ ("cutoff", 0.50f), ("resonance", 0.10f), ("fil1env", 0.60f), ("gain", 0.80f));+ Inst("aurora", 5, "Glacier Pad", ("table", 0.667f), ("position", 0.18f), ("warp", 0.5f),+ ("osc2on", 1f), ("osc2table", 0f), ("osc2position", 0.34f), ("osc2level", 0.58f), ("osc2detune", 0.57f),+ ("unison", 0.333f), ("unidetune", 0.30f), ("unispread", 0.60f),+ ("attack", 0.42f), ("decay", 0.5f), ("sustain", 0.8f), ("release", 0.66f),+ ("env2attack", 0.35f), ("env2decay", 0.5f), ("env2sustain", 0.55f),+ ("cutoff", 0.62f), ("resonance", 0.10f), ("fil1env", 0.60f),+ ("mtx1_2", 0.74f), ("lfo2sync", 0.5714f), ("lfo2depth", 0.35f), ("mtx3_2", 0.60f),+ ("fxchorus", 0.44f), ("fxchorusvoices", 0.5f), ("fxreverb", 0.42f), ("fxreverbmode", 0.5f), ("fxreverbsize", 0.7f),+ ("mac0val", 0.58f), ("mac0dest", 4f / 11f), ("mac0amt", 0.78f),+ ("mac2val", 0.72f), ("mac2dest", 6f / 11f), ("mac2amt", 0.68f), ("gain", 0.78f));+ Inst("aurora", 5, "Glass Choir", ("table", 0.667f), ("position", 0.55f),+ ("osc2on", 1f), ("osc2table", 0f), ("osc2level", 0.55f), ("osc2oct", 0.667f), ("osc2detune", 0.56f),+ ("unison", 0.333f), ("unidetune", 0.34f), ("unispread", 0.7f),+ ("cutoff", 0.72f), ("resonance", 0.12f), ("fil1env", 0.62f),+ ("attack", 0.35f), ("decay", 0.5f), ("sustain", 0.8f), ("release", 0.6f),+ ("env2attack", 0.4f), ("env2sustain", 0.6f), ("mtx1_2", 0.78f),+ ("fxchorus", 0.4f), ("fxchorusvoices", 1f), ("fxreverb", 0.4f), ("fxreverbmode", 0.5f), ("gain", 0.78f));+ Inst("aurora", 5, "Formant Pad", ("table", 0.667f), ("position", 0.42f), ("osc1warpmode", 0.5f), ("warp", 0.62f),+ ("unison", 0.667f), ("unidetune", 0.22f), ("unispread", 0.8f),+ ("attack", 0.46f), ("decay", 0.5f), ("sustain", 0.82f), ("release", 0.7f),+ ("cutoff", 0.58f), ("resonance", 0.24f), ("fil1type", 1f), ("fil1env", 0.56f),+ ("lfo1rate", 0.16f), ("lfo1depth", 0.5f), ("mtx2_2", 0.70f),+ ("fxreverb", 0.46f), ("fxreverbmode", 0.5f), ("fxreverbsize", 0.8f), ("gain", 0.76f));+ Inst("aurora", 5, "Deep Drone", ("table", 0f), ("position", 0.24f), ("osc1oct", 0.333f),+ ("sublevel", 0.6f), ("suboct", 0.5f), ("routesub", 1f),+ ("unison", 0.667f), ("unidetune", 0.18f), ("unispread", 0.9f),+ ("attack", 0.62f), ("decay", 0.6f), ("sustain", 0.9f), ("release", 0.78f),+ ("cutoff", 0.36f), ("resonance", 0.16f), ("fil1slope", 1f), ("fil1env", 0.56f),+ ("lfo1rate", 0.08f), ("lfo1depth", 0.6f), ("mtx2_3", 0.66f),+ ("fxreverb", 0.5f), ("fxreverbmode", 0.5f), ("fxreverbsize", 0.9f), ("gain", 0.74f));+ Inst("aurora", 5, "Aurora Sweep", ("table", 1f), ("position", 0.1f), ("osc1warpmode", 0.25f), ("warp", 0.55f),+ ("unison", 0.5f), ("unidetune", 0.3f), ("unispread", 0.75f),+ ("attack", 0.3f), ("decay", 0.55f), ("sustain", 0.8f), ("release", 0.7f),+ ("env2attack", 0.7f), ("env2decay", 0.7f), ("env2sustain", 0.9f), ("env2release", 0.8f),+ ("cutoff", 0.5f), ("resonance", 0.2f), ("fil1env", 0.72f), ("mtx1_2", 0.92f),+ ("fxchorus", 0.3f), ("fxreverb", 0.5f), ("fxreverbmode", 0.5f),+ ("mac0val", 1f), ("mac0dest", 4f / 11f), ("mac0amt", 0.9f), ("gain", 0.74f));++ // Keys, bells and plucks+ Inst("aurora", 5, "Glass Bells", ("table", 0.667f), ("position", 0.70f), ("warp", 0.55f),+ ("unison", 0f), ("attack", 0.02f), ("decay", 0.50f), ("sustain", 0.20f), ("release", 0.42f),+ ("cutoff", 0.80f), ("resonance", 0.16f), ("fil1env", 0.66f),+ ("fxreverb", 0.34f), ("fxreverbmode", 1f), ("gain", 0.80f));+ Inst("aurora", 5, "Motion Keys", ("table", 1f), ("position", 0.50f), ("warp", 0.70f),+ ("unison", 0.333f), ("unidetune", 0.24f), ("unispread", 0.5f),+ ("attack", 0.05f), ("decay", 0.42f), ("sustain", 0.60f), ("release", 0.40f),+ ("cutoff", 0.66f), ("resonance", 0.20f), ("fil1env", 0.62f),+ ("lfo2rate", 0.22f), ("lfo2depth", 0.6f), ("mtx3_2", 0.66f),+ ("fxchorus", 0.3f), ("gain", 0.80f));+ Inst("aurora", 5, "Digital Bell", ("table", 1f), ("position", 0.82f), ("osc1warpmode", 0.25f), ("warp", 0.66f),+ ("osc2on", 1f), ("osc2table", 1f), ("osc2position", 0.6f), ("osc2level", 0.42f), ("osc2semi", 0.7917f),+ ("attack", 0f), ("decay", 0.46f), ("sustain", 0.08f), ("release", 0.4f),+ ("cutoff", 0.86f), ("resonance", 0.1f), ("fil1env", 0.72f),+ ("mtx4_3", 0.7f), ("fxreverb", 0.4f), ("fxreverbmode", 1f), ("gain", 0.74f));+ Inst("aurora", 5, "Bright Pluck", ("table", 0.333f), ("position", 0.6f), ("osc1warpmode", 0.75f), ("warp", 0.4f),+ ("unison", 0.333f), ("unidetune", 0.2f), ("unispread", 0.4f),+ ("attack", 0f), ("decay", 0.34f), ("sustain", 0f), ("release", 0.24f),+ ("env2attack", 0f), ("env2decay", 0.26f), ("env2sustain", 0f), ("env2release", 0.2f),+ ("cutoff", 0.52f), ("resonance", 0.3f), ("fil1env", 0.86f),+ ("fxdrive", 0.16f), ("fxreverb", 0.24f), ("gain", 0.8f));+ Inst("aurora", 5, "Nylon Keys", ("table", 0f), ("position", 0.34f), ("warp", 0.5f),+ ("sublevel", 0.3f), ("suboct", 0.5f),+ ("attack", 0f), ("decay", 0.42f), ("sustain", 0.18f), ("release", 0.32f),+ ("cutoff", 0.56f), ("resonance", 0.12f), ("fil1env", 0.7f), ("fil1key", 0.5f),+ ("mtx4_3", 0.66f), ("fxdrive", 0.1f), ("fxdrivemode", 0.5f), ("fxreverb", 0.22f), ("gain", 0.82f));+ Inst("aurora", 5, "Tape Keys", ("table", 0.333f), ("position", 0.4f), ("warp", 0.5f),+ ("osc2on", 1f), ("osc2table", 0f), ("osc2level", 0.42f), ("osc2detune", 0.545f),+ ("attack", 0.04f), ("decay", 0.44f), ("sustain", 0.5f), ("release", 0.38f),+ ("cutoff", 0.54f), ("resonance", 0.14f), ("fil1env", 0.6f),+ ("fxdrive", 0.3f), ("fxdrivemode", 0.5f), ("fxtone", 0.38f),+ ("fxchorus", 0.34f), ("fxchorusrate", 0.2f), ("fxreverb", 0.2f), ("gain", 0.78f));+ Inst("aurora", 5, "Chime Sequence",("table", 0.667f), ("position", 0.5f),+ ("attack", 0f), ("decay", 0.3f), ("sustain", 0.05f), ("release", 0.3f),+ ("cutoff", 0.82f), ("resonance", 0.18f), ("fil1env", 0.6f),+ ("lfo2shape", 1f), ("lfo2sync", 0.7143f), ("lfo2depth", 0.7f), ("mtx3_2", 0.78f),+ ("fxreverb", 0.44f), ("fxreverbmode", 1f), ("fxreverbsize", 0.7f), ("gain", 0.74f));++ // Leads+ Inst("aurora", 5, "Detuned Lead", ("table", 0.333f), ("position", 0.40f), ("warp", 0.60f),+ ("unison", 0.667f), ("unidetune", 0.3f), ("unispread", 0.5f),+ ("attack", 0.02f), ("decay", 0.30f), ("sustain", 0.75f), ("release", 0.25f),+ ("cutoff", 0.76f), ("resonance", 0.20f), ("fil1env", 0.6f),+ ("bendrange", 4f / 11f), ("gain", 0.78f));+ Inst("aurora", 5, "Super Saw", ("table", 0f), ("position", 0.9f),+ ("osc2on", 1f), ("osc2table", 0f), ("osc2position", 0.9f), ("osc2level", 0.8f), ("osc2detune", 0.62f),+ ("unison", 1f), ("unidetune", 0.4f), ("unispread", 0.9f),+ ("cutoff", 0.8f), ("resonance", 0.14f), ("fil1env", 0.55f),+ ("attack", 0f), ("decay", 0.4f), ("sustain", 0.85f), ("release", 0.28f),+ ("fxdrive", 0.2f), ("fxchorus", 0.26f), ("fxreverb", 0.24f), ("gain", 0.72f));+ Inst("aurora", 5, "Fold Lead", ("table", 0.333f), ("position", 0.5f), ("osc1warpmode", 1f), ("warp", 0.6f),+ ("cutoff", 0.82f), ("resonance", 0.22f), ("fil1env", 0.6f),+ ("attack", 0.01f), ("decay", 0.3f), ("sustain", 0.7f), ("release", 0.22f),+ ("lfo1depth", 0.6f), ("mtx2_3", 0.68f), ("mtx6_0", 0.54f),+ ("fxdrive", 0.3f), ("fxdrivemode", 1f), ("bendrange", 4f / 11f), ("gain", 0.72f));+ Inst("aurora", 5, "Hollow Lead", ("table", 0.333f), ("position", 0.28f), ("osc1warpmode", 0.75f), ("warp", 0.72f),+ ("mono", 1f), ("unison", 0.333f), ("unidetune", 0.16f),+ ("attack", 0.03f), ("decay", 0.3f), ("sustain", 0.78f), ("release", 0.2f),+ ("cutoff", 0.64f), ("resonance", 0.34f), ("fil1slope", 1f), ("fil1env", 0.64f),+ ("lfo1rate", 0.4f), ("lfo1depth", 0.3f), ("mtx6_0", 0.56f),+ ("fxdrive", 0.22f), ("bendrange", 1f), ("gain", 0.76f));+ Inst("aurora", 5, "Shimmer Arp", ("table", 1f), ("position", 0.44f), ("warp", 0.58f),+ ("attack", 0f), ("decay", 0.26f), ("sustain", 0.2f), ("release", 0.22f),+ ("cutoff", 0.7f), ("resonance", 0.24f), ("fil1env", 0.74f),+ ("lfo1shape", 0.333f), ("lfo1sync", 0.7143f), ("lfo1depth", 0.8f), ("mtx2_2", 0.84f),+ ("fxchorus", 0.3f), ("fxchorusvoices", 1f), ("fxreverb", 0.4f), ("fxreverbmode", 1f),+ ("mac0val", 0.5f), ("mac0dest", 1f / 11f), ("mac0amt", 0.74f), ("gain", 0.74f));++ // Basses+ Inst("aurora", 5, "Sub Bass", ("table", 0f), ("position", 0.6f), ("osc1oct", 0.333f),+ ("sublevel", 0.85f), ("suboct", 0.5f),+ ("cutoff", 0.42f), ("resonance", 0.2f), ("fil1env", 0.72f), ("fil1slope", 1f),+ ("attack", 0f), ("decay", 0.3f), ("sustain", 0.6f), ("release", 0.18f),+ ("mono", 1f), ("unison", 0f), ("gain", 0.85f));+ Inst("aurora", 5, "Reese Bass", ("table", 0f), ("position", 0.8f), ("osc1oct", 0.333f),+ ("osc2on", 1f), ("osc2table", 0f), ("osc2position", 0.8f), ("osc2level", 0.85f), ("osc2oct", 0.333f), ("osc2detune", 0.62f),+ ("unison", 0.333f), ("unidetune", 0.22f), ("unispread", 0.4f),+ ("cutoff", 0.34f), ("resonance", 0.26f), ("fil1slope", 1f), ("fil1env", 0.64f),+ ("attack", 0f), ("decay", 0.32f), ("sustain", 0.7f), ("release", 0.16f),+ ("mono", 1f), ("fxdrive", 0.24f), ("fxdrivemode", 0.5f), ("gain", 0.82f));+ Inst("aurora", 5, "Acid Table", ("table", 0.333f), ("position", 0.46f), ("osc1oct", 0.333f), ("osc1warpmode", 0.75f), ("warp", 0.4f),+ ("cutoff", 0.30f), ("resonance", 0.72f), ("fil1slope", 1f), ("fil1env", 0.9f),+ ("env2attack", 0f), ("env2decay", 0.26f), ("env2sustain", 0.04f), ("env2release", 0.16f),+ ("attack", 0f), ("decay", 0.3f), ("sustain", 0.45f), ("release", 0.14f),+ ("mono", 1f), ("mtx4_3", 0.7f), ("fxdrive", 0.32f), ("gain", 0.84f));+ Inst("aurora", 5, "Wobble Wave", ("table", 0.333f), ("position", 0.55f), ("osc1oct", 0.333f),+ ("sublevel", 0.5f), ("suboct", 0.5f),+ ("cutoff", 0.34f), ("resonance", 0.44f), ("fil1slope", 1f),+ ("lfo1sync", 0.5714f), ("lfo1shape", 0f), ("lfo1depth", 0.85f), ("mtx2_3", 0.92f),+ ("attack", 0f), ("decay", 0.3f), ("sustain", 0.62f), ("release", 0.16f),+ ("mono", 1f), ("fxdrive", 0.3f), ("gain", 0.84f));+ Inst("aurora", 5, "Rubber Bass", ("table", 0f), ("position", 0.36f), ("osc1oct", 0.333f), ("osc1warpmode", 0.5f), ("warp", 0.62f),+ ("sublevel", 0.42f), ("suboct", 0.5f), ("routesub", 1f),+ ("cutoff", 0.38f), ("resonance", 0.36f), ("fil1env", 0.82f), ("fil1key", 0.55f),+ ("env2attack", 0f), ("env2decay", 0.3f), ("env2sustain", 0.1f),+ ("attack", 0f), ("decay", 0.3f), ("sustain", 0.55f), ("release", 0.18f),+ ("mono", 1f), ("fxdrive", 0.2f), ("fxdrivemode", 0.5f), ("gain", 0.84f));++ // Motion and texture+ Inst("aurora", 5, "Split Filter", ("table", 0f), ("position", 0.5f), ("routeosc1", 0f),+ ("osc2on", 1f), ("osc2table", 0.667f), ("osc2position", 0.6f), ("osc2level", 0.7f), ("osc2detune", 0.57f), ("routeosc2", 0.333f),+ ("fil1type", 0f), ("cutoff", 0.44f), ("fil2type", 0.25f), ("fil2freq", 0.56f),+ ("attack", 0.2f), ("decay", 0.45f), ("sustain", 0.75f), ("release", 0.45f),+ ("unison", 0.333f), ("unidetune", 0.24f), ("unispread", 0.85f),+ ("lfo2rate", 0.14f), ("lfo2depth", 0.6f), ("mtx3_6", 0.72f), ("gain", 0.76f));+ Inst("aurora", 5, "Air Strings", ("table", 0.667f), ("position", 0.3f), ("warp", 0.5f),+ ("osc2on", 1f), ("osc2table", 0.667f), ("osc2position", 0.38f), ("osc2level", 0.52f), ("osc2oct", 0.667f), ("osc2detune", 0.56f),+ ("unison", 0.667f), ("unidetune", 0.2f), ("unispread", 0.95f),+ ("attack", 0.34f), ("decay", 0.5f), ("sustain", 0.88f), ("release", 0.58f),+ ("cutoff", 0.66f), ("resonance", 0.1f), ("fil1env", 0.56f),+ ("lfo1rate", 0.3f), ("lfo1depth", 0.22f), ("mtx2_0", 0.53f),+ ("fxreverb", 0.44f), ("fxreverbmode", 0.5f), ("fxreverbsize", 0.8f),+ ("mac0val", 0.34f), ("mac0dest", 8f / 11f), ("mac0amt", 0.68f), ("gain", 0.74f));// ---- Nota Volt (kind 6) — 25 patches across basses, leads, pads, keys and motion.// Bipolar knobs (octave/semi/detune/env/lfo/pan/macro amount) are neutral atdiff --git a/src/native/nota.engine/src/WavetableSynth.h b/src/native/nota.engine/src/WavetableSynth.hindex 8af44dbf..c066662e 100644--- a/src/native/nota.engine/src/WavetableSynth.h+++ b/src/native/nota.engine/src/WavetableSynth.h@@ -1,16 +1,21 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.//-// Nota Aurora — the built-in wavetable synth (kind 5), reworked to mockup 2j. Each voice-// runs TWO wavetable oscillators (independent bank / position / warp / level / pitch) plus-// a sub oscillator, a unison stack (voices / detune / spread), two state-variable filters-// with per-source routing (F1 / F2 / Both / Dry) in parallel or series, two envelopes-// (Env 1 = amp, Env 2 = free), two LFOs (one tempo-syncable), a generic 8×7 modulation-// matrix, four macros, and a built-in FX block (drive · chorus · reverb). Four spectral+// Nota Aurora — the built-in wavetable synth (kind 5), reworked to the almanac's card.+// Each voice runs TWO wavetable oscillators (independent bank / position / warp / level /+// pitch) plus a sub oscillator, a unison stack (voices / detune / stereo spread), two+// state-variable filters with per-source routing (F1 / F2 / Both / Dry) in parallel or+// series, two envelopes (Env 1 = amp, Env 2 = free), two tempo-syncable LFOs, a generic+// 8×7 modulation matrix, EIGHT macros over twelve destinations, two performance wheels+// (pitch bend with a selectable range, mod wheel) and a built-in FX chain — drive+// (Tube / Tape / Fold, with a tone tilt), chorus (1× / 2× / 4×) and reverb+// (Room / Hall / Plate, with size) — each block switchable on its own. Four spectral// banks (Analog / Pulse / Formant / Chroma); five warp modes (Off / Sync / Bend / PWM /// Fold). All params ride the plugin-param interface → automation / persist / clone.//-// Header-only; allocation-free after construction (tables + FX buffers built up front).+// Header-only; allocation-free after construction. The 512 KB wavetable set is built ONCE+// per process and shared by every instance — it is read-only data, and rebuilding it per+// voice-bank cost every new track (and every clone) eight million sines.// Order of params is the persisted state layout — APPEND ONLY.#pragma once@@ -23,6 +28,7 @@#include <cstring>#include <memory>#include <string>+#include <unordered_map>#include <vector>namespace nota {@@ -31,7 +37,14 @@ class WavetableSynth final : public Instrument {public:static constexpr int kSources = 8; // Env1, Env2, LFO1, LFO2, Vel, Key, ModWhl, Randstatic constexpr int kDests = 7; // Pitch, Osc2 Pitch, Position, Cutoff, Reso, Level, Pan- static constexpr int kMacros = 4;+ static constexpr int kMacros = 8;+ // Macros reach further than the matrix: the seven voice-bus destinations above sit at+ // indices 0, 2, 4, 6, 7, 9 and 11 of this twelve-entry list, exactly where a+ // seven-entry normalized value rounds to — so a patch saved against the old list still+ // points at the same destination. The other five act on the block snapshot instead.+ // 0 Pitch · 1 Warp · 2 Osc 2 Pitch · 3 Osc 2 Level · 4 Position · 5 Sub Level+ // 6 Cutoff · 7 Reso · 8 Unison · 9 Level · 10 Drive · 11 Pan+ static constexpr int kMacroDests = 12;enum Param {// ---- original 11 (v1): Osc1 table/pos/warp, Env1 ADSR, Fil1 cutoff/reso, gain ----@@ -50,8 +63,14 @@ public:FxDrive, FxChorus, FxChorusRate, FxReverb, // 58..61ModWheel, MonoMode, // 62,63MatrixBase, // 64 (56 entries)- MacroBase = MatrixBase + kSources * kDests, // 120 (12 entries)- kNumParams = MacroBase + kMacros * 3 // 132+ MacroBase = MatrixBase + kSources * kDests, // 120 (24 entries)+ // ---- appended (v3, almanac rework): wheels, output pan, LFO 2 sync, FX blocks ----+ ExtraBase = MacroBase + kMacros * 3, // 144+ Bend = ExtraBase, BendRange, OutPan, Lfo2Sync, // 144..147+ FxDriveOn, FxDriveMode, FxTone, // 148..150+ FxChorusOn, FxChorusVoices, // 151,152+ FxReverbOn, FxReverbMode, FxReverbSize, // 153..155+ kNumParams // 156};static int matrixIdx(int s, int d) { return MatrixBase + s * kDests + d; }static int macroIdx(int m, int f) { return MacroBase + m * 3 + f; }@@ -74,7 +93,14 @@ public:set(ModWheel, 0.0f); set(MonoMode, 0.0f);for (int s = 0; s < kSources; ++s) for (int d = 0; d < kDests; ++d) set((Param)matrixIdx(s, d), 0.5f);for (int m = 0; m < kMacros; ++m) { set((Param)macroIdx(m, 0), 0.0f); set((Param)macroIdx(m, 1), 0.0f); set((Param)macroIdx(m, 2), 0.5f); }- buildTables();+ set(Bend, 0.5f); set(BendRange, 1.0f / 11.0f); // centred, ±2 semitones+ set(OutPan, 0.5f); set(Lfo2Sync, 0.0f);+ // The three FX blocks start switched ON with their amount at zero, so a patch saved+ // before they had switches sounds exactly as it did.+ set(FxDriveOn, 1.0f); set(FxDriveMode, 0.0f); set(FxTone, 0.5f);+ set(FxChorusOn, 1.0f); set(FxChorusVoices, 0.5f);+ set(FxReverbOn, 1.0f); set(FxReverbMode, 0.0f); set(FxReverbSize, 0.5f);+ tables_ = sharedTables();chorusBuf_.assign(4096, 0.0f);for (auto& c : revC_) c.buf.assign(1, 0.0f);}@@ -89,6 +115,7 @@ public:for (int c = 0; c < kRevCombs; ++c) { revC_[c].buf.assign((size_t)(ct[c] * sampleRate_ / 44100.0) + 1, 0.0f); revC_[c].idx = 0; revC_[c].store = 0; }static const int at[kRevAll] = {556, 441};for (int a = 0; a < kRevAll; ++a) { revA_[a].buf.assign((size_t)(at[a] * sampleRate_ / 44100.0) + 1, 0.0f); revA_[a].idx = 0; }+ toneL_ = toneR_ = 0.0f;}void setTransport(double, double samplesPerBeat, bool) override { if (samplesPerBeat > 0.0) spb_ = samplesPerBeat; }int32_t activeVoiceCount() const override { return activeVoices_.load(std::memory_order_relaxed); }@@ -112,6 +139,13 @@ public:return std::string(ids[i]);}if (i < MacroBase) { int j = i - MatrixBase; return "mtx" + std::to_string(j / kDests) + "_" + std::to_string(j % kDests); }+ if (i >= ExtraBase) {+ static const char* ex[] = { "bend", "bendrange", "outpan", "lfo2sync",+ "fxdriveon", "fxdrivemode", "fxtone",+ "fxchoruson", "fxchorusvoices",+ "fxreverbon", "fxreverbmode", "fxreverbsize" };+ return std::string(ex[i - ExtraBase]);+ }int j = i - MacroBase, m = j / 3, f = j % 3;return "mac" + std::to_string(m) + (f == 0 ? "val" : f == 1 ? "dest" : "amt");}@@ -134,14 +168,30 @@ public:static const char* sn[] = { "Env 1", "Env 2", "LFO 1", "LFO 2", "Velocity", "Key", "Mod Whl", "Random" };static const char* dn[] = { "Pitch", "Osc2 Pitch", "Position", "Cutoff", "Reso", "Level", "Pan" };if (i < MacroBase) { int j = i - MatrixBase; return std::string(sn[j / kDests]) + " → " + dn[j % kDests]; }+ if (i >= ExtraBase) {+ static const char* exNm[] = { "Pitch Bend", "Bend Range", "Out Pan", "LFO2 Sync",+ "Drive On", "Drive Mode", "Drive Tone",+ "Chorus On", "Chorus Voices",+ "Reverb On", "Reverb Mode", "Reverb Size" };+ return std::string(exNm[i - ExtraBase]);+ }int j = i - MacroBase, m = j / 3, f = j % 3;return "Macro " + std::to_string(m + 1) + (f == 0 ? "" : f == 1 ? " Dest" : " Amount");}float pluginParamGet(int32_t i) const override { return (i >= 0 && i < kNumParams) ? pn_[i].load(std::memory_order_relaxed) : 0.0f; }void pluginParamSet(int32_t i, float v) override { if (i >= 0 && i < kNumParams) pn_[i].store(std::clamp(v, 0.0f, 1.0f), std::memory_order_relaxed); }+ // The id → index table is the same for every instance, so build it once: a preset+ // apply looks up every one of its parameters, and the linear scan used to rebuild+ // each id's string on the way past it.int32_t pluginParamIndexOfId(const std::string& id) const override {- for (int32_t i = 0; i < kNumParams; ++i) if (pluginParamId(i) == id) return i;- return -1;+ static const std::unordered_map<std::string, int32_t> map = [this] {+ std::unordered_map<std::string, int32_t> m;+ m.reserve(kNumParams * 2);+ for (int32_t i = 0; i < kNumParams; ++i) m.emplace(pluginParamId(i), i);+ return m;+ }();+ auto it = map.find(id);+ return it == map.end() ? -1 : it->second;}std::vector<uint8_t> getState() const override {@@ -186,18 +236,46 @@ public:void allNotesOff() override { for (auto& v : voices_) v.active = false; }void render(float* out, int32_t frames) override {+ // ---- macros first: seven of the twelve destinations ride the per-voice bus+ // below, the other five move this block's snapshot ----+ double macroDst[kDests] = {0, 0, 0, 0, 0, 0, 0};+ double macroBlk[5] = {0, 0, 0, 0, 0}; // warp · osc2 level · sub level · unison · drive+ for (int m = 0; m < kMacros; ++m) {+ const double x = get((Param)macroIdx(m, 0)) * (get((Param)macroIdx(m, 2)) - 0.5) * 2.0;+ if (std::fabs(x) <= 1e-4) continue;+ switch (macroDestOf(get((Param)macroIdx(m, 1)))) {+ case 0: macroDst[0] += x; break; // Pitch+ case 2: macroDst[1] += x; break; // Osc 2 Pitch+ case 4: macroDst[2] += x; break; // Position+ case 6: macroDst[3] += x; break; // Cutoff+ case 7: macroDst[4] += x; break; // Reso+ case 9: macroDst[5] += x; break; // Level+ case 11: macroDst[6] += x; break; // Pan+ case 1: macroBlk[0] += x; break; // Warp+ case 3: macroBlk[1] += x; break; // Osc 2 Level+ case 5: macroBlk[2] += x; break; // Sub Level+ case 8: macroBlk[3] += x; break; // Unison detune+ default: macroBlk[4] += x; break; // Drive+ }+ }+// ---- block snapshot ----const int b1 = bankOf(Table), b2 = bankOf(Osc2Table);const int wm1 = warpModeOf(Osc1WarpMode), wm2 = warpModeOf(Osc2WarpMode);const float basePos1 = get(Position), basePos2 = get(Osc2Position);- const double warp1 = get(Warp), warp2 = get(Osc2Warp);+ const double warp1 = std::clamp(get(Warp) + macroBlk[0], 0.0, 1.0);+ const double warp2 = std::clamp(get(Osc2Warp) + macroBlk[0], 0.0, 1.0);const float lvl1 = get(Osc1On) > 0.5f ? get(Osc1Level) : 0.0f;- const float lvl2 = get(Osc2On) > 0.5f ? get(Osc2Level) : 0.0f;- const float subLvl = get(SubLevel); const int subWave = (int)std::lround(get(SubWave) * 2.0f);+ const float lvl2 = get(Osc2On) > 0.5f ? (float)std::clamp(get(Osc2Level) + macroBlk[1], 0.0, 2.0) : 0.0f;+ const float subLvl = (float)std::clamp(get(SubLevel) + macroBlk[2], 0.0, 2.0);+ const int subWave = (int)std::lround(get(SubWave) * 2.0f);const double m1 = pitchMul(Osc1Oct, Osc1Semi, Osc1Detune), m2 = pitchMul(Osc2Oct, Osc2Semi, Osc2Detune);const double subMul = std::exp2(std::lround((get(SubOct) - 0.5f) * 4.0f) - 1.0); // default one octave down- const float uni = get(Unison), uniDet = get(UniDetune), uniSpread = get(UniSpread);- const int uniN = std::clamp(1 + (int)std::lround(uni * 6.0f), 1, kUnison);+ // Unison: the count, the detune in cents and the stereo spread are three separate+ // dials — the detune no longer rides the count, so the readout says what you hear.+ const int uniN = std::clamp(1 + (int)std::lround(get(Unison) * 6.0f), 1, kUnison);+ const double uniDet = std::clamp(get(UniDetune) + macroBlk[3], 0.0, 1.0) * 50.0; // ± cents+ const float uniSpread = get(UniSpread);const float atk = rateOf(Attack, 0.001, 2.0), dec = rateOf(Decay, 0.002, 3.0), rel = rateOf(Release, 0.002, 4.0), sus = get(Sustain);const float atk2 = rateOf(Env2Attack, 0.001, 2.0), dec2 = rateOf(Env2Decay, 0.002, 3.0), rel2 = rateOf(Env2Release, 0.002, 4.0), sus2 = get(Env2Sustain);@@ -212,15 +290,35 @@ public:const bool series = get(FilSeries) > 0.5f;const int ls1 = shapeOf(Lfo1Shape), ls2 = shapeOf(Lfo2Shape);- const double lfo1Inc = lfoInc(Lfo1Rate, Lfo1Sync), lfo2Inc = expMap(get(Lfo2Rate), 0.05, 20.0) / sampleRate_;+ const double lfo1Inc = lfoInc(Lfo1Rate, Lfo1Sync), lfo2Inc = lfoInc(Lfo2Rate, Lfo2Sync);const float lfo1Depth = get(Lfo1Depth), lfo2Depth = get(Lfo2Depth);const float gain = get(Gain), modWheel = get(ModWheel);- // Matrix active list + macro offsets.+ // Pitch-bend wheel, in the range the patch declares (1..12 semitones).+ const double bendMul = std::exp2((get(Bend) - 0.5) * 2.0 * std::round(1.0 + get(BendRange) * 11.0) / 12.0);+ // Output pan, equal power.+ const float outPan = (get(OutPan) - 0.5f) * 2.0f;+ const float opL = std::cos((outPan + 1.0f) * 0.25f * (float)kPi);+ const float opR = std::sin((outPan + 1.0f) * 0.25f * (float)kPi);++ // FX chain snapshot: each block has a switch, a character and its amounts.+ const bool driveOn = get(FxDriveOn) > 0.5f, chorusOn = get(FxChorusOn) > 0.5f, reverbOn = get(FxReverbOn) > 0.5f;+ const float drive = (float)std::clamp(get(FxDrive) + macroBlk[4], 0.0, 1.0);+ const int driveMode = std::clamp((int)std::lround(get(FxDriveMode) * 2.0f), 0, 2);+ // Tone is a tilt: below the middle a one-pole darkens, above it lifts the top.+ const float toneCoef = (float)std::clamp((get(FxTone) - 0.5) * 2.0, -1.0, 1.0);+ const float chAmt = get(FxChorus);+ const int chVoices = 1 << std::clamp((int)std::lround(get(FxChorusVoices) * 2.0f), 0, 2); // 1 / 2 / 4+ const float rvAmt = get(FxReverb);+ const int revMode = std::clamp((int)std::lround(get(FxReverbMode) * 2.0f), 0, 2);+ // Room is short and dry-ish, Hall long and dark, Plate long and bright.+ static const float fbBase[3] = {0.76f, 0.86f, 0.83f}, dampBase[3] = {0.45f, 0.72f, 0.18f};+ const float revFb = std::clamp(fbBase[revMode] + (get(FxReverbSize) - 0.5f) * 0.16f, 0.5f, 0.96f);+ const float revDamp = dampBase[revMode];++ // Matrix active list.int amS[kSources * kDests], amD[kSources * kDests], amN = 0; double amA[kSources * kDests];- double macroDst[kDests] = {0,0,0,0,0,0,0};for (int s = 0; s < kSources; ++s) for (int d = 0; d < kDests; ++d) { double a = (get((Param)matrixIdx(s, d)) - 0.5) * 2.0; if (std::fabs(a) > 1e-4) { amS[amN] = s; amD[amN] = d; amA[amN] = a; ++amN; } }- for (int m = 0; m < kMacros; ++m) { double val = get((Param)macroIdx(m, 0)), amt = (get((Param)macroIdx(m, 2)) - 0.5) * 2.0; if (std::fabs(val * amt) > 1e-4) macroDst[destOf(get((Param)macroIdx(m, 1)))] += val * amt; }const double invSr = 1.0 / sampleRate_;@@ -246,12 +344,14 @@ public:const double pMul = std::exp2(dst[0] * 2.0);const float pos1 = std::clamp(basePos1 + (float)dst[2], 0.0f, 1.0f);const float pos2 = std::clamp(basePos2 + (float)dst[2], 0.0f, 1.0f);- const double base = v.freq * invSr * pMul;+ const double base = v.freq * invSr * pMul * bendMul;// --- oscillators (unison stack on Osc1/Osc2, mono sub) ---- float o1 = 0.0f, o2 = 0.0f;- if (lvl1 > 1e-5f) o1 = oscStack(v.ph1, base * m1, b1, pos1, wm1, warp1, uniN, uni * uniDet);- if (lvl2 > 1e-5f) o2 = oscStack(v.ph2, base * m2 * std::exp2(dst[1] * 2.0), b2, pos2, wm2, warp2, uniN, uni * uniDet);+ // A spread unison stack is stereo: the mid goes through the filters, the+ // side rides around them, so spread widens without doubling filter state.+ float o1 = 0.0f, o2 = 0.0f, side = 0.0f;+ if (lvl1 > 1e-5f) { float sd; o1 = oscStack(v.ph1, base * m1, b1, pos1, wm1, warp1, uniN, uniDet, uniSpread, sd); side += sd * lvl1; }+ if (lvl2 > 1e-5f) { float sd; o2 = oscStack(v.ph2, base * m2 * std::exp2(dst[1] * 2.0), b2, pos2, wm2, warp2, uniN, uniDet, uniSpread, sd); side += sd * lvl2; }float sub = 0.0f;if (subLvl > 1e-5f) { sub = subOsc(subWave, v.subPh); v.subPh += base * m1 * subMul; if (v.subPh >= 1.0) v.subPh -= 1.0; }o1 *= lvl1; o2 *= lvl2; sub *= subLvl;@@ -275,24 +375,22 @@ public:double s = wet + dryS;float amp = v.env * v.velocity * (1.0f + (float)dst[5]);- float sig = (float)s * amp;+ float sigL = (float)(s + side) * amp, sigR = (float)(s - side) * amp;const float pan = (float)std::clamp(dst[6], -1.0, 1.0);- mixL += sig * (pan <= 0 ? 1.0f : 1.0f - pan);- mixR += sig * (pan >= 0 ? 1.0f : 1.0f + pan);+ mixL += sigL * (pan <= 0 ? 1.0f : 1.0f - pan);+ mixR += sigR * (pan >= 0 ? 1.0f : 1.0f + pan);}activeVoices_.store(live, std::memory_order_relaxed);- // --- global FX: drive → chorus → reverb ---+ // --- global FX: drive → chorus → reverb, each on its own switch ---float l = mixL * 0.4f, r = mixR * 0.4f;- const float drive = get(FxDrive);- if (drive > 1e-4f) { float d = 1.0f + drive * 8.0f; l = std::tanh(l * d) / std::tanh(d * 0.7f + 1.0f); r = std::tanh(r * d) / std::tanh(d * 0.7f + 1.0f); }- const float chAmt = get(FxChorus);- if (chAmt > 1e-4f) { float cl, cr; chorus(l, r, chAmt, cl, cr); l = cl; r = cr; }- const float rvAmt = get(FxReverb);- if (rvAmt > 1e-4f) { float rl, rr; reverb(l, r, rl, rr); l += rl * rvAmt; r += rr * rvAmt; }-- out[i * 2] += l * gain;- out[i * 2 + 1] += r * gain;+ if (driveOn && drive > 1e-4f) { l = driveSample(driveMode, l, drive); r = driveSample(driveMode, r, drive); }+ if (driveOn && toneCoef != 0.0f) { l = tone(toneL_, l, toneCoef); r = tone(toneR_, r, toneCoef); }+ if (chorusOn && chAmt > 1e-4f) { float cl, cr; chorus(l, r, chAmt, chVoices, cl, cr); l = cl; r = cr; }+ if (reverbOn && rvAmt > 1e-4f) { float rl, rr; reverb(l, r, revFb, revDamp, rl, rr); l += rl * rvAmt; r += rr * rvAmt; }++ out[i * 2] += (l * opL) * gain;+ out[i * 2 + 1] += (r * opR) * gain;}}@@ -321,7 +419,7 @@ private:int filtType(int p) const { return std::clamp((int)std::lround(get(p) * 4.0f), 0, 4); }int shapeOf(int p) const { return std::clamp((int)std::lround(get(p) * 3.0f), 0, 3); }int routeOf(int p) const { return std::clamp((int)std::lround(get(p) * 3.0f), 0, 3); }- static int destOf(float v) { return std::clamp((int)std::lround(v * (kDests - 1)), 0, kDests - 1); }+ static int macroDestOf(float v) { return std::clamp((int)std::lround(v * (kMacroDests - 1)), 0, kMacroDests - 1); }static double resoToK(double r) { return std::clamp(2.0 - 1.94 * std::clamp(r, 0.0, 1.0), 0.06, 2.0); }double pitchMul(int oct, int semi, int det) const { int o = (int)std::lround((get(oct) - 0.5) * 6); int s = (int)std::lround((get(semi) - 0.5) * 24); double c = (get(det) - 0.5) * 100; return std::exp2(o + s / 12.0 + c / 1200.0); }@@ -352,29 +450,37 @@ private:}static float foldOut(float s, double amt) { float g = 1.0f + (float)amt * 3.0f; return std::sin((float)kHalfPi * g * s); } // smooth wavefolder- // One oscillator: a unison stack of wavetable reads with detune + equal-power spread.- float oscStack(double* ph, double inc, int bank, float pos, int mode, double warpAmt, int uniN, float detCents) {+ // One oscillator: a unison stack of wavetable reads, detuned in cents and spread+ // across the stereo field with equal power. Returns the mid (which the filters see)+ // and, through `sideOut`, the half-difference the spread opens up.+ float oscStack(double* ph, double inc, int bank, float pos, int mode, double warpAmt,+ int uniN, double detCents, float spread, float& sideOut) {const float posF = pos * (kFrames - 1); const int f0 = std::clamp((int)posF, 0, kFrames - 1), f1 = std::min(f0 + 1, kFrames - 1); const float ff = posF - f0;const float* t0 = frame(bank, f0); const float* t1 = frame(bank, f1);- float acc = 0.0f; const float norm = 1.0f / std::sqrt((float)uniN);- const float spread = get(UniSpread);+ float accL = 0.0f, accR = 0.0f;+ // √2 undoes the equal-power law's 0.707 at centre, so a spread of 0 is bit-for-bit+ // the mono stack this used to be.+ const float norm = 1.41421356f / std::sqrt((float)uniN);for (int u = 0; u < uniN; ++u) {const double d = (uniN > 1) ? ((double)u / (uniN - 1) - 0.5) * 2.0 : 0.0;- const double det = std::pow(2.0, d * detCents * 30.0 / 1200.0);+ const double det = std::exp2(d * detCents / 1200.0);double rp = warpRead(mode, ph[u], warpAmt);float s = readMorph(t0, t1, ff, rp);if (mode == 4) s = foldOut(s, warpAmt);- acc += s; // (kept mono; spread handled at voice pan for simplicity)+ const float pan = (float)d * spread;+ accL += s * std::cos((pan + 1.0f) * 0.25f * (float)kPi);+ accR += s * std::sin((pan + 1.0f) * 0.25f * (float)kPi);ph[u] += inc * det; if (ph[u] >= 1.0) ph[u] -= 1.0;}- (void)spread;- return acc * norm;+ accL *= norm; accR *= norm;+ sideOut = (accL - accR) * 0.5f;+ return (accL + accR) * 0.5f;}static float subOsc(int wave, double ph) {switch (wave) { case 1: return ph < 0.5 ? 1.0f : -1.0f; case 2: return (float)(4.0 * std::fabs(ph - 0.5) - 1.0); default: return (float)std::sin(kTwoPi * ph); }}- const float* frame(int bank, int f) const { return &tables_[((bank * kFrames) + f) * kTableSize]; }+ const float* frame(int bank, int f) const { return tables_ + (size_t)((bank * kFrames) + f) * kTableSize; }static float readMorph(const float* t0, const float* t1, float ff, double phase) {const double x = phase * kTableSize; int i0 = (int)x & (kTableSize - 1); int i1 = (i0 + 1) & (kTableSize - 1);const float xf = (float)(x - std::floor(x)); const float a = t0[i0] + (t0[i1] - t0[i0]) * xf; const float b = t1[i0] + (t1[i1] - t1[i0]) * xf; return a + (b - a) * ff;@@ -387,32 +493,70 @@ private:default: return (1.0f / n) * std::fabs(std::cos((float)kPi * n * (0.25f + 0.75f * t)));}}- void buildTables() {- tables_.assign((size_t)kBanks * kFrames * kTableSize, 0.0f);- const int nMax = std::min(kTableSize / 2, 64);- for (int b = 0; b < kBanks; ++b) for (int f = 0; f < kFrames; ++f) {- const float t = (float)f / (kFrames - 1); float* tab = &tables_[((b * kFrames) + f) * kTableSize]; float peak = 1e-6f;- for (int j = 0; j < kTableSize; ++j) { const double ph = (double)j / kTableSize; double acc = 0; for (int n = 1; n <= nMax; ++n) { const float a = harmAmp(b, t, n); if (a > 1e-5f) acc += a * std::sin(2.0 * kPi * n * ph); } tab[j] = (float)acc; peak = std::max(peak, std::fabs(tab[j])); }- const float inv = 1.0f / peak; for (int j = 0; j < kTableSize; ++j) tab[j] *= inv;- }+ // The four banks × sixteen frames are the same read-only 512 KB for every instance and+ // every clone, so they are built once, on first use, and handed out as a pointer.+ static const float* sharedTables() {+ static const std::vector<float> t = [] {+ std::vector<float> tab((size_t)kBanks * kFrames * kTableSize, 0.0f);+ const int nMax = std::min(kTableSize / 2, 64);+ for (int b = 0; b < kBanks; ++b) for (int f = 0; f < kFrames; ++f) {+ const float tt = (float)f / (kFrames - 1); float* p = &tab[((b * kFrames) + f) * kTableSize]; float peak = 1e-6f;+ // The recipe is fixed per (bank, frame): evaluate it once, not per sample.+ float amp[65];+ for (int n = 1; n <= nMax; ++n) amp[n] = harmAmp(b, tt, n);+ for (int j = 0; j < kTableSize; ++j) {+ const double ph = (double)j / kTableSize; double acc = 0;+ for (int n = 1; n <= nMax; ++n) if (amp[n] > 1e-5f) acc += amp[n] * std::sin(2.0 * kPi * n * ph);+ p[j] = (float)acc; peak = std::max(peak, std::fabs(p[j]));+ }+ const float inv = 1.0f / peak; for (int j = 0; j < kTableSize; ++j) p[j] *= inv;+ }+ return tab;+ }();+ return t.data();}static double lfoValue(int shape, double ph, float sh) { switch (shape) { case 1: return ph < 0.5 ? 4 * ph - 1 : 3 - 4 * ph; case 2: return ph < 0.5 ? 1 : -1; case 3: return sh; default: return std::sin(kTwoPi * ph); } }double lfoInc(int rate, int sync) const { int d = std::clamp((int)std::lround(get(sync) * 7.0f), 0, 7); if (d > 0 && spb_ > 0.0) { static const double beats[8] = {0, 4, 2, 1, 0.5, 0.25, 0.125, 0.0625}; return 1.0 / (beats[d] * spb_); } return expMap(get(rate), 0.05, 20.0) / sampleRate_; }- // FX: a simple stereo chorus (two modulated taps) and a compact Freeverb.- void chorus(float l, float r, float amt, float& outL, float& outR) {+ // FX · drive. Tube is the soft symmetric tanh this always had; Tape adds the second+ // harmonic a tape stage leans on; Fold turns the curve back on itself past the top.+ static float driveSample(int mode, float x, float amt) {+ const float d = 1.0f + amt * 8.0f;+ switch (mode) {+ // Tape: a rational curve that bends earlier and saturates more slowly than tanh,+ // with a second-harmonic term for the asymmetry a tape stage has.+ case 1: { float u = x * d + 0.35f * x * x * d; float y = u / (1.0f + std::fabs(u)); return y / (1.0f - 1.0f / (d * 0.7f + 2.0f)); }+ case 2: { float y = std::sin((float)kHalfPi * std::clamp(x * d, -3.0f, 3.0f)); return y * 0.8f; } // Fold+ default: return std::tanh(x * d) / std::tanh(d * 0.7f + 1.0f); // Tube+ }+ }+ // A tilt around the middle: negative darkens (one-pole low-pass), positive lifts the+ // top (the signal plus what the low-pass throws away).+ static float tone(float& z, float x, float coef) {+ const float a = 0.12f + 0.55f * (1.0f - std::fabs(coef));+ z += (x - z) * a;+ return coef < 0 ? z + (x - z) * (1.0f + coef) : x + (x - z) * coef * 1.4f;+ }++ // FX · a stereo chorus of 1, 2 or 4 modulated taps, and a compact Freeverb whose+ // feedback and damping the mode + size choose.+ void chorus(float l, float r, float amt, int voices, float& outL, float& outR) {const int sz = (int)chorusBuf_.size(); if (sz < 4) { outL = l; outR = r; return; }chorusBuf_[chorusW_] = (l + r) * 0.5f;const double rate = expMap(get(FxChorusRate), 0.1, 6.0); chorusPh_ += rate / sampleRate_; if (chorusPh_ >= 1.0) chorusPh_ -= 1.0;- auto tap = [&](double phase) { double d = (0.008 + 0.006 * std::sin(kTwoPi * phase)) * sampleRate_; double rp = chorusW_ - d; while (rp < 0) rp += sz; int i0 = (int)rp; int i1 = (i0 + 1) % sz; float f = (float)(rp - i0); return chorusBuf_[i0] + (chorusBuf_[i1] - chorusBuf_[i0]) * f; };- float a = tap(chorusPh_), b = tap(chorusPh_ + 0.5);+ auto tap = [&](double phase) { double d = (0.008 + 0.006 * std::sin(kTwoPi * (phase - std::floor(phase)))) * sampleRate_; double rp = chorusW_ - d; while (rp < 0) rp += sz; int i0 = (int)rp; int i1 = (i0 + 1) % sz; float f = (float)(rp - i0); return chorusBuf_[i0] + (chorusBuf_[i1] - chorusBuf_[i0]) * f; };+ float a = 0.0f, b = 0.0f;+ // Taps sit evenly around the LFO cycle; odd ones go left, even ones right.+ for (int k = 0; k < voices; ++k) { float t = tap(chorusPh_ + (double)k / voices); if (k % 2 == 0) a += t; else b += t; }+ const float na = 1.0f / std::max(1, (voices + 1) / 2), nb = voices > 1 ? 1.0f / (voices / 2) : 1.0f;+ a *= na; b = voices > 1 ? b * nb : a;if (++chorusW_ >= sz) chorusW_ = 0;outL = l * (1 - amt * 0.5f) + a * amt; outR = r * (1 - amt * 0.5f) + b * amt;}- void reverb(float l, float r, float& outL, float& outR) {+ void reverb(float l, float r, float fb, float damp, float& outL, float& outR) {const float in = (l + r) * 0.015f; float o = 0.0f;- for (auto& c : revC_) { float out = c.buf[c.idx]; c.store = out * 0.8f + c.store * 0.2f; c.buf[c.idx] = in + c.store * 0.84f; if (++c.idx >= (int)c.buf.size()) c.idx = 0; o += out; }+ for (auto& c : revC_) { float out = c.buf[c.idx]; c.store = out * (1.0f - damp) + c.store * damp; c.buf[c.idx] = in + c.store * fb; if (++c.idx >= (int)c.buf.size()) c.idx = 0; o += out; }for (auto& a : revA_) { float bo = a.buf[a.idx]; float out = -o + bo; a.buf[a.idx] = o + bo * 0.5f; if (++a.idx >= (int)a.buf.size()) a.idx = 0; o = out; }outL = o; outR = o;}@@ -430,7 +574,9 @@ private:double lfoPhase1_ = 0, lfoPhase2_ = 0, chorusPh_ = 0;float lfoSh1_ = 0, lfoSh2_ = 0;uint32_t rng_ = 0x51ed270bu;- std::vector<float> tables_, chorusBuf_; int chorusW_ = 0;+ const float* tables_ = nullptr; // shared, read-only (sharedTables)+ std::vector<float> chorusBuf_; int chorusW_ = 0;+ float toneL_ = 0, toneR_ = 0;Comb revC_[kRevCombs]; Allp revA_[kRevAll];std::atomic<int32_t> activeVoices_{0};std::atomic<float> pn_[kNumParams];diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.csindex ff780749..452c9c01 100644--- a/tests/Nota.SmokeTest/Program.cs+++ b/tests/Nota.SmokeTest/Program.cs@@ -1170,7 +1170,7 @@ Console.WriteLine("-- Nota Aurora --");Check(ae.DeviceName(t, -1) == "Nota Aurora", $"instrument is Nota Aurora (got '{ae.DeviceName(t, -1)}')");int pc = ae.PluginParamCount(t, -1);- Check(pc == 132, $"Nota Aurora exposes 132 params (got {pc})");+ Check(pc == 156, $"Nota Aurora exposes 156 params (got {pc})");int pos = -1; bool idsOk = true;for (int i = 0; i < pc; i++){@@ -1185,7 +1185,7 @@ Console.WriteLine("-- Nota Aurora --");// State round-trips to another track (project save/load path).ae.PluginParamSet(t, -1, pos, 0.88f);var state = ae.GetPluginState(t, -1);- Check(state.Length >= 132 * 4, $"aurora state serialized ({state.Length} bytes)");+ Check(state.Length >= 156 * 4, $"aurora state serialized ({state.Length} bytes)");int t2 = ae.AddWavetableSynthTrack();ae.SetPluginState(t2, -1, state);Check(Math.Abs(ae.PluginParamGet(t2, -1, pos) - 0.88f) < 1e-4, "aurora state restores params on another track");@@ -1221,6 +1221,130 @@ Console.WriteLine("-- Nota Aurora --");var b2 = new float[8192 * 2]; ae.Seek(0.0); ae.Play(); ae.RenderOffline(b2, 8192); ae.StopTransport();Check(Rms(b2, 8192) > 0.001f, $"Aurora osc2-only patch is audible (RMS {Rms(b2, 8192):F3})");}++ // v3 (almanac rework): the wheels, the output pan, LFO 2's sync and the three FX+ // blocks' switches and characters all exist and all act.+ Check(AId("bend") >= 0 && AId("bendrange") >= 0 && AId("outpan") >= 0 && AId("lfo2sync") >= 0+ && AId("fxdriveon") >= 0 && AId("fxdrivemode") >= 0 && AId("fxtone") >= 0+ && AId("fxchoruson") >= 0 && AId("fxchorusvoices") >= 0+ && AId("fxreverbon") >= 0 && AId("fxreverbmode") >= 0 && AId("fxreverbsize") >= 0+ && AId("mac7val") >= 0,+ "Aurora v3 params present (wheels / out pan / LFO 2 sync / FX blocks / macro 8)");+ {+ // Each case gets its own engine so a voice left sounding by one render cannot leak+ // into the next, and each renders the same note for the same length.+ float[] RenderWith(params (string Id, float Value)[] ps)+ {+ using var we = new NotaEngine();+ we.SetBpm(120); we.SetTimeSignature(4, 4);+ int tw = we.AddWavetableSynthTrack();+ foreach (var (id, value) in ps)+ for (int i = 0; i < we.PluginParamCount(tw, -1); i++)+ if (we.PluginParamId(tw, -1, i) == id) we.PluginParamSet(tw, -1, i, value);+ we.AddMidiClip(tw, 0.0, 4.0);+ we.SetClipNotes(tw, 0, new[] { new NotaNote(60, 0.0, 2.0, 0.9f) });+ var b = new float[8192 * 2];+ we.Seek(0.0); we.Play(); we.RenderOffline(b, 8192); we.StopTransport();+ return b;+ }+ float Diff(float[] a, float[] b) { float d = 0; for (int i = 0; i < a.Length; i++) d += Math.Abs(a[i] - b[i]); return d / a.Length; }+ int Crossings(float[] b, int n)+ { int c = 0; for (int i = 2; i < n * 2; i += 2) if ((b[i - 2] < 0) != (b[i] < 0)) c++; return c; }+ float Side(float[] b, int n)+ { float d = 0; for (int i = 0; i < n; i++) d += Math.Abs(b[i * 2] - b[i * 2 + 1]); return d / n; }++ // Zero crossings stand in for pitch: bending up an octave roughly doubles them.+ var flat = RenderWith(("fil1freq", 0.9f));+ var bent = RenderWith(("bend", 1f), ("bendrange", 1f));+ int cf = Crossings(flat, 8192), cb = Crossings(bent, 8192);+ bool bfin = true; foreach (var x in bent) if (!float.IsFinite(x) || Math.Abs(x) > 8f) { bfin = false; break; }+ Check(bfin && cb > cf * 1.5, $"Aurora pitch bend +12 st raises the pitch ({cf} -> {cb} crossings)");++ // Output pan is equal-power: hard right silences the left channel.+ var right = RenderWith(("outpan", 1f));+ float lSum = 0, rSum = 0;+ for (int i = 0; i < 8192; i++) { lSum += Math.Abs(right[i * 2]); rSum += Math.Abs(right[i * 2 + 1]); }+ Check(lSum < 1e-4f && rSum > 0.001f, $"Aurora out pan hard right silences the left (L {lSum:F4} / R {rSum:F4})");++ // Unison spread is what makes the stack stereo — and with it at zero the voice is+ // exactly the mono one it always was.+ var narrow = RenderWith(("unison", 0.5f), ("unidetune", 0.4f), ("unispread", 0f));+ var wide = RenderWith(("unison", 0.5f), ("unidetune", 0.4f), ("unispread", 1f));+ Check(Side(narrow, 8192) < 1e-6f, "Aurora unison at zero spread stays mono");+ Check(Side(wide, 8192) > 1e-3f, $"Aurora unison spread opens the stereo field ({Side(wide, 8192):F4})");++ // Each FX block answers its switch, and each character is its own sound.+ var dryFx = RenderWith(("fxdrive", 0.7f), ("fxdriveon", 0f));+ var clean = RenderWith();+ Check(Diff(dryFx, clean) < 1e-6f, "Aurora drive switched off is the dry signal");+ var tube = RenderWith(("fxdrive", 0.7f), ("fxdrivemode", 0f));+ var tape = RenderWith(("fxdrive", 0.7f), ("fxdrivemode", 0.5f));+ var fold = RenderWith(("fxdrive", 0.7f), ("fxdrivemode", 1f));+ Check(Diff(tube, clean) > 1e-3f && Diff(tube, tape) > 1e-3f && Diff(tube, fold) > 1e-3f,+ "Aurora drive Tube / Tape / Fold are three different curves");+ var revOff = RenderWith(("fxreverb", 0.7f), ("fxreverbon", 0f));+ var revRoom = RenderWith(("fxreverb", 0.7f), ("fxreverbmode", 0f));+ var revHall = RenderWith(("fxreverb", 0.7f), ("fxreverbmode", 0.5f));+ Check(Diff(revOff, clean) < 1e-6f, "Aurora reverb switched off is the dry signal");+ Check(Diff(revRoom, clean) > 1e-4f && Diff(revRoom, revHall) > 1e-5f, "Aurora reverb Room and Hall differ, and both are wet");+ var chOff = RenderWith(("fxchorus", 0.8f), ("fxchoruson", 0f));+ var ch2 = RenderWith(("fxchorus", 0.8f), ("fxchorusvoices", 0.5f));+ var ch4 = RenderWith(("fxchorus", 0.8f), ("fxchorusvoices", 1f));+ Check(Diff(chOff, clean) < 1e-6f, "Aurora chorus switched off is the dry signal");+ Check(Diff(ch2, ch4) > 1e-4f, "Aurora chorus 2x and 4x differ");++ // LFO 2 can lock to the grid now, like LFO 1.+ var lfoFree = RenderWith(("lfo2depth", 1f), ("mtx3_3", 1f), ("lfo2sync", 0f), ("lfo2rate", 0.9f));+ var lfoSync = RenderWith(("lfo2depth", 1f), ("mtx3_3", 1f), ("lfo2sync", 4f / 7f));+ Check(Diff(lfoFree, lfoSync) > 1e-4f, "Aurora LFO 2 tempo sync changes its rate");+ }++ // v3: macros reach twelve destinations, five of which act on the block snapshot. The+ // seven older ones keep the normalized value an old project saved for them.+ {+ float MacroRms(params (string Id, float Value)[] ps)+ {+ using var me2 = new NotaEngine();+ me2.SetBpm(120); me2.SetTimeSignature(4, 4);+ int tmm = me2.AddWavetableSynthTrack();+ void Put(string id, float v)+ {+ for (int i = 0; i < me2.PluginParamCount(tmm, -1); i++)+ if (me2.PluginParamId(tmm, -1, i) == id) { me2.PluginParamSet(tmm, -1, i, v); return; }+ }+ foreach (var (id, value) in ps) Put(id, value);+ me2.AddMidiClip(tmm, 0.0, 4.0);+ me2.SetClipNotes(tmm, 0, new[] { new NotaNote(60, 0.0, 2.0, 0.9f) });+ var b = new float[8192 * 2];+ me2.Seek(0.0); me2.Play(); me2.RenderOffline(b, 8192); me2.StopTransport();+ return Rms(b, 8192);+ }+ // Macro 1 → Sub level (target 5 of 12), full amount: the sub comes up.+ float plain = MacroRms();+ float lifted = MacroRms(("mac0val", 1f), ("mac0dest", 5f / 11f), ("mac0amt", 1f));+ Check(lifted > plain * 1.1f, $"an Aurora macro on Sub level is audible ({plain:F3} -> {lifted:F3})");+ // The legacy seven: 5/6 used to mean "Level" and still does.+ float neutral = MacroRms(("mac0val", 1f), ("mac0dest", 5f / 6f), ("mac0amt", 0.5f));+ float louder = MacroRms(("mac0val", 1f), ("mac0dest", 5f / 6f), ("mac0amt", 1f));+ Check(louder > neutral * 1.1f, $"an old Aurora macro pointing at Level still lands there ({neutral:F3} -> {louder:F3})");+ // Macro 8 exists and works too.+ float m8 = MacroRms(("mac7val", 1f), ("mac7dest", 5f / 11f), ("mac7amt", 1f));+ Check(m8 > plain * 1.1f, $"Aurora macro 8 reaches its target ({plain:F3} -> {m8:F3})");+ }++ // Factory presets: 25 ship, every named param is a real Aurora id, each applies in place.+ {+ var auroraIds = new System.Collections.Generic.HashSet<string>();+ for (int i = 0; i < pc; i++) auroraIds.Add(ae.PluginParamId(t, -1, i));+ var cat = new FactoryPresetCatalog();+ var mine = cat.All().Where(p => p.IsInstrument && p.BuiltinKind == 5).ToList();+ Check(mine.Count == 25, $"Nota Aurora ships 25 factory presets (got {mine.Count})");+ var bad = mine.SelectMany(p => cat.Document(p.Id)!.NamedParams!.Keys.Where(k => !auroraIds.Contains(k)).Select(k => $"{p.DisplayName}:{k}")).ToList();+ Check(bad.Count == 0, $"every Aurora preset param id exists{(bad.Count > 0 ? " — bad: " + string.Join(", ", bad) : "")}");+ int tp = ae.AddWavetableSynthTrack();+ int fails = mine.Count(p => cat.ApplyInPlace(ae, p.Id, tp, -1).Length != 0);+ Check(fails == 0, $"every Aurora preset applies in place ({fails} failed)");+ }}// ============================ Nota Volt ====================================