Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

Redesign of Vintage

Egor Khindikaynenc9b2571a4176
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 84ef9f98..619f9faf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -51,6 +51,32 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
level, the effective attack and release, look-ahead latency and how often it kicked in.
### Changed
+- **Nota Vintage shows what the era does to the signal, not just its knobs.** The card moves
+ onto the Auto Filter / Lens / Compressor frame — a STATE column (drive and wear faders), a
+ centre panel with **Curve**, **Wear** and **Output** tabs, a **Tone / Output** panel and a
+ status strip. The six characters are now a list in each tab's head row instead of a grid
+ of buttons:
+ - **Curve** — the transfer curve the saturation runs (read from the engine, so it is the
+ real one), what you hear after Mix, Output and auto-comp, a dot where the input peak sits,
+ the THD and the curve's asymmetry. Drag the window for the drive.
+ - **Wear** — the pitch drift over the last four seconds in cents, wow in brass and flutter
+ in teal. Drag up and down for the depth, sideways for the rate.
+ - **Output** — the harmonics the curve adds at the input's level (f … 7f) against the hiss
+ floor, with the input / output peaks.
+ - **New in the engine:** a **tone model** (Warm — the era's own tilt and head bump, as
+ before; Flat; Dark) with **low and high shelves**, **Character** (the era's voicing on or
+ off), **wow and flutter rates** (the wow free or synced from 4 bars to 1/8), a **hiss
+ high-pass**, **wear that follows the input** (hiss and crackle only under the signal),
+ **stereo drift**, a **Tube / Analog output stage**, **even-harmonics-only** saturation and
+ **auto gain compensation**. Flutter wanders a little as Wear rises.
+ - **30 factory presets**, up from six, level-matched to the dry signal — records, tape
+ decks, VHS, tube and console colour, telephone and AM radio. The thirteen new parameters
+ are appended and default to the old sound, so older projects open unchanged; every one of
+ them automates (the tone and wow ones grouped in the lane menu), MIDI-learns, saves in a
+ preset and is reachable over MCP. `get_device_text` returns the status line, the live
+ reading and a guide to the parameter values, `device_action` 0 resets the wear, and the
+ new `read_vintage` returns the THD with the harmonics, the asymmetry, the wow and flutter
+ in cents, the pitch drift's range, the band-limit, the hiss level and the auto-comp gain.
- **Nota Auto Filter shows the cutoff moving, not just where it is set.** The card moves onto
the Lens / Compressor / Delay frame — a SHAPE column (cutoff and resonance faders, with a
mark where the modulation has them now), a centre panel with **Filter**, **Envelope** and
diff --git a/FEATURES.md b/FEATURES.md
index e6a71dcb..23a73d02 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -358,8 +358,14 @@ and user presets, automation, persistence and cloning.
- **Nota Auto Shift** (7) — real-time vocal pitch correction: pitch detection, Key +
Scale, Follow scale device, correction amount and speed, Range (guards against octave
jumps), Formant, Mix; a PITCH TRACE visualiser.
-- **Nota Vintage** (8) — degradation and saturation: 6 era modes
- (Vinyl/Cassette/Reel/VHS/Tube/Analog), wow/flutter, noise, crackle, wear.
+- **Nota Vintage** (8) — degradation and saturation: 6 era characters
+ (Vinyl/Cassette/Reel/VHS/Tube/Analog, with the voicing switchable off), drive, tone with a
+ Warm / Flat / Dark model and low / high shelves, wow (free or tempo-synced) and flutter with
+ their rates, noise with a hiss high-pass, crackle, wear, wear that follows the input, stereo
+ drift, a Tube / Analog output stage, even-harmonics-only saturation, auto gain compensation,
+ mix, output, oversampling. Tabs: Curve (the transfer curve, the input on it) / Wear (pitch
+ drift over 4 s in cents) / Output (harmonics against the hiss floor) and Tone / Output, with
+ a STATE column and a status strip. 30 factory presets. MCP: `read_vintage`.
- **Nota Beat Repeat** (9) — beat repeat with Mix/Insert/Gate modes, Chance, Gate, Repeat,
Latch, INTERVAL/GRID, Pitch/Decay/Volume, FILTER, Mix; a TIMELINE visualiser.
- **Nota Orbit** (10, formerly Auto Pan) — auto-pan and tremolo, L/R phase (0° = tremolo …
diff --git a/src/managed/Nota.App/ArrangementView.Automation.cs b/src/managed/Nota.App/ArrangementView.Automation.cs
index 6d18be6a..5583a88b 100644
--- a/src/managed/Nota.App/ArrangementView.Automation.cs
+++ b/src/managed/Nota.App/ArrangementView.Automation.cs
@@ -389,9 +389,10 @@ public sealed partial class ArrangementView
// Nota Chamber (45 params) groups by its section prefix ("IR", "Algo", "EQ" …),
// Nota Prism (52) by band ("Low", "Mid", "High", "Crossover") and Nota Lens (37) by
// view ("Spectrum", "Scope", "Waterfall", "Cursor"), the Compressor its key
- // ("SC HP", "SC Gain" …) and the Auto Filter its sources ("Env", "LFO", "Mod"):
+ // ("SC HP", "SC Gain" …), the Auto Filter its sources ("Env", "LFO", "Mod") and Nota
+ // Vintage its tone and wow ("Tone Low", "Wow Rate" …):
// a word shared by two or more params becomes a submenu.
- bool grouped = e.TrackDeviceBuiltinKind(t.Id, d) is 1 or 7 or 20 or 21 or 22;
+ bool grouped = e.TrackDeviceBuiltinKind(t.Id, d) is 1 or 7 or 8 or 20 or 21 or 22;
var names = new string[builtinPc];
for (int p = 0; p < builtinPc; p++) names[p] = e.DeviceParamName(t.Id, d, p);
static string Head(string n) { int sp = n.IndexOf(' '); return sp > 0 ? n[..sp] : ""; }
diff --git a/src/managed/Nota.App/Controls/VintageViews.cs b/src/managed/Nota.App/Controls/VintageViews.cs
new file mode 100644
index 00000000..78d88e0b
--- /dev/null
+++ b/src/managed/Nota.App/Controls/VintageViews.cs
@@ -0,0 +1,283 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Nota Vintage card windows (the centre panel's three tabs):
+// • VtCurveView — Curve: the static transfer curve the engine runs (input level → output,
+// brass), what reaches the output with Mix and Output (teal), the dry
+// line dashed, a dot where the input peak sits on the curve and the dust
+// of Crackle; drag up / down for the drive;
+// • VtWearView — Wear: the pitch drift over the last ~4 s in cents — wow in brass,
+// flutter in teal — from the engine's history; drag up / down for the
+// depth of the selected source, sideways for its rate;
+// • VtHarmView — Output: the harmonics the curve adds at the input level (f … 7f,
+// relative to the fundamental) against the hiss floor; drag for the drive.
+
+using System;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Media;
+
+namespace Nota.App;
+
+// A drag on the whole window: vertical and (optionally) horizontal, both from start values.
+internal abstract class VtWindowBase : Control
+{
+ private bool _drag;
+ private Point _start;
+ private double _v0, _h0;
+
+ public event Action? GestureBegin;
+ public event Action? GestureEnd;
+ public event Action<double>? DragV;
+ public event Action<double>? DragH;
+ public Func<double>? StartV { get; set; }
+ public Func<double>? StartH { get; set; }
+ public bool Dragging => _drag;
+
+ protected VtWindowBase() { ClipToBounds = true; Cursor = new Cursor(StandardCursorType.SizeAll); MinHeight = 36; }
+
+ protected override void OnPointerPressed(PointerPressedEventArgs e)
+ {
+ if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
+ _drag = true; _start = e.GetPosition(this);
+ _v0 = StartV?.Invoke() ?? 0; _h0 = StartH?.Invoke() ?? 0;
+ GestureBegin?.Invoke(); e.Pointer.Capture(this); e.Handled = true;
+ }
+ protected override void OnPointerMoved(PointerEventArgs e)
+ {
+ if (!_drag) return;
+ var p = e.GetPosition(this);
+ double dy = (_start.Y - p.Y) / Math.Max(40, Bounds.Height), dx = (p.X - _start.X) / Math.Max(40, Bounds.Width);
+ DragV?.Invoke(Math.Clamp(_v0 + dy * 0.6, 0, 1));
+ if (StartH is not null) DragH?.Invoke(Math.Clamp(_h0 + dx * 0.6, 0, 1));
+ }
+ protected override void OnPointerReleased(PointerReleasedEventArgs e)
+ {
+ if (!_drag) return;
+ _drag = false; e.Pointer.Capture(null); GestureEnd?.Invoke();
+ }
+
+ protected static void Grid(DrawingContext ctx, double w, double h, int cols)
+ {
+ for (int i = 1; i < 4; i++) ctx.DrawLine(NotaGraph.GridPen, new Point(0, h * i / 4), new Point(w, h * i / 4));
+ for (int i = 1; i < cols; i++) ctx.DrawLine(NotaGraph.GridPen, new Point(w * i / cols, 0), new Point(w * i / cols, h));
+ }
+}
+
+internal sealed class VtCurveView : VtWindowBase
+{
+ private float[] _curve = Array.Empty<float>();
+ private int _n;
+ private double _mix = 1, _out = 1, _in, _crackle;
+ private string _legend = "";
+ private uint _rng = 0x51u;
+
+ /// <summary>The curve points for input 0..1 (engine telemetry), the mix, the output gain (linear),
+ /// the input peak (0..1, 0 = silent) and the crackle amount for the dust.</summary>
+ public void Set(float[] src, int offset, int n, double mix, double outGain, double inPeak, double crackle, string legend)
+ {
+ if (_curve.Length != n) _curve = new float[n];
+ if (n > 0 && offset + n <= src.Length) Array.Copy(src, offset, _curve, 0, n);
+ _n = n; _mix = mix; _out = outGain; _in = inPeak; _crackle = crackle; _legend = legend;
+ InvalidateVisual();
+ }
+
+ private double Rand() { _rng = _rng * 1664525u + 1013904223u; return ((_rng >> 8) & 0xFFFF) / 65536.0; }
+
+ public override void Render(DrawingContext ctx)
+ {
+ double w = Bounds.Width, h = Bounds.Height;
+ if (w <= 0 || h <= 0) return;
+ var frame = new Rect(0, 0, w, h);
+ NotaGraph.Window(ctx, frame);
+ Grid(ctx, w, h, 4);
+ double x0 = 3, x1 = w - 3, top = 14, bot = h - 12;
+ // y spans the larger of the curve's peak and unity, so a hot curve is never clipped.
+ double peak = 1;
+ for (int i = 0; i < _n; i++) peak = Math.Max(peak, Math.Abs(_curve[i]) * Math.Max(1, _out));
+ double X(double t) => x0 + t * (x1 - x0);
+ double Y(double v) => bot - Math.Clamp(v / peak, -0.05, 1.02) * (bot - top);
+
+ ctx.DrawLine(new Pen(NotaPalette.BorderStrong, 1, new DashStyle(new double[] { 3, 5 }, 0)), new Point(X(0), Y(0)), new Point(X(1), Y(1)));
+ if (_n > 1)
+ {
+ StreamGeometry Line(Func<int, double> v)
+ {
+ var g = new StreamGeometry();
+ using var c = g.Open();
+ for (int i = 0; i < _n; i++)
+ {
+ var p = new Point(X((double)i / (_n - 1)), Y(v(i)));
+ if (i == 0) c.BeginFigure(p, false); else c.LineTo(p);
+ }
+ c.EndFigure(false);
+ return g;
+ }
+ double Heard(int i) => (1 - _mix) * ((double)i / (_n - 1)) + _mix * _curve[i] * _out;
+ bool differs = false;
+ for (int i = 0; i < _n && !differs; i++) differs = Math.Abs(Heard(i) - _curve[i]) > 0.01;
+ if (differs) ctx.DrawGeometry(null, new Pen(NotaPalette.Wash(NotaPalette.Teal, 0x90), 1.1), Line(Heard));
+ ctx.DrawGeometry(null, NotaGraph.PrimaryPen, Line(i => _curve[i]));
+
+ // where the input sits on the curve now
+ if (_in > 0.002)
+ {
+ double t = Math.Clamp(_in, 0, 1), f = t * (_n - 1);
+ int a = (int)Math.Floor(f), b = Math.Min(_n - 1, a + 1);
+ double yv = _curve[a] + (_curve[b] - _curve[a]) * (f - a);
+ NotaGraph.Node(ctx, new Point(X(t), Y(yv)), true);
+ }
+ if (differs) NotaGraph.Legend(ctx, w - 5, 14, ("heard", NotaPalette.TealBright, NotaGraph.Mark.Line));
+ }
+
+ // dust: re-sprinkled every frame, as many specks as the crackle asks for
+ int dots = (int)(_crackle * 26);
+ var dust = NotaPalette.Wash(NotaPalette.Accent, 0x70);
+ for (int i = 0; i < dots; i++)
+ {
+ double rr = 0.6 + Rand() * 0.8;
+ ctx.DrawEllipse(dust, null, new Point(x0 + Rand() * (x1 - x0), top + Rand() * (bot - top)), rr, rr);
+ }
+
+ NotaGraph.Title(ctx, frame, "Transfer curve");
+ NotaGraph.Axis(ctx, frame, NotaGraph.Corner.TopRight, _legend, NotaPalette.TextTertiary);
+ NotaGraph.Axis(ctx, frame, NotaGraph.Corner.BottomLeft, "−∞");
+ NotaGraph.Axis(ctx, frame, NotaGraph.Corner.BottomRight, "0 dBFS");
+ var mid = NotaGraph.AxisText("−6 dB");
+ ctx.DrawText(mid, new Point(X(0.5) - mid.Width / 2, h - mid.Height - 3));
+ }
+}
+
+internal sealed class VtWearView : VtWindowBase
+{
+ private float[] _wow = Array.Empty<float>(), _flut = Array.Empty<float>();
+ private int _n, _show = 2;
+ private string _peak = "", _mid = "", _end = "";
+
+ /// <summary>The histories (cents, oldest first), which to show (0 wow, 1 flutter, 2 both), the
+ /// peak text and the axis texts.</summary>
+ public void Set(float[] src, int wowAt, int flutAt, int n, int show, string peak, string mid, string end)
+ {
+ if (_wow.Length != n) { _wow = new float[n]; _flut = new float[n]; }
+ if (n > 0 && flutAt + n <= src.Length) { Array.Copy(src, wowAt, _wow, 0, n); Array.Copy(src, flutAt, _flut, 0, n); }
+ _n = n; _show = show; _peak = peak; _mid = mid; _end = end;
+ InvalidateVisual();
+ }
+
+ public override void Render(DrawingContext ctx)
+ {
+ double w = Bounds.Width, h = Bounds.Height;
+ if (w <= 0 || h <= 0) return;
+ var frame = new Rect(0, 0, w, h);
+ NotaGraph.Window(ctx, frame);
+ Grid(ctx, w, h, 6);
+ double top = 14, bot = h - 12, cy = (top + bot) / 2, half = Math.Max(4, (bot - top) / 2);
+ ctx.DrawLine(new Pen(NotaPalette.BorderStrong, 1, new DashStyle(new double[] { 2, 4 }, 0)), new Point(0, cy), new Point(w, cy));
+ if (_n < 2) { Labels(); return; }
+
+ bool showW = _show != 1, showF = _show != 0;
+ double range = 5; // ± cents, grows to fit what is drawn
+ for (int i = 0; i < _n; i++)
+ {
+ double v = (showW ? _wow[i] : 0) + (showF ? _flut[i] : 0);
+ range = Math.Max(range, Math.Abs(v));
+ }
+ range *= 1.15;
+ double Y(double c) => cy - Math.Clamp(c / range, -1, 1) * half;
+
+ StreamGeometry Line(Func<int, double> v)
+ {
+ var g = new StreamGeometry();
+ using var c = g.Open();
+ int px = Math.Max(2, (int)w);
+ for (int x = 0; x < px; x++)
+ {
+ int k = Math.Min(_n - 1, (int)((double)x / (px - 1) * (_n - 1)));
+ var p = new Point(x * w / (px - 1), Y(v(k)));
+ if (x == 0) c.BeginFigure(p, false); else c.LineTo(p);
+ }
+ c.EndFigure(false);
+ return g;
+ }
+ if (showF) ctx.DrawGeometry(null, new Pen(NotaPalette.Wash(NotaPalette.Teal, 0xA0), 1), Line(k => _flut[k] + (showW ? _wow[k] : 0)));
+ if (showW) ctx.DrawGeometry(null, NotaGraph.PrimaryPen, Line(k => _wow[k]));
+ var scale = NotaGraph.AxisText(NotaNum.F($"±{range:0} ¢"));
+ ctx.DrawText(scale, new Point(4, top));
+ Labels();
+
+ void Labels()
+ {
+ NotaGraph.Title(ctx, frame, "Pitch drift");
+ NotaGraph.Axis(ctx, frame, NotaGraph.Corner.TopRight, _peak, NotaPalette.AccentBright);
+ if (_show != 0) NotaGraph.Legend(ctx, w - 5, h - 26, ("flutter", NotaPalette.TealBright, NotaGraph.Mark.Line));
+ NotaGraph.Axis(ctx, frame, NotaGraph.Corner.BottomLeft, "0");
+ NotaGraph.Axis(ctx, frame, NotaGraph.Corner.BottomRight, _end);
+ var m = NotaGraph.AxisText(_mid);
+ ctx.DrawText(m, new Point((w - m.Width) / 2, h - m.Height - 3));
+ }
+ }
+}
+
+internal sealed class VtHarmView : VtWindowBase
+{
+ private readonly double[] _h = new double[7];
+ private double _floor = -120;
+ private string _thd = "", _floorText = "";
+
+ /// <summary>Harmonics 1..7 in dB relative to the fundamental, the hiss floor on the same
+ /// scale, and the texts.</summary>
+ public void Set(float[] src, int at, double floorDb, string thd, string floorText)
+ {
+ for (int k = 0; k < 7; k++) _h[k] = at + k < src.Length ? src[at + k] : -120;
+ _floor = floorDb; _thd = thd; _floorText = floorText;
+ InvalidateVisual();
+ }
+
+ public override void Render(DrawingContext ctx)
+ {
+ double w = Bounds.Width, h = Bounds.Height;
+ if (w <= 0 || h <= 0) return;
+ var frame = new Rect(0, 0, w, h);
+ NotaGraph.Window(ctx, frame);
+ Grid(ctx, w, h, 6);
+ double top = 16, bot = h - 12;
+ const double range = 96; // dB below the fundamental
+ double Y(double db) => bot - Math.Clamp((db + range) / range, 0, 1) * (bot - top);
+ double Xk(int k) => w * (0.1 + 0.8 * k / 6.0);
+
+ if (_floor > -range)
+ {
+ double fy = Y(_floor);
+ var g = new StreamGeometry();
+ using (var c = g.Open())
+ {
+ // a gently tilted floor, as hiss rises a little toward the highs
+ c.BeginFigure(new Point(0, fy + 4), false);
+ c.LineTo(new Point(w * 0.6, fy)); c.LineTo(new Point(w, fy + 3));
+ c.EndFigure(false);
+ }
+ ctx.DrawGeometry(null, new Pen(NotaPalette.Wash(NotaPalette.Teal, 0xA0), 1.1), g);
+ var ft = NotaGraph.AxisText(_floorText, NotaPalette.TealBright);
+ ctx.DrawText(ft, new Point(w - ft.Width - 5, Math.Max(top, fy - ft.Height - 2)));
+ }
+ var bar = new Pen(NotaPalette.Accent, 3, lineCap: PenLineCap.Round);
+ var dim = new Pen(NotaPalette.Wash(NotaPalette.Accent, 0x50), 3, lineCap: PenLineCap.Round);
+ for (int k = 0; k < 7; k++)
+ {
+ double x = Xk(k);
+ double db = k == 0 ? 0 : _h[k];
+ if (db <= -range) continue;
+ ctx.DrawLine(k > 0 && db < _floor ? dim : bar, new Point(x, bot), new Point(x, Y(db)));
+ }
+
+ NotaGraph.Title(ctx, frame, "Harmonics");
+ NotaGraph.Axis(ctx, frame, NotaGraph.Corner.TopRight, _thd, NotaPalette.AccentBright);
+ string[] names = { "f", "2f", "3f", "4f", "5f", "6f", "7f" };
+ for (int k = 0; k < 7; k++)
+ {
+ var t = NotaGraph.AxisText(names[k]);
+ ctx.DrawText(t, new Point(Math.Clamp(Xk(k) - t.Width / 2, 3, w - t.Width - 3), h - t.Height - 2));
+ }
+ }
+}
diff --git a/src/managed/Nota.App/Controls/VintageViz.cs b/src/managed/Nota.App/Controls/VintageViz.cs
deleted file mode 100644
index 9711e746..00000000
--- a/src/managed/Nota.App/Controls/VintageViz.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-only
-// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
-//
-// Nota Vintage character viz: the memoryless saturation transfer curve (input→output,
-// mirroring Vintage.h per Mode + Drive + Tone) over a faint grid + unity reference,
-// with a speckle "grain" overlay whose density tracks Noise + Crackle + Wear and a
-// bandwidth bar showing how far the highs are rolled off. Animates its grain on Tick.
-
-using System;
-using System.Globalization;
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Media;
-
-namespace Nota.App;
-
-internal sealed class VintageViz : 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 Grid = NotaGraph.Grid;
- private static readonly Typeface Face = NotaFonts.Mono;
- private static readonly string[] ModeNames = { "VINYL", "CASSETTE", "REEL", "VHS", "TUBE", "ANALOG" };
- // Mirrors Vintage.h kMode: shape, driveMul, bias, bandHz.
- private static readonly int[] Shape = { 0, 2, 2, 0, 1, 0 };
- private static readonly float[] DriveMul = { 3.0f, 4.0f, 6.0f, 3.5f, 8.0f, 5.0f };
- private static readonly float[] Bias = { 0.05f, 0.08f, 0.06f, 0.10f, 0.18f, 0.03f };
- private static readonly double[] BandHz = { 13000, 10000, 15000, 7000, 16000, 18000 };
-
- private int _mode;
- private float _drive = 0.35f, _tone = 0.5f, _grain, _wear;
- private uint _rng = 0x1234u;
-
- public VintageViz() { MinWidth = 150; MinHeight = 70; }
-
- // grain = combined Noise+Crackle density (0..1); wear narrows the bandwidth bar.
- public void Set(int mode, float drive, float tone, float grain, float wear)
- { _mode = Math.Clamp(mode, 0, 5); _drive = drive; _tone = tone; _grain = grain; _wear = wear; InvalidateVisual(); }
-
- public void Tick() => InvalidateVisual(); // re-speckle the grain
-
- private float Shaped(float x)
- {
- float g = 1f + DriveMul[_mode] * _drive * 3f;
- float bias = Bias[_mode] * (0.3f + _drive);
- float pre = x * g;
- return Shape[_mode] switch
- {
- 1 => MathF.Tanh(pre + bias) - MathF.Tanh(bias), // tube
- 2 => pre / (1f + MathF.Abs(pre)) * 1.2f, // tape
- _ => MathF.Tanh(pre), // soft
- };
- }
-
- private float Rand() { _rng = _rng * 1664525u + 1013904223u; return ((_rng >> 8) & 0xFFFF) / 65536f; }
-
- public override void Render(DrawingContext ctx)
- {
- double w = Bounds.Width, h = Bounds.Height;
- if (w <= 0 || h <= 0) return;
- NotaGraph.Window(ctx, new Rect(0, 0, w, h));
- double pad = 7, x0 = pad, x1 = w - pad, top = pad + 10, bot = h - pad - 13;
-
- 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));
- }
- ctx.DrawLine(new Pen(Grid, 1) { DashStyle = DashStyle.Dash }, new Point(x0, bot), new Point(x1, top)); // unity ref
-
- // Transfer curve.
- float norm = Math.Max(1e-3f, Math.Abs(Shaped(1f)));
- var pen = new Pen(AccentBright, 1.6, lineCap: PenLineCap.Round, lineJoin: PenLineJoin.Round);
- var g = new StreamGeometry();
- using (var gc = g.Open())
- {
- int n = 64;
- for (int i = 0; i <= n; i++)
- {
- double t = (double)i / n;
- float xin = (float)(t * 2.0 - 1.0);
- double y = Shaped(xin) / norm;
- var pt = new Point(x0 + t * (x1 - x0), bot - (y * 0.5 + 0.5) * (bot - top));
- if (i == 0) gc.BeginFigure(pt, false); else gc.LineTo(pt);
- }
- }
- ctx.DrawGeometry(null, pen, g);
-
- // Grain speckle: dots scattered across the panel, count ∝ Noise+Crackle.
- int dots = (int)(_grain * 120);
- var dotBrush = NotaPalette.Wash(NotaPalette.AccentBright, 0x90);
- for (int i = 0; i < dots; i++)
- {
- double dx = x0 + Rand() * (x1 - x0);
- double dy = top + Rand() * (bot - top);
- double rad = 0.5 + Rand() * 1.1;
- ctx.DrawEllipse(dotBrush, null, new Point(dx, dy), rad, rad);
- }
-
- // Bandwidth bar along the bottom: filled portion = retained highs (narrows with Wear).
- double frac = Math.Clamp((BandHz[_mode] * (1.0 - 0.55 * _wear)) / 20000.0, 0.05, 1.0);
- double by = bot + 6, bh = 3;
- ctx.DrawRectangle(NotaPalette.Wash(NotaPalette.BorderStrong, 0x40), null, new Rect(x0, by, x1 - x0, bh), 1.5, 1.5);
- ctx.DrawRectangle(NotaPalette.Wash(NotaPalette.Ink("#5AC8B0"), 0xB0), null, new Rect(x0, by, (x1 - x0) * frac, bh), 1.5, 1.5);
-
- ctx.DrawText(new FormattedText("DRIVE", CultureInfo.InvariantCulture, FlowDirection.LeftToRight, Face, 8, TextTertiary), new Point(x0, pad - 2));
- var t2 = new FormattedText(ModeNames[_mode], CultureInfo.InvariantCulture, FlowDirection.LeftToRight, Face, 8, AccentBright);
- ctx.DrawText(t2, new Point(x1 - t2.Width, pad - 2));
- }
-}
diff --git a/src/managed/Nota.App/DeviceCards/Bodies/VintageDeviceBody.cs b/src/managed/Nota.App/DeviceCards/Bodies/VintageDeviceBody.cs
index c979bba7..7923499a 100644
--- a/src/managed/Nota.App/DeviceCards/Bodies/VintageDeviceBody.cs
+++ b/src/managed/Nota.App/DeviceCards/Bodies/VintageDeviceBody.cs
@@ -1,15 +1,20 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
//
-// Detail · Devices — built-in Nota Vintage (device kind 8) body: a MODE selector
-// (Vinyl / Cassette / Reel / VHS / Tube / Analog), a CHARACTER knob group (Drive/Tone/
-// Mix/Output) and a WEAR group (Wow/Flutter/Noise/Crackle/Wear, teal), beside a live
-// character viz (saturation transfer curve + grain speckle + bandwidth bar). All
-// controls are the device's generic params → automation + persist for free.
+// Detail · Devices — built-in Nota Vintage body (device kind 8), a build of the "Nota
+// Vintage" mockup (700 × 260) on the Auto Filter / Lens / Compressor frame: an always-
+// visible STATE column (drive · wear faders), a centre panel with Curve / Wear / Output
+// tabs — the transfer curve the engine runs, the pitch drift over the last four seconds,
+// the harmonics against the hiss floor — each with the character list in its head row, a
+// right panel with Tone / Output tabs, and a status strip. Every control is a device param,
+// so automation / MIDI learn / presets / A-B / persistence come for free.
+// FullBleed — the shared shell draws the header (name · preset · badge · bypass).
using System;
+using System.Collections.Generic;
using Avalonia;
using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Layout;
using Avalonia.Media;
@@ -20,131 +25,648 @@ namespace Nota.App;
internal sealed class VintageDeviceBody : IDeviceBody
{
- // Param indices — must match Vintage.h.
- private const int Mode = 0, Drive = 1, Tone = 2, Wow = 3, Flutter = 4, Noise = 5, Crackle = 6, Wear = 7, Mix = 8, Output = 9, OS = 10;
- private static readonly string[] OsNames = { "Off", "2×", "4×", "8×" };
- private static readonly string[] Modes = { "Vinyl", "Cassette", "Reel", "VHS", "Tube", "Analog" };
+ // ── Parameter indices (must match Vintage.h) ─────────────────────────────
+ private const int Mode = 0, Drive = 1, Tone = 2, Wow = 3, Flutter = 4, Noise = 5, Crackle = 6, Wear = 7, Mix = 8,
+ Output = 9, OS = 10, ToneLow = 11, ToneHigh = 12, ToneModel = 13, Character = 14, AutoComp = 15, WowRate = 16,
+ FlutterRate = 17, WowSync = 18, HissHp = 19, WearFollow = 20, StereoDrift = 21, OutputStage = 22, EvenOnly = 23;
+ // Scope layout (Vintage::S_* / kTele / kCurve / kHist).
+ private const int S_InPk = 0, S_OutPk = 1, S_Cpu = 2, S_SampleRate = 3, S_Delay = 5, S_WowHz = 6,
+ S_FlutHz = 7, S_WowCents = 8, S_FlutCents = 9, S_BandHz = 10, S_HissDb = 11, S_Thd = 12, S_H1 = 13, S_TestLvl = 20,
+ S_Asym = 21, S_CompDb = 22, S_HistLen = 25, S_HistMs = 26, kTele = 32, kCurve = 48, kHist = 1024;
+ private const int kScope = kTele + kCurve + 2 * kHist;
- public double Width => 700; // the almanac device format: 700 × 260; the viz column takes the slack
+ private static readonly string[] Modes = { "Vinyl", "Cassette", "Reel", "VHS", "Tube", "Analog" };
+ private static readonly string[] OsNames = { "Off", "2×", "4×", "8×" };
+ private static readonly string[] SyncNames = { "4 bars", "2 bars", "1 bar", "1/2", "1/4", "1/8" };
- public string? Subtitle => "CHARACTER"; // the processing type, shown as the header badge
+ public double Width => 700;
+ public bool FullBleed => true;
+ public string? Subtitle => "CHARACTER";
public Control Build(DeviceCardContext ctx, int index)
{
var engine = ctx.Engine;
int track = ctx.TrackId, di = index;
float P(int p) => engine.DeviceGetParam(track, di, p);
- void SetP(int p, float v) => engine.DeviceSetParam(track, di, p, v);
void Begin(int p) => engine.BeginAutomationWrite(track, AutomationTarget.DeviceParam, di, p, "");
void End(int p) => engine.EndAutomationWrite(track, AutomationTarget.DeviceParam, di, p, "");
+ void Raw(int p, float v) => engine.DeviceSetParam(track, di, p, Math.Clamp(v, 0f, 1f));
+ // A discrete edit (a click) is one automation gesture, so it records while the transport does.
+ void SetP(int p, float v) { Begin(p); Raw(p, v); End(p); }
+ void Reset(int p) { Begin(p); Raw(p, engine.DeviceParamDefault(track, di, p)); End(p); }
+ bool On(int p) => P(p) >= 0.5f;
+ int Sel(int p, int n) => Math.Clamp((int)Math.Round(P(p) * (n - 1)), 0, n - 1);
+
+ var readouts = new List<Action>();
+ // by index: a panel built lazily inside a readout (the Tone tab's two bodies) adds its own
+ void RefreshAll() { for (int i = 0; i < readouts.Count; i++) readouts[i](); }
+ var scope = new float[kScope];
+ int scN = 0;
+ double Sc(int i) => scN > i ? scope[i] : 0;
- var viz = new VintageViz { VerticalAlignment = VerticalAlignment.Stretch, MinWidth = 200 };
- void SyncViz()
+ // ---- units ----------------------------------------------------------------
+ static double Exp(double v, double lo, double hi) => lo * Math.Pow(hi / lo, Math.Clamp(v, 0, 1));
+ static string Pct(double v) => NotaNum.F($"{v * 100:0} %");
+ static string ToneF(double v) => NotaNum.F($"{(v - 0.5) * 10:+0.0;−0.0;0}");
+ static string GainF(double v) => NotaNum.F($"{(v - 0.5) * 24:+0.0;−0.0;0.0} dB");
+ static string ShelfF(double v) => NotaNum.F($"{(v - 0.5) * 24:+0.0;−0.0;0.0}");
+ static string HzF(double hz) => hz >= 1000 ? NotaNum.F($"{hz / 1000:0.0#} kHz") : hz >= 10 ? NotaNum.F($"{hz:0} Hz") : hz >= 1 ? NotaNum.F($"{hz:0.0} Hz") : NotaNum.F($"{hz:0.00} Hz");
+ static string DbF(double lin) => lin > 1e-5 ? NotaNum.F($"{20 * Math.Log10(lin):0.0;−0.0} dB") : "−∞ dB";
+ static string DbfsF(double lin) => lin > 1e-5 ? NotaNum.F($"{20 * Math.Log10(lin):0.0;−0.0} dBFS") : "−∞ dBFS";
+ static string ThdF(double v) => v < 0.001 ? "< 0.1 %" : NotaNum.F($"{v * 100:0.0} %");
+ static string CentsF(double c) => NotaNum.F($"±{c:0} ¢");
+ bool Synced() => On(WowSync);
+ string WowRateF(double v) => Synced() ? SyncNames[Math.Clamp((int)Math.Round(v * 5), 0, 5)] : HzF(Exp(v, 0.1, 4));
+ static string FlutRateF(double v) => HzF(Exp(v, 2, 20));
+ static string HissHpF(double v) => HzF(Exp(v, 20, 2000));
+ string ModeName() => Modes[Sel(Mode, 6)];
+ string OsText() => Sel(OS, 4) == 0 ? "no oversampling" : NotaNum.F($"{OsNames[Sel(OS, 4)]} OS");
+ double WowHz() => Sc(S_WowHz) > 0 ? Sc(S_WowHz) : Exp(P(WowRate), 0.1, 4);
+ double FlutHz() => Sc(S_FlutHz) > 0 ? Sc(S_FlutHz) : Exp(P(FlutterRate), 2, 20);
+ double H(int k) => Sc(S_H1 + k - 1); // harmonic k, dB re the fundamental
+ string Dominant()
{
- int m = Math.Clamp((int)Math.Round(P(Mode) * 5), 0, 5);
- float grain = Math.Clamp(P(Noise) * 0.6f + P(Crackle) * 0.5f, 0f, 1f);
- viz.Set(m, P(Drive), P(Tone), grain, P(Wear));
+ double even = 0, odd = 0;
+ for (int k = 2; k <= 7; k++) { double pw = Math.Pow(10, H(k) / 10); if (k % 2 == 0) even += pw; else odd += pw; }
+ if (even + odd < 1e-9) return "clean";
+ return even > odd * 1.5 ? "even dominant" : odd > even * 1.5 ? "odd dominant" : "even + odd";
}
- ctx.AddDeviceRefresher(viz.Tick);
+ static string Ordinal(int k) => k switch { 2 => "2nd", 3 => "3rd", _ => NotaNum.F($"{k}th") };
+ string Loudest() { int best = 2; for (int k = 3; k <= 7; k++) if (H(k) > H(best)) best = k; return H(best) > -100 ? Ordinal(best) + " harmonic" : "no harmonics"; }
+ string StageName() => Sel(OutputStage, 3) switch { 1 => "tube stage", 2 => "analog stage", _ => "" };
- // ---- formatters ----
- static string PctF(double v) => $"{v * 100:0}\u2009%";
- static string Bip(double v) => $"{(v - 0.5) * 200:+0;−0;0}\u2009%";
- static string GainF(double v) => $"{(v - 0.5) * 24:+0.0;−0.0;0.0}\u2009dB";
+ // ---- small builders ---------------------------------------------------------
+ static TextBlock Caps(string t, IBrush? c = null, double fs = 7) => new()
+ { Text = t, FontSize = fs, FontWeight = FontWeight.Bold, Foreground = c ?? TextTertiary, LetterSpacing = 0.8, VerticalAlignment = VerticalAlignment.Center };
+ static TextBlock Mono(string t, double fs, IBrush c)
+ { var tb = new TextBlock { Text = t, FontSize = fs, Foreground = c, VerticalAlignment = VerticalAlignment.Center }; tb.BindResource(TextBlock.FontFamilyProperty, "Font.Mono"); return tb; }
+ static StackPanel Row(double sp, params Control[] cs)
+ { var s = new StackPanel { Orientation = Orientation.Horizontal, Spacing = sp, VerticalAlignment = VerticalAlignment.Center }; foreach (var c in cs) s.Children.Add(c); return s; }
+ static T Docked<T>(T c, Dock d) where T : Control { DockPanel.SetDock(c, d); return c; }
+ static T Col<T>(T c, int col) where T : Control { Grid.SetColumn(c, col); return c; }
+ static T GRow<T>(T c, int row) where T : Control { Grid.SetRow(c, row); return c; }
+ void Learn(Control c, int p) => MidiLearn.Bind(c, MidiTarget.DeviceParam(track, di, p), engine.DeviceParamName(track, di, p));
- // ---- gauge-knob cell (shared Knob + value + caption) ----
- Control Cell(string name, int p, Func<double, string> fmt, IBrush? arc = null, double size = 40)
+ // Gauge knob bound to a device param (automation gesture + MIDI learn + live follow).
+ Control K(int p, string name, Func<double, string> fmt, IBrush? arc = null, double cellW = 46)
{
- var value = new TextBlock { Text = fmt(P(p)), FontSize = 9, Foreground = TextPrimary };
- value.BindResource(TextBlock.FontFamilyProperty, "Font.Mono");
- var knob = new Knob(P(p), 1.0) { Accent = true, ArcColor = arc, Default = engine.DeviceParamDefault(track, di, p), Width = size, Height = size };
- knob.ValueChanged += v => { SetP(p, (float)v); value.Text = fmt(v); SyncViz(); };
+ var val = Mono(fmt(P(p)), 7, TextPrimary);
+ var knob = new Knob(P(p), 1.0) { Accent = true, ArcColor = arc, Default = engine.DeviceParamDefault(track, di, p), Width = 34, Height = 34 };
+ knob.ValueChanged += v => { Raw(p, (float)v); val.Text = fmt(v); };
knob.GestureBegin += () => Begin(p);
knob.GestureEnd += () => End(p);
- MidiLearn.Bind(knob, MidiTarget.DeviceParam(track, di, p), name);
- ctx.AddDeviceRefresher(() => { if (!knob.Dragging) { float c = P(p); if (Math.Abs(c - knob.Value) > 1e-3) { knob.Value = c; value.Text = fmt(c); } } });
- return KnobCell(name, knob, value, size + 18);
+ Learn(knob, p);
+ readouts.Add(() => { if (knob.Dragging) return; float c = P(p); if (Math.Abs(c - knob.Value) > 1e-4) knob.Value = c; val.Text = fmt(c); });
+ return KnobCell(name, knob, val, cellW);
+ }
+
+ // On/off switch bound to a param (> 0.5 = on).
+ Control Toggle(int p, string label, Func<string>? live = null)
+ {
+ var wrap = Switch(label, () => On(p), () => { SetP(p, On(p) ? 0f : 1f); RefreshAll(); }, out var sync, null, live);
+ readouts.Add(sync);
+ Learn(wrap, p);
+ return wrap;
+ }
+
+ // Segmented pill over a discrete param (n options spread over 0..1).
+ Control Seg(int p, string[] names)
+ {
+ int n = names.Length;
+ var seg = Segments(names, () => Sel(p, n), iv => { SetP(p, n > 1 ? iv / (float)(n - 1) : 0f); RefreshAll(); }, out var sync, padX: 6);
+ readouts.Add(sync);
+ Learn(seg, p);
+ return seg;
+ }
+
+ // Outlined chips: lit = brass edge + wash.
+ Control Chips(string[] names, Func<int, bool> lit, Action<int> pick, int learnParam, double h = 16, double padX = 7)
+ {
+ var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 3, VerticalAlignment = VerticalAlignment.Center };
+ var cells = new Border[names.Length];
+ var texts = new TextBlock[names.Length];
+ for (int i = 0; i < names.Length; i++)
+ {
+ int iv = i;
+ var tb = new TextBlock { Text = names[i], FontSize = 8, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center };
+ var b = new Border { Height = h, Padding = new Thickness(padX, 0), CornerRadius = NotaRadius.Badge, BorderThickness = new Thickness(1), Cursor = new Cursor(StandardCursorType.Hand), Child = tb };
+ b.PointerPressed += (_, e) => { if (!e.GetCurrentPoint(b).Properties.IsLeftButtonPressed) return; pick(iv); RefreshAll(); e.Handled = true; };
+ cells[i] = b; texts[i] = tb; row.Children.Add(b);
+ }
+ readouts.Add(() =>
+ {
+ for (int i = 0; i < names.Length; i++)
+ {
+ bool on = lit(i);
+ cells[i].BorderBrush = on ? Brass : NotaPalette.BorderStrong;
+ cells[i].Background = on ? NotaPalette.AccentSubtle : Brushes.Transparent;
+ texts[i].Foreground = on ? AccentBright : TextSecondary;
+ texts[i].FontWeight = on ? FontWeight.SemiBold : FontWeight.Normal;
+ }
+ });
+ if (learnParam >= 0) Learn(row, learnParam);
+ return row;
+ }
+
+ // A latching chip: lit when `lit()`, a click runs `click`; its text can follow the value.
+ Border Latch(int p, Func<bool> lit, Action click, Func<string> text, string tip, bool fill = false)
+ {
+ var tb = new TextBlock { FontSize = 8, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center };
+ var b = new Border { Height = 16, Padding = new Thickness(7, 0), CornerRadius = NotaRadius.Badge, BorderThickness = new Thickness(1), Cursor = new Cursor(StandardCursorType.Hand), VerticalAlignment = VerticalAlignment.Center, Child = tb };
+ if (fill) b.HorizontalAlignment = HorizontalAlignment.Stretch;
+ void Hi()
+ {
+ bool on = lit();
+ b.Background = on ? NotaPalette.AccentSubtle : fill ? Raised : Brushes.Transparent;
+ b.BorderBrush = on ? Brass : fill ? Brushes.Transparent : NotaPalette.BorderStrong;
+ tb.Foreground = on ? AccentBright : fill ? TextPrimary : TextSecondary;
+ tb.FontWeight = on ? FontWeight.SemiBold : FontWeight.Normal;
+ tb.Text = text();
+ }
+ b.PointerPressed += (_, e) => { if (!e.GetCurrentPoint(b).Properties.IsLeftButtonPressed) return; click(); RefreshAll(); e.Handled = true; };
+ ToolTip.SetTip(b, tip);
+ Learn(b, p);
+ readouts.Add(Hi); Hi();
+ return b;
+ }
+ Border ToggleLatch(int p, Func<string> text, string tip, bool fill = false)
+ => Latch(p, () => On(p), () => SetP(p, On(p) ? 0f : 1f), text, tip, fill);
+
+ // Slider row: caps label · track · mono value.
+ Control SliderRow(string label, int p, Func<double, string> fmt, bool bipolar = false, bool modulation = false, double labW = 40)
+ {
+ var bar = DeviceCardKit.SliderRow("", () => P(p), v => Raw(p, (float)v), () => fmt(P(p)), out var sync,
+ begin: () => Begin(p), end: () => End(p), reset: () => Reset(p), bipolar: bipolar, valueWidth: 34, modulation: modulation);
+ readouts.Add(sync);
+ Learn(bar, p);
+ var g = new Grid { ColumnDefinitions = new ColumnDefinitions(NotaNum.F($"{labW},*")), VerticalAlignment = VerticalAlignment.Center };
+ g.Children.Add(Caps(label));
+ g.Children.Add(Col(bar, 1));
+ return g;
+ }
+
+ // The character list: [name ▾] opens the six voicings; the wheel steps through them.
+ Control CharDrop()
+ {
+ var name = new TextBlock { FontSize = 8, FontWeight = FontWeight.SemiBold, Foreground = AccentBright, VerticalAlignment = VerticalAlignment.Center };
+ var box = new Border
+ {
+ Height = 16, MinWidth = 74, Background = Sunken, BorderBrush = Brass, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Badge,
+ Padding = new Thickness(6, 0), Cursor = new Cursor(StandardCursorType.Hand), VerticalAlignment = VerticalAlignment.Center,
+ Child = new DockPanel { Children = { Docked(new Glyph(GlyphKind.ChevronDown, 7) { Foreground = NotaPalette.AccentDim, Margin = new Thickness(6, 0, 0, 0) }, Dock.Right), name } },
+ };
+ readouts.Add(() => name.Text = ModeName());
+ ToolTip.SetTip(box, "Character — the era the signal passes through: its saturation, tone, band-limit and how much hiss, crackle, wow and flutter it brings. Scroll to step.");
+ Learn(box, Mode);
+ box.PointerPressed += (_, e) =>
+ {
+ if (!e.GetCurrentPoint(box).Properties.IsLeftButtonPressed) return;
+ var fly = new MenuFlyout();
+ int cur = Sel(Mode, 6);
+ for (int i = 0; i < Modes.Length; i++)
+ {
+ int iv = i;
+ var mi = new MenuItem { Header = Modes[i] };
+ if (i == cur) mi.Icon = new Avalonia.Controls.Shapes.Ellipse { Width = 6, Height = 6, Fill = Brass };
+ mi.Click += (_, _) => { SetP(Mode, iv / 5f); RefreshAll(); };
+ fly.Items.Add(mi);
+ }
+ fly.ShowAt(box);
+ e.Handled = true;
+ };
+ box.PointerWheelChanged += (_, e) =>
+ {
+ int m = Math.Clamp(Sel(Mode, 6) + (e.Delta.Y < 0 ? 1 : -1), 0, 5);
+ SetP(Mode, m / 5f); RefreshAll(); e.Handled = true;
+ };
+ return box;
+ }
+
+ static Grid HeadRow(Control left, Control right)
+ {
+ var g = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), Height = 18, ColumnSpacing = 6 };
+ g.Children.Add(left); g.Children.Add(Col(right, 1));
+ return g;
+ }
+ Control KnobRow(Control[] knobs, Func<string> info1, Func<string> info2)
+ {
+ var i1 = Mono("", 7, TextTertiary); i1.HorizontalAlignment = HorizontalAlignment.Right;
+ var i2 = Mono("", 7, TextTertiary); i2.HorizontalAlignment = HorizontalAlignment.Right;
+ readouts.Add(() => { i1.Text = info1(); i2.Text = info2(); });
+ var g = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*"), Height = 52 };
+ g.Children.Add(Row(4, knobs));
+ g.Children.Add(Col(new StackPanel { Spacing = 3, VerticalAlignment = VerticalAlignment.Center, Children = { i1, i2 } }, 1));
+ return g;
}
- static StackPanel KnobRow(params Control[] cs)
+ static Control TabBody(Control head, Control window, Control knobs) => new DockPanel
+ {
+ LastChildFill = true, Margin = new Thickness(8, 5, 8, 0),
+ Children = { Docked(head, Dock.Top), Docked(knobs, Dock.Bottom), new Border { Margin = new Thickness(0, 5, 0, 0), Child = window } },
+ };
+
+ // ======================================================================
+ // LEFT — STATE column (drive · wear)
+ // ======================================================================
+ Control StateFader(int p, string label, IBrush ink, string tip)
{
- var sp = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 2, HorizontalAlignment = HorizontalAlignment.Center };
- foreach (var c in cs) sp.Children.Add(c);
- return sp;
+ var f = new AfFader { Ink = ink, Width = 16, VerticalAlignment = VerticalAlignment.Stretch, Default = engine.DeviceParamDefault(track, di, p) };
+ f.Changed += v => { Raw(p, (float)v); RefreshAll(); };
+ f.GestureBegin += () => Begin(p);
+ f.GestureEnd += () => End(p);
+ Learn(f, p);
+ ToolTip.SetTip(f, tip);
+ readouts.Add(() => f.Set(P(p), double.NaN));
+ var lb = Caps(label); lb.HorizontalAlignment = HorizontalAlignment.Center;
+ return new DockPanel { Children = { Docked(lb, Dock.Bottom), new Border { Margin = new Thickness(0, 0, 0, 3), Child = f } } };
}
- Border Panel(Control body, bool teal = false) => new()
+ var stateTitle = Caps("STATE"); stateTitle.HorizontalAlignment = HorizontalAlignment.Center;
+ var stateDrv = Mono("", 7, AccentBright); stateDrv.HorizontalAlignment = HorizontalAlignment.Center;
+ var stateWear = Mono("", 7, TextPrimary); stateWear.HorizontalAlignment = HorizontalAlignment.Center;
+ readouts.Add(() =>
+ {
+ stateDrv.Text = Pct(P(Drive));
+ stateWear.Text = Pct(P(Wear));
+ stateTitle.Foreground = Sc(S_InPk) > 0.01 ? AccentBright : TextTertiary; // lit while signal passes
+ });
+ var faders = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto"), ColumnSpacing = 9, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 4, 0, 4) };
+ faders.Children.Add(StateFader(Drive, "DRV", Brass, "Drive — how hard the signal hits the saturation. Double-click resets."));
+ faders.Children.Add(Col(StateFader(Wear, "WEAR", Teal, "Wear — the age of the medium: a narrower band, more hiss and crackle, a wandering flutter. Double-click resets."), 1));
+ var stateCol = new Border
{
- Background = Card2, BorderBrush = teal ? Teal : BorderDef,
- BorderThickness = teal ? new Thickness(2, 1, 1, 1) : new Thickness(1),
- CornerRadius = NotaRadius.Panel, Padding = new Thickness(9, 8), Child = body,
+ Width = 56, Background = Card2, BorderBrush = BorderDef, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Tile, Padding = new Thickness(0, 5, 0, 4),
+ Child = new DockPanel { Children = { Docked(stateTitle, Dock.Top), Docked(stateWear, Dock.Bottom), Docked(stateDrv, Dock.Bottom), faders } },
};
- static TextBlock Head(string t, IBrush? c = null) => new() { Text = t, FontSize = 9, FontWeight = FontWeight.Bold, Foreground = c ?? TextTertiary, Margin = new Thickness(0, 0, 0, 7) };
+ DockPanel.SetDock(stateCol, Dock.Left);
+
+ // ======================================================================
+ // CENTRE — Curve
+ // ======================================================================
+ VtCurveView? curve = null;
+ Control CurveTab()
+ {
+ curve = new VtCurveView();
+ curve.StartV = () => P(Drive);
+ curve.DragV += v => Raw(Drive, (float)v);
+ curve.GestureBegin += () => Begin(Drive);
+ curve.GestureEnd += () => End(Drive);
+ ToolTip.SetTip(curve, "The transfer curve the saturation runs — input level across, output up; dashed is the dry line, teal what you hear with Mix and Output, the dot where the input peak sits. Drag up or down for the drive.");
+ Learn(curve, Drive);
+
+ var thd = Mono("", 7, TextTertiary);
+ readouts.Add(() => thd.Text = "THD " + ThdF(Sc(S_Thd)));
+ var count = Mono("", 7, TextTertiary);
+ readouts.Add(() => count.Text = NotaNum.F($"{Sel(Mode, 6) + 1} / 6"));
+ var head = HeadRow(Row(6, Caps("CHAR"), CharDrop(), count, new Border { Width = 4 }, Caps("OS"), Seg(OS, OsNames)), thd);
+ var knobs = KnobRow(new[]
+ {
+ K(Drive, "DRIVE", Pct),
+ K(Tone, "TONE", ToneF),
+ K(Mix, "MIX", Pct),
+ K(Output, "OUTPUT", GainF, Teal),
+ },
+ () => NotaNum.F($"peak {DbF(Sc(S_InPk))} → {DbF(Sc(S_OutPk))}"),
+ () => NotaNum.F($"{OsText()} · asym {Pct(Sc(S_Asym))} · {Dominant()}"));
+ return TabBody(head, curve, knobs);
+ }
- // ---- MODE selector: 6 chips in two rows, live-synced ----
- var chips = new Border[Modes.Length];
- void SyncMode() { int cur = Math.Clamp((int)Math.Round(P(Mode) * 5), 0, 5); for (int i = 0; i < chips.Length; i++) { bool on = i == cur; chips[i].Background = on ? Brass : Card2; ((TextBlock)chips[i].Child!).Foreground = on ? OnAccent : TextSecondary; } }
- var modeGrid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*"), RowDefinitions = new RowDefinitions("Auto,Auto"), ColumnSpacing = 3, RowSpacing = 3 };
- for (int i = 0; i < Modes.Length; i++)
+ // ======================================================================
+ // CENTRE — Wear
+ // ======================================================================
+ VtWearView? wearView = null;
+ int wearShow = 2; // 0 wow, 1 flutter, 2 both — what the window shows and a drag edits
+ Control WearTab()
{
- int vi = i;
- var chip = new Border
+ wearView = new VtWearView();
+ wearView.StartV = () => wearShow == 1 ? P(Flutter) : P(Wow);
+ wearView.StartH = () => wearShow == 1 ? P(FlutterRate) : P(WowRate);
+ wearView.DragV += v =>
{
- Background = Card2, BorderBrush = BorderStrong, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control,
- Padding = new Thickness(0, 3), Cursor = new Cursor(StandardCursorType.Hand),
- Child = new TextBlock { Text = Modes[i], FontSize = 9, FontWeight = FontWeight.SemiBold, Foreground = TextSecondary, HorizontalAlignment = HorizontalAlignment.Center },
+ if (wearShow != 1) { double d = v - P(Wow); Raw(Wow, (float)v); if (wearShow == 2) Raw(Flutter, (float)(P(Flutter) + d)); }
+ else Raw(Flutter, (float)v);
};
- chip.PointerPressed += (_, e) => { e.Handled = true; SetP(Mode, vi / 5f); SyncMode(); SyncViz(); };
- chips[i] = chip;
- Grid.SetColumn(chip, i % 3); Grid.SetRow(chip, i / 3); modeGrid.Children.Add(chip);
- }
- SyncMode();
- ctx.AddDeviceRefresher(SyncMode);
- MidiLearn.Bind(modeGrid, MidiTarget.DeviceParam(track, di, Mode), engine.DeviceParamName(track, di, Mode));
-
- // ---- OVERSAMPLE chips (normalized param 0..1 → Off/2×/4×/8×) ----
- var osChips = new Border[4];
- void SyncOs() { int cur = Math.Clamp((int)Math.Round(P(OS) * 3), 0, 3); for (int i = 0; i < 4; i++) { bool on = i == cur; osChips[i].Background = on ? Brass : Card2; ((TextBlock)osChips[i].Child!).Foreground = on ? OnAccent : TextSecondary; } }
- var osRow = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 3 };
- for (int i = 0; i < 4; i++)
- {
- int vi = i;
- var chip = new Border { Background = Card2, BorderBrush = BorderStrong, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Padding = new Thickness(7, 2), Cursor = new Cursor(StandardCursorType.Hand),
- Child = new TextBlock { Text = OsNames[i], FontSize = 9, FontWeight = FontWeight.SemiBold, Foreground = TextSecondary, HorizontalAlignment = HorizontalAlignment.Center } };
- chip.PointerPressed += (_, e) => { e.Handled = true; SetP(OS, vi / 3f); SyncOs(); };
- osChips[i] = chip; osRow.Children.Add(chip);
- }
- SyncOs();
- ctx.AddDeviceRefresher(SyncOs);
- MidiLearn.Bind(osRow, MidiTarget.DeviceParam(track, di, OS), engine.DeviceParamName(track, di, OS));
- var osStrip = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, VerticalAlignment = VerticalAlignment.Center, Children = { new TextBlock { Text = "OVERSAMPLE", FontSize = 8, FontWeight = FontWeight.Bold, Foreground = TextTertiary, VerticalAlignment = VerticalAlignment.Center }, osRow } };
-
- // ---- CHARACTER panel: mode + drive/tone/mix/output ----
- var charPanel = Panel(new StackPanel { Spacing = 8, Children =
- {
- Head("CHARACTER"),
- modeGrid,
- KnobRow(Cell("Drive", Drive, PctF), Cell("Tone", Tone, Bip), Cell("Mix", Mix, PctF, Teal), Cell("Output", Output, GainF)),
- osStrip,
- } });
-
- // ---- WEAR panel: wow/flutter/noise/crackle/wear (teal knobs = degradation) ----
- var wearPanel = Panel(new StackPanel { Spacing = 8, VerticalAlignment = VerticalAlignment.Center, Children =
- {
- Head("WEAR"),
- KnobRow(Cell("Wow", Wow, PctF, Teal), Cell("Flutter", Flutter, PctF, Teal), Cell("Noise", Noise, PctF, Teal)),
- KnobRow(Cell("Crackle", Crackle, PctF, Teal), Cell("Wear", Wear, PctF, Teal)),
- } });
-
- // ---- SHAPE panel: the character viz as its own island ----
- var vizPanel = Panel(viz);
- vizPanel.VerticalAlignment = VerticalAlignment.Stretch;
-
- SyncViz();
- ctx.AddDeviceRefresher(SyncViz);
-
- var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,*"), ColumnSpacing = 6 };
- grid.Children.Add(charPanel);
- Grid.SetColumn(wearPanel, 1); grid.Children.Add(wearPanel);
- Grid.SetColumn(vizPanel, 2); grid.Children.Add(vizPanel);
- return grid;
+ wearView.DragH += v => Raw(wearShow == 1 ? FlutterRate : WowRate, (float)v);
+ wearView.GestureBegin += () => { Begin(Wow); Begin(Flutter); Begin(WowRate); Begin(FlutterRate); };
+ wearView.GestureEnd += () => { End(Wow); End(Flutter); End(WowRate); End(FlutterRate); };
+ ToolTip.SetTip(wearView, "The pitch drift over the last four seconds — wow in brass, flutter in teal. Drag up or down for the depth of what is picked above, sideways for its rate.");
+ Learn(wearView, Wow);
+
+ var show = Chips(new[] { "Wow", "Flutter", "Both" }, i => wearShow == i, i => wearShow = i, -1);
+ ToolTip.SetTip(show, "What the window shows and a drag in it edits");
+ var sync = Latch(WowSync, () => On(WowSync), () => SetP(WowSync, On(WowSync) ? 0f : 1f),
+ () => Synced() ? "Sync " + SyncNames[Sel(WowRate, 6)] : "Sync off",
+ "Sync — the wow follows the tempo: one sway every 4 bars … 1/8 (RATE picks it)");
+ var drift = Mono("", 7, AccentBright);
+ readouts.Add(() => drift.Text = "drift " + HzF(WowHz()));
+ var head = HeadRow(Row(6, Caps("CHAR"), CharDrop(), show, sync), drift);
+ var knobs = KnobRow(new[]
+ {
+ K(Wow, "WOW", Pct, null, 40),
+ K(WowRate, "RATE", WowRateF, null, 40),
+ K(Flutter, "FLUTTER", Pct, Teal, 40),
+ K(FlutterRate, "F·RATE", FlutRateF, Teal, 40),
+ K(Crackle, "CRACKLE", Pct, null, 40),
+ K(Wear, "WEAR", Pct, null, 40),
+ },
+ () => NotaNum.F($"{CentsF(Sc(8) + Sc(9))} · wow {HzF(WowHz())} · flut {HzF(FlutHz())}"),
+ () => (Sc(S_BandHz) > 0 ? "band " + HzF(Sc(S_BandHz)) : "band open") + (Sc(S_HissDb) > -119 ? NotaNum.F($" · hiss {Sc(S_HissDb):0} dB") : " · no hiss"));
+ return TabBody(head, wearView, knobs);
+ }
+ void SyncWearView()
+ {
+ if (wearView is null) return;
+ int n = scN >= kScope ? (int)Math.Min(kHist, Sc(S_HistLen)) : 0;
+ double secs = kHist * (Sc(S_HistMs) > 0 ? Sc(S_HistMs) : 4) / 1000.0;
+ string peak = wearShow switch { 0 => "+" + CentsF(Sc(S_WowCents))[1..], 1 => "+" + CentsF(Sc(S_FlutCents))[1..], _ => "+" + CentsF(Sc(S_WowCents) + Sc(S_FlutCents))[1..] };
+ wearView.Set(scope, kTele + kCurve, kTele + kCurve + kHist, n, wearShow, peak,
+ NotaNum.F($"wow {HzF(WowHz())}"), NotaNum.F($"{secs:0} s"));
+ }
+
+ // ======================================================================
+ // CENTRE — Output
+ // ======================================================================
+ VtHarmView? harm = null;
+ Control OutputTab()
+ {
+ harm = new VtHarmView();
+ harm.StartV = () => P(Drive);
+ harm.DragV += v => Raw(Drive, (float)v);
+ harm.GestureBegin += () => Begin(Drive);
+ harm.GestureEnd += () => End(Drive);
+ ToolTip.SetTip(harm, "The harmonics the saturation adds at the input's level (the fundamental at the top), against the hiss floor in teal. Drag up or down for the drive.");
+ Learn(harm, Drive);
+
+ var peak = Mono("", 7, AccentBright);
+ readouts.Add(() => peak.Text = DbfsF(Sc(S_OutPk)));
+ var comp = ToggleLatch(AutoComp, () => Sc(S_CompDb) != 0 && On(AutoComp) ? NotaNum.F($"Auto-comp {Sc(S_CompDb):+0.0;−0.0;0.0}") : "Auto-comp",
+ "Auto-comp — the output level follows the input's, however hard the drive");
+ var head = HeadRow(Row(6, Caps("CHAR"), CharDrop(), new Border { Width = 4 }, Caps("OS"), Seg(OS, OsNames), comp), peak);
+ var knobs = KnobRow(new[]
+ {
+ K(Drive, "DRIVE", Pct),
+ K(Tone, "TONE", ToneF),
+ K(Wear, "WEAR", Pct, Teal),
+ K(Output, "OUTPUT", GainF),
+ },
+ () => H(2) > -100 || H(3) > -100 ? NotaNum.F($"2nd {H(2):0} dB · 3rd {H(3):0} dB · {Dominant()}") : "no harmonics — clean",
+ () => NotaNum.F($"{OsText()}{(On(AutoComp) ? NotaNum.F($" · comp {Sc(S_CompDb):+0.0;−0.0;0.0} dB") : "")}"));
+ return TabBody(head, harm, knobs);
+ }
+ void SyncHarm()
+ {
+ if (harm is null) return;
+ // the hiss floor on the harmonics' scale: relative to the fundamental at the test level
+ double lvl = Math.Max(1e-4, Sc(S_TestLvl));
+ double floor = Sc(S_HissDb) > -119 ? Sc(S_HissDb) - 20 * Math.Log10(lvl) : -200;
+ harm.Set(scope, S_H1, floor, "THD " + ThdF(Sc(S_Thd)), Sc(S_HissDb) > -119 ? NotaNum.F($"hiss floor {Sc(S_HissDb):0} dB") : "");
+ }
+
+ // ======================================================================
+ // RIGHT — Tone / Output
+ // ======================================================================
+ int centreTab = 0;
+ Control Box(string title, Func<string> line1, Func<string> line2, Func<bool>? lit = null)
+ {
+ var t = Caps(title);
+ var l1 = Mono("", 9, AccentBright);
+ var l2 = Mono("", 8, TextSecondary);
+ var b = new Border { Background = Sunken, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Badge, Padding = new Thickness(6, 4),
+ Child = new StackPanel { Spacing = 2, Children = { t, l1, l2 } } };
+ readouts.Add(() =>
+ {
+ l1.Text = line1(); l2.Text = line2();
+ bool on = lit?.Invoke() ?? false;
+ b.BorderBrush = on ? NotaPalette.BorderBrass : NotaPalette.GraphBorder;
+ t.Foreground = on ? AccentBright : TextTertiary;
+ });
+ return b;
+ }
+ Control ModelRow()
+ {
+ var chips = Chips(new[] { "Warm", "Flat", "Dark" }, i => Sel(ToneModel, 3) == i, i => SetP(ToneModel, i / 2f), ToneModel, h: 15, padX: 6);
+ ToolTip.SetTip(chips, "Tone model — Warm: the era's own tilt and head bump; Flat: the TONE knob alone; Dark: a lower, darker tilt");
+ var g = new Grid { ColumnDefinitions = new ColumnDefinitions("40,*") };
+ g.Children.Add(Caps("MODEL")); g.Children.Add(Col(chips, 1));
+ return g;
+ }
+ static Control Rule(Control c) => new Border { BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0), Padding = new Thickness(0, 5, 0, 0), Child = c };
+ static Control Spread(params Control[] rows)
+ {
+ var defs = new List<string>();
+ for (int i = 0; i < rows.Length; i++) { if (i > 0) defs.Add("*"); defs.Add("Auto"); }
+ var g = new Grid { RowDefinitions = new RowDefinitions(string.Join(",", defs)) };
+ for (int i = 0; i < rows.Length; i++) g.Children.Add(GRow(rows[i], i * 2));
+ return new Border { Padding = new Thickness(8, 6), Child = g };
+ }
+
+ // Tone for the Curve / Output tabs: the model, the shelves, the character.
+ Control ToneCharBody() => Spread(
+ ModelRow(),
+ SliderRow("LOW", ToneLow, ShelfF, bipolar: true),
+ SliderRow("HIGH", ToneHigh, ShelfF, bipolar: true),
+ Rule(SliderRow("MIX", Mix, Pct)),
+ Box("CHARACTER", () => NotaNum.F($"{ModeName()} · asym {Pct(Sc(S_Asym))}"),
+ () => P(Wear) > 0.004f ? NotaNum.F($"wear {Pct(P(Wear))} · {Loudest()}") : "no wear · " + Loudest(), () => On(Character)),
+ new StackPanel { Spacing = 5, Children = {
+ Toggle(Character, "Character", () => On(Character) ? "Character: " + ModeName() : "Character off"),
+ Toggle(AutoComp, "Auto-compensation") } });
+ // Tone for the Wear tab: the model, the hiss and its high-pass, the wear box.
+ Control ToneWearBody() => Spread(
+ ModelRow(),
+ SliderRow("NOISE", Noise, Pct, modulation: true),
+ SliderRow("HISS HP", HissHp, HissHpF, modulation: true),
+ Rule(SliderRow("MIX", Mix, Pct)),
+ Box("WEAR", () => NotaNum.F($"{CentsF(Sc(S_WowCents) + Sc(S_FlutCents))} · peak drift"),
+ () => NotaNum.F($"wow {Pct(P(Wow))} + flutter {Pct(P(Flutter))}"), () => P(Wow) + P(Flutter) > 0.01f),
+ new StackPanel { Spacing = 5, Children = {
+ Toggle(WearFollow, "Wear follows input"),
+ Toggle(StereoDrift, "Stereo drift") } });
+ Control ToneTab()
+ {
+ var host = new ContentControl();
+ Control? a = null, b = null;
+ readouts.Add(() =>
+ {
+ Control want = centreTab == 1 ? (b ??= ToneWearBody()) : (a ??= ToneCharBody());
+ if (!ReferenceEquals(host.Content, want)) host.Content = want;
+ });
+ return host;
+ }
+
+ Control OutTab()
+ {
+ Control Line(string k, Func<string> v, IBrush? ink = null)
+ {
+ var val = Mono("", 8, ink ?? TextPrimary); val.HorizontalAlignment = HorizontalAlignment.Right;
+ readouts.Add(() => val.Text = v());
+ var g = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") };
+ g.Children.Add(new TextBlock { Text = k, FontSize = 8, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center });
+ g.Children.Add(Col(val, 1));
+ return g;
+ }
+ var box = new Border
+ {
+ Background = Sunken, BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Badge, Padding = new Thickness(6, 4),
+ Child = new StackPanel { Spacing = 2, Children = {
+ Caps("OUTPUT"),
+ Line("in", () => DbF(Sc(S_InPk))),
+ Line("out", () => DbF(Sc(S_OutPk))),
+ Line("THD", () => ThdF(Sc(S_Thd)), AccentBright) } },
+ };
+ var sliders = new StackPanel { Spacing = 6, Children = {
+ SliderRow("MIX", Mix, Pct),
+ SliderRow("NOISE", Noise, Pct, modulation: true),
+ SliderRow("GAIN", Output, ShelfF, bipolar: true) } };
+ // Output stage: Tube / Analog, a click on the lit one switches the stage off.
+ var btns = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*"), ColumnSpacing = 6 };
+ btns.Children.Add(Latch(OutputStage, () => Sel(OutputStage, 3) == 1, () => SetP(OutputStage, Sel(OutputStage, 3) == 1 ? 0f : 0.5f), () => "Tube",
+ "Tube stage — a warm, asymmetric valve stage after the saturation (click again for none)", fill: true));
+ btns.Children.Add(Col(Latch(OutputStage, () => Sel(OutputStage, 3) == 2, () => SetP(OutputStage, Sel(OutputStage, 3) == 2 ? 0f : 1f), () => "Analog",
+ "Analog stage — a console-style soft clip after the saturation (click again for none)", fill: true), 1));
+ var body = new DockPanel { LastChildFill = false, Children = {
+ Docked(box, Dock.Top),
+ Docked(new Border { Margin = new Thickness(0, 7, 0, 0), Child = sliders }, Dock.Top),
+ Docked(new StackPanel { Spacing = 5, Children = { Toggle(AutoComp, "Auto-compensation"), Toggle(EvenOnly, "Even harmonics only") } }, Dock.Bottom),
+ Docked(new Border { BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0), Padding = new Thickness(0, 5, 0, 5), Child = btns }, Dock.Bottom) } };
+ return new Border { Padding = new Thickness(8, 6), Child = body };
+ }
+
+ // ======================================================================
+ // Tab frames
+ // ======================================================================
+ var centreHost = new ContentControl();
+ var rightHost = new ContentControl();
+ var centreBodies = new Control?[3];
+ var rightBodies = new Control?[2];
+ var extras = Mono("", 7, TextTertiary);
+ readouts.Add(() =>
+ {
+ string m = ModeName().ToLowerInvariant();
+ extras.Text = centreTab switch
+ {
+ 1 => NotaNum.F($"window {kHist * (Sc(S_HistMs) > 0 ? Sc(S_HistMs) : 4) / 1000:0} s · {m}"),
+ 2 => NotaNum.F($"{m} · {(Sel(OS, 4) == 0 ? "no OS" : OsNames[Sel(OS, 4)] + " OS")} · THD {ThdF(Sc(S_Thd))}"),
+ _ => NotaNum.F($"{m} · asym {Pct(Sc(S_Asym))} · {Loudest()}"),
+ };
+ });
+ Control CentreBody(int t) => centreBodies[t] ??= t switch { 1 => WearTab(), 2 => OutputTab(), _ => CurveTab() };
+ Control RightBody(int t) => rightBodies[t] ??= t == 1 ? OutTab() : ToneTab();
+
+ var centre = TabFrame(new[] { "Curve", "Wear", "Output" }, centreHost, CentreBody, false, t => { centreTab = t; Refresh(); }, extras);
+ var rightFrame = TabFrame(new[] { "Tone", "Output" }, rightHost, RightBody, true, _ => RefreshAll(), null);
+ var right = new Border { Width = 186, Background = Card2, BorderBrush = BorderDef, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Tile, ClipToBounds = true, Child = rightFrame };
+ DockPanel.SetDock(right, Dock.Right);
+ var centreBox = new Border { Background = Card2, BorderBrush = BorderDef, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Tile, Margin = new Thickness(5, 0), ClipToBounds = true, Child = centre };
+
+ // ======================================================================
+ // Status strip
+ // ======================================================================
+ var statusLeft = new TextBlock { FontSize = 8, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis };
+ var statusRight = Mono("", 8, TextSecondary);
+ string StatusText()
+ {
+ var parts = new List<string> { On(Character) ? ModeName() : ModeName() + " (voicing off)" };
+ switch (centreTab)
+ {
+ case 1:
+ parts.Add(NotaNum.F($"wow {Pct(P(Wow))}{(Synced() ? " " + SyncNames[Sel(WowRate, 6)] : "")}"));
+ parts.Add(NotaNum.F($"flutter {Pct(P(Flutter))}"));
+ parts.Add(NotaNum.F($"crackle {Pct(P(Crackle))}"));
+ parts.Add(NotaNum.F($"wear {Pct(P(Wear))}"));
+ parts.Add(NotaNum.F($"noise {Pct(P(Noise))}"));
+ if (On(WearFollow)) parts.Add("follows input");
+ if (On(StereoDrift)) parts.Add("stereo drift");
+ break;
+ case 2:
+ parts.Add(NotaNum.F($"drive {Pct(P(Drive))}"));
+ parts.Add("tone " + ToneF(P(Tone)));
+ parts.Add(NotaNum.F($"wear {Pct(P(Wear))}"));
+ parts.Add(NotaNum.F($"mix {Pct(P(Mix))}"));
+ parts.Add("out " + GainF(P(Output)));
+ if (StageName().Length > 0) parts.Add(StageName());
+ if (On(EvenOnly)) parts.Add("even only");
+ parts.Add(Sel(OS, 4) == 0 ? "OS off" : OsNames[Sel(OS, 4)] + " OS");
+ break;
+ default:
+ parts.Add(NotaNum.F($"drive {Pct(P(Drive))}"));
+ parts.Add("tone " + ToneF(P(Tone)));
+ parts.Add(NotaNum.F($"mix {Pct(P(Mix))}"));
+ parts.Add("out " + GainF(P(Output)));
+ parts.Add(Sel(OS, 4) == 0 ? "OS off" : OsNames[Sel(OS, 4)] + " OS");
+ if (On(AutoComp)) parts.Add("auto-comp");
+ break;
+ }
+ return string.Join(" · ", parts);
+ }
+ readouts.Add(() =>
+ {
+ statusLeft.Text = StatusText();
+ double sr = Sc(S_SampleRate), dl = Sc(S_Delay);
+ string lat = dl > 0 && sr > 0 ? NotaNum.F($"tape delay {dl / sr * 1000:0.0} ms") : "latency 0 smp";
+ statusRight.Text = sr > 0 ? NotaNum.F($"{sr / 1000:0.#} kHz · {lat} · CPU {Sc(S_Cpu) * 100:0.0} %") : "";
+ });
+ var statusGrid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 8 };
+ statusGrid.Children.Add(statusLeft);
+ statusGrid.Children.Add(Col(statusRight, 1));
+ var status = new Border { Height = 18, Background = Sunken, BorderBrush = BorderDef, BorderThickness = new Thickness(0, 1, 0, 0), Padding = new Thickness(8, 0), Child = statusGrid };
+ DockPanel.SetDock(status, Dock.Bottom);
+
+ // ---- assemble ---------------------------------------------------------------
+ var bodyRow = new DockPanel { LastChildFill = true, Margin = new Thickness(5), Children = { stateCol, right, centreBox } };
+ var root = new DockPanel { LastChildFill = true, Background = NotaPalette.SurfaceInset, Children = { status, bodyRow } };
+
+ void Refresh()
+ {
+ scN = engine.DeviceScope(track, di, scope, kScope);
+ if (centreTab == 0 && curve is not null && !curve.Dragging)
+ curve.Set(scope, kTele, scN >= kTele + kCurve ? kCurve : 0, P(Mix), Math.Pow(10, ((P(Output) - 0.5) * 24 + Sc(S_CompDb)) / 20),
+ Sc(S_InPk), P(Crackle), NotaNum.F($"{ModeName().ToLowerInvariant()} · asym {Pct(Sc(S_Asym))}"));
+ if (centreTab == 1) SyncWearView();
+ if (centreTab == 2) SyncHarm();
+ RefreshAll();
+ }
+ ctx.AddDeviceRefresher(Refresh);
+ Refresh();
+ return root;
+
+ // local: a tab frame (bar + swapping body), optional extras on the right of the bar.
+ Control TabFrame(string[] tabs, ContentControl host, Func<int, Control> body, bool centered, Action<int>? changed, Control? extrasCtl)
+ {
+ int sel = 0;
+ var btns = new Border[tabs.Length];
+ void Hi()
+ {
+ for (int i = 0; i < tabs.Length; i++)
+ {
+ bool on = i == sel;
+ btns[i].Background = on ? Card2 : Brushes.Transparent;
+ btns[i].BorderBrush = on ? Brass : Brushes.Transparent;
+ var tb = (TextBlock)btns[i].Child!;
+ tb.Foreground = on ? AccentBright : TextTertiary;
+ tb.FontWeight = on ? FontWeight.SemiBold : FontWeight.Normal;
+ }
+ }
+ var bar = centered ? (Avalonia.Controls.Panel)new UniformGrid { Rows = 1 } : new StackPanel { Orientation = Orientation.Horizontal };
+ for (int i = 0; i < tabs.Length; i++)
+ {
+ int iv = i;
+ var b = new Border
+ {
+ Padding = new Thickness(9, 0), BorderThickness = new Thickness(0, 0, 0, 2), BorderBrush = Brushes.Transparent, Cursor = new Cursor(StandardCursorType.Hand),
+ Child = new TextBlock { Text = tabs[i], FontSize = 9, Foreground = TextTertiary, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center },
+ };
+ b.PointerPressed += (_, _) => { sel = iv; Hi(); host.Content = body(iv); changed?.Invoke(iv); };
+ btns[i] = b;
+ bar.Children.Add(b);
+ }
+ var barDock = new DockPanel { Height = 20, LastChildFill = centered };
+ if (extrasCtl != null) { var ex = new Border { Padding = new Thickness(0, 0, 8, 0), Child = extrasCtl }; DockPanel.SetDock(ex, Dock.Right); barDock.Children.Add(ex); }
+ if (!centered) DockPanel.SetDock(bar, Dock.Left);
+ barDock.Children.Add(bar);
+ var barBorder = new Border { BorderBrush = BorderDef, BorderThickness = new Thickness(0, 0, 0, 1), Child = barDock };
+ DockPanel.SetDock(barBorder, Dock.Top);
+ Hi();
+ host.Content = body(sel);
+ return new DockPanel { LastChildFill = true, Children = { barBorder, host } };
+ }
}
}
diff --git a/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs b/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
index 9c31a17b..76112299 100644
--- a/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
+++ b/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
@@ -1252,13 +1252,48 @@ public sealed class FactoryPresetCatalog : IFactoryPresets
Fx("autofilter", 7, "Talking Filter", ("Type", 0.333f), ("Slope", 1f), ("Freq", 0.45f), ("Res", 0.55f), ("Mod Target", 1f), ("Env Amt", 0.75f), ("Env Attack", 0.25f), ("Env Release", 0.55f), ("LFO Amt", 0.25f), ("LFO Rate", 0.60f), ("LFO Wave", 0.25f), ("Morph", 0.3f), ("Gain", 0.22f), ("Dry/Wet", 1f));
// ---- Nota Vintage (kind 8) — all params normalized 0..1. Mode 0 Vinyl/.2 Cassette/
- // .4 Reel/.6 VHS/.8 Tube/1 Analog; Tone 0.5 = neutral tilt; Output 0.5 = 0 dB.
- Fx("vintage", 8, "Dusty Vinyl", ("Mode", 0.0f), ("Drive", 0.35f), ("Tone", 0.42f), ("Wow", 0.35f), ("Flutter", 0.20f), ("Noise", 0.30f), ("Crackle", 0.55f), ("Wear", 0.25f), ("Mix", 1f), ("Output", 0.5f));
- Fx("vintage", 8, "Warped Cassette",("Mode", 0.2f), ("Drive", 0.45f), ("Tone", 0.40f), ("Wow", 0.45f), ("Flutter", 0.55f), ("Noise", 0.45f), ("Crackle", 0.10f), ("Wear", 0.40f), ("Mix", 1f), ("Output", 0.5f));
- Fx("vintage", 8, "Reel Warmth", ("Mode", 0.4f), ("Drive", 0.55f), ("Tone", 0.52f), ("Wow", 0.25f), ("Flutter", 0.20f), ("Noise", 0.18f), ("Crackle", 0.05f), ("Wear", 0.15f), ("Mix", 1f), ("Output", 0.5f));
- Fx("vintage", 8, "VHS Fever", ("Mode", 0.6f), ("Drive", 0.40f), ("Tone", 0.32f), ("Wow", 0.45f), ("Flutter", 0.70f), ("Noise", 0.50f), ("Crackle", 0.30f), ("Wear", 0.55f), ("Mix", 1f), ("Output", 0.55f));
- Fx("vintage", 8, "Tube Glow", ("Mode", 0.8f), ("Drive", 0.60f), ("Tone", 0.58f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0.08f), ("Crackle", 0f), ("Wear", 0.05f), ("Mix", 1f), ("Output", 0.5f));
- Fx("vintage", 8, "Analog Glue", ("Mode", 1.0f), ("Drive", 0.45f), ("Tone", 0.50f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0.05f), ("Crackle", 0f), ("Wear", 0f), ("Mix", 1f), ("Output", 0.5f));
+ // .4 Reel/.6 VHS/.8 Tube/1 Analog; Tone 0.5 = neutral tilt; Output 0.5 = 0 dB (±12);
+ // Tone Low/High 0.5 = 0 dB (±12); Tone Model 0 Warm/.5 Flat/1 Dark; Wow Rate free
+ // 0.1·40^v Hz (.462 = 0.55 Hz), synced round(v·5) → 4 bars/2 bars/1 bar/1/2/1/4/1/8;
+ // Flutter Rate 2·10^v Hz (.544 = 7 Hz); Hiss HP 20·100^v Hz; Output Stage 0 off/.5
+ // Tube/1 Analog; Oversampling .333 2×/.667 4×/1 8×. Unnamed → default (note the
+ // defaults carry some wow, flutter, noise and crackle — clean presets zero them).
+ // Vinyl
+ Fx("vintage", 8, "Dusty Vinyl", ("Mode", 0.0f), ("Drive", 0.35f), ("Tone", 0.42f), ("Wow", 0.35f), ("Flutter", 0.20f), ("Noise", 0.30f), ("Crackle", 0.55f), ("Wear", 0.25f), ("Mix", 1f), ("Output", 0.408f));
+ Fx("vintage", 8, "78 RPM Shellac", ("Mode", 0.0f), ("Drive", 0.50f), ("Tone", 0.35f), ("Tone Model", 1f), ("Tone High", 0.38f), ("Wow", 0.20f), ("Flutter", 0.10f), ("Noise", 0.50f), ("Hiss HP", 0.5f), ("Crackle", 0.80f), ("Wear", 0.70f), ("Output", 0.4625f));
+ Fx("vintage", 8, "Lo-Fi Beat Tape", ("Mode", 0.0f), ("Drive", 0.30f), ("Tone", 0.40f), ("Tone Low", 0.58f), ("Wow", 0.35f), ("Flutter", 0.15f), ("Noise", 0.20f), ("Crackle", 0.50f), ("Wear", 0.30f), ("Output", 0.392f));
+ Fx("vintage", 8, "Clean Crackle", ("Mode", 0.0f), ("Drive", 0.10f), ("Tone Model", 0.5f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0.12f), ("Crackle", 0.55f), ("Wear", 0.10f), ("Output", 0.35f));
+ Fx("vintage", 8, "Warped Record", ("Mode", 0.0f), ("Drive", 0.30f), ("Wow", 0.75f), ("Wow Rate", 0.298f), ("Flutter", 0.10f), ("Noise", 0.25f), ("Crackle", 0.40f), ("Wear", 0.35f), ("Stereo Drift", 1f), ("Output", 0.392f));
+ // Tape
+ Fx("vintage", 8, "Warped Cassette", ("Mode", 0.2f), ("Drive", 0.45f), ("Tone", 0.40f), ("Wow", 0.45f), ("Flutter", 0.55f), ("Noise", 0.45f), ("Crackle", 0.10f), ("Wear", 0.40f), ("Mix", 1f), ("Output", 0.5f));
+ Fx("vintage", 8, "Worn Deck", ("Mode", 0.2f), ("Drive", 0.52f), ("Tone Model", 1f), ("Wow", 0.30f), ("Flutter", 0.25f), ("Flutter Rate", 0.6f), ("Noise", 0.30f), ("Hiss HP", 0.48f), ("Crackle", 0.45f), ("Wear", 0.64f), ("Wear Follow", 1f), ("Mix", 0.78f), ("Output", 0.73f));
+ Fx("vintage", 8, "Chewed Tape", ("Mode", 0.2f), ("Drive", 0.50f), ("Wow", 0.80f), ("Flutter", 0.70f), ("Flutter Rate", 0.78f), ("Noise", 0.45f), ("Crackle", 0.20f), ("Wear", 0.85f), ("Stereo Drift", 1f), ("Output", 0.53f));
+ Fx("vintage", 8, "Walkman", ("Mode", 0.2f), ("Drive", 0.40f), ("Tone", 0.45f), ("Wow", 0.25f), ("Flutter", 0.45f), ("Flutter Rate", 0.70f), ("Noise", 0.35f), ("Crackle", 0f), ("Wear", 0.30f), ("Output", 0.5f));
+ Fx("vintage", 8, "Reel Warmth", ("Mode", 0.4f), ("Drive", 0.55f), ("Tone", 0.52f), ("Wow", 0.25f), ("Flutter", 0.20f), ("Noise", 0.18f), ("Crackle", 0.05f), ("Wear", 0.15f), ("Mix", 1f), ("Output", 0.617f));
+ Fx("vintage", 8, "Tape Saturation", ("Mode", 0.4f), ("Drive", 0.70f), ("Tone Low", 0.56f), ("Wow", 0.05f), ("Flutter", 0.05f), ("Noise", 0.06f), ("Crackle", 0f), ("Wear", 0f), ("Auto Comp", 1f), ("Oversampling", 0.333f));
+ Fx("vintage", 8, "Mastering Tape", ("Mode", 0.4f), ("Drive", 0.40f), ("Tone Model", 0.5f), ("Tone High", 0.54f), ("Wow", 0.02f), ("Flutter", 0.03f), ("Noise", 0.03f), ("Crackle", 0f), ("Wear", 0f), ("Auto Comp", 1f), ("Oversampling", 0.667f), ("Output", 0.47f));
+ Fx("vintage", 8, "Tape Sway 1/2", ("Mode", 0.4f), ("Drive", 0.35f), ("Wow", 0.50f), ("Wow Sync", 1f), ("Wow Rate", 0.6f), ("Flutter", 0.10f), ("Noise", 0.10f), ("Crackle", 0f), ("Wear", 0.10f), ("Output", 0.533f));
+ Fx("vintage", 8, "Seasick 2 Bars", ("Mode", 0.2f), ("Drive", 0.30f), ("Wow", 0.90f), ("Wow Sync", 1f), ("Wow Rate", 0.2f), ("Flutter", 0.10f), ("Noise", 0.15f), ("Crackle", 0f), ("Wear", 0.20f), ("Stereo Drift", 1f), ("Output", 0.47f));
+ // VHS
+ Fx("vintage", 8, "VHS Fever", ("Mode", 0.6f), ("Drive", 0.40f), ("Tone", 0.32f), ("Wow", 0.45f), ("Flutter", 0.70f), ("Noise", 0.50f), ("Crackle", 0.30f), ("Wear", 0.55f), ("Mix", 1f), ("Output", 0.45f));
+ Fx("vintage", 8, "VHS Dream", ("Mode", 0.6f), ("Drive", 0.30f), ("Tone Model", 1f), ("Wow", 0.45f), ("Wow Rate", 0.5f), ("Flutter", 0.50f), ("Noise", 0.30f), ("Crackle", 0.10f), ("Wear", 0.40f), ("Stereo Drift", 1f), ("Mix", 0.8f), ("Output", 0.5f));
+ Fx("vintage", 8, "Broken Tracking", ("Mode", 0.6f), ("Drive", 0.50f), ("Wow", 0.70f), ("Flutter", 0.90f), ("Flutter Rate", 0.875f), ("Noise", 0.60f), ("Crackle", 0.50f), ("Wear", 0.90f), ("Stereo Drift", 1f), ("Output", 0.5f));
+ // Tube
+ Fx("vintage", 8, "Tube Glow", ("Mode", 0.8f), ("Drive", 0.60f), ("Tone", 0.58f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0.08f), ("Crackle", 0f), ("Wear", 0.05f), ("Mix", 1f), ("Output", 0.7125f));
+ Fx("vintage", 8, "Tube Glue", ("Mode", 0.8f), ("Drive", 0.72f), ("Tone", 0.76f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0.18f), ("Crackle", 0f), ("Wear", 0.40f), ("Output Stage", 0.5f), ("Auto Comp", 1f), ("Mix", 0.64f), ("Output", 0.54f), ("Oversampling", 0.667f));
+ Fx("vintage", 8, "Even Warmth", ("Mode", 0.8f), ("Drive", 0.50f), ("Even Only", 1f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0f), ("Crackle", 0f), ("Wear", 0f), ("Auto Comp", 1f), ("Oversampling", 0.333f), ("Output", 0.446f));
+ Fx("vintage", 8, "Hot Preamp", ("Mode", 0.8f), ("Drive", 0.90f), ("Tone", 0.55f), ("Tone Low", 0.55f), ("Output Stage", 0.5f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0.05f), ("Crackle", 0f), ("Wear", 0f), ("Auto Comp", 1f), ("Oversampling", 0.667f), ("Output", 0.667f));
+ Fx("vintage", 8, "Parallel Tube", ("Mode", 0.8f), ("Drive", 0.95f), ("Output Stage", 0.5f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0f), ("Crackle", 0f), ("Wear", 0f), ("Auto Comp", 1f), ("Mix", 0.4f), ("Oversampling", 0.333f), ("Output", 0.54f));
+ // Analog
+ Fx("vintage", 8, "Analog Glue", ("Mode", 1.0f), ("Drive", 0.45f), ("Tone", 0.50f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0.05f), ("Crackle", 0f), ("Wear", 0f), ("Mix", 1f), ("Output", 0.533f));
+ Fx("vintage", 8, "Console Bus", ("Mode", 1.0f), ("Drive", 0.35f), ("Output Stage", 1f), ("Tone Low", 0.53f), ("Tone High", 0.53f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0.04f), ("Crackle", 0f), ("Wear", 0f), ("Auto Comp", 1f), ("Oversampling", 0.333f));
+ Fx("vintage", 8, "Transformer Color", ("Mode", 1.0f), ("Drive", 0.55f), ("Even Only", 1f), ("Output Stage", 1f), ("Tone Low", 0.60f), ("Tone High", 0.45f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0f), ("Crackle", 0f), ("Wear", 0f), ("Output", 0.533f));
+ Fx("vintage", 8, "Crunch Drive", ("Mode", 1.0f), ("Drive", 0.95f), ("Tone", 0.60f), ("Output Stage", 0.5f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0f), ("Crackle", 0f), ("Wear", 0f), ("Auto Comp", 1f), ("Oversampling", 0.667f));
+ // Special
+ Fx("vintage", 8, "Telephone Line", ("Mode", 0.6f), ("Drive", 0.60f), ("Tone Model", 1f), ("Tone Low", 0.10f), ("Tone High", 0.30f), ("Wow", 0f), ("Flutter", 0.10f), ("Noise", 0.25f), ("Hiss HP", 0.65f), ("Crackle", 0.20f), ("Wear", 1f), ("Output", 0.5f));
+ Fx("vintage", 8, "AM Radio", ("Mode", 0.6f), ("Drive", 0.50f), ("Tone Low", 0.15f), ("Tone High", 0.30f), ("Wow", 0.05f), ("Flutter", 0.30f), ("Noise", 0.50f), ("Hiss HP", 0.85f), ("Crackle", 0.25f), ("Wear", 0.90f), ("Output", 0.5f));
+ Fx("vintage", 8, "Neutral Saturator", ("Character", 0f), ("Drive", 0.50f), ("Tone Model", 0.5f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0f), ("Crackle", 0f), ("Wear", 0f), ("Auto Comp", 1f), ("Oversampling", 0.667f));
+ Fx("vintage", 8, "Gated Dust", ("Character", 0f), ("Drive", 0f), ("Wow", 0f), ("Flutter", 0f), ("Noise", 0.35f), ("Hiss HP", 0.5f), ("Crackle", 0.30f), ("Wear", 0.20f), ("Wear Follow", 1f), ("Output", 0.42f));
// ---- Nota Auto Pan (kind 9) — all params normalized 0..1. Waveform 0 Sine/.25 Tri/
// .5 Saw/.75 Sqr/1 S&H; Phase 0.5 = 180° (pan), 0 = tremolo; Rate exp 0.01..40 Hz.
diff --git a/src/managed/Nota.Mcp/Tools/DeviceTools.cs b/src/managed/Nota.Mcp/Tools/DeviceTools.cs
index 6863bf51..d08b375e 100644
--- a/src/managed/Nota.Mcp/Tools/DeviceTools.cs
+++ b/src/managed/Nota.Mcp/Tools/DeviceTools.cs
@@ -67,10 +67,10 @@ public sealed class DeviceTools(IAudioEngine engine, IEngineDispatch dispatch, I
[McpServerTool(Name = "load_device_file"), Description("Load an audio file into a device that takes one — Nota Chamber: a user impulse response (WAV / FLAC / MP3; mono, stereo or 4-channel true stereo), which also selects it. Returns true on success.")]
public Task<bool> LoadDeviceFile(int trackId, int deviceIndex, [Description("Absolute path to the audio file")] string path) => Mutate(() => E.DeviceLoadFile(trackId, deviceIndex, path));
- [McpServerTool(Name = "get_device_text"), Description("Read a device's resource text. Nota Chamber: id 0 = current IR name, 1 = its category, 2 = the loaded user IR's name, 10 = the built-in IR list (name, category, seconds per line; the IR param selects entry round(v × 16), 1.0 = the user IR). Nota Lens: id 0 = the analysis summary, 1 = the third-octave band table, 2 = the scope measurements, 3 = the strongest spectral peaks, 4 = the A/B cursor measurements — or use read_analyzer, which returns all of it parsed. Delay (kind 3): id 0 = a one-line summary of what it is doing now (sync division or free times, ping-pong, feedback, mix, or that it is frozen). Reverb (kind 2): id 0 = a one-line summary (algorithm, RT60, pre-delay, diffusion, mix, early reflections / vintage, or that the tail is frozen). Compressor (kind 1): id 0 = a one-line summary (character, threshold, ratio, knee, attack / release, detector, range, mix, the reduction right now, external key / unlinked / Listen) — or use read_dynamics for the numbers. Auto Filter (kind 7): id 0 = a one-line summary (type, slope, cutoff, Q, what the envelope and LFO drive and by how much, drive, mix, sidechain key), 1 = the live reading (modulated cutoff with its note, resonance, envelope level, LFO value and phase, onsets counted), 2 = a guide to what each 0..1 parameter value means — or use read_filter_motion for the numbers.")]
+ [McpServerTool(Name = "get_device_text"), Description("Read a device's resource text. Nota Chamber: id 0 = current IR name, 1 = its category, 2 = the loaded user IR's name, 10 = the built-in IR list (name, category, seconds per line; the IR param selects entry round(v × 16), 1.0 = the user IR). Nota Lens: id 0 = the analysis summary, 1 = the third-octave band table, 2 = the scope measurements, 3 = the strongest spectral peaks, 4 = the A/B cursor measurements — or use read_analyzer, which returns all of it parsed. Delay (kind 3): id 0 = a one-line summary of what it is doing now (sync division or free times, ping-pong, feedback, mix, or that it is frozen). Reverb (kind 2): id 0 = a one-line summary (algorithm, RT60, pre-delay, diffusion, mix, early reflections / vintage, or that the tail is frozen). Compressor (kind 1): id 0 = a one-line summary (character, threshold, ratio, knee, attack / release, detector, range, mix, the reduction right now, external key / unlinked / Listen) — or use read_dynamics for the numbers. Auto Filter (kind 7): id 0 = a one-line summary (type, slope, cutoff, Q, what the envelope and LFO drive and by how much, drive, mix, sidechain key), 1 = the live reading (modulated cutoff with its note, resonance, envelope level, LFO value and phase, onsets counted), 2 = a guide to what each 0..1 parameter value means — or use read_filter_motion for the numbers. Nota Vintage (kind 8): id 0 = a one-line summary (character, drive, tone model and shelves, wow / flutter with their rates, noise, crackle, wear, stage, mix, output, oversampling, auto-comp), 1 = the live reading (in / out peaks, THD with the 2nd and 3rd harmonics, asymmetry, wow and flutter in cents, band-limit, hiss level, auto-comp gain), 2 = a guide to what each 0..1 parameter value means — or use read_vintage for the numbers.")]
public Task<string> GetDeviceText(int trackId, int deviceIndex, int id) => Read(() => E.DeviceText(trackId, deviceIndex, id));
- [McpServerTool(Name = "device_action"), Description("Run a device's own command — the few things that are actions rather than parameters. Delay (kind 3): id 0 clears the loop (empties the delay buffer, so whatever is still circulating stops; useful after Freeze). Reverb (kind 2): id 0 kills the tail (empties the reverb's buffers, so whatever is still ringing — or frozen — stops). Auto Filter (kind 7): id 0 restarts the LFO (from its start phase; in Sync the cycle is re-anchored to the current beat), id 1 resets the envelope follower (drops a held peak). Devices without a command ignore the call.")]
+ [McpServerTool(Name = "device_action"), Description("Run a device's own command — the few things that are actions rather than parameters. Delay (kind 3): id 0 clears the loop (empties the delay buffer, so whatever is still circulating stops; useful after Freeze). Reverb (kind 2): id 0 kills the tail (empties the reverb's buffers, so whatever is still ringing — or frozen — stops). Auto Filter (kind 7): id 0 restarts the LFO (from its start phase; in Sync the cycle is re-anchored to the current beat), id 1 resets the envelope follower (drops a held peak). Nota Vintage (kind 8): id 0 resets the wear (restarts the wow and flutter at their zero phase and silences a ringing crackle). Devices without a command ignore the call.")]
public Task DeviceAction(int trackId, int deviceIndex, [Description("Command id — see the device's list in this description")] int id,
int intArg = 0, float floatArg = 0) => Mutate(() => E.DeviceAction(trackId, deviceIndex, id, intArg, floatArg));
@@ -159,6 +159,41 @@ public sealed class DeviceTools(IAudioEngine engine, IEngineDispatch dispatch, I
Math.Round(V(5) * 360, 1), Db(V(6)), Db(V(7)), (int)V(11), recent, HzOf(lo), HzOf(hi), V(9));
});
+ public sealed record VintageReading(string Summary, string Live, string Character, double InputPeakDb, double OutputPeakDb,
+ double ThdPercent, double TestLevelDb, double[] HarmonicsDb, double Asymmetry, double WowCents, double WowHz,
+ double FlutterCents, double FlutterHz, double PitchMinCentsLast4s, double PitchMaxCentsLast4s, double BandLimitHz,
+ double HissDbfs, double AutoCompDb, double TapeDelayMs, double SampleRate);
+
+ [McpServerTool(Name = "read_vintage"), Description(
+ "Read what a Nota Vintage (built-in effect kind 8) is doing right now: the character (Vinyl / Cassette / Reel / VHS / "
+ + "Tube / Analog), the input / output peaks, the THD of its saturation at the input's level (or −6 dBFS when silent) with "
+ + "the 2nd…7th harmonics in dB relative to the fundamental, the curve's asymmetry (0..1 — even harmonics), the wow and "
+ + "flutter depth in ± cents with their rates, the pitch drift's range over the last ~4 s, the band-limit corner (0 = open), "
+ + "the hiss level in dBFS, the auto-comp gain and the tape delay the wow adds. Peaks and the pitch history move only "
+ + "while audio plays through the track. Use get_device_text id 2 for what each parameter value means.")]
+ public Task<VintageReading> ReadVintage(int trackId, int deviceIndex) => Read(() =>
+ {
+ const int tele = 32, curve = 48, hist = 1024;
+ var sc = new float[tele + curve + 2 * hist];
+ int n = E.DeviceScope(trackId, deviceIndex, sc, sc.Length);
+ float V(int i) => n > i ? sc[i] : 0f;
+ static double Db(float lin) => lin > 1e-6f ? Math.Round(20 * Math.Log10(lin), 1) : -120;
+ string[] modes = { "Vinyl", "Cassette", "Reel", "VHS", "Tube", "Analog" };
+ double lo = 0, hi = 0;
+ if (n >= sc.Length)
+ for (int i = 0; i < hist; i++)
+ {
+ double c = sc[tele + curve + i] + sc[tele + curve + hist + i];
+ lo = Math.Min(lo, c); hi = Math.Max(hi, c);
+ }
+ var h = new double[6];
+ for (int k = 0; k < 6; k++) h[k] = Math.Round(V(14 + k), 1);
+ return new VintageReading(E.DeviceText(trackId, deviceIndex, 0), E.DeviceText(trackId, deviceIndex, 1),
+ modes[Math.Clamp((int)V(23), 0, 5)], Db(V(0)), Db(V(1)), Math.Round(V(12) * 100, 2), Db(V(20)), h, Math.Round(V(21), 3),
+ Math.Round(V(8), 1), Math.Round(V(6), 3), Math.Round(V(9), 1), Math.Round(V(7), 2), Math.Round(lo, 1), Math.Round(hi, 1),
+ Math.Round(V(10)), Math.Round(V(11), 1), Math.Round(V(22), 1), V(3) > 0 ? Math.Round(V(5) / V(3) * 1000, 2) : 0, V(3));
+ });
+
public sealed record AnalyzerBand(double Hz, double Db);
public sealed record AnalyzerPeak(double Hz, double Db, string Note);
public sealed record AnalyzerReading(string Summary, string Scope, string Cursors, AnalyzerBand[] Bands, AnalyzerPeak[] Peaks);
diff --git a/src/native/nota.engine/src/Vintage.h b/src/native/nota.engine/src/Vintage.h
index e2705912..31e48577 100644
--- a/src/native/nota.engine/src/Vintage.h
+++ b/src/native/nota.engine/src/Vintage.h
@@ -6,13 +6,23 @@
// Vinyl / Cassette / Reel-to-Reel / VHS / Tube / Analog. Each Mode sets a character
// table (saturation shape + drive, tone tilt, head bump, band-limit, and the baseline
// amounts of hiss, crackle/dust and wow/flutter). On top sit global knobs — Drive,
-// Tone, Wow, Flutter, Noise, Crackle, Wear (an age macro), Mix and Output.
+// Tone, Wow, Flutter, Noise, Crackle, Wear (an age macro), Mix and Output — and the
+// finer controls: a Warm / Flat / Dark tone model with low + high shelves, Character
+// (the era's voicing on / off), wow and flutter rates (wow free or tempo-synced), a hiss
+// high-pass, wear that follows the input, stereo drift, a Tube / Analog output stage,
+// an even-harmonics-only saturation and automatic gain compensation.
//
-// in ─▶ wow/flutter delay ─▶ saturate(shape) ─▶ tone/bump/band-limit/hp ─▶ +hiss +crackle ─▶ mix ─▶ out
+// in ─▶ wow/flutter delay ─▶ saturate(shape) ─▶ stage ─▶ tone/bump/shelves/band/hp
+// ─▶ +hiss +crackle ─▶ auto-comp ─▶ mix ─▶ out
//
// Header-only, allocation-free after construction (fixed delay ring + per-channel
// biquad state). Params are normalized 0..1 and denormalized in process(), so
// persistence / automation / clone flow generically through the base Device. JUCE-free.
+//
+// Telemetry for the card and MCP (scopeRead): kTele live values, then kCurve points of
+// the static transfer curve (input 0..1 → output, the same function process() runs),
+// then the wow and flutter pitch histories in cents (kHist points, 4 ms each, oldest →
+// newest). deviceText: 0 = status line, 1 = live reading, 2 = parameter guide.
#pragma once
@@ -21,8 +31,11 @@
#include <algorithm>
#include <atomic>
+#include <chrono>
#include <cmath>
#include <cstdint>
+#include <cstdio>
+#include <string>
#include <vector>
namespace nota {
@@ -31,9 +44,55 @@ class Vintage : public Device {
public:
// Param layout — order is the persisted/automation layout. APPEND ONLY.
enum { Mode = 0, Drive, Tone, Wow, Flutter, Noise, Crackle, Wear, Mix, Output,
- Oversampling, // 0..1 → Off/2×/4×/8× (appended last)
+ Oversampling, // 0..1 → Off/2×/4×/8×
+ ToneLow, // low shelf 120 Hz, 0.5 = 0 dB, ±12 dB
+ ToneHigh, // high shelf 6 kHz, 0.5 = 0 dB, ±12 dB
+ ToneModel, // 0 Warm (the era's tilt + head bump), 0.5 Flat, 1 Dark
+ Character, // the Mode's voicing on (1) / off (0)
+ AutoComp, // automatic gain compensation
+ WowRate, // free 0.1·40^v Hz; synced round(v·5) → 4 bars … 1/8
+ FlutterRate, // 2·10^v Hz
+ WowSync, // wow rate follows the tempo
+ HissHp, // hiss high-pass 20·100^v Hz
+ WearFollow, // hiss + crackle follow the input level
+ StereoDrift, // right channel wow/flutter a quarter-cycle apart, own crackle
+ OutputStage, // 0 off, 0.5 Tube, 1 Analog
+ EvenOnly, // saturation adds even harmonics only
kNumParams };
+ // Telemetry slots (scopeRead).
+ enum {
+ S_InPk = 0, // input peak (decaying), linear
+ S_OutPk, // output peak (decaying), linear
+ S_Cpu, // share of real time spent in process()
+ S_SampleRate,
+ S_Bpm, // 0 until the transport has run
+ S_Delay, // the wow/flutter tape delay in samples (0 when off)
+ S_WowHz, // effective wow rate
+ S_FlutHz, // flutter rate
+ S_WowCents, // wow depth, ± cents
+ S_FlutCents, // flutter depth, ± cents
+ S_BandHz, // band-limit corner (0 = open)
+ S_HissDb, // hiss level, dBFS RMS (−120 = none)
+ S_Thd, // THD of the static curve at the test level, 0..1
+ S_H1, // harmonic levels 1..7, dB relative to the fundamental (H1 = 0)
+ S_H7 = S_H1 + 6,
+ S_TestLvl, // the level the THD was measured at (the input peak, or −6 dBFS)
+ S_Asym, // curve asymmetry 0..1 (|f(a)+f(−a)| / |f(a)|)
+ S_CompDb, // auto-comp gain now, dB
+ S_Mode,
+ S_Crackles, // crackle clicks since load
+ S_HistLen, // points per history (kHist)
+ S_HistMs, // ms per history point
+ S_WowPhase, // wow phase 0..1
+ S_Reserved0, S_Reserved1, S_Reserved2, S_Reserved3,
+ kTele = 32
+ };
+ static constexpr int kCurve = 48;
+ static constexpr int kHist = 1024; // 4 ms per point → ~4 s
+ static constexpr int kScopeTotal = kTele + kCurve + 2 * kHist;
+ enum { A_ResetWear = 0 }; // deviceAction ids
+
Vintage() {
p_[Mode].store(0.0f); // Vinyl
p_[Drive].store(0.35f);
@@ -45,125 +104,278 @@ public:
p_[Wear].store(0.20f);
p_[Mix].store(1.0f);
p_[Output].store(0.5f); // 0 dB
+ p_[ToneLow].store(0.5f);
+ p_[ToneHigh].store(0.5f);
+ p_[ToneModel].store(0.0f); // Warm = the voicing older projects had
+ p_[Character].store(1.0f);
+ p_[WowRate].store(kWowRateDefault); // 0.55 Hz
+ p_[FlutterRate].store(kFlutRateDefault); // 7 Hz
}
void setSampleRate(double sr, int32_t maxBlock) override {
sr_ = sr > 0 ? sr : 44100.0;
for (int c = 0; c < 2; ++c) {
toneSh_[c].reset(); bumpSh_[c].reset(); bandLp_[c].reset(); hp_[c].reset();
+ lowSh_[c].reset(); highSh_[c].reset();
+ hissHp_[c] = 0.0f; hissPrev_[c] = 0.0f; clickEnv_[c] = 0.0f;
for (int i = 0; i < kDelay; ++i) dl_[c][i] = 0.0f;
}
- dw_ = 0; wowPh_ = 0.0; flutPh_ = 0.0; clickEnv_ = 0.0f;
+ dw_ = 0; wowPh_ = 0.0; flutPh_ = 0.0; flutNoise_ = 0.0f; flutNoiseT_ = 0.0f;
+ inEnv_ = 0.0f; inMs_ = 0.0; wetMs_ = 0.0; compG_ = 1.0f;
maxFrames_ = maxBlock > 0 ? maxBlock : 4096;
os_.prepare(maxFrames_);
- dry_.assign(maxFrames_ * 2, 0.0f); click_.assign(maxFrames_, 0.0f);
+ dry_.assign(maxFrames_ * 2, 0.0f); click_.assign(maxFrames_ * 2, 0.0f); follow_.assign(maxFrames_, 1.0f);
+ srA_.store((float)sr_, std::memory_order_relaxed);
}
- void process(float* buf, int32_t frames) override {
- const int m = std::clamp((int)std::lround(get(Mode) * 5.0f), 0, kModes - 1);
- const ModeChar& md = kMode[m];
- const float drive = std::clamp(get(Drive), 0.0f, 1.0f);
- const float tone = std::clamp(get(Tone), 0.0f, 1.0f);
- const float wow = std::clamp(get(Wow), 0.0f, 1.0f);
- const float flutter = std::clamp(get(Flutter), 0.0f, 1.0f);
- const float noise = std::clamp(get(Noise), 0.0f, 1.0f);
- const float crackle = std::clamp(get(Crackle), 0.0f, 1.0f);
- const float wear = std::clamp(get(Wear), 0.0f, 1.0f);
- const float mix = std::clamp(get(Mix), 0.0f, 1.0f);
- const float outGain = std::pow(10.0f, (get(Output) - 0.5f) * 24.0f / 20.0f); // ±12 dB
+ void setTransport(double beatStart, double spb, bool playing) override {
+ beatStart_ = beatStart; spb_ = spb > 0 ? spb : 0.0; playing_ = playing;
+ }
+
+ void deviceAction(int32_t id, int32_t, float) override {
+ if (id == A_ResetWear) resetReq_.store(true, std::memory_order_relaxed);
+ }
- // Saturation drive + asymmetric bias (bias grows with drive → even harmonics).
- const float g = 1.0f + md.driveMul * drive * 3.0f;
- const float bias = md.bias * (0.3f + drive);
- const float biasDC = std::tanh(bias);
- const float makeup = 1.0f / (0.7f + 0.5f * md.driveMul * drive);
-
- // Tone tilt (mode voicing + user Tone) as a high shelf; static head bump; the
- // band-limit narrows with Wear; the low cut models the era's limited low end.
- const double tiltDb = (md.tilt + (tone - 0.5)) * 14.0;
- const double bandHz = std::clamp(md.bandHz * (1.0 - 0.55 * wear), 1500.0, sr_ * 0.45);
- Biquad::Coef toneC = Biquad::highShelf(sr_, 3500.0, tiltDb);
- Biquad::Coef bumpC = Biquad::lowShelf (sr_, 90.0, md.bumpDb);
- Biquad::Coef bandC = Biquad::lowpass (sr_, bandHz, 0.707);
+ void process(float* buf, int32_t frames) override {
+ const auto t0 = std::chrono::steady_clock::now();
+ if (resetReq_.exchange(false, std::memory_order_relaxed)) {
+ wowPh_ = 0.0; flutPh_ = 0.0; flutNoise_ = flutNoiseT_ = 0.0f;
+ clickEnv_[0] = clickEnv_[1] = 0.0f;
+ }
+ const Params P = params();
+ const ModeChar& md = P.md;
+ const Curve cv = curveFor(P);
+
+ // Tone: the model's tilt (Warm = the era's tilt + head bump, Flat = the Tone knob
+ // alone, Dark = a lower, darker tilt) + the low / high shelves; the band-limit
+ // narrows with Wear; the low cut models the era's limited low end.
+ const double tiltDb = (P.model == 0 ? md.tilt + (P.tone - 0.5) : P.model == 1 ? (P.tone - 0.5) : (P.tone - 0.5) - 0.3) * 14.0;
+ const double tiltHz = P.model == 2 ? 2000.0 : 3500.0;
+ const double bumpDb = P.model == 0 ? md.bumpDb : 0.0;
+ const double bandHz = bandFor(P);
+ Biquad::Coef toneC = Biquad::highShelf(sr_, tiltHz, tiltDb);
+ Biquad::Coef bumpC = Biquad::lowShelf (sr_, 90.0, bumpDb);
+ Biquad::Coef bandC = bandHz > 0 ? Biquad::lowpass(sr_, bandHz, 0.707) : Biquad::Coef{};
Biquad::Coef hpC = Biquad::highpass (sr_, md.hpHz, 0.707);
- for (int c = 0; c < 2; ++c) { toneSh_[c].set(toneC); bumpSh_[c].set(bumpC); bandLp_[c].set(bandC); hp_[c].set(hpC); }
+ Biquad::Coef lowC = Biquad::lowShelf (sr_, 120.0, (P.low - 0.5) * 24.0);
+ Biquad::Coef highC = Biquad::highShelf(sr_, 6000.0, (P.high - 0.5) * 24.0);
+ for (int c = 0; c < 2; ++c) {
+ toneSh_[c].set(toneC); bumpSh_[c].set(bumpC); bandLp_[c].set(bandC); hp_[c].set(hpC);
+ lowSh_[c].set(lowC); highSh_[c].set(highC);
+ }
- // Wow (slow) + flutter (fast) pitch modulation via a fractional delay line.
- const double baseDelay = 0.006 * sr_;
- const double wowSamp = md.wowMul * wow * 0.0040 * sr_;
- const double flutSamp = md.flutMul * flutter * 0.0015 * sr_;
+ // Wow (slow) + flutter (fast) pitch modulation via a fractional delay line. Wow
+ // runs free or locked to the beat; flutter wanders a little more as Wear rises.
+ const double baseDelay = kBaseDelayS * sr_;
+ const double wowSamp = md.wowMul * P.wow * 0.0040 * sr_;
+ const double flutSamp = md.flutMul * P.flutter * 0.0015 * sr_;
const bool modOn = (wowSamp + flutSamp) > 0.25;
- const double wowInc = 0.55 / sr_; // ~0.55 Hz
- const double flutInc = 7.0 / sr_; // ~7 Hz
-
- const float hissLvl = noise * md.noiseMul * (1.0f + wear) * 0.05f;
- const float crkAmt = crackle * md.crackleMul * (1.0f + 2.0f * wear);
- const float crkProb = crkAmt * 0.0012f;
+ const bool sync = P.wowSync && spb_ > 0.0;
+ const double wowHz = wowHzFor(P);
+ const double flutHz = flutHzFor(P);
+ const double wowInc = wowHz / sr_;
+ const double flutInc = flutHz / sr_;
+ const double stereoOff = P.stereo ? 0.25 : 0.0;
+ const float flutWander = 0.35f * P.wear;
+
+ const float hissLvl = P.noise * md.noiseMul * (1.0f + P.wear) * 0.05f;
+ const float crkAmt = P.crackle * md.crackleMul * (1.0f + 2.0f * P.wear);
+ const float crkProb = crkAmt * 0.0012f;
+ const float hissHpA = (float)std::exp(-2.0 * kPi * expMap(get(HissHp), 20.0, 2000.0) / sr_);
+ const float envAtt = (float)std::exp(-1.0 / (0.005 * sr_));
+ const float envRel = (float)std::exp(-1.0 / (0.150 * sr_));
+ const double msA = std::exp(-1.0 / (0.3 * sr_)); // auto-comp RMS window
+ const float compA = (float)std::exp(-1.0 / (0.05 * sr_));
+ const int histStep = std::max(1, (int)std::lround(sr_ * kHistMs * 0.001));
+
+ const float mix = P.mix;
+ const float outGain = std::pow(10.0f, (get(Output) - 0.5f) * 24.0f / 20.0f); // ±12 dB
- // Oversample the memoryless saturation only. Wow/flutter (a pitch-mod delay)
- // runs at base rate before the up-sampling; the tone/bump/band-limit filters
- // and the additive hiss + crackle stay at base rate after it.
+ // Oversample the memoryless saturation + stage only. Wow/flutter (a pitch-mod
+ // delay) runs at base rate before the up-sampling; the filters and the additive
+ // hiss + crackle stay at base rate after it.
const int osIdx = std::clamp((int)std::lround(get(Oversampling) * 3.0f), 0, 3);
os_.setActive(1 << osIdx);
- const int shape = md.shape;
if (frames > maxFrames_) frames = maxFrames_;
+ float inPk = 0.0f, outPk = 0.0f;
- // --- Base-rate pre: wow/flutter tap into buf, crackle per sample, stash dry. ---
+ // --- Base-rate pre: wow/flutter tap into buf, crackle + input follower, stash dry. ---
for (int32_t i = 0; i < frames; ++i) {
const float dryL = buf[i * 2], dryR = buf[i * 2 + 1];
dry_[i * 2] = dryL; dry_[i * 2 + 1] = dryR;
+ const float a = std::max(std::fabs(dryL), std::fabs(dryR));
+ inPk = std::max(inPk, a);
+ inEnv_ = a > inEnv_ ? a + (inEnv_ - a) * envAtt : a + (inEnv_ - a) * envRel;
+ follow_[i] = P.follow ? std::min(1.0f, inEnv_ * 4.0f) : 1.0f;
+
+ // Beat-locked wow: the phase is the beat position within the division.
+ if (sync && playing_) {
+ const double beats = kSyncBeats[std::clamp((int)std::lround(get(WowRate) * 5.0f), 0, 5)];
+ const double beat = beatStart_ + (double)i / spb_;
+ wowPh_ = beat / beats - std::floor(beat / beats);
+ }
+ // Flutter wander: a smoothed random target, re-drawn a few times per cycle.
+ if (flutWander > 0.0f) {
+ if (whiteUni() < flutInc * 3.0) flutNoiseT_ = whiteUni() * 2.0f - 1.0f;
+ flutNoise_ += (flutNoiseT_ - flutNoise_) * 0.002f;
+ }
dl_[0][dw_] = dryL; dl_[1][dw_] = dryR;
float wl = dryL, wr = dryR;
+ double centsW = 0.0, centsF = 0.0;
if (modOn) {
- const double lfo = wowSamp * std::sin(2.0 * kPi * wowPh_) + flutSamp * std::sin(2.0 * kPi * flutPh_);
- const double tap = baseDelay + lfo;
- wl = readFrac(0, tap); wr = readFrac(1, tap);
+ const double fl = 1.0 + flutWander * flutNoise_;
+ const double sW = std::sin(2.0 * kPi * wowPh_), sF = std::sin(2.0 * kPi * flutPh_);
+ wl = readFrac(0, baseDelay + wowSamp * sW + flutSamp * fl * sF);
+ if (stereoOff > 0.0) {
+ const double sWr = std::sin(2.0 * kPi * (wowPh_ + stereoOff)), sFr = std::sin(2.0 * kPi * (flutPh_ + stereoOff));
+ wr = readFrac(1, baseDelay + wowSamp * sWr + flutSamp * fl * sFr);
+ } else {
+ wr = readFrac(1, baseDelay + wowSamp * sW + flutSamp * fl * sF);
+ }
+ // Pitch = the read head's speed: 1 − dD/dn. In cents ≈ −1731 · dD/dn.
+ centsW = -1731.2 * wowSamp * 2.0 * kPi * wowInc * std::cos(2.0 * kPi * wowPh_);
+ centsF = -1731.2 * flutSamp * fl * 2.0 * kPi * flutInc * std::cos(2.0 * kPi * flutPh_);
}
dw_ = (dw_ + 1) & (kDelay - 1);
wowPh_ += wowInc; if (wowPh_ >= 1.0) wowPh_ -= 1.0;
flutPh_ += flutInc; if (flutPh_ >= 1.0) flutPh_ -= 1.0;
- float click = 0.0f;
+ if (++histCount_ >= histStep) {
+ histCount_ = 0;
+ const uint32_t hw = histW_.load(std::memory_order_relaxed);
+ histWow_[hw & (kHist - 1)] = (float)centsW;
+ histFlut_[hw & (kHist - 1)] = (float)centsF;
+ histW_.store(hw + 1, std::memory_order_relaxed);
+ }
+
+ float cl = 0.0f, cr = 0.0f;
if (crkAmt > 0.0f) {
- clickEnv_ *= 0.55f;
- if (whiteUni() < crkProb) clickEnv_ = (whiteUni() * 0.7f + 0.2f) * (whiteUni() < 0.5f ? -1.0f : 1.0f);
- click = clickEnv_ * 0.6f;
+ for (int c = 0; c < (P.stereo ? 2 : 1); ++c) {
+ clickEnv_[c] *= 0.55f;
+ if (whiteUni() < crkProb) {
+ clickEnv_[c] = (whiteUni() * 0.7f + 0.2f) * (whiteUni() < 0.5f ? -1.0f : 1.0f);
+ crackles_.fetch_add(1, std::memory_order_relaxed);
+ }
+ }
+ cl = clickEnv_[0] * 0.6f;
+ cr = (P.stereo ? clickEnv_[1] : clickEnv_[0]) * 0.6f;
}
- click_[i] = click;
+ click_[i * 2] = cl * follow_[i]; click_[i * 2 + 1] = cr * follow_[i];
buf[i * 2] = wl; buf[i * 2 + 1] = wr;
}
- // --- Oversampled saturation (memoryless). ---
+ // --- Oversampled saturation + output stage (memoryless). ---
os_.process(buf, frames, [&](float& l, float& r, int /*i*/) {
- l = saturate(shape, l * g, bias, biasDC) * makeup;
- r = saturate(shape, r * g, bias, biasDC) * makeup;
+ l = cv.eval(l);
+ r = cv.eval(r);
});
- // --- Base-rate post: tone/bump/band/hp, + hiss + crackle, then dry/wet. ---
+ // --- Base-rate post: tone/bump/shelves/band/hp, + hiss + crackle, auto-comp, dry/wet. ---
for (int32_t i = 0; i < frames; ++i) {
float yL = buf[i * 2], yR = buf[i * 2 + 1];
- yL = toneSh_[0].process(yL); yL = bumpSh_[0].process(yL); yL = bandLp_[0].process(yL); yL = hp_[0].process(yL);
- yR = toneSh_[1].process(yR); yR = bumpSh_[1].process(yR); yR = bandLp_[1].process(yR); yR = hp_[1].process(yR);
- if (hissLvl > 0.0f) { yL += (whiteUni() * 2.0f - 1.0f) * hissLvl; yR += (whiteUni() * 2.0f - 1.0f) * hissLvl; }
- yL += click_[i]; yR += click_[i];
- buf[i * 2] = dry_[i * 2] * (1.0f - mix) + yL * outGain * mix;
- buf[i * 2 + 1] = dry_[i * 2 + 1] * (1.0f - mix) + yR * outGain * mix;
+ yL = toneSh_[0].process(yL); yL = bumpSh_[0].process(yL); yL = lowSh_[0].process(yL); yL = highSh_[0].process(yL);
+ yL = bandLp_[0].process(yL); yL = hp_[0].process(yL);
+ yR = toneSh_[1].process(yR); yR = bumpSh_[1].process(yR); yR = lowSh_[1].process(yR); yR = highSh_[1].process(yR);
+ yR = bandLp_[1].process(yR); yR = hp_[1].process(yR);
+ if (hissLvl > 0.0f) {
+ const float g = hissLvl * follow_[i];
+ yL += hiss(0, hissHpA) * g;
+ yR += hiss(1, hissHpA) * g;
+ }
+ yL += click_[i * 2]; yR += click_[i * 2 + 1];
+ if (P.autoComp) {
+ const float dl = dry_[i * 2], dr = dry_[i * 2 + 1];
+ inMs_ = inMs_ * msA + (1.0 - msA) * 0.5 * (dl * dl + dr * dr);
+ wetMs_ = wetMs_ * msA + (1.0 - msA) * 0.5 * (yL * yL + yR * yR);
+ if (inMs_ > 1e-8 && wetMs_ > 1e-10) {
+ const float want = (float)std::clamp(std::sqrt(inMs_ / wetMs_), 0.125, 8.0); // ±18 dB
+ compG_ = want + (compG_ - want) * compA;
+ }
+ yL *= compG_; yR *= compG_;
+ } else if (compG_ != 1.0f) {
+ compG_ = 1.0f; inMs_ = wetMs_ = 0.0;
+ }
+ const float oL = dry_[i * 2] * (1.0f - mix) + yL * outGain * mix;
+ const float oR = dry_[i * 2 + 1] * (1.0f - mix) + yR * outGain * mix;
+ buf[i * 2] = oL; buf[i * 2 + 1] = oR;
+ outPk = std::max(outPk, std::max(std::fabs(oL), std::fabs(oR)));
+ }
+
+ const float fall = std::exp(-(float)frames / (float)(0.3 * sr_)); // ~300 ms peak fall
+ inPkA_.store(std::max(inPk, inPkA_.load(std::memory_order_relaxed) * fall), std::memory_order_relaxed);
+ outPkA_.store(std::max(outPk, outPkA_.load(std::memory_order_relaxed) * fall), std::memory_order_relaxed);
+ compA_.store(compG_, std::memory_order_relaxed);
+ wowPhA_.store((float)wowPh_, std::memory_order_relaxed);
+ delayA_.store(modOn ? (float)baseDelay : 0.0f, std::memory_order_relaxed);
+ bpmA_.store(spb_ > 0.0 ? (float)(60.0 * sr_ / spb_) : 0.0f, std::memory_order_relaxed);
+ srA_.store((float)sr_, std::memory_order_relaxed);
+ if (frames > 0) {
+ const double el = std::chrono::duration<double>(std::chrono::steady_clock::now() - t0).count();
+ cpuS_ = cpuS_ * 0.9 + (el / (frames / sr_)) * 0.1;
+ cpuA_.store((float)cpuS_, std::memory_order_relaxed);
}
}
+ // Telemetry block, the transfer curve, then the pitch histories (see the header note).
+ // Writes as much of that layout as fits in maxSamples. Lock-free; torn reads are fine.
+ int32_t scopeRead(float* out, int32_t maxSamples) const override {
+ if (!out || maxSamples <= 0) return 0;
+ const Params P = params();
+ const Curve cv = curveFor(P);
+ float t[kTele] = {};
+ t[S_InPk] = inPkA_.load(std::memory_order_relaxed);
+ t[S_OutPk] = outPkA_.load(std::memory_order_relaxed);
+ t[S_Cpu] = cpuA_.load(std::memory_order_relaxed);
+ t[S_SampleRate] = srA_.load(std::memory_order_relaxed);
+ t[S_Bpm] = bpmA_.load(std::memory_order_relaxed);
+ t[S_Delay] = delayA_.load(std::memory_order_relaxed);
+ const double wowHz = wowHzFor(P), flutHz = flutHzFor(P);
+ t[S_WowHz] = (float)wowHz;
+ t[S_FlutHz] = (float)flutHz;
+ t[S_WowCents] = (float)depthCents(P.md.wowMul * P.wow * 0.0040, wowHz);
+ t[S_FlutCents] = (float)depthCents(P.md.flutMul * P.flutter * 0.0015 * (1.0 + 0.35 * P.wear), flutHz);
+ t[S_BandHz] = (float)bandFor(P);
+ const float hiss = P.noise * P.md.noiseMul * (1.0f + P.wear) * 0.05f / std::sqrt(3.0f);
+ t[S_HissDb] = hiss > 1e-6f ? 20.0f * std::log10(hiss * std::pow(10.0f, (get(Output) - 0.5f) * 1.2f) * P.mix) : -120.0f;
+ const float lvl = t[S_InPk] > 0.004f ? std::min(t[S_InPk], 1.0f) : 0.5f;
+ t[S_TestLvl] = lvl;
+ double h[8] = {};
+ harmonics(cv, lvl, h);
+ double sq = 0.0;
+ for (int k = 2; k <= 7; ++k) sq += h[k] * h[k];
+ t[S_Thd] = h[1] > 1e-9 ? (float)(std::sqrt(sq) / h[1]) : 0.0f;
+ for (int k = 1; k <= 7; ++k)
+ t[S_H1 + k - 1] = h[1] > 1e-9 && h[k] > 1e-9 ? (float)std::max(-120.0, 20.0 * std::log10(h[k] / h[1])) : -120.0f;
+ const float fp = cv.eval(0.5f), fn = cv.eval(-0.5f);
+ t[S_Asym] = std::fabs(fp) > 1e-6f ? std::min(1.0f, std::fabs(fp + fn) / std::fabs(fp)) : 0.0f;
+ const float cg = compA_.load(std::memory_order_relaxed);
+ t[S_CompDb] = P.autoComp && cg > 1e-6f ? 20.0f * std::log10(cg) : 0.0f;
+ t[S_Mode] = (float)P.mode;
+ t[S_Crackles] = (float)crackles_.load(std::memory_order_relaxed);
+ t[S_HistLen] = (float)kHist;
+ t[S_HistMs] = (float)kHistMs;
+ t[S_WowPhase] = wowPhA_.load(std::memory_order_relaxed);
+ int32_t n = 0;
+ for (int k = 0; k < kTele && n < maxSamples; ++k) out[n++] = t[k];
+ for (int k = 0; k < kCurve && n < maxSamples; ++k) out[n++] = cv.eval((float)k / (kCurve - 1));
+ const uint32_t hw = histW_.load(std::memory_order_relaxed);
+ for (int k = 0; k < kHist && n < maxSamples; ++k) out[n++] = histWow_[(hw + (uint32_t)k) & (kHist - 1)];
+ for (int k = 0; k < kHist && n < maxSamples; ++k) out[n++] = histFlut_[(hw + (uint32_t)k) & (kHist - 1)];
+ return n;
+ }
+
const char* displayName() const override { return "Nota Vintage"; }
int32_t builtinKind() const override { return 8; }
int32_t paramCount() const override { return kNumParams; }
const char* paramName(int32_t i) const override {
- switch (i) {
- case Mode: return "Mode"; case Drive: return "Drive"; case Tone: return "Tone";
- case Wow: return "Wow"; case Flutter: return "Flutter"; case Noise: return "Noise";
- case Crackle: return "Crackle"; case Wear: return "Wear"; case Mix: return "Mix";
- case Output: return "Output"; case Oversampling: return "Oversampling"; default: return "";
- }
+ static const char* nm[kNumParams] = {
+ "Mode", "Drive", "Tone", "Wow", "Flutter", "Noise", "Crackle", "Wear", "Mix", "Output", "Oversampling",
+ "Tone Low", "Tone High", "Tone Model", "Character", "Auto Comp", "Wow Rate", "Flutter Rate", "Wow Sync",
+ "Hiss HP", "Wear Follow", "Stereo Drift", "Output Stage", "Even Only" };
+ return (i >= 0 && i < kNumParams) ? nm[i] : "";
}
float paramMin(int32_t /*i*/) const override { return 0.0f; }
float paramMax(int32_t /*i*/) const override { return 1.0f; }
@@ -174,11 +386,186 @@ public:
if (i >= 0 && i < kNumParams) p_[i].store(std::clamp(v, 0.0f, 1.0f), std::memory_order_relaxed);
}
+ // 0 — a one-line status; 1 — the live reading; 2 — a guide to the parameter values.
+ std::string deviceText(int32_t id) const override {
+ char b[1024];
+ const Params P = params();
+ if (id == 0) {
+ std::string s = kModeName[P.mode];
+ if (!P.character) s += " (voicing off)";
+ std::snprintf(b, sizeof b, " - drive %.0f %% - tone %+.1f - %s", P.drive * 100.0f, (P.tone - 0.5f) * 10.0f, kModelName[P.model]);
+ s += b;
+ if (std::fabs(P.low - 0.5f) > 0.004f || std::fabs(P.high - 0.5f) > 0.004f) {
+ std::snprintf(b, sizeof b, " (low %+.1f / high %+.1f dB)", (P.low - 0.5f) * 24.0f, (P.high - 0.5f) * 24.0f);
+ s += b;
+ }
+ if (P.wow > 0.004f || P.flutter > 0.004f) {
+ std::snprintf(b, sizeof b, " - wow %.0f %% @ %s - flutter %.0f %% @ %.1f Hz", P.wow * 100.0f, wowRateText(P).c_str(),
+ P.flutter * 100.0f, flutHzFor(P));
+ s += b;
+ }
+ std::snprintf(b, sizeof b, " - noise %.0f %% - crackle %.0f %% - wear %.0f %%", P.noise * 100.0f, P.crackle * 100.0f, P.wear * 100.0f);
+ s += b;
+ if (P.stage > 0) s += P.stage == 1 ? " - tube stage" : " - analog stage";
+ if (P.even) s += " - even harmonics only";
+ if (P.follow) s += " - wear follows input";
+ if (P.stereo) s += " - stereo drift";
+ std::snprintf(b, sizeof b, " - mix %.0f %% - out %+.1f dB - OS %s%s", P.mix * 100.0f, (get(Output) - 0.5f) * 24.0f,
+ kOsName[std::clamp((int)std::lround(get(Oversampling) * 3.0f), 0, 3)], P.autoComp ? " - auto-comp" : "");
+ s += b;
+ return s;
+ }
+ if (id == 1) {
+ float sc[kTele];
+ scopeRead(sc, kTele);
+ auto db = [](float lin) { return lin > 1e-6f ? 20.0f * std::log10(lin) : -120.0f; };
+ std::snprintf(b, sizeof b,
+ "in %.1f dB - out %.1f dB - THD %.1f %% at %.1f dBFS (2nd %.0f dB, 3rd %.0f dB) - asym %.0f %% - "
+ "wow +/-%.1f ct @ %.2f Hz - flutter +/-%.1f ct @ %.1f Hz - band %s - hiss %.0f dBFS - comp %+.1f dB - crackles %.0f",
+ db(sc[S_InPk]), db(sc[S_OutPk]), sc[S_Thd] * 100.0f, db(sc[S_TestLvl]), sc[S_H1 + 1], sc[S_H1 + 2], sc[S_Asym] * 100.0f,
+ sc[S_WowCents], sc[S_WowHz], sc[S_FlutCents], sc[S_FlutHz],
+ sc[S_BandHz] > 0 ? hzText(sc[S_BandHz]).c_str() : "open", sc[S_HissDb], sc[S_CompDb], sc[S_Crackles]);
+ return b;
+ }
+ if (id == 2) {
+ return "All params are 0..1. Mode: 0 Vinyl, 0.2 Cassette, 0.4 Reel, 0.6 VHS, 0.8 Tube, 1 Analog. Drive: saturation amount. "
+ "Tone: tilt, 0.5 = neutral (+/-7 dB at 3.5 kHz). Tone Model: 0 Warm (the era's tilt + head bump), 0.5 Flat (the Tone knob "
+ "only), 1 Dark (darker tilt at 2 kHz). Tone Low: shelf at 120 Hz, Tone High: shelf at 6 kHz, both 0.5 = 0 dB, +/-12 dB. "
+ "Character: 1 = the Mode's voicing (shape, band-limit, bump, hiss/crackle/wow/flutter weights), 0 = neutral. "
+ "Wow / Flutter: depth. Wow Rate: free 0.1*40^v Hz (0.462 = 0.55 Hz); with Wow Sync on round(v*5) picks 4 bars, 2 bars, "
+ "1 bar, 1/2, 1/4, 1/8. Flutter Rate: 2*10^v Hz (0.544 = 7 Hz). Noise: hiss. Hiss HP: 20*100^v Hz. Crackle: clicks. "
+ "Wear: age macro (narrows the band, more hiss/crackle, flutter wanders). Wear Follow: hiss + crackle follow the input level. "
+ "Stereo Drift: the right channel's wow/flutter a quarter-cycle apart, own crackle. Output Stage: 0 off, 0.5 Tube, 1 Analog. "
+ "Even Only: the saturation adds even harmonics only. Auto Comp: output level matched to the input. "
+ "Mix: dry/wet. Output: 0.5 = 0 dB, +/-12 dB. Oversampling: 0 off, 0.333 2x, 0.667 4x, 1 8x. Toggles: >= 0.5 = on.";
+ }
+ return {};
+ }
+
private:
static constexpr double kPi = 3.14159265358979323846;
static constexpr int kDelay = 2048; // power of two (pitch-mod ring)
+ static constexpr double kBaseDelayS = 0.006;
+ static constexpr double kHistMs = 4.0;
+ static constexpr float kWowRateDefault = 0.4621f; // log(5.5)/log(40) → 0.55 Hz
+ static constexpr float kFlutRateDefault = 0.5441f; // log10(3.5) → 7 Hz
+ static constexpr double kSyncBeats[6] = { 16.0, 8.0, 4.0, 2.0, 1.0, 0.5 };
+ static constexpr const char* kModeName[6] = { "Vinyl", "Cassette", "Reel", "VHS", "Tube", "Analog" };
+ static constexpr const char* kModelName[3] = { "warm", "flat", "dark" };
+ static constexpr const char* kOsName[4] = { "off", "2x", "4x", "8x" };
+ static constexpr const char* kSyncName[6] = { "4 bars", "2 bars", "1 bar", "1/2", "1/4", "1/8" };
float get(int i) const { return p_[i].load(std::memory_order_relaxed); }
+ static double expMap(float v, double lo, double hi) { return lo * std::pow(hi / lo, std::clamp((double)v, 0.0, 1.0)); }
+ static std::string hzText(double hz) {
+ char b[32];
+ if (hz >= 1000.0) std::snprintf(b, sizeof b, "%.1f kHz", hz / 1000.0); else std::snprintf(b, sizeof b, "%.0f Hz", hz);
+ return b;
+ }
+
+ // Per-mode character: saturation shape + drive/bias, tone tilt, low head bump, the
+ // band-limit and low-cut corners, and the baseline hiss / crackle / wow / flutter.
+ struct ModeChar { int shape; float driveMul; float bias; float tilt; float bumpDb;
+ double bandHz; double hpHz; float noiseMul; float crackleMul; float wowMul; float flutMul; };
+ static constexpr int kModes = 6;
+ static constexpr ModeChar kMode[kModes] = {
+ /* Vinyl */ { 0, 3.0f, 0.05f, -0.10f, 1.5f, 13000.0, 35.0, 0.5f, 1.3f, 1.0f, 0.3f },
+ /* Cassette */ { 2, 4.0f, 0.08f, -0.15f, 0.0f, 10000.0, 45.0, 1.2f, 0.2f, 0.6f, 1.0f },
+ /* Reel */ { 2, 6.0f, 0.06f, 0.00f, 3.0f, 15000.0, 30.0, 0.4f, 0.1f, 0.5f, 0.5f },
+ /* VHS */ { 0, 3.5f, 0.10f, -0.25f, 0.0f, 7000.0, 60.0, 1.0f, 0.5f, 0.8f, 1.4f },
+ /* Tube */ { 1, 8.0f, 0.18f, 0.05f, 0.0f, 16000.0, 20.0, 0.15f,0.0f, 0.0f, 0.0f },
+ /* Analog */ { 0, 5.0f, 0.03f, 0.00f, 0.0f, 18000.0, 20.0, 0.10f,0.0f, 0.0f, 0.0f },
+ };
+ // Character off: a plain soft saturator with the wear knobs at face value.
+ static constexpr ModeChar kNeutral = { 0, 4.0f, 0.02f, 0.0f, 0.0f, 0.0, 20.0, 1.0f, 1.0f, 1.0f, 1.0f };
+
+ // A snapshot of the params in musical terms (process() and the message thread alike).
+ struct Params {
+ int mode, model, stage;
+ ModeChar md;
+ float drive, tone, wow, flutter, noise, crackle, wear, mix, low, high;
+ bool character, autoComp, wowSync, follow, stereo, even;
+ };
+ Params params() const {
+ Params P{};
+ P.mode = std::clamp((int)std::lround(get(Mode) * 5.0f), 0, kModes - 1);
+ P.character = get(Character) >= 0.5f;
+ P.md = P.character ? kMode[P.mode] : kNeutral;
+ P.model = std::clamp((int)std::lround(get(ToneModel) * 2.0f), 0, 2);
+ P.stage = std::clamp((int)std::lround(get(OutputStage) * 2.0f), 0, 2);
+ P.drive = std::clamp(get(Drive), 0.0f, 1.0f);
+ P.tone = std::clamp(get(Tone), 0.0f, 1.0f);
+ P.wow = std::clamp(get(Wow), 0.0f, 1.0f);
+ P.flutter = std::clamp(get(Flutter), 0.0f, 1.0f);
+ P.noise = std::clamp(get(Noise), 0.0f, 1.0f);
+ P.crackle = std::clamp(get(Crackle), 0.0f, 1.0f);
+ P.wear = std::clamp(get(Wear), 0.0f, 1.0f);
+ P.mix = std::clamp(get(Mix), 0.0f, 1.0f);
+ P.low = get(ToneLow); P.high = get(ToneHigh);
+ P.autoComp = get(AutoComp) >= 0.5f;
+ P.wowSync = get(WowSync) >= 0.5f;
+ P.follow = get(WearFollow) >= 0.5f;
+ P.stereo = get(StereoDrift) >= 0.5f;
+ P.even = get(EvenOnly) >= 0.5f;
+ return P;
+ }
+ double wowHzFor(const Params& P) const {
+ if (P.wowSync && spb_ > 0.0) {
+ const double beats = kSyncBeats[std::clamp((int)std::lround(get(WowRate) * 5.0f), 0, 5)];
+ return sr_ / spb_ / beats;
+ }
+ return expMap(get(WowRate), 0.1, 4.0);
+ }
+ double flutHzFor(const Params&) const { return expMap(get(FlutterRate), 2.0, 20.0); }
+ std::string wowRateText(const Params& P) const {
+ if (P.wowSync) return kSyncName[std::clamp((int)std::lround(get(WowRate) * 5.0f), 0, 5)];
+ char b[32]; std::snprintf(b, sizeof b, "%.2f Hz", wowHzFor(P)); return b;
+ }
+ // The band-limit corner (0 = open — the neutral voicing has none).
+ double bandFor(const Params& P) const {
+ if (P.md.bandHz <= 0.0) return 0.0;
+ return std::clamp(P.md.bandHz * (1.0 - 0.55 * P.wear), 1500.0, sr_ * 0.45);
+ }
+ // ± cents of a sine delay modulation of `seconds` depth at `hz`.
+ static double depthCents(double seconds, double hz) {
+ const double slope = seconds * 2.0 * kPi * hz; // peak dD/dt (s/s)
+ return slope > 1e-9 ? 1200.0 * std::log2(1.0 + std::min(slope, 0.5)) : 0.0;
+ }
+
+ // The memoryless curve: saturation shape (or the even-only generator) + output stage.
+ struct Curve {
+ int shape = 0, stage = 0;
+ bool even = false;
+ float g = 1.0f, bias = 0.0f, biasDC = 0.0f, makeup = 1.0f, evenAmt = 0.0f;
+ inline float eval(float x) const {
+ float y;
+ if (even) {
+ // An even function of the driven input added to the clean one: only even
+ // harmonics (and DC, which the low cut removes).
+ const float pre = x * g;
+ const float e = 0.5f * (std::tanh(pre + 0.6f) + std::tanh(0.6f - pre)) - std::tanh(0.6f);
+ y = x - e * evenAmt;
+ } else {
+ y = saturate(shape, x * g, bias, biasDC) * makeup;
+ }
+ switch (stage) {
+ case 1: y = (std::tanh(1.4f * y + 0.12f) - 0.11943f) * 0.75f; break; // tube: warm, asymmetric
+ case 2: y = y / (1.0f + 0.3f * std::fabs(y)) * 1.1f; break; // analog: console soft clip
+ default: break;
+ }
+ return y;
+ }
+ };
+ Curve curveFor(const Params& P) const {
+ Curve c;
+ c.shape = P.md.shape; c.stage = P.stage; c.even = P.even;
+ c.g = 1.0f + P.md.driveMul * P.drive * 3.0f;
+ c.bias = P.md.bias * (0.3f + P.drive); // bias grows with drive → even harmonics
+ c.biasDC = std::tanh(c.bias);
+ c.makeup = 1.0f / (0.7f + 0.5f * P.md.driveMul * P.drive);
+ c.evenAmt = (0.2f + 1.3f * P.drive) * 0.9f / (0.35f + 0.25f * c.g);
+ return c;
+ }
// Memoryless saturation shape: 0 soft (tanh), 1 tube (asymmetric, even harmonics),
// 2 tape (algebraic soft knee with gentle compression).
@@ -190,17 +577,24 @@ private:
}
}
- // Full per-channel chain after the pitch-mod tap: saturate → tone/bump/band/hp,
- // then add per-channel hiss and the shared crackle click.
- inline float channel(int c, float x, float g, float bias, float biasDC, float makeup,
- int shape, float hissLvl, float click) {
- float y = saturate(shape, x * g, bias, biasDC) * makeup;
- y = toneSh_[c].process(y);
- y = bumpSh_[c].process(y);
- y = bandLp_[c].process(y);
- y = hp_[c].process(y);
- if (hissLvl > 0.0f) y += (whiteUni() * 2.0f - 1.0f) * hissLvl;
- return y + click;
+ // Harmonic amplitudes 1..7 of the curve driven by a sine of amplitude `a` (DFT, 128 pts).
+ static void harmonics(const Curve& cv, float a, double* h) {
+ constexpr int N = 128;
+ float y[N];
+ for (int n = 0; n < N; ++n) y[n] = cv.eval(a * (float)std::sin(2.0 * kPi * n / N));
+ for (int k = 1; k <= 7; ++k) {
+ double re = 0.0, im = 0.0;
+ for (int n = 0; n < N; ++n) { const double w = 2.0 * kPi * k * n / N; re += y[n] * std::cos(w); im += y[n] * std::sin(w); }
+ h[k] = 2.0 * std::sqrt(re * re + im * im) / N;
+ }
+ }
+
+ // Hiss: white noise through a one-pole high-pass.
+ inline float hiss(int c, float a) {
+ const float x = whiteUni() * 2.0f - 1.0f;
+ const float y = a * (hissHp_[c] + x - hissPrev_[c]);
+ hissPrev_[c] = x; hissHp_[c] = y;
+ return y;
}
// Linear-interpolated read `tap` samples behind the write head.
@@ -254,32 +648,35 @@ private:
}
};
- // Per-mode character: saturation shape + drive/bias, tone tilt, low head bump, the
- // band-limit and low-cut corners, and the baseline hiss / crackle / wow / flutter.
- struct ModeChar { int shape; float driveMul; float bias; float tilt; float bumpDb;
- double bandHz; double hpHz; float noiseMul; float crackleMul; float wowMul; float flutMul; };
- static constexpr int kModes = 6;
- static constexpr ModeChar kMode[kModes] = {
- /* Vinyl */ { 0, 3.0f, 0.05f, -0.10f, 1.5f, 13000.0, 35.0, 0.5f, 1.3f, 1.0f, 0.3f },
- /* Cassette */ { 2, 4.0f, 0.08f, -0.15f, 0.0f, 10000.0, 45.0, 1.2f, 0.2f, 0.6f, 1.0f },
- /* Reel */ { 2, 6.0f, 0.06f, 0.00f, 3.0f, 15000.0, 30.0, 0.4f, 0.1f, 0.5f, 0.5f },
- /* VHS */ { 0, 3.5f, 0.10f, -0.25f, 0.0f, 7000.0, 60.0, 1.0f, 0.5f, 0.8f, 1.4f },
- /* Tube */ { 1, 8.0f, 0.18f, 0.05f, 0.0f, 16000.0, 20.0, 0.15f,0.0f, 0.0f, 0.0f },
- /* Analog */ { 0, 5.0f, 0.03f, 0.00f, 0.0f, 18000.0, 20.0, 0.10f,0.0f, 0.0f, 0.0f },
- };
-
double sr_ = 44100.0;
std::atomic<float> p_[kNumParams] = {};
- Biquad toneSh_[2], bumpSh_[2], bandLp_[2], hp_[2];
+ Biquad toneSh_[2], bumpSh_[2], bandLp_[2], hp_[2], lowSh_[2], highSh_[2];
float dl_[2][kDelay] = {};
int dw_ = 0;
double wowPh_ = 0.0, flutPh_ = 0.0;
- float clickEnv_ = 0.0f;
+ float flutNoise_ = 0.0f, flutNoiseT_ = 0.0f;
+ float clickEnv_[2] = {};
+ float hissHp_[2] = {}, hissPrev_[2] = {};
+ float inEnv_ = 0.0f;
+ double inMs_ = 0.0, wetMs_ = 0.0;
+ float compG_ = 1.0f;
uint32_t rng_ = 0x9E3779B9u;
+ double beatStart_ = 0.0, spb_ = 0.0; // transport (for wow sync)
+ bool playing_ = false;
+ std::atomic<bool> resetReq_{false};
+
+ // Telemetry.
+ float histWow_[kHist] = {}, histFlut_[kHist] = {};
+ std::atomic<uint32_t> histW_{0};
+ int histCount_ = 0;
+ std::atomic<uint32_t> crackles_{0};
+ double cpuS_ = 0.0;
+ std::atomic<float> inPkA_{0}, outPkA_{0}, cpuA_{0}, srA_{44100.0f}, bpmA_{0}, compA_{1}, wowPhA_{0}, delayA_{0};
+
Oversampler os_; // saturation anti-aliasing
int32_t maxFrames_ = 4096;
- std::vector<float> dry_, click_; // base-rate stashes (sized in setSampleRate)
+ std::vector<float> dry_, click_, follow_; // base-rate stashes (sized in setSampleRate)
};
} // namespace nota
diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.cs
index 13c9268b..845d227c 100644
--- a/tests/Nota.SmokeTest/Program.cs
+++ b/tests/Nota.SmokeTest/Program.cs
@@ -6915,32 +6915,162 @@ Console.WriteLine("-- Nota Vintage (effect kind 8) --");
Check(vveng.DeviceName(vvt, vvdi) == "Nota Vintage", $"device is Nota Vintage (got '{vveng.DeviceName(vvt, vvdi)}')");
Check(vveng.TrackDeviceBuiltinKind(vvt, vvdi) == 8, "device reports builtin kind 8");
int vvpc = vveng.DeviceParamCount(vvt, vvdi);
- Check(vvpc == 11, $"Nota Vintage exposes 11 params ({vvpc})");
- vveng.DeviceSetParam(vvt, vvdi, 1, 0.7f); // Drive
- Check(Math.Abs(vveng.DeviceGetParam(vvt, vvdi, 1) - 0.7f) < 1e-3f, "device param set/get round-trips");
-
- // Engage the wear/wow/flutter/noise stages so every path renders.
- vveng.DeviceSetParam(vvt, vvdi, 3, 0.6f); // Wow
- vveng.DeviceSetParam(vvt, vvdi, 4, 0.6f); // Flutter
- vveng.DeviceSetParam(vvt, vvdi, 5, 0.5f); // Noise
- vveng.DeviceSetParam(vvt, vvdi, 6, 0.5f); // Crackle
- vveng.DeviceSetParam(vvt, vvdi, 7, 0.4f); // Wear
- vveng.SetBpm(120);
- for (int mode = 0; mode < 6; mode++)
- {
- vveng.DeviceSetParam(vvt, vvdi, 0, mode / 5f);
- var vbuf = new float[2048 * 2];
- vveng.Seek(0); vveng.Play();
- vveng.RenderOffline(vbuf, 2048);
- vveng.StopTransport();
- float rms = Rms(vbuf, 2048); bool finite = true;
- foreach (var s in vbuf) if (!float.IsFinite(s) || Math.Abs(s) > 8f) { finite = false; break; }
- Check(rms > 1e-4f && finite, $"Vintage mode {mode} is audible + stable (rms {rms:0.000})");
- }
-
- // Duplicate the track → cloneDevice(kind 8) must carry the params.
+ Check(vvpc == 24, $"Nota Vintage exposes 24 params ({vvpc})");
+ const int VMode = 0, VDrive = 1, VWow = 3, VFlutter = 4, VNoise = 5, VCrackle = 6, VWear = 7, VMix = 8, VOutput = 9,
+ VLow = 11, VHigh = 12, VModel = 13, VChar = 14, VComp = 15, VWowRate = 16, VFlutRate = 17, VWowSync = 18,
+ VHissHp = 19, VFollow = 20, VStereo = 21, VStage = 22, VEven = 23;
+ Check(vveng.DeviceParamName(vvt, vvdi, VLow) == "Tone Low" && vveng.DeviceParamName(vvt, vvdi, VModel) == "Tone Model"
+ && vveng.DeviceParamName(vvt, vvdi, VComp) == "Auto Comp" && vveng.DeviceParamName(vvt, vvdi, VWowSync) == "Wow Sync"
+ && vveng.DeviceParamName(vvt, vvdi, VStage) == "Output Stage" && vveng.DeviceParamName(vvt, vvdi, VEven) == "Even Only",
+ "appended params: Tone Low/High/Model · Character · Auto Comp · Wow/Flutter Rate · Wow Sync · Hiss HP · Wear Follow · Stereo Drift · Output Stage · Even Only");
+ // The appended params default to the voicing older projects had.
+ Check(vveng.DeviceParamDefault(vvt, vvdi, VChar) > 0.5f && vveng.DeviceParamDefault(vvt, vvdi, VModel) < 0.01f
+ && Math.Abs(vveng.DeviceParamDefault(vvt, vvdi, VLow) - 0.5f) < 1e-6f && vveng.DeviceParamDefault(vvt, vvdi, VComp) < 0.5f
+ && vveng.DeviceParamDefault(vvt, vvdi, VStage) < 0.01f && vveng.DeviceParamDefault(vvt, vvdi, VEven) < 0.5f,
+ "appended params default to the old sound (character on, warm model, flat shelves, no stage / comp / even)");
+ vveng.DeviceSetParam(vvt, vvdi, VDrive, 0.7f);
+ Check(Math.Abs(vveng.DeviceGetParam(vvt, vvdi, VDrive) - 0.7f) < 1e-3f, "device param set/get round-trips");
+
+ var vbuf = new float[4096 * 2];
+ void VRender(int n = 4096) { vveng.SetBpm(120); vveng.Seek(0); vveng.Play(); for (int k = 0; k < n; k += 4096) vveng.RenderOffline(vbuf, 4096); vveng.StopTransport(); }
+ bool VFinite(float[] b) { foreach (var x in b) if (!float.IsFinite(x) || Math.Abs(x) > 8f) return false; return true; }
+
+ // Engage the wear/wow/flutter/noise stages so every path renders; every mode, both voicings.
+ vveng.DeviceSetParam(vvt, vvdi, VWow, 0.6f);
+ vveng.DeviceSetParam(vvt, vvdi, VFlutter, 0.6f);
+ vveng.DeviceSetParam(vvt, vvdi, VNoise, 0.5f);
+ vveng.DeviceSetParam(vvt, vvdi, VCrackle, 0.5f);
+ vveng.DeviceSetParam(vvt, vvdi, VWear, 0.4f);
+ int vBad = 0;
+ for (int ch = 1; ch >= 0; ch--)
+ for (int mode = 0; mode < 6; mode++)
+ {
+ vveng.DeviceSetParam(vvt, vvdi, VChar, ch);
+ vveng.DeviceSetParam(vvt, vvdi, VMode, mode / 5f);
+ VRender();
+ float rms = Rms(vbuf, 4096);
+ if (!(rms > 1e-4f && VFinite(vbuf))) vBad++;
+ }
+ Check(vBad == 0, $"every mode renders audible + stable, with the voicing on and off ({vBad} failed)");
+ vveng.DeviceSetParam(vvt, vvdi, VChar, 1f);
+ vveng.DeviceSetParam(vvt, vvdi, VMode, 0.2f); // Cassette: wow + flutter both weigh in
+
+ // Every new switch and choice renders audible + finite.
+ int vSw = 0;
+ foreach (var (p, v) in new[] { (VModel, 0.5f), (VModel, 1f), (VLow, 1f), (VHigh, 0f), (VComp, 1f), (VWowSync, 1f), (VHissHp, 1f),
+ (VFollow, 1f), (VStereo, 1f), (VStage, 0.5f), (VStage, 1f), (VEven, 1f), (VFlutRate, 1f), (VWowRate, 1f) })
+ {
+ vveng.DeviceSetParam(vvt, vvdi, p, v);
+ VRender();
+ if (!(Rms(vbuf, 4096) > 1e-4f && VFinite(vbuf))) vSw++;
+ vveng.DeviceSetParam(vvt, vvdi, p, vveng.DeviceParamDefault(vvt, vvdi, p));
+ }
+ Check(vSw == 0, $"every tone model, shelf, stage and wear switch renders stable ({vSw} failed)");
+
+ // Scope: telemetry, the transfer curve, the two pitch histories.
+ const int vTele = 32, vCurve = 48, vHist = 1024;
+ var vsc = new float[vTele + vCurve + 2 * vHist];
+ VRender(16384);
+ int vn = vveng.DeviceScope(vvt, vvdi, vsc, vsc.Length);
+ Check(vn == vsc.Length && vsc[3] > 1000 && vsc[25] == vHist, $"Vintage scope carries telemetry + curve + histories ({vn} values, sr {vsc[3]:0})");
+ Check(vsc[0] > 0.01f && vsc[1] > 0.01f, $"input / output peaks are metered ({vsc[0]:0.00} → {vsc[1]:0.00})");
+ bool mono = true; for (int k = 1; k < vCurve; k++) if (vsc[vTele + k] < vsc[vTele + k - 1] - 1e-4f) mono = false;
+ Check(mono && vsc[vTele] == 0f && vsc[vTele + vCurve - 1] > 0.3f, $"the transfer curve rises from 0 ({vsc[vTele + vCurve - 1]:0.00} at 0 dBFS)");
+ Check(vsc[12] > 0.001f && vsc[13] == 0f && vsc[14] < 0f, $"THD and harmonics are measured (THD {vsc[12] * 100:0.0} %, 2nd {vsc[14]:0} dB)");
+ float wmax = 0; for (int k = 0; k < vHist; k++) wmax = Math.Max(wmax, Math.Abs(vsc[vTele + vCurve + k]));
+ Check(wmax > 1f && vsc[8] > 1f, $"the wow history is written in cents (peak {wmax:0.0} ¢, depth ±{vsc[8]:0.0} ¢)");
+
+ // Wow rate: faster rate, more cents for the same depth; sync picks the rate from the tempo.
+ float c0 = vsc[8];
+ vveng.DeviceSetParam(vvt, vvdi, VWowRate, 0.9f); vveng.DeviceScope(vvt, vvdi, vsc, vsc.Length);
+ Check(vsc[8] > c0 * 2 && vsc[6] > 2f, $"Wow Rate speeds the wow ({vsc[6]:0.00} Hz, ±{vsc[8]:0} ¢)");
+ vveng.DeviceSetParam(vvt, vvdi, VWowSync, 1f); vveng.DeviceSetParam(vvt, vvdi, VWowRate, 0.4f); // 1 bar at 120 BPM = 0.5 Hz
+ VRender(); vveng.DeviceScope(vvt, vvdi, vsc, vsc.Length);
+ Check(Math.Abs(vsc[6] - 0.5f) < 0.01f, $"Wow Sync: 1 bar at 120 BPM = 0.5 Hz ({vsc[6]:0.000})");
+ vveng.DeviceSetParam(vvt, vvdi, VWowSync, 0f); vveng.DeviceSetParam(vvt, vvdi, VWowRate, vveng.DeviceParamDefault(vvt, vvdi, VWowRate));
+
+ // Even Only: the 3rd harmonic falls away, the 2nd stays.
+ vveng.DeviceSetParam(vvt, vvdi, VMode, 1f); vveng.DeviceSetParam(vvt, vvdi, VDrive, 0.8f);
+ vveng.DeviceScope(vvt, vvdi, vsc, vsc.Length);
+ float odd3 = vsc[15];
+ vveng.DeviceSetParam(vvt, vvdi, VEven, 1f); vveng.DeviceScope(vvt, vvdi, vsc, vsc.Length);
+ Check(vsc[15] < -80f && vsc[14] > -60f && odd3 > -60f, $"Even Only drops the odd harmonics (3rd {odd3:0} → {vsc[15]:0} dB, 2nd {vsc[14]:0} dB)");
+ vveng.DeviceSetParam(vvt, vvdi, VEven, 0f);
+
+ // Auto Comp pulls a hot drive back toward the input level.
+ foreach (var p in new[] { VWow, VFlutter, VNoise, VCrackle, VWear }) vveng.DeviceSetParam(vvt, vvdi, p, 0f);
+ vveng.DeviceSetParam(vvt, vvdi, VDrive, 1f);
+ VRender(); float hot = Rms(vbuf, 4096);
+ vveng.DeviceSetParam(vvt, vvdi, VComp, 1f);
+ VRender(16384); float comped = Rms(vbuf, 4096);
+ vveng.SetDeviceBypassed(vvt, vvdi, true); VRender(); float dryR = Rms(vbuf, 4096); vveng.SetDeviceBypassed(vvt, vvdi, false);
+ Check(Math.Abs(20 * Math.Log10(comped / dryR)) < 2.5 && Math.Abs(20 * Math.Log10(hot / dryR)) > 3,
+ $"Auto Comp matches the dry level ({20 * Math.Log10(hot / dryR):+0.0;-0.0;0.0} dB → {20 * Math.Log10(comped / dryR):+0.0;-0.0;0.0} dB)");
+ vveng.DeviceSetParam(vvt, vvdi, VComp, 0f);
+
+ // Mix 0 = the dry signal (the wow tap is only in the wet path).
+ vveng.DeviceSetParam(vvt, vvdi, VMix, 0f);
+ VRender(); float mix0 = Rms(vbuf, 4096);
+ Check(Math.Abs(mix0 - dryR) < dryR * 0.02f, $"Mix 0 passes the dry signal ({mix0:0.000} vs {dryR:0.000})");
+ vveng.DeviceSetParam(vvt, vvdi, VMix, 1f);
+
+ // Texts + the reset action.
+ vveng.DeviceSetParam(vvt, vvdi, VMode, 0.2f); vveng.DeviceSetParam(vvt, vvdi, VWow, 0.4f);
+ string vtext = vveng.DeviceText(vvt, vvdi, 0);
+ Check(vtext.StartsWith("Cassette") && vtext.Contains("wow 40 %"), $"status text names the character and the wow (got '{vtext}')");
+ Check(vveng.DeviceText(vvt, vvdi, 1).Contains("THD") && vveng.DeviceText(vvt, vvdi, 2).Contains("Output Stage"), "live reading and parameter guide texts");
+ vveng.DeviceAction(vvt, vvdi, 0, 0, 0);
+ VRender(); Check(VFinite(vbuf), "the wear reset action keeps the output finite");
+
+ // MCP: the character reading.
+ var vtools = new Nota.Mcp.Tools.DeviceTools(vveng, new Nota.SmokeTest.SyncDispatch(), new Nota.SmokeTest.NoRefresh());
+ VRender(16384);
+ var vr = vtools.ReadVintage(vvt, vvdi).Result;
+ Check(vr.Character == "Cassette" && vr.SampleRate > 1000 && vr.WowCents > 0 && vr.HarmonicsDb.Length == 6 && vr.Summary.StartsWith("Cassette") && vr.PitchMaxCentsLast4s >= vr.PitchMinCentsLast4s,
+ $"MCP read_vintage reports the character, THD and pitch drift ({vr.Character}, THD {vr.ThdPercent:0.0} %, ±{vr.WowCents:0} ¢)");
+
+ // Duplicate the track → cloneDevice(kind 8) must carry the params, appended ones too.
+ vveng.DeviceSetParam(vvt, vvdi, VStage, 1f);
int vvcopy = vveng.DuplicateTrack(vvt);
- Check(vvcopy > 0 && Math.Abs(vveng.DeviceGetParam(vvcopy, vvdi, 1) - 0.7f) < 1e-3f, "duplicate track clones Vintage params");
+ Check(vvcopy > 0 && Math.Abs(vveng.DeviceGetParam(vvcopy, vvdi, VWow) - 0.4f) < 1e-3f && vveng.DeviceGetParam(vvcopy, vvdi, VStage) > 0.9f,
+ "duplicate track clones Vintage params (appended ones too)");
+ vveng.RemoveTrack(vvcopy); // the copy would play into the master and skew the level checks below
+
+ // Automation drives an appended param.
+ int vlane = vveng.AddAutomationLane(vvt, AutomationTarget.DeviceParam, vvdi, VHigh);
+ vveng.SetAutomationPoints(vvt, vlane, new[] { new AutomationPoint(0, 0.9f), new AutomationPoint(16, 0.9f) });
+ VRender();
+ Check(Math.Abs(vveng.DeviceGetParam(vvt, vvdi, VHigh) - 0.9f) < 0.01f, $"automation drives Tone High ({vveng.DeviceGetParam(vvt, vvdi, VHigh):0.00})");
+ vveng.RemoveAutomationLane(vvt, vlane);
+
+ // Factory presets: ≥ 25, every named param exists, each applies in place and renders.
+ {
+ var names = new HashSet<string>();
+ for (int k = 0; k < vvpc; k++) names.Add(vveng.DeviceParamName(vvt, vvdi, k));
+ var cat = new FactoryPresetCatalog();
+ var mine = cat.All().Where(p => !p.IsInstrument && !p.IsMidiEffect && p.BuiltinKind == 8).ToList();
+ Check(mine.Count >= 25, $"Nota Vintage ships ≥ 25 factory presets ({mine.Count})");
+ var bad = mine.SelectMany(p => cat.Document(p.Id)!.NamedParams!.Keys.Where(k => !names.Contains(k)).Select(k => $"{p.DisplayName}:{k}")).ToList();
+ Check(bad.Count == 0, $"every Vintage preset param name exists{(bad.Count > 0 ? " — bad: " + string.Join(", ", bad) : "")}");
+ vveng.SetDeviceBypassed(vvt, vvdi, true); VRender(16384); float dryRef = Rms(vbuf, 4096); vveng.SetDeviceBypassed(vvt, vvdi, false);
+ int pf = 0; var loud = new List<string>();
+ foreach (var p in mine)
+ {
+ if (cat.ApplyInPlace(vveng, p.Id, vvt, vvdi).Length != 0) { pf++; continue; }
+ VRender(16384);
+ float r = Rms(vbuf, 4096);
+ if (!VFinite(vbuf) || r < 1e-4f) pf++;
+ double db = 20 * Math.Log10(r / dryRef);
+ if (Environment.GetEnvironmentVariable("NOTA_VINTAGE_LEVELS") == "1") Console.WriteLine($" level {p.DisplayName,-20} {db:+0.0;-0.0;0.0} dB");
+ if (Math.Abs(db) > 4) loud.Add($"{p.DisplayName} {db:+0.0;-0.0;0.0} dB");
+ }
+ Check(pf == 0, $"every Vintage preset applies and renders ({pf} failed)");
+ Check(loud.Count == 0, $"every Vintage preset sits within ±4 dB of the dry level{(loud.Count > 0 ? " — " + string.Join(", ", loud) : "")}");
+ cat.ApplyInPlace(vveng, "vintage/Tube Glue", vvt, vvdi);
+ Check(Math.Abs(vveng.DeviceGetParam(vvt, vvdi, VStage) - 0.5f) < 1e-3f && vveng.DeviceGetParam(vvt, vvdi, VComp) > 0.5f, "Tube Glue preset: tube stage + auto-comp");
+ cat.ApplyInPlace(vveng, "vintage/Dusty Vinyl", vvt, vvdi);
+ Check(vveng.DeviceGetParam(vvt, vvdi, VStage) < 0.01f && vveng.DeviceGetParam(vvt, vvdi, VComp) < 0.5f, "unnamed params reset to defaults between presets");
+ }
}
// ===================== Nota Orbit (effect kind 9) ======================