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 Volt

Egor Khindikaynenbd8d8ca1448a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d457879..be818d8f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,25 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
## [Unreleased]
### Added
+- **Nota Volt grew performance wheels and wider macros, and its editor is now the
+ almanac's card.** A **pitch-bend** wheel with a selectable **range** (±2 / ±5 / ±12
+ semitones) joins the mod wheel in a rail that stays on screen on every tab, and the
+ vibrato can be put **on the mod wheel** so the patch's depth becomes the wheel's
+ ceiling. A **macro** now reaches **twelve** destinations instead of six — the three
+ source levels, Filter 2's cutoff and either LFO's rate on top of pitch, osc 2 pitch,
+ cutoff, resonance, level and pan — and names itself after what it drives (*BRIGHT*,
+ *DRIVE*, *MOTION*). The card lays the synth out as **Osc · Filter · Env · LFO · Mod ·
+ Macro** tabs — the three sources as a table, the selected filter's response as a drag
+ pad beside its type, slope and amounts, both envelopes drawn and draggable, the LFOs
+ each naming where they land, the matrix as cells you drag up for + and down for −, and
+ the eight macros as tiles — over a 186 px rail that switches between **Global** (voice
+ mode, bend range, cutoff, resonance, glide, gain, pan and the track's meter) and
+ **Voice** (both output amps, unison and the two velocity amounts), with a status strip
+ that reads the patch back in words. Projects saved before this load unchanged: the
+ existing parameters keep their index, the new ones start neutral, and a macro saved
+ against the old six destinations still points at the same one.
+- **Nota Volt ships 25 factory presets** (was 8) — basses, leads, pads, keys and motion
+ patches, including the eight that existed before under their old names.
- **Nota Operator grew two performance wheels and keyboard tracking, and its editor is now
the almanac's card.** A **pitch-bend** wheel with a selectable **range** (±2 / ±5 / ±12
semitones) and a **mod wheel** on the modulation index sit in a rail that stays on screen
@@ -204,6 +223,10 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
message past the half-way point, so sweeping a mapped CC across it made the target
flutter instead of toggling once. It now fires on the crossing only — which is also what
makes a mapped gamepad trigger usable.
+- Nota Volt's modulation matrix said "drag a cell · up +, down −" but actually took a
+ horizontal drag, and drew each route as a small bar that vanished at narrow cell widths.
+ It now drags vertically, as it always claimed, and a route lights its whole cell with a
+ brass wash that deepens with the amount.
- The filter-response graph shared by Nota Volt, Aurora, Bass and Operator labelled its
frequency axis `20 · 100 · 1k · 10k · 20k` regardless of where those points actually
fell, and read the cutoff off Volt's own map on every instrument. It now takes the
diff --git a/FEATURES.md b/FEATURES.md
index 085e3605..a555c40f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -261,8 +261,12 @@ and user presets, automation, persistence and cloning.
crossfade, reverse loop, filter key-tracking, Vel→Vol; Sample · Pitch · Env · Filter
tabs; an editable waveform.
- **Nota Grain** — granular synthesizer.
-- **Nota Volt** — subtractive, with a 7×6 modulation matrix, 8 macros, extended LFOs
- (shapes, fade-in, tempo sync), oscillator start phase, 12/24 dB filter slope, Mono/Poly.
+- **Nota Volt** — subtractive synth, two paths: two oscillators and noise, each routed to
+ one of two filters (LP/HP/BP/Notch, 12/24 dB, with Filter 1 able to feed Filter 2) and
+ its own amp; amp and filter envelopes, two LFOs (shapes, depth, fade-in, tempo sync), a
+ dedicated vibrato that can ride the mod wheel, a 7×6 modulation matrix, 8 macros over 12
+ destinations, unison, glide, oscillator start phase, pitch-bend (±2/±5/±12) and
+ modulation wheels, VEL→AMP, VEL→FILTER, Mono/Poly. 25 factory presets.
- **Nota Aurora** — wavetable synth: two wavetable oscillators (16 frames per bank, warp
Off/Sync/Bend/PWM/Fold) plus a sub oscillator and unison, two filters with routing, two
envelopes, two LFOs, an 8×7 mod matrix, 4 macros, built-in drive/chorus/reverb,
diff --git a/src/managed/Nota.App/Controls/VoltMatrix.cs b/src/managed/Nota.App/Controls/VoltMatrix.cs
index 8f5ec20b..62a899c4 100644
--- a/src/managed/Nota.App/Controls/VoltMatrix.cs
+++ b/src/managed/Nota.App/Controls/VoltMatrix.cs
@@ -1,11 +1,13 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
//
-// Nota Volt modulation matrix (mockup 2a/2e): a source×destination grid of bipolar
-// cells. Drag a cell vertically to set its amount (up = positive, down = negative);
-// right-click or double-click clears it. Source rows 0..3 are modulators (teal bars),
-// 4..6 are performance sources (amber). Reads/writes the mtx{s}_{d} plugin params and
-// records automation gestures, like the other Volt drag controls.
+// Nota Volt modulation matrix: a source×destination grid of bipolar cells. Drag a cell
+// vertically to set its amount (up = positive, down = negative); right-click or
+// double-click clears it. A route reads as a brass-washed cell carrying its signed
+// amount — the deeper the wash, the more of it — and an empty one stays a dark well, so
+// the routes a patch actually uses are the only thing on screen. Modulator rows are
+// named in teal, performance sources in plain ink. Reads/writes the mtx{s}_{d} plugin
+// params and records automation gestures, like the other Volt drag controls.
using System;
using System.Globalization;
@@ -23,12 +25,14 @@ internal sealed class VoltMatrix : Control
private static readonly IBrush BorderDef = NotaPalette.BorderDefault;
private static readonly IBrush GridB = NotaGraph.Grid;
private static readonly IBrush Teal = NotaPalette.Teal;
- private static readonly IBrush TealFill = NotaPalette.Wash(NotaPalette.Teal, 0x80);
- private static readonly IBrush AmberFill = NotaPalette.Wash(NotaPalette.Accent, 0x80);
+ private static readonly IBrush Lit = NotaPalette.AccentBright;
+ private static readonly IBrush LitEdge = NotaPalette.BorderBrass;
private static readonly IBrush TxtC = NotaPalette.TextPrimary;
private static readonly IBrush MutedC = NotaPalette.TextTertiary;
private static readonly IBrush CellBg = NotaPalette.BgSunken;
private static readonly Typeface Face = NotaFonts.Mono;
+ // How far the pointer travels for the full ±range — the knob's own feel.
+ private const double Travel = 140;
private readonly IAudioEngine _e;
private readonly int _t;
@@ -36,8 +40,15 @@ internal sealed class VoltMatrix : Control
private readonly string[] _src, _dst;
private const double LabelW = 56, HeaderH = 15;
private int _dragS = -1, _dragD = -1;
- private double _startX, _startVal;
+ private double _startY, _startVal;
+ /// <summary>How many leading source rows are modulators (named in teal); the rest are
+ /// performance sources.</summary>
+ public int Modulators { get; init; } = 4;
+
+ /// <summary>Raised after a cell changes, so the card can refresh what reads the matrix
+ /// (the route count, an LFO's "lands on" line, the status strip).</summary>
+ public event Action? Changed;
public VoltMatrix(IAudioEngine e, int t, int[,] idx, string[] src, string[] dst)
{ _e = e; _t = t; _idx = idx; _src = src; _dst = dst; }
@@ -47,6 +58,7 @@ internal sealed class VoltMatrix : Control
{
foreach (var i in _idx) if (i >= 0) _e.PluginParamSet(_t, -1, i, 0.5f);
InvalidateVisual();
+ Changed?.Invoke();
}
private (double cw, double ch) Cell()
@@ -61,8 +73,8 @@ internal sealed class VoltMatrix : Control
int i = _idx[s, d]; if (i < 0) return;
var pt = e.GetCurrentPoint(this);
if (pt.Properties.IsRightButtonPressed || e.ClickCount == 2)
- { _e.PluginParamSet(_t, -1, i, 0.5f); InvalidateVisual(); e.Handled = true; return; }
- _dragS = s; _dragD = d; _startX = p.X; _startVal = _e.PluginParamGet(_t, -1, i);
+ { _e.PluginParamSet(_t, -1, i, 0.5f); InvalidateVisual(); Changed?.Invoke(); e.Handled = true; return; }
+ _dragS = s; _dragD = d; _startY = p.Y; _startVal = _e.PluginParamGet(_t, -1, i);
_e.BeginAutomationWrite(_t, AutomationTarget.PluginParam, -1, -1, Id(s, d));
e.Pointer.Capture(this); e.Handled = true;
}
@@ -70,16 +82,18 @@ internal sealed class VoltMatrix : Control
{
if (_dragS < 0) return;
int i = _idx[_dragS, _dragD]; if (i < 0) return;
- // Horizontal drag: dragging one cell-width right/left sweeps the full ±range.
- var (cw, _) = Cell();
- double v = Math.Clamp(_startVal + (e.GetPosition(this).X - _startX) / Math.Max(24, cw), 0, 1);
- _e.PluginParamSet(_t, -1, i, (float)v); InvalidateVisual();
+ // Vertical drag, like a knob: up adds, down subtracts, a modifier goes fine.
+ double fine = e.KeyModifiers.HasFlag(KeyModifiers.Shift) || e.KeyModifiers.HasFlag(KeyModifiers.Control)
+ || e.KeyModifiers.HasFlag(KeyModifiers.Meta) ? 0.25 : 1.0;
+ double v = Math.Clamp(_startVal + (_startY - e.GetPosition(this).Y) / Travel * fine, 0, 1);
+ _e.PluginParamSet(_t, -1, i, (float)v); InvalidateVisual(); Changed?.Invoke();
}
protected override void OnPointerReleased(PointerReleasedEventArgs e)
{
if (_dragS < 0) return;
_e.EndAutomationWrite(_t, AutomationTarget.PluginParam, -1, -1, Id(_dragS, _dragD));
_dragS = _dragD = -1; e.Pointer.Capture(null);
+ Changed?.Invoke();
}
private void Txt(DrawingContext ctx, string t, double x, double y, IBrush b, double size = 8, bool center = false)
@@ -98,28 +112,22 @@ internal sealed class VoltMatrix : Control
for (int s = 0; s < _src.Length; s++)
{
double cy = HeaderH + s * ch;
- Txt(ctx, _src[s], 2, cy + ch / 2 - 5, s < 4 ? Teal : TxtC, 8);
+ Txt(ctx, _src[s], 2, cy + ch / 2 - 5, s < Modulators ? Teal : TxtC, 8);
for (int d = 0; d < _dst.Length; d++)
{
double cx = LabelW + d * cw;
var r = new Rect(cx + 1, cy + 1, cw - 2, ch - 2);
int i = _idx[s, d];
- bool has = i >= 0;
- ctx.DrawRectangle(has ? CellBg : Sunken, new Pen(GridB, 1), r, 2, 2);
- if (!has) continue;
+ if (i < 0) { ctx.DrawRectangle(Sunken, new Pen(GridB, 1), r, 2, 2); continue; }
double amt = (_e.PluginParamGet(_t, -1, i) - 0.5) * 2.0;
- double midX = r.X + r.Width / 2;
- // Bipolar horizontal bar: grows right for +, left for −, from the centre line.
- if (Math.Abs(amt) > 0.01)
- {
- double bw = Math.Abs(amt) * (r.Width / 2 - 1);
- var bar = amt > 0 ? new Rect(midX, r.Y + 1, bw, r.Height - 2)
- : new Rect(midX - bw, r.Y + 1, bw, r.Height - 2);
- ctx.FillRectangle(s < 4 ? TealFill : AmberFill, bar);
- }
- ctx.DrawLine(new Pen(GridB, 1), new Point(midX, r.Y + 2), new Point(midX, r.Bottom - 2));
- if (Math.Abs(amt) > 0.01 && r.Width >= 20)
- Txt(ctx, ((int)Math.Round(amt * 100)).ToString(), midX, r.Y + r.Height / 2 - 5, TxtC, 8, true);
+ bool on = Math.Abs(amt) > 0.01;
+ if (!on) { ctx.DrawRectangle(CellBg, new Pen(GridB, 1), r, 2, 2); continue; }
+ // A route lights the whole cell: a brass wash that deepens with the amount,
+ // a brass hairline, and the signed number in Brass Light.
+ var wash = NotaPalette.Wash(NotaPalette.Accent, (byte)(0x18 + 0x40 * Math.Min(1.0, Math.Abs(amt))));
+ ctx.DrawRectangle(wash, new Pen(LitEdge, 1), r, 2, 2);
+ if (r.Width >= 18)
+ Txt(ctx, (amt > 0 ? "+" : "−") + (int)Math.Round(Math.Abs(amt) * 100), r.X + r.Width / 2, r.Y + r.Height / 2 - 5, Lit, 8, true);
}
}
}
diff --git a/src/managed/Nota.App/DeviceCards/Instruments/VoltInstrumentCard.cs b/src/managed/Nota.App/DeviceCards/Instruments/VoltInstrumentCard.cs
index 89ce775b..40c4c03c 100644
--- a/src/managed/Nota.App/DeviceCards/Instruments/VoltInstrumentCard.cs
+++ b/src/managed/Nota.App/DeviceCards/Instruments/VoltInstrumentCard.cs
@@ -1,14 +1,27 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
//
-// Detail · Devices — built-in Nota Volt editor (instrument kind 6), rebuilt to the 2e
-// mockup (700×260, the same compact shell as Nota Grain): header (26, with a live
-// voice meter) · always-visible LIVE strip (34: Cutoff/Res/Glide sliders + Poly/Mono)
-// · vertical tab rail (80: Osc/Filter/Env/LFO/Mod/Macro) swapping the body · output
-// rail (96: Gain knob + peak meter + Pan). The filter response and both envelopes are
-// interactive drag graphs; the Mod tab is a 7×6 drag matrix; waveform/filter-type are
-// icon/text chips; modulation depths use teal knobs. All controls are plugin params;
-// the card follows automation live via RefreshSynthLive.
+// Detail · Devices — built-in Nota Volt editor (instrument kind 6): a two-path subtractive
+// synth in the 700 × 260 card the almanac draws for it.
+//
+// Wheels 56 pitch bend and mod wheel, on screen on every tab — the two hand controls
+// a player reaches for first.
+// Centre six tabs:
+// Osc — Osc 1 / Osc 2 / Noise as a table: wave, octave, semi, fine,
+// start phase, level, and which filter the source is sent to.
+// Filter — the response of the selected filter as a drag pad, with type,
+// slope, cutoff, resonance, env / key / LFO amounts and, on
+// Filter 1, how much of it spills into Filter 2.
+// Env — the amp and filter envelopes side by side, drawn and draggable.
+// LFO — LFO 1 / LFO 2 / Vibrato as a table, each naming where it lands.
+// Mod — the 7 × 6 matrix: drag a cell up for +, down for −.
+// Macro — eight macros, each a value, an amount and one of twelve targets.
+// Rail 186 Global (voice mode, bend range, cutoff, resonance, glide, gain, pan and
+// the track's meter) or Voice (both output amps, unison and the two
+// velocity amounts).
+//
+// Brass is the parameter itself; teal is modulation and what receives it. Everything is a
+// plugin param → automation / persist / clone, and the card follows automation live.
using System;
using System.Collections.Generic;
@@ -24,24 +37,69 @@ namespace Nota.App;
internal sealed class VoltInstrumentCard : IInstrumentCard
{
- // Exact mockup palette (matches GrainInstrumentCard).
- private static readonly IBrush CardBg = NotaPalette.BgApp;
- private static readonly IBrush HdrBg = NotaPalette.SurfaceCard;
- private static readonly IBrush RailBg = NotaPalette.SurfaceInset;
- private static readonly IBrush Border2 = NotaPalette.BorderDefault;
- private static readonly IBrush Inset = NotaPalette.BgSunken;
- private static readonly IBrush Amber = NotaPalette.Accent;
- private static readonly IBrush AmberLit = NotaPalette.AccentBright;
- private static readonly IBrush TealC = NotaPalette.Teal;
- private static readonly IBrush TxtC = NotaPalette.TextPrimary;
- private static readonly IBrush MutedC = NotaPalette.TextTertiary;
- private static readonly IBrush Handle = NotaPalette.TextSecondary;
- private static readonly IBrush AmberSubtle = NotaPalette.Wash(NotaPalette.Accent, 0x28);
-
- private static readonly string[] DestNames = { "Pitch", "Osc2", "Cutoff", "Reso", "Level", "Pan" };
-
public bool BodyOnly => true;
public string Subtitle => "SUBTRACTIVE";
+ public double CardWidth => 700;
+
+ private const double WheelsW = 56, RailW = 186, TabH = 20, StatusH = 18, BodyH = 186;
+
+ private static readonly string[] TabNames = { "Osc", "Filter", "Env", "LFO", "Mod", "Macro" };
+ private static readonly string[] RailTabs = { "Global", "Voice" };
+ private static readonly string[] WaveNames = { "saw", "square", "triangle", "sine" };
+ private static readonly string[] FilterNames = { "LP", "HP", "BP", "Notch" };
+ private static readonly string[] NoiseNames = { "dark", "pink", "white" };
+ private static readonly float[] NoiseStops = { 0f, 0.5f, 1f };
+ private static readonly float[] RouteStops = { 0f, 1f };
+ private static readonly string[] ShapeNames = { "sin", "tri", "sqr", "S&H" };
+ private static readonly string[] SyncNames = { "free", "1 bar", "1/2", "1/4", "1/8", "1/16", "1/32", "1/64" };
+ private static readonly string[] BendNames = { "±2", "±5", "±12" };
+ private static readonly float[] BendStops = { 1f / 11f, 4f / 11f, 1f };
+ private static readonly string[] SrcNames = { "Amp Env", "Flt Env", "LFO 1", "LFO 2", "Velocity", "Key", "Mod Whl" };
+ private static readonly string[] DestNames = { "Pitch", "Osc 2", "Cutoff", "Reso", "Level", "Pan" };
+
+ // The twelve macro targets, in the engine's order (VoltSynth::kMacroDests). The six
+ // matrix destinations sit at 0, 2, 4, 7, 9 and 11 so an old patch still points home.
+ private static readonly string[] MacroDests =
+ {
+ "Pitch", "Osc 1 level", "Osc 2 pitch", "Osc 2 level", "Cutoff", "Noise level",
+ "Filter 2", "Reso", "LFO 1 rate", "Level", "LFO 2 rate", "Pan",
+ };
+ // What a macro on that target is called on the patch — the word a player reads, not
+ // the parameter's name.
+ private static readonly string[] MacroWords =
+ {
+ "PITCH", "BODY", "INTERVAL", "DRIVE", "BRIGHT", "AIR",
+ "TONE 2", "EDGE", "MOTION", "SWELL", "DRIFT", "WIDTH",
+ };
+
+ // The engine's own perceptual maps (VoltSynth.h), so a readout says what it does.
+ private static double ExpMap(float v, double lo, double hi) => lo * Math.Pow(hi / lo, Math.Clamp(v, 0f, 1f));
+ private static string Hz(float v) => NotaNum.Hz(ExpMap(v, 20, 18000));
+ // An LFO runs well below 1 Hz, where NotaNum.Hz would round every slow rate to "0 Hz".
+ private static string SlowHz(double hz) => hz >= 9.995 ? NotaNum.Hz(hz)
+ : NotaNum.Unit(hz, hz < 0.995 ? "0.00" : "0.0", "Hz");
+ private static string Secs(float v, double lo, double hi) => NotaNum.Time(ExpMap(v, lo, hi));
+ private static string Pct(float v) => NotaNum.Pct(v);
+ private static string Bip(float v) => NotaNum.Unit((v - 0.5f) * 200, "+0;−0;0", "%");
+ private static string Oct(float v) => NotaNum.Str(Math.Round((v - 0.5) * 6), "+0;−0;0");
+ private static string Semi(float v) => NotaNum.Str(Math.Round((v - 0.5) * 24), "+0;−0;0");
+ private static string Cents(float v) => NotaNum.Unit(Math.Round((v - 0.5) * 100), "+0;−0;0", "c");
+ private static string Phase(float v) => v <= 0.001f ? "free" : NotaNum.Unit(v * 360, "0", "°");
+ private static string GlideT(float v) => v <= 0.001f ? "off" : NotaNum.Time(ExpMap(v, 0.005, 0.6));
+ private static string FadeT(float v) => v <= 0.001f ? "off" : NotaNum.Time(ExpMap(v, 0.01, 5.0));
+ private static string Reso(float v) => NotaNum.Str(v, "0.00");
+ private static string VibDepth(float v) => NotaNum.Unit(v * 50, "0", "c");
+ private static string PanText(float v)
+ {
+ double p = (v - 0.5) * 200;
+ return Math.Abs(p) < 0.5 ? "C" : (p < 0 ? "L" : "R") + NotaNum.Str(Math.Abs(p), "0");
+ }
+ // Noise colour is continuous; the three chips name the band it falls in rather than
+ // going dark whenever the knob sits between them.
+ private static int NoiseBand(float v) => v < 0.25f ? 0 : v < 0.75f ? 1 : 2;
+ private static int SyncDiv(float v) => Math.Clamp((int)Math.Round(v * 7), 0, 7);
+ private static string SyncText(float v) => SyncNames[SyncDiv(v)];
+ private static int BendRange(float v) => (int)Math.Round(1 + v * 11);
public Control Build(DeviceCardContext ctx)
{
@@ -50,248 +108,878 @@ internal sealed class VoltInstrumentCard : IInstrumentCard
int pc = engine.PluginParamCount(track, -1);
var idx = new Dictionary<string, int>();
for (int i = 0; i < pc; i++) idx[engine.PluginParamId(track, -1, i)] = i;
- float G(string id) => idx.TryGetValue(id, out var i) ? engine.PluginParamGet(track, -1, i) : 0f;
int I(string id) => idx.TryGetValue(id, out var i) ? i : -1;
+ float G(string id) => I(id) is var i and >= 0 ? engine.PluginParamGet(track, -1, i) : 0f;
void SetP(string id, float v) { if (I(id) is var i and >= 0) engine.PluginParamSet(track, -1, i, Math.Clamp(v, 0f, 1f)); }
- (int, string) P(string id) => (I(id), id);
+ void Begin(string id) { if (I(id) >= 0) engine.BeginAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id); }
+ void End(string id) { if (I(id) >= 0) engine.EndAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id); }
int Sel(string id, int n) => Math.Clamp((int)Math.Round(G(id) * (n - 1)), 0, n - 1);
+ (int, string) P(string id) => (I(id), id);
var readouts = new List<Action>();
- var filtGraph = new VoltFilter(engine, track);
- var ampEnv = new VoltEnv(engine, track);
- var filtEnv = new VoltEnv(engine, track);
- int fsel = 0;
+ int tab = 0, railTab = 0, fsel = 0; // Osc · Global · Filter 1
+
+ var filtGraph = new VoltFilter(engine, track) { VerticalAlignment = VerticalAlignment.Stretch, MinHeight = 60 };
+ var ampEnv = new VoltEnv(engine, track) { VerticalAlignment = VerticalAlignment.Stretch, MinHeight = 50 };
+ var filtEnv = new VoltEnv(engine, track) { VerticalAlignment = VerticalAlignment.Stretch, MinHeight = 50 };
+ var hint = new TextBlock
+ {
+ FontSize = NotaType.Axis, Foreground = TextTertiary, FontFamily = NotaFonts.MonoFamily,
+ VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Right,
+ Margin = new Thickness(0, 0, 6, 0), TextTrimming = TextTrimming.CharacterEllipsis,
+ };
+ var status = new TextBlock { FontSize = 8, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis };
+ var meta = new TextBlock { FontSize = 8, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center, FontFamily = NotaFonts.MonoFamily };
+ Action applyFilter = () => { };
+ Action showTab = () => { };
void Refresh()
{
- string pre = fsel == 0 ? "fil1" : "fil2";
- filtGraph.Target(pre == "fil1" ? "FILTER 1" : "FILTER 2", P(pre + "freq"), P(pre + "reso"), Sel(pre + "type", 4));
- filtGraph.Refresh(); ampEnv.Refresh(); filtEnv.Refresh();
- foreach (var a in readouts) a();
+ applyFilter();
+ ampEnv.Refresh(); filtEnv.Refresh();
+ foreach (var r in readouts) r();
+ hint.Text = Hint();
+ status.Text = Summary();
+ meta.Text = Meta();
}
- // ---- shared builders ----
- Control K(string id, string name, bool mod = false, double sz = 34, double cw = 44)
- => InstrumentControls.InstKnob(ctx, idx, id, name, Refresh, sz, cw, mod ? TealC : null);
- Control Row(double spacing, params Control[] cs)
- { var sp = new StackPanel { Orientation = Orientation.Horizontal, Spacing = spacing, VerticalAlignment = VerticalAlignment.Center }; foreach (var c in cs) sp.Children.Add(c); return sp; }
- Control Lbl(string t, double fs, IBrush c) => new TextBlock { Text = t, FontSize = fs, FontWeight = FontWeight.Bold, Foreground = c, VerticalAlignment = VerticalAlignment.Center };
+ // ---- shared builders --------------------------------------------------
+ static TextBlock Cap(string t, IBrush? c = null) => new()
+ {
+ Text = t, FontSize = NotaType.KnobLabel, FontWeight = FontWeight.Bold,
+ LetterSpacing = NotaType.KnobLabelTracking, Foreground = c ?? TextTertiary,
+ VerticalAlignment = VerticalAlignment.Center,
+ };
+ static TextBlock Mono(string t, IBrush? c = null, double fs = 8) => new()
+ {
+ Text = t, FontSize = fs, Foreground = c ?? TextSecondary,
+ VerticalAlignment = VerticalAlignment.Center, FontFamily = NotaFonts.MonoFamily,
+ };
+ static TextBlock Section(string t, IBrush? c = null) => new()
+ {
+ Text = t, FontSize = NotaType.DeviceSection, FontWeight = FontWeight.SemiBold,
+ Foreground = c ?? TextPrimary, VerticalAlignment = VerticalAlignment.Center,
+ };
+
+ // Every knob on this card is a table cell: the cell carries a short label (or, in a
+ // macro tile, none at all, because the tile is already named) while MIDI learn and
+ // the CV menu keep the parameter's full name.
+ Control PKnob(string id, string label, string learn, Func<float, string> fmt,
+ double size = 28, double cellW = 44, IBrush? arc = null)
+ {
+ if (!idx.TryGetValue(id, out var pi)) return new Panel();
+ var value = new TextBlock
+ {
+ Text = fmt(G(id)), FontSize = NotaType.KnobValue, FontFamily = NotaFonts.MonoFamily,
+ Foreground = TextPrimary, HorizontalAlignment = HorizontalAlignment.Center,
+ TextAlignment = TextAlignment.Center, LineHeight = 10,
+ };
+ var knob = new Knob(G(id), 1.0)
+ {
+ Accent = true, ArcColor = arc, Default = engine.InstrumentParamDefault(track, pi),
+ Width = size, Height = size, HorizontalAlignment = HorizontalAlignment.Center,
+ };
+ knob.ValueChanged += v => { engine.PluginParamSet(track, -1, pi, (float)v); value.Text = fmt((float)v); Refresh(); };
+ knob.GestureBegin += () => Begin(id);
+ knob.GestureEnd += () => End(id);
+ ctx.AddInstFader(pi, knob, value, fmt);
+ MidiLearn.Bind(knob, MidiTarget.PluginParam(track, -1, pi), learn);
+ return label.Length == 0
+ ? new StackPanel { Width = cellW, Spacing = 0, Children = { knob, value } }
+ : KnobCell(label, knob, value, cellW);
+ }
- // Param-backed chip strip (writes id = pick/(n-1)); optional per-index tint.
- Control Chips(string id, string[] names, double fs = 9)
+ Control Chips(string id, string[] names, Func<int>? current = null, Action<int>? pick = null, bool fill = false)
{
int n = names.Length;
- var seg = DeviceCardKit.Segments(names, () => Sel(id, n), iv => { SetP(id, iv / (float)(n - 1)); Refresh(); }, out var sync);
+ var seg = Segments(names, current ?? (() => Sel(id, n)),
+ pick ?? (iv => { SetP(id, iv / (float)(n - 1)); Refresh(); }), out var sync, fill: fill);
readouts.Add(sync);
if (I(id) is var pi and >= 0) MidiLearn.Bind(seg, MidiTarget.PluginParam(track, -1, pi), id);
return seg;
}
- // Waveform icon chips (Saw/Square/Tri/Sine).
+ // A chip strip that lights only on exact stops, so a value set between them (by
+ // automation, the matrix or a macro) reads as "somewhere in between" rather than
+ // snapping the display to a lie.
+ Control StopChips(string id, string[] names, float[] stops, bool fill = false)
+ => Chips(id, names, () => NearestExact(G(id), stops), iv => { SetP(id, stops[iv]); Refresh(); }, fill);
+
+ Grid Slider(string label, string id, Func<string> text, double labelW = 0, double valueW = 40)
+ {
+ int pi = I(id);
+ var row = SliderRow(label, () => G(id), v => { SetP(id, (float)v); Refresh(); }, text, out var sync,
+ begin: pi >= 0 ? () => Begin(id) : null,
+ end: pi >= 0 ? () => End(id) : null,
+ reset: pi >= 0 ? () => { SetP(id, engine.InstrumentParamDefault(track, pi)); Refresh(); } : null,
+ labelWidth: labelW, valueWidth: valueW);
+ readouts.Add(sync);
+ if (pi >= 0) MidiLearn.Bind(row, MidiTarget.PluginParam(track, -1, pi), label);
+ return row;
+ }
+
+ Control Toggle(string label, string id, Func<string>? live = null)
+ {
+ var host = Switch(label, () => G(id) >= 0.5f, () => { SetP(id, G(id) >= 0.5f ? 0f : 1f); Refresh(); }, out var sync, liveLabel: live);
+ readouts.Add(sync);
+ if (I(id) is var pi and >= 0) MidiLearn.Bind(host, MidiTarget.PluginParam(track, -1, pi), label);
+ return host;
+ }
+
+ // Waveform chips: the same recessed strip as Segments, with the glyph instead of a
+ // word — four waves read faster drawn than spelled.
Control WaveChips(string id)
{
- var arr = new Border[4]; var ic = new WaveIcon[4];
- void Hi() { int cur = Sel(id, 4); for (int i = 0; i < 4; i++) { bool on = i == cur; arr[i].Background = on ? NotaPalette.Accent : Inset; arr[i].BorderBrush = on ? NotaPalette.Accent : Border2; ic[i].Stroke = on ? NotaPalette.TextOnAccent : MutedC; ic[i].InvalidateVisual(); } }
- var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 2, VerticalAlignment = VerticalAlignment.Center };
+ var cells = new Border[4];
+ var icons = new WaveIcon[4];
+ var row = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 1 };
for (int i = 0; i < 4; i++)
- { int iv = i; var wi = new WaveIcon(i) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; var b = new Border { Width = 26, Height = 18, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Badge, Cursor = new Cursor(StandardCursorType.Hand), Child = wi }; b.PointerPressed += (_, _) => { SetP(id, iv / 3f); Hi(); Refresh(); }; arr[i] = b; ic[i] = wi; row.Children.Add(b); }
- readouts.Add(Hi); Hi();
+ {
+ int iv = i;
+ var ic = new WaveIcon(i) { Width = 18, Height = 11, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };
+ var c = new Border
+ {
+ CornerRadius = NotaRadius.Badge, Padding = new Thickness(3, 2), Background = Brushes.Transparent,
+ Cursor = new Cursor(StandardCursorType.Hand), Child = ic,
+ };
+ c.PointerPressed += (_, e) =>
+ {
+ if (!e.GetCurrentPoint(c).Properties.IsLeftButtonPressed) return;
+ SetP(id, iv / 3f); Refresh(); e.Handled = true;
+ };
+ cells[i] = c; icons[i] = ic; row.Children.Add(c);
+ }
+ void Paint()
+ {
+ int cur = Sel(id, 4);
+ for (int i = 0; i < 4; i++)
+ {
+ bool on = i == cur;
+ cells[i].Background = on ? Brass : Brushes.Transparent;
+ icons[i].Stroke = on ? OnAccent : TextTertiary;
+ icons[i].InvalidateVisual();
+ }
+ }
+ readouts.Add(Paint); Paint();
if (I(id) is var pi and >= 0) MidiLearn.Bind(row, MidiTarget.PluginParam(track, -1, pi), id);
- return row;
+ var host = new Border
+ {
+ Background = NotaPalette.BgSunken, BorderBrush = BorderDef, BorderThickness = new Thickness(1),
+ CornerRadius = NotaRadius.Control, Padding = new Thickness(1), HorizontalAlignment = HorizontalAlignment.Left,
+ VerticalAlignment = VerticalAlignment.Center, Child = row,
+ };
+ host.BindResource(Border.BoxShadowProperty, "Shadow.Sunken");
+ return host;
}
- // Local (non-param) segmented toggle.
- Control Seg(string[] names, int initial, Action<int> onPick, double fs = 9)
+ // ---- the wheels rail --------------------------------------------------
+ Control Wheel(string id, double def, bool spring)
{
- int cur = initial;
- return DeviceCardKit.Segments(names, () => cur, iv => { cur = iv; onPick(iv); }, out _);
+ var w = new PerformWheel { Default = def, Spring = spring, VerticalAlignment = VerticalAlignment.Stretch, Norm = G(id), HorizontalAlignment = HorizontalAlignment.Center };
+ w.ValueChanged += v => { SetP(id, (float)v); Refresh(); };
+ w.GestureBegin += () => Begin(id);
+ w.GestureEnd += () => End(id);
+ if (I(id) is var pi and >= 0) MidiLearn.Bind(w, MidiTarget.PluginParam(track, -1, pi), id);
+ readouts.Add(() => { if (!w.Dragging) w.Norm = G(id); });
+ return w;
}
- // Header (dot / name / subtitle / voice count) is provided by the shared shell.
+ var bendWheel = Wheel("bend", 0.5, true);
+ var modWheel = Wheel("modwheel", 0, false);
+ var bendVal = Mono("", TextSecondary, NotaType.KnobValue);
+ var modVal = Mono("", TextSecondary, NotaType.KnobValue);
+ bendVal.HorizontalAlignment = modVal.HorizontalAlignment = HorizontalAlignment.Center;
+ readouts.Add(() =>
+ {
+ int range = BendRange(G("bendrange"));
+ double semis = (G("bend") - 0.5) * 2 * range;
+ bool centred = Math.Abs(semis) < 0.05;
+ bendVal.Text = centred ? $"±{range}\u2009st" : NotaNum.Unit(semis, "+0.0;−0.0;0", "st");
+ bendVal.Foreground = centred ? TextSecondary : AccentBright;
+ modVal.Text = NotaNum.Pct(G("modwheel"));
+ modVal.Foreground = G("modwheel") > 1e-3f ? AccentBright : TextSecondary;
+ });
- // ---- LIVE strip (always visible) ----
- Control Slider(string id, double trackW, string name, Func<double, string> fmt)
+ Grid Pair(Control a, Control b)
{
- int pi = I(id);
- var row = DeviceCardKit.SliderRow(name, () => G(id), n => { if (pi >= 0) engine.PluginParamSet(track, -1, pi, (float)n); Refresh(); }, () => fmt(G(id)), out var sync,
- begin: () => { if (pi >= 0) engine.BeginAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id); },
- end: () => { if (pi >= 0) engine.EndAutomationWrite(track, AutomationTarget.PluginParam, -1, -1, id); },
- trackWidth: trackW, valueWidth: 46);
- readouts.Add(sync);
- if (pi >= 0) MidiLearn.Bind(row, MidiTarget.PluginParam(track, -1, pi), name);
- return row;
+ var g = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*") };
+ g.Children.Add(a); Grid.SetColumn(b, 1); g.Children.Add(b);
+ return g;
}
- string GlideFmt(double v) => v <= 0.001 ? "off" : $"{20 * Math.Pow(120, v):0}\u2009ms";
- var monoSeg = Seg(new[] { "Poly", "Mono" }, G("mono") > 0.5f ? 1 : 0, i => { SetP("mono", i); Refresh(); }, 9);
- DockPanel.SetDock(monoSeg, Dock.Right);
- var liveStrip = new Border { Height = 34, Background = HdrBg, BorderBrush = Border2, BorderThickness = new Thickness(0, 0, 0, 1),
- Child = new DockPanel { Margin = new Thickness(9, 0), LastChildFill = false, Children = { monoSeg,
- new StackPanel { Orientation = Orientation.Horizontal, Spacing = 12, VerticalAlignment = VerticalAlignment.Center, Children = {
- Slider("fil1freq", 88, "CUTOFF", v => { double hz = 20 * Math.Pow(900, v); return hz >= 1000 ? $"{hz / 1000:0.0}\u2009k" : $"{hz:0}\u2009Hz"; }),
- Slider("fil1reso", 66, "RESO", v => $"{v:0.00}"),
- Slider("glide", 60, "GLIDE", GlideFmt) } } } } };
-
- // ---- tab bodies ----
- // Osc tab: three lanes (Osc1 / Osc2 / Noise) with a shared knob column.
- Control OscLane(string title, Control picker, params Control[] knobs)
- {
- var head = new StackPanel { Width = 96, Spacing = 3, VerticalAlignment = VerticalAlignment.Center, Children = { Lbl(title, 9, TxtC), picker } };
- var kr = Row(2, knobs);
- var lane = new Border { Height = 62, Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Padding = new Thickness(8, 2),
- Child = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, VerticalAlignment = VerticalAlignment.Center, Children = { head, kr } } };
- return lane;
+ var pitchCap = Cap("PITCH"); pitchCap.HorizontalAlignment = HorizontalAlignment.Center;
+ var modCap = Cap("MOD"); modCap.HorizontalAlignment = HorizontalAlignment.Center;
+ var wheelsCap = Cap("WHEELS"); wheelsCap.HorizontalAlignment = HorizontalAlignment.Center;
+ var wheelsGrid = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto,Auto"), RowSpacing = 4, Margin = new Thickness(4, 5) };
+ var wheelRows = new Control[] { wheelsCap, Pair(bendWheel, modWheel), Pair(pitchCap, modCap), Pair(bendVal, modVal) };
+ for (int i = 0; i < wheelRows.Length; i++) { Grid.SetRow(wheelRows[i], i); wheelsGrid.Children.Add(wheelRows[i]); }
+ var wheelsPanel = SectionBox(wheelsGrid);
+ wheelsPanel.Width = WheelsW;
+
+ // ---- Osc tab ----------------------------------------------------------
+ // One grid for all three sources, so the column headers sit over their own cells.
+ var oscGrid = new Grid
+ {
+ ColumnDefinitions = new ColumnDefinitions("46,Auto,*,*,*,*,*,Auto"), ColumnSpacing = 4,
+ RowDefinitions = new RowDefinitions("*,*,*"),
+ };
+ void OscCell(Control c, int row, int col, int span = 1)
+ { Grid.SetRow(c, row); Grid.SetColumn(c, col); if (span > 1) Grid.SetColumnSpan(c, span); oscGrid.Children.Add(c); }
+
+ // "ROUTE" over the F1 / F2 chips, right-aligned like the almanac's route cell.
+ Control RouteCell(string id)
+ {
+ var cap = Cap("ROUTE"); cap.HorizontalAlignment = HorizontalAlignment.Right;
+ var chips = StopChips(id, new[] { "F1", "F2" }, RouteStops);
+ chips.HorizontalAlignment = HorizontalAlignment.Right;
+ return new StackPanel { Spacing = 2, VerticalAlignment = VerticalAlignment.Center, Children = { cap, chips } };
}
- var mixBar = new MixBar(engine, track, new[] { I("osc1level"), I("osc2level"), I("noise") });
- readouts.Add(mixBar.Refresh);
- Control OscTab() => new StackPanel { Spacing = 5, Children = {
- OscLane("OSC 1", WaveChips("osc1wave"), K("osc1octave", "OCT"), K("osc1semi", "SEMI"), K("osc1detune", "FINE"), K("osc1level", "LEVEL"), K("osc1route", "ROUTE"), K("osc1phase", "PHASE")),
- OscLane("OSC 2", WaveChips("osc2wave"), K("osc2octave", "OCT"), K("osc2semi", "SEMI"), K("osc2detune", "FINE"), K("osc2level", "LEVEL"), K("osc2route", "ROUTE"), K("osc2phase", "PHASE")),
- OscLane("NOISE", Chips("noisecolor", new[] { "dark", "pink", "white" }),
- K("noise", "LEVEL"), K("noisecolor", "COLOR"), K("noiseroute", "ROUTE"),
- new StackPanel { Width = 120, Spacing = 3, VerticalAlignment = VerticalAlignment.Center, Children = { new TextBlock { Text = "MIX SUM", FontSize = 8, FontWeight = FontWeight.Bold, Foreground = MutedC }, mixBar } }) } };
-
- // Filter tab: big response graph + Fil1/Fil2 + type/slope + vertical knob list.
- var filtRight = new StackPanel { Width = 132, Spacing = 6, VerticalAlignment = VerticalAlignment.Center };
- void FillFilterRight()
+
+ for (int o = 0; o < 2; o++)
{
- string pre = fsel == 0 ? "fil1" : "fil2";
- filtRight.Children.Clear();
- filtRight.Children.Add(Chips(pre + "type", new[] { "LP", "HP", "BP", "Notch" }));
- filtRight.Children.Add(Seg(new[] { "12\u2009dB", "24\u2009dB" }, G(pre + "slope") > 0.5f ? 1 : 0, i => { SetP(pre + "slope", i); Refresh(); }, 8));
- filtRight.Children.Add(Row(2, K(pre + "freq", "CUTOFF"), K(pre + "reso", "RESO")));
- filtRight.Children.Add(Row(2, K(pre + "env", "ENV", true), K(pre + "key", "KEY", true)));
+ string pre = o == 0 ? "osc1" : "osc2";
+ string nm = o == 0 ? "OSC 1" : "OSC 2";
+ if (o > 0)
+ {
+ var rule = new Border { BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0) };
+ Grid.SetRow(rule, o); Grid.SetColumnSpan(rule, 8); oscGrid.Children.Add(rule);
+ }
+ OscCell(Section(nm), o, 0);
+ OscCell(WaveChips(pre + "wave"), o, 1);
+ OscCell(PKnob(pre + "octave", "OCT", nm + " Octave", Oct, 26, 40), o, 2);
+ OscCell(PKnob(pre + "semi", "SEMI", nm + " Semi", Semi, 26, 40), o, 3);
+ OscCell(PKnob(pre + "detune", "FINE", nm + " Fine", Cents, 26, 40, Teal), o, 4);
+ OscCell(PKnob(pre + "phase", "PHASE", nm + " Phase", Phase, 26, 40), o, 5);
+ OscCell(PKnob(pre + "level", "LEVEL", nm + " Level", Pct, 26, 40), o, 6);
+ OscCell(RouteCell(pre + "route"), o, 7);
}
- filtGraph.VerticalAlignment = VerticalAlignment.Stretch;
- Control FilterTab()
- {
- FillFilterRight();
- var g = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 8, VerticalAlignment = VerticalAlignment.Stretch };
- g.Children.Add(filtGraph);
- var right = new StackPanel { Spacing = 5, VerticalAlignment = VerticalAlignment.Center, Children = {
- new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, Children = { Lbl("FILTER", 9, TxtC), Seg(new[] { "1", "2" }, fsel, i => { fsel = i; FillFilterRight(); Refresh(); }, 9) } },
- filtRight } };
- Grid.SetColumn(right, 1); g.Children.Add(right);
- return g;
+ {
+ var rule = new Border { BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0) };
+ Grid.SetRow(rule, 2); Grid.SetColumnSpan(rule, 8); oscGrid.Children.Add(rule);
+ OscCell(Section("NOISE"), 2, 0);
+ OscCell(Chips("noisecolor", NoiseNames, () => NoiseBand(G("noisecolor")), iv => { SetP("noisecolor", NoiseStops[iv]); Refresh(); }), 2, 1);
+ OscCell(PKnob("noisecolor", "COLOR", "Noise Color", Pct, 26, 40), 2, 2);
+ OscCell(PKnob("noise", "LEVEL", "Noise Level", Pct, 26, 40), 2, 6);
+
+ var mixBar = new MixBar(engine, track, new[] { I("osc1level"), I("osc2level"), I("noise") });
+ readouts.Add(mixBar.Refresh);
+ var mixVal = Mono("", TextSecondary, NotaType.KnobValue);
+ readouts.Add(() =>
+ {
+ float sum = G("osc1level") + G("osc2level") + G("noise");
+ mixVal.Text = sum <= 1e-3f ? "silent" : NotaNum.Db(AudioMath.LinToDb(Math.Min(1f, sum)));
+ });
+ var mixCell = new StackPanel
+ {
+ Spacing = 2, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(6, 0),
+ Children = { Cap("MIX SUM"), mixBar, mixVal },
+ };
+ OscCell(mixCell, 2, 3, 3);
+ OscCell(RouteCell("noiseroute"), 2, 7);
}
+ var oscBody = new Border { Padding = new Thickness(7, 3), Child = oscGrid };
- // Env tab: amp + filter envelopes side by side with A/D/S/R value cells.
- Control EnvPanel(string title, string route, VoltEnv gView, string[] ids)
+ // ---- Filter tab -------------------------------------------------------
+ // Both filters share one column of controls; picking 1 or 2 swaps which set of
+ // knobs is visible — a knob is bound to one param index for its life.
+ var filtCells = new Panel[6];
+ var filtStack = new Control[2, 6];
+ string[] filtIds = { "freq", "reso", "env", "key", "lfo", "tof2" };
+ string[] filtLbl = { "Cutoff", "Reso", "Env", "Key", "LFO", "To F2" };
+ var filtKnobGrid = new Grid
{
- gView.Target(title, P(ids[0]), P(ids[1]), P(ids[2]), P(ids[3]));
- gView.VerticalAlignment = VerticalAlignment.Stretch;
- string[] lbl = { "A", "D", "S", "R" };
- var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*,*"), ColumnSpacing = 4, Margin = new Thickness(0, 5, 0, 0) };
- for (int k = 0; k < 4; k++)
+ ColumnDefinitions = new ColumnDefinitions("*,*,*"), RowDefinitions = new RowDefinitions("*,*"),
+ VerticalAlignment = VerticalAlignment.Stretch,
+ };
+ for (int k = 0; k < 6; k++)
+ {
+ filtCells[k] = new Panel();
+ Grid.SetColumn(filtCells[k], k % 3); Grid.SetRow(filtCells[k], k / 3);
+ filtKnobGrid.Children.Add(filtCells[k]);
+ }
+ for (int f = 0; f < 2; f++)
+ {
+ string pre = f == 0 ? "fil1" : "fil2";
+ for (int k = 0; k < 6; k++)
{
- var v = new TextBlock { Text = Pct(G(ids[k])), FontSize = 9, Foreground = TxtC, HorizontalAlignment = HorizontalAlignment.Center };
- v.BindResource(TextBlock.FontFamilyProperty, "Font.Mono");
- string pid = ids[k]; var tv = v; readouts.Add(() => tv.Text = Pct(G(pid)));
- var cell = new Border { Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Padding = new Thickness(2, 2),
- Child = new StackPanel { Children = { new TextBlock { Text = lbl[k], FontSize = 8, FontWeight = FontWeight.Bold, Foreground = MutedC, HorizontalAlignment = HorizontalAlignment.Center }, v } } };
- Grid.SetColumn(cell, k); grid.Children.Add(cell);
+ string id = pre + filtIds[k];
+ Func<float, string> fmt = k switch
+ {
+ 0 => Hz, 1 => Reso, 2 => Bip, 3 => Pct, 4 => Bip, _ => Pct,
+ };
+ // Filter 2 has no "To F2" — it is the end of that path.
+ Control cell = k == 5 && f == 1
+ ? new Panel()
+ : PKnob(id, filtLbl[k].ToUpperInvariant(), $"Filter {f + 1} {filtLbl[k]}", fmt, 26, 44, k >= 2 ? Teal : null);
+ cell.IsVisible = false;
+ filtStack[f, k] = cell;
+ filtCells[k].Children.Add(cell);
}
- DockPanel.SetDock(grid, Dock.Bottom);
- var head = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, Children = { Lbl(title, 9, TxtC), new TextBlock { Text = route, FontSize = 8, Foreground = TealC, VerticalAlignment = VerticalAlignment.Center } } };
- DockPanel.SetDock(head, Dock.Top);
- var body = new DockPanel { LastChildFill = true, Children = { head, grid, gView } };
- return new Border { Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Padding = new Thickness(8, 6), Child = body };
}
- Control EnvTab()
+ var filtTypeHosts = new Panel[2];
+ var filtSlopeHosts = new Panel[2];
+ var filtTypeChips = new Control[2];
+ var filtSlopeChips = new Control[2];
+ for (int f = 0; f < 2; f++)
+ {
+ string pre = f == 0 ? "fil1" : "fil2";
+ filtTypeChips[f] = Chips(pre + "type", FilterNames);
+ filtSlopeChips[f] = Chips(pre + "slope", new[] { "12\u2009dB", "24\u2009dB" }, () => G(pre + "slope") >= 0.5f ? 1 : 0,
+ iv => { SetP(pre + "slope", iv); Refresh(); }, fill: true);
+ filtTypeHosts[f] = new Panel { Children = { filtTypeChips[f] } };
+ filtSlopeHosts[f] = new Panel { Children = { filtSlopeChips[f] } };
+ }
+ var filtPick = Segments(new[] { "1", "2" }, () => fsel, iv => { fsel = iv; Refresh(); }, out var filtPickSync);
+ readouts.Add(filtPickSync);
+ filtPick.HorizontalAlignment = HorizontalAlignment.Right;
+ var filtHead = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") };
+ filtHead.Children.Add(Cap("FILTER"));
+ Grid.SetColumn(filtPick, 1); filtHead.Children.Add(filtPick);
+
+ var filtTypeStack = new Panel();
+ foreach (var h in filtTypeHosts) filtTypeStack.Children.Add(h);
+ var filtSlopeStack = new Panel();
+ foreach (var h in filtSlopeHosts) filtSlopeStack.Children.Add(h);
+
+ var filtRight = new Grid { RowDefinitions = new RowDefinitions("Auto,Auto,Auto,*"), RowSpacing = 4, Width = 136 };
+ var filtRightRows = new Control[] { filtHead, filtTypeStack, filtSlopeStack, filtKnobGrid };
+ for (int i = 0; i < filtRightRows.Length; i++) { Grid.SetRow(filtRightRows[i], i); filtRight.Children.Add(filtRightRows[i]); }
+
+ applyFilter = () =>
{
- var g = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*"), ColumnSpacing = 8, VerticalAlignment = VerticalAlignment.Stretch };
- var a = EnvPanel("AMP ENV", "→ Level", ampEnv, new[] { "attack", "decay", "sustain", "release" });
- var f = EnvPanel("FILTER ENV", "→ Cutoff", filtEnv, new[] { "fattack", "fdecay", "fsustain", "frelease" });
- Grid.SetColumn(f, 1); g.Children.Add(a); g.Children.Add(f);
+ string pre = fsel == 0 ? "fil1" : "fil2";
+ filtGraph.Target($"FILTER {fsel + 1}", P(pre + "freq"), P(pre + "reso"), Sel(pre + "type", 4));
+ filtGraph.Refresh();
+ for (int f = 0; f < 2; f++)
+ {
+ filtTypeHosts[f].IsVisible = filtSlopeHosts[f].IsVisible = f == fsel;
+ for (int k = 0; k < 6; k++) filtStack[f, k].IsVisible = f == fsel;
+ }
+ };
+
+ var filtGrid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 7 };
+ filtGrid.Children.Add(filtGraph);
+ Grid.SetColumn(filtRight, 1); filtGrid.Children.Add(filtRight);
+ var filtBody = new Border { Padding = new Thickness(7, 5), Child = filtGrid };
+
+ // ---- Env tab ----------------------------------------------------------
+ Control EnvPanel(string title, string route, VoltEnv view, string[] ids, Func<string> summary)
+ {
+ view.Target(title, P(ids[0]), P(ids[1]), P(ids[2]), P(ids[3]));
+ string[] stage = { "A", "D", "S", "R" };
+ Func<float, string>[] fmt =
+ {
+ v => Secs(v, 0.001, 2.0), v => Secs(v, 0.002, 4.0), Pct, v => Secs(v, 0.002, 5.0),
+ };
+ var cells = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*,*"), ColumnSpacing = 3 };
+ for (int k = 0; k < 4; k++)
+ {
+ string id = ids[k];
+ var fk = fmt[k];
+ var v = Mono(fk(G(id)), TextPrimary, NotaType.RowLabel);
+ v.HorizontalAlignment = HorizontalAlignment.Center;
+ readouts.Add(() => v.Text = fk(G(id)));
+ var cap = Cap(stage[k]); cap.HorizontalAlignment = HorizontalAlignment.Center;
+ var cell = new Border
+ {
+ Background = NotaPalette.SurfaceRaised, BorderBrush = BorderDef, BorderThickness = new Thickness(1),
+ CornerRadius = NotaRadius.Badge, Padding = new Thickness(2, 1),
+ Child = new StackPanel { Children = { cap, v } },
+ };
+ if (I(id) is var pi and >= 0) MidiLearn.Bind(cell, MidiTarget.PluginParam(track, -1, pi), title + " · " + stage[k]);
+ Grid.SetColumn(cell, k); cells.Children.Add(cell);
+ }
+ var sum = Mono("", TextSecondary, NotaType.Axis);
+ sum.HorizontalAlignment = HorizontalAlignment.Right;
+ readouts.Add(() => sum.Text = summary());
+ var head = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,*"), ColumnSpacing = 5, Height = 11 };
+ head.Children.Add(Cap(title));
+ var dest = Mono(route, Teal, NotaType.Axis); Grid.SetColumn(dest, 1); head.Children.Add(dest);
+ Grid.SetColumn(sum, 2); head.Children.Add(sum);
+
+ var g = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto"), RowSpacing = 4 };
+ g.Children.Add(head);
+ Grid.SetRow(view, 1); g.Children.Add(view);
+ Grid.SetRow(cells, 2); g.Children.Add(cells);
return g;
}
+ string AdsrSum(string a, string d, string s, string r)
+ => $"{Secs(G(a), 0.001, 2.0)} · {Secs(G(d), 0.002, 4.0)} · {Pct(G(s))} · {Secs(G(r), 0.002, 5.0)}";
+ var ampPanel = EnvPanel("AMP ENV", "→ Level", ampEnv, new[] { "attack", "decay", "sustain", "release" },
+ () => AdsrSum("attack", "decay", "sustain", "release"));
+ var filtEnvPanel = EnvPanel("FILTER ENV", "→ Cutoff", filtEnv, new[] { "fattack", "fdecay", "fsustain", "frelease" },
+ () => AdsrSum("fattack", "fdecay", "fsustain", "frelease"));
+ var filtEnvHost = new Border
+ {
+ BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(1, 0, 0, 0),
+ Padding = new Thickness(6, 0, 0, 0), Child = filtEnvPanel,
+ };
+ var envGrid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*"), ColumnSpacing = 6 };
+ envGrid.Children.Add(ampPanel);
+ Grid.SetColumn(filtEnvHost, 1); envGrid.Children.Add(filtEnvHost);
+ var envBody = new Border { Padding = new Thickness(7, 5), Child = envGrid };
+
+ // ---- LFO tab ----------------------------------------------------------
+ // Where an LFO actually lands: its strongest matrix route, or the filter cutoff it
+ // is wired to by the fixed routing. A modulator that goes nowhere says so.
+ string LfoDest(int src)
+ {
+ int best = -1; double mag = 0.02;
+ for (int d = 0; d < 6; d++)
+ {
+ double a = Math.Abs(G($"mtx{src}_{d}") - 0.5) * 2;
+ if (a > mag) { mag = a; best = d; }
+ }
+ string fixedId = src == 2 ? "fil1lfo" : "fil2lfo";
+ double fixedAmt = Math.Abs(G(fixedId) - 0.5) * 2;
+ if (fixedAmt > mag) return $"→ Filter {(src == 2 ? 1 : 2)}";
+ return best < 0 ? "unrouted" : "→ " + DestNames[best];
+ }
- // LFO tab: LFO 1 / LFO 2 / Vibrato lanes.
- Control LfoLane(string title, Control? extras, params Control[] knobs)
+ var lfoGrid = new Grid
+ {
+ ColumnDefinitions = new ColumnDefinitions("52,Auto,*,*,*,*,Auto"), ColumnSpacing = 5,
+ RowDefinitions = new RowDefinitions("*,*,*"),
+ };
+ void LfoCell(Control c, int row, int col) { Grid.SetRow(c, row); Grid.SetColumn(c, col); lfoGrid.Children.Add(c); }
+ for (int l = 0; l < 2; l++)
+ {
+ string pre = l == 0 ? "lfo1" : "lfo2";
+ string nm = l == 0 ? "LFO 1" : "LFO 2";
+ int src = l + 2;
+ if (l > 0)
+ {
+ var rule = new Border { BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0) };
+ Grid.SetRow(rule, l); Grid.SetColumnSpan(rule, 7); lfoGrid.Children.Add(rule);
+ }
+ LfoCell(Section(nm), l, 0);
+ LfoCell(Chips(pre + "shape", ShapeNames), l, 1);
+ string rateId = pre + "rate", syncId = pre + "sync";
+ LfoCell(PKnob(rateId, "RATE", nm + " Rate", v => SyncDiv(G(syncId)) > 0 ? SyncText(G(syncId)) : SlowHz(ExpMap(v, 0.05, 20)), 28, 46), l, 2);
+ LfoCell(PKnob(pre + "depth", "DEPTH", nm + " Depth", Pct, 28, 46, Teal), l, 3);
+ LfoCell(PKnob(syncId, "SYNC", nm + " Sync", SyncText, 28, 46), l, 4);
+ LfoCell(PKnob(pre + "fade", "FADE", nm + " Fade", FadeT, 28, 46, Teal), l, 5);
+ var dest = Mono("", Teal, NotaType.Axis);
+ dest.HorizontalAlignment = HorizontalAlignment.Right; dest.Width = 62; dest.TextAlignment = TextAlignment.Right;
+ readouts.Add(() => dest.Text = LfoDest(src));
+ LfoCell(dest, l, 6);
+ }
{
- var head = new StackPanel { Width = 116, Spacing = 3, VerticalAlignment = VerticalAlignment.Center, Children = { Lbl(title, 9, TxtC) } };
- if (extras != null) head.Children.Add(extras);
- var lane = new Border { Height = 62, Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Padding = new Thickness(8, 2),
- Child = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, VerticalAlignment = VerticalAlignment.Center, Children = { head, Row(2, knobs) } } };
- return lane;
+ var rule = new Border { BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0) };
+ Grid.SetRow(rule, 2); Grid.SetColumnSpan(rule, 7); lfoGrid.Children.Add(rule);
+ LfoCell(Section("VIBRATO"), 2, 0);
+ LfoCell(Toggle("By wheel", "vibwheel"), 2, 1);
+ LfoCell(PKnob("vibrate", "RATE", "Vibrato Rate", v => SlowHz(ExpMap(v, 0.1, 12)), 28, 46), 2, 2);
+ LfoCell(PKnob("vibamt", "DEPTH", "Vibrato Depth", VibDepth, 28, 46, Teal), 2, 3);
+ var note = new TextBlock
+ {
+ Text = "vibrato always rides the pitch", FontSize = NotaType.Axis, Foreground = TextDisabled,
+ VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap,
+ };
+ Grid.SetRow(note, 2); Grid.SetColumn(note, 4); Grid.SetColumnSpan(note, 2); lfoGrid.Children.Add(note);
+ var dest = Mono("→ Pitch", Teal, NotaType.Axis);
+ dest.HorizontalAlignment = HorizontalAlignment.Right; dest.Width = 62; dest.TextAlignment = TextAlignment.Right;
+ LfoCell(dest, 2, 6);
}
- Control LfoTab() => new StackPanel { Spacing = 5, Children = {
- LfoLane("LFO 1", Chips("lfo1shape", new[] { "sin", "tri", "sqr", "S&H" }, 8), K("lfo1rate", "RATE"), K("lfo1depth", "DEPTH", true), K("lfo1sync", "SYNC"), K("lfo1fade", "FADE", true)),
- LfoLane("LFO 2", Chips("lfo2shape", new[] { "sin", "tri", "sqr", "S&H" }, 8), K("lfo2rate", "RATE"), K("lfo2depth", "DEPTH", true), K("lfo2sync", "SYNC"), K("lfo2fade", "FADE", true)),
- LfoLane("VIBRATO", null, K("vibrate", "RATE"), K("vibamt", "DEPTH", true)) } };
+ var lfoBody = new Border { Padding = new Thickness(7, 3), Child = lfoGrid };
- // Mod tab: 7×6 drag matrix.
+ // ---- Mod tab ----------------------------------------------------------
var mtxIdx = new int[7, 6];
for (int s = 0; s < 7; s++) for (int d = 0; d < 6; d++) mtxIdx[s, d] = I($"mtx{s}_{d}");
- var matrix = new VoltMatrix(engine, track, mtxIdx, new[] { "Amp Env", "Flt Env", "LFO 1", "LFO 2", "Velocity", "Key", "Mod Whl" }, DestNames) { VerticalAlignment = VerticalAlignment.Stretch };
+ var matrix = new VoltMatrix(engine, track, mtxIdx, SrcNames, DestNames) { VerticalAlignment = VerticalAlignment.Stretch };
+ matrix.Changed += Refresh;
readouts.Add(matrix.Refresh);
- Control ModTab()
- {
- var clear = new Border { Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Control, Padding = new Thickness(7, 1), Cursor = new Cursor(StandardCursorType.Hand), VerticalAlignment = VerticalAlignment.Center, Child = new TextBlock { Text = "Clear all", FontSize = 9, Foreground = MutedC } };
- clear.PointerPressed += (_, _) => matrix.ClearAll();
- var head = new DockPanel { Margin = new Thickness(0, 0, 0, 4), LastChildFill = false, Children = { clear,
- new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, VerticalAlignment = VerticalAlignment.Center, Children = { Lbl("MOD MATRIX", 9, TxtC), new TextBlock { Text = "drag a cell · up +, down −", FontSize = 8, Foreground = MutedC, VerticalAlignment = VerticalAlignment.Center } } } } };
- DockPanel.SetDock(clear, Dock.Right);
- DockPanel.SetDock(head, Dock.Top);
- return new DockPanel { LastChildFill = true, Children = { head, matrix } };
+ int RouteCount()
+ {
+ int n = 0;
+ for (int s = 0; s < 7; s++) for (int d = 0; d < 6; d++) if (Math.Abs(G($"mtx{s}_{d}") - 0.5) > 0.01) n++;
+ return n;
}
+ var modHint = new TextBlock
+ {
+ Text = "drag a cell — up adds, down subtracts · double-click clears", FontSize = NotaType.Axis,
+ Foreground = TextDisabled, VerticalAlignment = VerticalAlignment.Center,
+ };
+ var modGrid = new Grid { RowDefinitions = new RowDefinitions("*,Auto"), RowSpacing = 3 };
+ modGrid.Children.Add(matrix);
+ Grid.SetRow(modHint, 1); modGrid.Children.Add(modHint);
+ var modBody = new Border { Padding = new Thickness(7, 4), Child = modGrid };
+
+ // ---- Macro tab --------------------------------------------------------
+ var macroGrid = new Grid
+ {
+ ColumnDefinitions = new ColumnDefinitions("*,*,*,*"), RowDefinitions = new RowDefinitions("*,*"),
+ ColumnSpacing = 5, RowSpacing = 5,
+ };
+ int MacroDest(int m) => Math.Clamp((int)Math.Round(G($"mac{m}dest") * (MacroDests.Length - 1)), 0, MacroDests.Length - 1);
+ bool MacroOn(int m) => Math.Abs(G($"mac{m}amt") - 0.5f) > 0.01f;
+ for (int m = 0; m < 8; m++)
+ {
+ int mv = m;
+ string destId = $"mac{mv}dest";
+ var name = new TextBlock
+ {
+ FontSize = NotaType.KnobLabel, FontWeight = FontWeight.Bold, LetterSpacing = NotaType.KnobLabelTracking,
+ Foreground = NotaPalette.TextStrong, HorizontalAlignment = HorizontalAlignment.Center,
+ };
+ var dest = new TextBlock
+ {
+ FontSize = NotaType.Axis, Foreground = Teal, HorizontalAlignment = HorizontalAlignment.Center,
+ Cursor = new Cursor(StandardCursorType.Hand),
+ };
+ ToolTip.SetTip(dest, "Click for the next target, right-click for the previous");
+ void Step(int dir)
+ {
+ int n = MacroDests.Length;
+ Begin(destId);
+ SetP(destId, ((MacroDest(mv) + dir % n + n) % n) / (float)(n - 1));
+ End(destId);
+ Refresh();
+ }
+ dest.PointerPressed += (_, e) =>
+ {
+ var pt = e.GetCurrentPoint(dest).Properties;
+ if (pt.IsLeftButtonPressed) { Step(+1); e.Handled = true; }
+ else if (pt.IsRightButtonPressed) { Step(-1); e.Handled = true; }
+ };
+ if (I(destId) is var dpi and >= 0) MidiLearn.Bind(dest, MidiTarget.PluginParam(track, -1, dpi), $"Macro {mv + 1} Dest");
+
+ var cellBorder = new Border
+ {
+ Background = NotaPalette.SurfaceRaised, BorderBrush = BorderDef, BorderThickness = new Thickness(1),
+ CornerRadius = NotaRadius.Control, Padding = new Thickness(2, 2),
+ Child = new StackPanel
+ {
+ Spacing = 1, VerticalAlignment = VerticalAlignment.Center,
+ Children =
+ {
+ new StackPanel
+ {
+ Orientation = Orientation.Horizontal, Spacing = 2, HorizontalAlignment = HorizontalAlignment.Center,
+ Children =
+ {
+ PKnob($"mac{mv}val", "", $"Macro {mv + 1}", Pct, 30, 38),
+ PKnob($"mac{mv}amt", "", $"Macro {mv + 1} Amount", Bip, 26, 38, Teal),
+ },
+ },
+ name, dest,
+ },
+ },
+ };
+ readouts.Add(() =>
+ {
+ bool on = MacroOn(mv);
+ int d = MacroDest(mv);
+ name.Text = on ? $"MACRO {mv + 1} · {MacroWords[d]}" : $"MACRO {mv + 1}";
+ name.Foreground = on ? NotaPalette.TextStrong : TextDisabled;
+ dest.Text = on ? "→ " + MacroDests[d] : "unassigned";
+ dest.Foreground = on ? Teal : TextDisabled;
+ cellBorder.Background = on ? NotaPalette.SurfaceRaised : NotaPalette.BgSunken;
+ cellBorder.BorderBrush = on ? BorderDef : NotaPalette.GraphBorder;
+ });
+ Grid.SetColumn(cellBorder, mv % 4); Grid.SetRow(cellBorder, mv / 4);
+ macroGrid.Children.Add(cellBorder);
+ }
+ var macroBody = new Border { Padding = new Thickness(7, 5), Child = macroGrid };
+
+ // ---- the tab strip ----------------------------------------------------
+ var bodies = new Control[] { oscBody, filtBody, envBody, lfoBody, modBody, macroBody };
+ var tabCells = new Border[TabNames.Length];
+ var tabTexts = new TextBlock[TabNames.Length];
+ var clearAll = TextButton("Clear all");
+ clearAll.Margin = new Thickness(0, 0, 6, 0);
+ ToolTip.SetTip(clearAll, "Zero every route in the matrix");
+ clearAll.PointerPressed += (_, e) =>
+ {
+ if (!e.GetCurrentPoint(clearAll).Properties.IsLeftButtonPressed) return;
+ matrix.ClearAll(); Refresh(); e.Handled = true;
+ };
+
+ var tabRow = new StackPanel { Orientation = Orientation.Horizontal };
+ for (int i = 0; i < TabNames.Length; i++)
+ {
+ int iv = i;
+ var tb = new TextBlock { Text = TabNames[i], FontSize = NotaType.DeviceSection, VerticalAlignment = VerticalAlignment.Center };
+ var cell = new Border
+ {
+ Padding = new Thickness(7, 0), BorderThickness = new Thickness(0, 0, 0, 2),
+ Cursor = new Cursor(StandardCursorType.Hand), Child = tb,
+ };
+ cell.PointerPressed += (_, e) =>
+ {
+ if (!e.GetCurrentPoint(cell).Properties.IsLeftButtonPressed) return;
+ tab = iv; showTab(); e.Handled = true;
+ };
+ tabCells[i] = cell; tabTexts[i] = tb; tabRow.Children.Add(cell);
+ }
+ var tabStrip = new Grid { Height = TabH, ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto") };
+ tabStrip.Children.Add(tabRow);
+ Grid.SetColumn(hint, 1); tabStrip.Children.Add(hint);
+ Grid.SetColumn(clearAll, 2); tabStrip.Children.Add(clearAll);
+
+ showTab = () =>
+ {
+ for (int i = 0; i < TabNames.Length; i++)
+ {
+ bool on = i == tab;
+ tabCells[i].Background = on ? NotaPalette.SurfaceRaised : Brushes.Transparent;
+ tabCells[i].BorderBrush = on ? Brass : Brushes.Transparent;
+ tabTexts[i].Foreground = on ? AccentBright : TextTertiary;
+ tabTexts[i].FontWeight = on ? FontWeight.SemiBold : FontWeight.Normal;
+ bodies[i].IsVisible = on;
+ }
+ clearAll.IsVisible = tab == 4;
+ Refresh();
+ };
+
+ var tabHost = new Panel { MinHeight = BodyH - TabH };
+ foreach (var b in bodies) tabHost.Children.Add(b);
+ var tabGrid = new Grid { RowDefinitions = new RowDefinitions("Auto,*") };
+ tabGrid.Children.Add(HeaderStrip(tabStrip));
+ Grid.SetRow(tabHost, 1); tabGrid.Children.Add(tabHost);
+ var tabPanel = SectionBox(tabGrid);
- // Macro tab: 8 macros (value knob + destination cycle + amount).
- Control MacroCell(int m)
+ // ---- rail · Global ----------------------------------------------------
+ var monoChips = Chips("mono", new[] { "Poly", "Mono" }, () => G("mono") >= 0.5f ? 1 : 0, iv => { SetP("mono", iv); Refresh(); });
+ monoChips.HorizontalAlignment = HorizontalAlignment.Right;
+ var monoRow = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") };
+ monoRow.Children.Add(Cap("VOICES"));
+ Grid.SetColumn(monoChips, 1); monoRow.Children.Add(monoChips);
+
+ var bendChips = Segments(BendNames, () => NearestExact(G("bendrange"), BendStops),
+ iv => { SetP("bendrange", BendStops[iv]); Refresh(); }, out var bendSync);
+ readouts.Add(bendSync);
+ if (I("bendrange") is var bri and >= 0) MidiLearn.Bind(bendChips, MidiTarget.PluginParam(track, -1, bri), "Bend Range");
+ bendChips.HorizontalAlignment = HorizontalAlignment.Right;
+ var bendRow = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") };
+ bendRow.Children.Add(Cap("BEND"));
+ Grid.SetColumn(bendChips, 1); bendRow.Children.Add(bendChips);
+
+ var meter = new MeterBar { VerticalAlignment = VerticalAlignment.Stretch, Width = MeterScale.StereoWidth };
+ ctx.AddDeviceRefresher(() => { if (engine.TryGetTrackMeter(track, out var m)) meter.Push(m); });
+ var meterScale = new Grid
+ {
+ VerticalAlignment = VerticalAlignment.Stretch,
+ RowDefinitions = new RowDefinitions(string.Join(",", ScaleRows(0, -12, -48))),
+ };
+ for (int i = 0; i < 3; i++)
{
- var dest = new TextBlock { FontSize = 8, Foreground = TealC, HorizontalAlignment = HorizontalAlignment.Center, Cursor = new Cursor(StandardCursorType.Hand) };
- void SyncDest() => dest.Text = "→ " + DestNames[Sel($"mac{m}dest", 6)];
- dest.PointerPressed += (_, _) => { SetP($"mac{m}dest", ((Sel($"mac{m}dest", 6) + 1) % 6) / 5f); SyncDest(); };
- readouts.Add(SyncDest); SyncDest();
- var body = new StackPanel { Width = 116, Spacing = 1, HorizontalAlignment = HorizontalAlignment.Center, Children = {
- Row(2, K($"mac{m}val", $"MACRO {m + 1}"), K($"mac{m}amt", "AMOUNT", true)), dest } };
- return new Border { Background = Inset, BorderBrush = Border2, BorderThickness = new Thickness(1), CornerRadius = NotaRadius.Panel, Padding = new Thickness(4, 4), Child = body };
+ var c = Mono(i == 0 ? "0" : i == 1 ? "−12" : "−48", NotaPalette.TextAxis, NotaType.Axis);
+ Grid.SetRow(c, i * 2 + 1); meterScale.Children.Add(c);
}
- Control MacroTab()
+ var meterBlock = new Grid
+ {
+ ColumnDefinitions = new ColumnDefinitions("Auto,Auto"), ColumnSpacing = 4,
+ HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(0, 0, 0, 9),
+ };
+ meterBlock.Children.Add(meter);
+ Grid.SetColumn(meterScale, 1); meterBlock.Children.Add(meterScale);
+
+ var globalBottom = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,Auto,*"), VerticalAlignment = VerticalAlignment.Stretch };
+ var gainCell = PKnob("volume", "GAIN", "Gain", Pct, NotaSize.KnobMain, 48);
+ var panCell = PKnob("outpan", "PAN", "Out Pan", PanText, NotaSize.KnobRegular, 44);
+ globalBottom.Children.Add(gainCell);
+ Grid.SetColumn(panCell, 1); globalBottom.Children.Add(panCell);
+ Grid.SetColumn(meterBlock, 2); globalBottom.Children.Add(meterBlock);
+
+ var globalTop = new StackPanel
+ {
+ Spacing = 5, Margin = new Thickness(8, 6, 8, 0),
+ Children =
+ {
+ monoRow,
+ bendRow,
+ Slider("CUTOFF", "fil1freq", () => Hz(G("fil1freq")), labelW: 40),
+ Slider("RESO", "fil1reso", () => Reso(G("fil1reso")), labelW: 40),
+ Slider("GLIDE", "glide", () => GlideT(G("glide")), labelW: 40),
+ },
+ };
+ var globalGrid = new Grid { RowDefinitions = new RowDefinitions("Auto,*") };
+ globalGrid.Children.Add(globalTop);
+ var globalBottomFrame = new Border
+ {
+ BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0),
+ Margin = new Thickness(8, 5, 8, 5), Padding = new Thickness(0, 4, 0, 0), Child = globalBottom,
+ };
+ Grid.SetRow(globalBottomFrame, 1); globalGrid.Children.Add(globalBottomFrame);
+
+ // ---- rail · Voice -----------------------------------------------------
+ Control AmpRow(string title, string levelId, string panId, string name)
{
- var g = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*,*,*"), RowDefinitions = new RowDefinitions("*,*"), ColumnSpacing = 5, RowSpacing = 5, VerticalAlignment = VerticalAlignment.Center };
- for (int m = 0; m < 8; m++) { var c = MacroCell(m); Grid.SetColumn(c, m % 4); Grid.SetRow(c, m / 4); g.Children.Add(c); }
+ var knobs = new StackPanel
+ {
+ Orientation = Orientation.Horizontal, Spacing = 4, VerticalAlignment = VerticalAlignment.Center,
+ Children = { PKnob(levelId, "LEVEL", name + " Level", Pct, 30, 44), PKnob(panId, "PAN", name + " Pan", PanText, 30, 44) },
+ };
+ knobs.HorizontalAlignment = HorizontalAlignment.Right;
+ var g = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*") };
+ g.Children.Add(Cap(title));
+ Grid.SetColumn(knobs, 1); g.Children.Add(knobs);
return g;
}
+ var voiceGrid = new StackPanel
+ {
+ Spacing = 4, Margin = new Thickness(8, 5),
+ Children =
+ {
+ AmpRow("AMP 1", "amp1level", "amp1pan", "Amp 1"),
+ AmpRow("AMP 2", "amp2level", "amp2pan", "Amp 2"),
+ new Border
+ {
+ BorderBrush = NotaPalette.GraphBorder, BorderThickness = new Thickness(0, 1, 0, 0),
+ Padding = new Thickness(0, 5, 0, 0),
+ Child = new StackPanel
+ {
+ Spacing = 5,
+ Children =
+ {
+ Slider("UNISON", "unison", () => Pct(G("unison")), labelW: 46),
+ Slider("VEL→AMP", "velamp", () => Pct(G("velamp")), labelW: 46),
+ Slider("VEL→FIL", "velfilter", () => Pct(G("velfilter")), labelW: 46),
+ },
+ },
+ },
+ },
+ };
- // ---- output rail: Gain + Pan (the peak meter now lives in the shared shell header) ----
- var outRail = new Border { Width = 96, Background = RailBg, BorderBrush = Border2, BorderThickness = new Thickness(1, 0, 0, 0), Padding = new Thickness(8, 8),
- Child = new StackPanel { Spacing = 14, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Children = {
- K("volume", "GAIN", false, 40, 60), K("outpan", "PAN", false, 36, 54) } } };
- DockPanel.SetDock(outRail, Dock.Right);
-
- // ---- tab rail + swapped body ----
- string[] tabs = { "Osc", "Filter", "Env", "LFO", "Mod", "Macro" };
- bool[] tealTab = { false, false, false, true, true, false };
- var tabHost = new ContentControl { VerticalAlignment = VerticalAlignment.Stretch };
- // Build each tab once and cache it: several tabs embed a single shared control
- // (mix bar, filter/env graphs, matrix), so rebuilding on every switch would try
- // to re-parent them (crash) and re-register live-follow knobs (leak).
- var tabCache = new Control?[tabs.Length];
- Control TabBody(int t) => tabCache[t] ??= t switch { 1 => FilterTab(), 2 => EnvTab(), 3 => LfoTab(), 4 => ModTab(), 5 => MacroTab(), _ => OscTab() };
- int tabSel = 0; var tabBtns = new Border[tabs.Length];
- void HiTabs() { for (int i = 0; i < tabs.Length; i++) { bool on = i == tabSel; tabBtns[i].Background = on ? NotaPalette.SurfaceRaised : Brushes.Transparent; tabBtns[i].BorderBrush = on ? (tealTab[i] ? TealC : Amber) : Brushes.Transparent; ((TextBlock)tabBtns[i].Child!).Foreground = on ? TxtC : MutedC; } }
- var railCol = new StackPanel { Spacing = 2 };
- for (int i = 0; i < tabs.Length; i++)
+ // ---- the rail's own two tabs ------------------------------------------
+ var railBodies = new Control[] { globalGrid, voiceGrid };
+ var railCells = new Border[RailTabs.Length];
+ var railTexts = new TextBlock[RailTabs.Length];
+ var railTabGrid = new Grid { Height = TabH, ColumnDefinitions = new ColumnDefinitions("*,*") };
+ void ShowRailTab()
+ {
+ for (int i = 0; i < RailTabs.Length; i++)
+ {
+ bool on = i == railTab;
+ railCells[i].Background = on ? NotaPalette.SurfaceRaised : Brushes.Transparent;
+ railCells[i].BorderBrush = on ? Brass : Brushes.Transparent;
+ railTexts[i].Foreground = on ? AccentBright : TextTertiary;
+ railTexts[i].FontWeight = on ? FontWeight.SemiBold : FontWeight.Normal;
+ railBodies[i].IsVisible = on;
+ }
+ Refresh();
+ }
+ for (int i = 0; i < RailTabs.Length; i++)
{
int iv = i;
- var b = new Border { Height = 22, CornerRadius = NotaRadius.Control, Padding = new Thickness(8, 0), BorderThickness = new Thickness(2, 0, 0, 0), BorderBrush = Brushes.Transparent,
- Child = new TextBlock { Text = tabs[i], FontSize = 9, FontWeight = FontWeight.Medium, Foreground = MutedC, VerticalAlignment = VerticalAlignment.Center } };
- b.PointerPressed += (_, _) => { tabSel = iv; HiTabs(); tabHost.Content = TabBody(iv); };
- tabBtns[i] = b; railCol.Children.Add(b);
+ var tb = new TextBlock
+ {
+ Text = RailTabs[i], FontSize = NotaType.DeviceSection,
+ HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
+ };
+ var cell = new Border
+ {
+ BorderThickness = new Thickness(0, 0, 0, 2), Cursor = new Cursor(StandardCursorType.Hand), Child = tb,
+ };
+ cell.PointerPressed += (_, e) =>
+ {
+ if (!e.GetCurrentPoint(cell).Properties.IsLeftButtonPressed) return;
+ railTab = iv; ShowRailTab(); e.Handled = true;
+ };
+ railCells[i] = cell; railTexts[i] = tb;
+ Grid.SetColumn(cell, i); railTabGrid.Children.Add(cell);
}
- var rail = new Border { Width = 80, Background = RailBg, BorderBrush = Border2, BorderThickness = new Thickness(0, 0, 1, 0), Padding = new Thickness(5, 8), Child = railCol };
- DockPanel.SetDock(rail, Dock.Left);
- var body = new DockPanel { LastChildFill = true, Children = { rail, outRail, new Border { Padding = new Thickness(10, 8), Child = tabHost } } };
+ var railHost = new Panel();
+ foreach (var b in railBodies) railHost.Children.Add(b);
+ var railGrid = new Grid { RowDefinitions = new RowDefinitions("Auto,*") };
+ railGrid.Children.Add(HeaderStrip(railTabGrid));
+ Grid.SetRow(railHost, 1); railGrid.Children.Add(railHost);
+ var rail = SectionBox(railGrid);
+ rail.Width = RailW;
- // ---- assemble (body only; the shared shell provides the header + frame) ----
- DockPanel.SetDock(liveStrip, Dock.Top);
- var dockRoot = new DockPanel { LastChildFill = true, Background = CardBg, Children = { liveStrip, body } };
+ // ---- status strip -----------------------------------------------------
+ string RouteWord(string id) => NearestExact(G(id), RouteStops) switch { 0 => "F1", 1 => "F2", _ => "F1+F2" };
+ int MacroAssigned() { int n = 0; for (int m = 0; m < 8; m++) if (MacroOn(m)) n++; return n; }
+ static string Plural(int n, string one, string many) => n + " " + (n == 1 ? one : many);
+
+ // The line at the right of the tab strip: what this tab holds, in three words.
+ string Hint() => tab switch
+ {
+ 0 => $"{WaveNames[Sel("osc1wave", 4)]} · {WaveNames[Sel("osc2wave", 4)]} · {NoiseNames[NoiseBand(G("noisecolor"))]}",
+ 1 => $"{FilterNames[Sel((fsel == 0 ? "fil1" : "fil2") + "type", 4)]} {(G((fsel == 0 ? "fil1" : "fil2") + "slope") >= 0.5f ? "24" : "12")}\u2009dB/oct",
+ 2 => "amp · filter",
+ 3 => $"{(SyncDiv(G("lfo1sync")) > 0 ? SyncText(G("lfo1sync")) : "free")} · {(SyncDiv(G("lfo2sync")) > 0 ? SyncText(G("lfo2sync")) : "free")} · vibrato {(G("vibamt") <= 1e-3f ? "off" : "on")}",
+ 4 => Plural(RouteCount(), "route", "routes"),
+ _ => $"8 slots · {MacroAssigned()} assigned",
+ };
+ string Summary() => tab switch
+ {
+ 0 => $"Osc 1 {WaveNames[Sel("osc1wave", 4)]} {Cents(G("osc1detune"))} → {RouteWord("osc1route")} · "
+ + $"Osc 2 {WaveNames[Sel("osc2wave", 4)]} {Cents(G("osc2detune"))} → {RouteWord("osc2route")} · "
+ + $"noise {NoiseNames[NoiseBand(G("noisecolor"))]} {Pct(G("noise"))}",
+ 1 => $"Filter {fsel + 1} · {FilterNames[Sel((fsel == 0 ? "fil1" : "fil2") + "type", 4)]} "
+ + $"{(G((fsel == 0 ? "fil1" : "fil2") + "slope") >= 0.5f ? "24" : "12")}\u2009dB/oct · "
+ + $"{Hz(G((fsel == 0 ? "fil1" : "fil2") + "freq"))} · reso {Reso(G((fsel == 0 ? "fil1" : "fil2") + "reso"))} · "
+ + $"env {Bip(G((fsel == 0 ? "fil1" : "fil2") + "env"))} · key {Pct(G((fsel == 0 ? "fil1" : "fil2") + "key"))}",
+ 2 => $"Amp env {AdsrSum("attack", "decay", "sustain", "release")} · filter env → cutoff {Bip(G("fil1env"))}",
+ 3 => $"LFO 1 {ShapeNames[Sel("lfo1shape", 4)]} {(SyncDiv(G("lfo1sync")) > 0 ? SyncText(G("lfo1sync")) : SlowHz(ExpMap(G("lfo1rate"), 0.05, 20)))} {LfoDest(2)} · "
+ + $"LFO 2 {ShapeNames[Sel("lfo2shape", 4)]} {(SyncDiv(G("lfo2sync")) > 0 ? SyncText(G("lfo2sync")) : SlowHz(ExpMap(G("lfo2rate"), 0.05, 20)))} {LfoDest(3)} · "
+ + $"vibrato {(G("vibamt") <= 1e-3f ? "off" : VibDepth(G("vibamt")) + (G("vibwheel") >= 0.5f ? " by wheel" : ""))}",
+ 4 => RouteCount() == 0 ? "no routes — drag a cell to make one" : Plural(RouteCount(), "route", "routes") + " in the matrix",
+ _ => $"8 slots · {MacroAssigned()} assigned",
+ };
+ string Meta()
+ {
+ string mode = G("mono") >= 0.5f ? "MONO" : "POLY 16";
+ return $"{mode} · ±{BendRange(G("bendrange"))} ST · GAIN {Pct(G("volume"))}";
+ }
+ var statusBar = new Grid { Height = StatusH, ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 10 };
+ statusBar.Children.Add(status);
+ Grid.SetColumn(meta, 1); statusBar.Children.Add(meta);
+ var statusHost = new Border
+ {
+ Height = StatusH, BorderBrush = BorderDef, BorderThickness = new Thickness(0, 1, 0, 0),
+ Background = NotaPalette.SurfaceAbyss, Padding = new Thickness(8, 0), Child = statusBar,
+ };
+
+ // ---- assembly ---------------------------------------------------------
+ var body = new Grid
+ {
+ ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto"), ColumnSpacing = NotaSpace.DeviceGap,
+ Margin = new Thickness(NotaSpace.DeviceGap),
+ };
+ body.Children.Add(wheelsPanel);
+ Grid.SetColumn(tabPanel, 1); body.Children.Add(tabPanel);
+ Grid.SetColumn(rail, 2); body.Children.Add(rail);
+
+ DockPanel.SetDock(statusHost, Dock.Bottom);
+ var root = new DockPanel
+ {
+ LastChildFill = true, Background = NotaPalette.Gutter,
+ Children = { statusHost, body },
+ };
- HiTabs(); tabHost.Content = TabBody(tabSel);
- ampEnv.Target("AMP ENV", P("attack"), P("decay"), P("sustain"), P("release"));
- filtEnv.Target("FILTER ENV", P("fattack"), P("fdecay"), P("fsustain"), P("frelease"));
ctx.SetInstLiveViz(Refresh);
- Refresh();
- return dockRoot;
+ ShowRailTab();
+ showTab();
+ return root;
+ }
+
+ // A device section: card ground, hairline, radius 6 — the almanac's section box.
+ private static Border SectionBox(Control child) => new()
+ {
+ Background = NotaPalette.SurfaceCard, BorderBrush = BorderDef, BorderThickness = new Thickness(1),
+ CornerRadius = NotaRadius.Tile, ClipToBounds = true, Child = child,
+ };
+
+ // A section's own header strip: a hairline under it, nothing else.
+ private static Border HeaderStrip(Control child) => new()
+ {
+ BorderBrush = BorderDef, BorderThickness = new Thickness(0, 0, 0, 1), Child = child,
+ };
+
+ /// <summary>Row definitions that put a caption for each dB mark at its place on the
+ /// meter's scale: a star gap, the caption (Auto), … and a star gap for the remainder.</summary>
+ private static IEnumerable<string> ScaleRows(params double[] dbs)
+ {
+ double prev = 0;
+ foreach (var db in dbs)
+ {
+ double fromTop = 1.0 - MeterScale.NormDb(db);
+ yield return Math.Max(0, fromTop - prev).ToString("0.000", NotaNum.Culture) + "*";
+ yield return "Auto";
+ prev = fromTop;
+ }
+ yield return Math.Max(0, 1.0 - prev).ToString("0.000", NotaNum.Culture) + "*";
}
}
diff --git a/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs b/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
index 043d6666..96480e87 100644
--- a/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
+++ b/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
@@ -85,8 +85,17 @@ public sealed class FactoryPresetCatalog : IFactoryPresets
Inst("aurora", 5, "Fold Lead", ("table", 0.33f), ("position", 0.5f), ("osc1warpmode", 1f), ("warp", 0.6f), ("cutoff", 0.82f), ("resonance", 0.22f),
("attack", 0.01f), ("decay", 0.3f), ("sustain", 0.7f), ("release", 0.22f), ("lfo1depth", 0.6f), ("mtx2_3", 0.35f), ("fxdrive", 0.3f), ("gain", 0.72f));
- // ---- Nota Volt (kind 6) — virtual analog. Bipolar knobs (octave/semi/detune/
- // env/lfo/pan) are neutral at 0.5. Filter type: LP 0 / HP .33 / BP .66 / Notch 1.
+ // ---- Nota Volt (kind 6) — 25 patches across basses, leads, pads, keys and motion.
+ // Bipolar knobs (octave/semi/detune/env/lfo/pan/macro amount) are neutral at
+ // 0.5; octave spans ±3 (.333 = −1 oct), semi ±12 (.5 + n/24), detune ±50 cents.
+ // Filter type: LP 0 / HP .33 / BP .66 / Notch 1 · slope 12 dB 0 / 24 dB 1 ·
+ // wave Saw 0 / Square .333 / Tri .667 / Sine 1 · LFO shape sin 0 / tri .333 /
+ // sqr .667 / S&H 1 · LFO sync free 0 then 1 bar … 1/64 at n/7 (1/4 = .4286,
+ // 1/8 = .5714, 1/16 = .7143) · route F1 0 / F2 1 · noise dark 0 / pink .5 /
+ // white 1. Matrix cells are mtx{src}_{dst}: src 0 amp env · 1 filter env ·
+ // 2 LFO 1 · 3 LFO 2 · 4 velocity · 5 key · 6 mod wheel; dst 0 pitch ·
+ // 1 osc 2 pitch · 2 cutoff · 3 reso · 4 level · 5 pan. A macro's dest is
+ // n/11 over the twelve targets (3 = osc 2 level, 4 = cutoff, 8 = LFO 1 rate).
Inst("volt", 6, "Fat Bass", ("osc1octave", 0.333f), ("osc2octave", 0.333f), ("osc2detune", 0.58f), ("osc1level", 0.9f), ("osc2level", 0.8f),
("fil1freq", 0.34f), ("fil1reso", 0.26f), ("fil1env", 0.74f), ("fattack", 0.0f), ("fdecay", 0.28f), ("fsustain", 0.2f),
("attack", 0.0f), ("decay", 0.3f), ("sustain", 0.5f), ("release", 0.15f), ("amp1level", 0.9f), ("unison", 0.3f), ("velamp", 0.5f), ("volume", 0.85f));
@@ -112,6 +121,93 @@ public sealed class FactoryPresetCatalog : IFactoryPresets
("lfo2rate", 0.18f), ("lfo2depth", 0.7f), ("mtx3_5", 0.85f), ("fattack", 0.2f), ("fdecay", 0.5f), ("fsustain", 0.4f),
("attack", 0.1f), ("decay", 0.4f), ("sustain", 0.7f), ("release", 0.45f), ("amp1level", 0.82f), ("unison", 0.35f), ("volume", 0.8f));
+ // v5: the rest of the library — basses, leads, pads, keys and motion patches.
+ // Basses
+ Inst("volt", 6, "Acid Bass", ("osc1wave", 0.0f), ("osc1octave", 0.333f), ("osc2level", 0.0f), ("osc1level", 0.95f),
+ ("fil1freq", 0.30f), ("fil1reso", 0.72f), ("fil1env", 0.90f), ("fil1slope", 1.0f),
+ ("fattack", 0.0f), ("fdecay", 0.26f), ("fsustain", 0.04f), ("frelease", 0.16f),
+ ("attack", 0.0f), ("decay", 0.3f), ("sustain", 0.45f), ("release", 0.14f),
+ ("mono", 1.0f), ("glide", 0.2f), ("amp1level", 0.9f), ("velfilter", 0.6f), ("volume", 0.85f));
+ Inst("volt", 6, "Reese Bass", ("osc1octave", 0.333f), ("osc2octave", 0.333f), ("osc2detune", 0.66f), ("osc1level", 0.9f), ("osc2level", 0.9f),
+ ("fil1freq", 0.36f), ("fil1reso", 0.18f), ("fil1env", 0.60f), ("fil1slope", 1.0f), ("unison", 0.55f),
+ ("attack", 0.0f), ("decay", 0.4f), ("sustain", 0.8f), ("release", 0.2f), ("amp1level", 0.9f),
+ ("mac0val", 0.5f), ("mac0dest", 0.2727f), ("mac0amt", 0.78f), ("volume", 0.82f));
+ Inst("volt", 6, "Growl Bass", ("osc1octave", 0.333f), ("osc2octave", 0.333f), ("osc2detune", 0.60f), ("osc2wave", 0.333f),
+ ("fil1freq", 0.30f), ("fil1reso", 0.50f), ("fil1env", 0.72f), ("fil1slope", 1.0f),
+ ("lfo1shape", 0.333f), ("lfo1sync", 0.5714f), ("lfo1depth", 0.75f), ("mtx2_2", 0.78f),
+ ("attack", 0.0f), ("decay", 0.35f), ("sustain", 0.6f), ("release", 0.18f),
+ ("mono", 1.0f), ("amp1level", 0.88f), ("volume", 0.82f));
+ // Leads
+ Inst("volt", 6, "Super Saw", ("osc2detune", 0.64f), ("osc1level", 0.85f), ("osc2level", 0.85f), ("unison", 0.9f),
+ ("fil1freq", 0.80f), ("fil1reso", 0.14f), ("fil1env", 0.56f),
+ ("attack", 0.08f), ("decay", 0.5f), ("sustain", 0.88f), ("release", 0.4f),
+ ("amp1level", 0.8f), ("volume", 0.72f));
+ Inst("volt", 6, "Solo Lead", ("osc2detune", 0.55f), ("fil1freq", 0.70f), ("fil1reso", 0.28f), ("fil1env", 0.60f),
+ ("attack", 0.02f), ("decay", 0.4f), ("sustain", 0.82f), ("release", 0.25f),
+ ("mono", 1.0f), ("glide", 0.18f), ("vibrate", 0.45f), ("vibamt", 0.30f), ("vibwheel", 1.0f),
+ ("bendrange", 0.3636f), ("amp1level", 0.85f), ("volume", 0.8f));
+ Inst("volt", 6, "Hard Lead", ("osc1wave", 0.333f), ("osc2wave", 0.333f), ("osc2detune", 0.58f), ("osc2semi", 0.5417f),
+ ("fil1freq", 0.66f), ("fil1reso", 0.42f), ("fil1env", 0.66f), ("fil1slope", 1.0f),
+ ("attack", 0.0f), ("decay", 0.35f), ("sustain", 0.72f), ("release", 0.2f),
+ ("mono", 1.0f), ("velfilter", 0.5f), ("amp1level", 0.85f), ("volume", 0.78f));
+ // Pads
+ Inst("volt", 6, "String Machine",("osc2detune", 0.60f), ("osc1level", 0.85f), ("osc2level", 0.85f), ("unison", 0.8f),
+ ("fil1freq", 0.60f), ("fil1reso", 0.12f), ("fil1env", 0.58f),
+ ("fattack", 0.35f), ("fdecay", 0.55f), ("fsustain", 0.55f), ("frelease", 0.6f),
+ ("attack", 0.42f), ("decay", 0.5f), ("sustain", 0.9f), ("release", 0.7f),
+ ("lfo2rate", 0.16f), ("lfo2depth", 0.5f), ("mtx3_5", 0.72f), ("amp1level", 0.8f), ("volume", 0.72f));
+ Inst("volt", 6, "Choir Pad", ("osc1wave", 0.667f), ("osc2wave", 0.667f), ("osc2detune", 0.56f), ("noise", 0.06f), ("noisecolor", 1.0f),
+ ("fil1freq", 0.54f), ("fil1reso", 0.10f), ("fil1env", 0.56f), ("unison", 0.6f),
+ ("fattack", 0.45f), ("fdecay", 0.5f), ("fsustain", 0.6f), ("frelease", 0.6f),
+ ("attack", 0.55f), ("decay", 0.5f), ("sustain", 0.92f), ("release", 0.78f),
+ ("amp1level", 0.8f), ("volume", 0.74f));
+ Inst("volt", 6, "Dark Drone", ("osc1octave", 0.333f), ("osc2octave", 0.333f), ("osc2detune", 0.70f), ("unison", 0.9f),
+ ("fil1freq", 0.30f), ("fil1reso", 0.24f), ("fil1env", 0.56f), ("fil1slope", 1.0f),
+ ("fattack", 0.6f), ("fdecay", 0.7f), ("fsustain", 0.7f), ("frelease", 0.8f),
+ ("attack", 0.68f), ("decay", 0.7f), ("sustain", 1.0f), ("release", 0.85f),
+ ("lfo1rate", 0.10f), ("lfo1depth", 0.6f), ("mtx2_2", 0.68f), ("amp1level", 0.78f), ("volume", 0.7f));
+ Inst("volt", 6, "Glass Pad", ("osc1wave", 1.0f), ("osc2wave", 0.667f), ("osc2octave", 0.667f), ("osc2detune", 0.54f), ("osc2level", 0.45f),
+ ("fil1freq", 0.86f), ("fil1reso", 0.08f), ("fil1env", 0.5f), ("unison", 0.5f),
+ ("attack", 0.45f), ("decay", 0.6f), ("sustain", 0.75f), ("release", 0.82f),
+ ("mac0val", 0.4f), ("mac0dest", 0.3636f), ("mac0amt", 0.72f), ("amp1level", 0.8f), ("volume", 0.74f));
+ // Keys and plucks
+ Inst("volt", 6, "Electric Keys",("osc1wave", 0.667f), ("osc2wave", 1.0f), ("osc2detune", 0.53f), ("osc2level", 0.5f),
+ ("fil1freq", 0.66f), ("fil1reso", 0.12f), ("fil1env", 0.66f),
+ ("fattack", 0.0f), ("fdecay", 0.45f), ("fsustain", 0.1f), ("frelease", 0.3f),
+ ("attack", 0.0f), ("decay", 0.62f), ("sustain", 0.28f), ("release", 0.45f),
+ ("velamp", 0.7f), ("amp1level", 0.85f), ("volume", 0.8f));
+ Inst("volt", 6, "Bell Tone", ("osc1wave", 1.0f), ("osc2wave", 1.0f), ("osc2semi", 0.7917f), ("osc2level", 0.55f), ("osc1octave", 0.667f),
+ ("fil1freq", 0.90f), ("fil1reso", 0.10f), ("fil1env", 0.5f),
+ ("attack", 0.0f), ("decay", 0.80f), ("sustain", 0.0f), ("release", 0.72f),
+ ("velamp", 0.6f), ("amp1level", 0.82f), ("volume", 0.76f));
+ Inst("volt", 6, "Clav Stab", ("osc1wave", 0.333f), ("osc2wave", 0.333f), ("osc2detune", 0.54f), ("osc1phase", 0.25f), ("osc2phase", 0.25f),
+ ("fil1freq", 0.58f), ("fil1reso", 0.38f), ("fil1env", 0.82f), ("fil1key", 0.5f),
+ ("fattack", 0.0f), ("fdecay", 0.22f), ("fsustain", 0.0f), ("frelease", 0.14f),
+ ("attack", 0.0f), ("decay", 0.3f), ("sustain", 0.0f), ("release", 0.18f),
+ ("velfilter", 0.6f), ("amp1level", 0.88f), ("volume", 0.82f));
+ // Motion and noise
+ Inst("volt", 6, "Sample & Hold",("osc1wave", 0.333f), ("osc2detune", 0.57f),
+ ("fil1freq", 0.48f), ("fil1reso", 0.44f), ("fil1env", 0.5f),
+ ("lfo1shape", 1.0f), ("lfo1sync", 0.7143f), ("lfo1depth", 0.9f), ("mtx2_2", 0.88f),
+ ("attack", 0.0f), ("decay", 0.4f), ("sustain", 0.75f), ("release", 0.3f),
+ ("mac0val", 0.5f), ("mac0dest", 0.7273f), ("mac0amt", 0.70f), ("amp1level", 0.82f), ("volume", 0.78f));
+ Inst("volt", 6, "Noise Sweep", ("osc1level", 0.0f), ("osc2level", 0.0f), ("noise", 0.95f), ("noisecolor", 0.85f),
+ ("fil1type", 0.667f), ("fil1freq", 0.35f), ("fil1reso", 0.62f), ("fil1env", 0.95f), ("fil1slope", 1.0f),
+ ("fattack", 0.55f), ("fdecay", 0.6f), ("fsustain", 0.8f), ("frelease", 0.6f),
+ ("attack", 0.4f), ("decay", 0.5f), ("sustain", 0.9f), ("release", 0.6f),
+ ("amp1level", 0.8f), ("volume", 0.7f));
+ Inst("volt", 6, "Siren", ("osc1wave", 0.667f), ("osc2level", 0.0f),
+ ("fil1freq", 0.70f), ("fil1reso", 0.20f),
+ ("lfo1shape", 0.333f), ("lfo1rate", 0.18f), ("lfo1depth", 0.8f), ("mtx2_0", 0.62f),
+ ("attack", 0.05f), ("decay", 0.4f), ("sustain", 0.9f), ("release", 0.25f),
+ ("mono", 1.0f), ("amp1level", 0.82f), ("volume", 0.76f));
+ // Both filters in series — Filter 1 spills into Filter 2, which is what "To F2" is for.
+ Inst("volt", 6, "Serial Filters",("osc1route", 0.0f), ("osc2route", 0.0f), ("noiseroute", 0.0f), ("osc2detune", 0.57f),
+ ("fil1type", 0.0f), ("fil1freq", 0.58f), ("fil1reso", 0.30f), ("fil1env", 0.72f), ("fil1tof2", 1.0f),
+ ("fil2type", 0.333f), ("fil2freq", 0.26f), ("fil2reso", 0.24f),
+ ("amp1level", 0.0f), ("amp2level", 0.9f),
+ ("attack", 0.0f), ("decay", 0.4f), ("sustain", 0.7f), ("release", 0.25f), ("volume", 0.82f));
+
// ---- Nota Bass (kind 7) — bass synth. Osc Shape morphs sine 0 → tri → saw → pulse 1.
// Bipolar knobs (octave/semi/env/lfo-amt/pitch) are neutral at 0.5. Filter type:
// LP 0 / HP .33 / BP .66 / Notch 1; slope 12 = 0 / 24 = 1; mono Poly 0 / Mono 1.
diff --git a/src/native/nota.engine/src/VoltSynth.h b/src/native/nota.engine/src/VoltSynth.h
index e5074d67..c8f03d5a 100644
--- a/src/native/nota.engine/src/VoltSynth.h
+++ b/src/native/nota.engine/src/VoltSynth.h
@@ -19,8 +19,12 @@
// On top of the fixed routings sits a generic MODULATION MATRIX (mockup 2a/2e):
// 7 sources (Amp Env, Filter Env, LFO 1, LFO 2, Velocity, Key, Mod Wheel) × 6
// destinations (Pitch, Osc2 Pitch, Cutoff, Reso, Level, Pan), each a bipolar amount.
-// Eight MACROS add manual offsets into the same destinations. Two full-shape LFOs
-// (sin/tri/sqr/S&H) with depth, per-note fade-in and optional tempo sync round it out.
+// Eight MACROS add manual offsets into a wider list of twelve destinations — the six
+// above plus the three source levels, Filter 2's cutoff and either LFO's rate. Two
+// full-shape LFOs (sin/tri/sqr/S&H) with depth, per-note fade-in and optional tempo
+// sync round it out, and two performance wheels — pitch bend with a selectable range
+// (1..12 semitones) and a mod wheel that is both a matrix source and, when the patch
+// asks for it, the hand on the vibrato.
//
// All parameters ride the Instrument plugin-param interface (normalized 0..1, stable
// ids) → automation / persist / clone for free. Header-only; allocation-free after
@@ -47,9 +51,17 @@ public:
static constexpr int kSources = 7; // Amp Env, Flt Env, LFO1, LFO2, Vel, Key, Mod Whl
static constexpr int kDests = 6; // Pitch, Osc2 Pitch, Cutoff, Reso, Level, Pan
static constexpr int kMacros = 8;
+ // Macros reach further than the matrix: the six voice-bus destinations above sit at
+ // indices 0, 2, 4, 7, 9 and 11 of this twelve-entry list, exactly where a six-entry
+ // normalized value rounds to — so a project saved against the old list still points
+ // at the same destination. The six new ones act on the block snapshot instead.
+ // 0 Pitch · 1 Osc 1 Level · 2 Osc 2 Pitch · 3 Osc 2 Level · 4 Cutoff · 5 Noise
+ // 6 Filter 2 · 7 Reso · 8 LFO 1 Rate · 9 Level · 10 LFO 2 Rate · 11 Pan
+ static constexpr int kMacroDests = 12;
// Parameter layout (normalized 0..1). Order == persisted state layout — APPEND ONLY.
- // Scalar block is 0..63; the matrix (64..105) and macros (106..129) follow.
+ // Scalar block is 0..63; the matrix (64..105), macros (106..129) and the two
+ // performance wheels (130..132) follow.
enum Param {
Osc1Wave = 0, Osc1Octave, Osc1Semi, Osc1Detune, Osc1Level, Osc1Route,
Osc2Wave, Osc2Octave, Osc2Semi, Osc2Detune, Osc2Level, Osc2Route,
@@ -69,7 +81,10 @@ public:
ModWheel, MonoMode, OutPan, // 61,62,63
MatrixBase, // 64 (42 entries)
MacroBase = MatrixBase + kSources * kDests, // 106 (24 entries)
- kNumParams = MacroBase + kMacros * 3 // 130
+ // ---- appended (v5, almanac rework): the two performance wheels ----
+ ExtraBase = MacroBase + kMacros * 3, // 130
+ Bend = ExtraBase, BendRange, VibWheel, // 130,131,132
+ kNumParams // 133
};
static int matrixIdx(int s, int d) { return MatrixBase + s * kDests + d; }
@@ -96,6 +111,9 @@ public:
set(ModWheel, 0.0f); set(MonoMode, 0.0f); set(OutPan, 0.5f);
for (int s = 0; s < kSources; ++s) for (int d = 0; d < kDests; ++d) set((Param)matrixIdx(s, d), 0.5f); // bipolar zero
for (int m = 0; m < kMacros; ++m) { set((Param)macroIdx(m, 0), 0.0f); set((Param)macroIdx(m, 1), 0.0f); set((Param)macroIdx(m, 2), 0.5f); }
+ set(Bend, 0.5f); // centred
+ set(BendRange, 1.0f / 11.0f); // ±2 semitones
+ set(VibWheel, 0.0f); // vibrato at its own depth, not the wheel's
}
int32_t kind() const override { return 6; }
@@ -133,6 +151,7 @@ public:
return std::string(ids[i]);
}
if (i < MacroBase) { int j = i - MatrixBase; return "mtx" + std::to_string(j / kDests) + "_" + std::to_string(j % kDests); }
+ if (i >= ExtraBase) { static const char* ex[] = { "bend", "bendrange", "vibwheel" }; return std::string(ex[i - ExtraBase]); }
int j = i - MacroBase, m = j / 3, f = j % 3;
return "mac" + std::to_string(m) + (f == 0 ? "val" : f == 1 ? "dest" : "amt");
}
@@ -160,6 +179,7 @@ public:
static const char* srcNm[] = { "Amp Env", "Flt Env", "LFO 1", "LFO 2", "Velocity", "Key", "Mod Whl" };
static const char* dstNm[] = { "Pitch", "Osc2 Pitch", "Cutoff", "Reso", "Level", "Pan" };
if (i < MacroBase) { int j = i - MatrixBase; return std::string(srcNm[j / kDests]) + " → " + dstNm[j % kDests]; }
+ if (i >= ExtraBase) { static const char* exNm[] = { "Pitch Bend", "Bend Range", "Vibrato → Wheel" }; return std::string(exNm[i - ExtraBase]); }
int j = i - MacroBase, m = j / 3, f = j % 3;
return "Macro " + std::to_string(m + 1) + (f == 0 ? "" : f == 1 ? " Dest" : " Amount");
}
@@ -233,20 +253,44 @@ public:
void allNotesOff() override { for (auto& v : voices_) v.active = false; }
void render(float* out, int32_t frames) override {
+ // ---- macros first: six of the twelve destinations move the block snapshot
+ // below (levels, Filter 2, LFO rates), the other six ride the voice bus ----
+ double macroDst[kDests] = { 0, 0, 0, 0, 0, 0 };
+ double macroBlk[6] = { 0, 0, 0, 0, 0, 0 }; // osc1 lvl · osc2 lvl · noise · fil2 · lfo1 rate · lfo2 rate
+ for (int m = 0; m < kMacros; ++m) {
+ const double x = get((Param)macroIdx(m, 0)) * (get((Param)macroIdx(m, 2)) - 0.5) * 2.0;
+ if (std::fabs(x) <= 1e-4) continue;
+ switch (macroDestOf(get((Param)macroIdx(m, 1)))) {
+ case 0: macroDst[0] += x; break; // Pitch
+ case 2: macroDst[1] += x; break; // Osc 2 Pitch
+ case 4: macroDst[2] += x; break; // Cutoff
+ case 7: macroDst[3] += x; break; // Reso
+ case 9: macroDst[4] += x; break; // Level
+ case 11: macroDst[5] += x; break; // Pan
+ case 1: macroBlk[0] += x; break; // Osc 1 Level
+ case 3: macroBlk[1] += x; break; // Osc 2 Level
+ case 5: macroBlk[2] += x; break; // Noise Level
+ case 6: macroBlk[3] += x; break; // Filter 2 cutoff
+ case 8: macroBlk[4] += x; break; // LFO 1 rate
+ default: macroBlk[5] += x; break; // LFO 2 rate
+ }
+ }
+
// ---- per-block param snapshot ----
const int w1 = waveOf(Osc1Wave), w2 = waveOf(Osc2Wave);
const double mult1 = pitchMult(Osc1Octave, Osc1Semi, Osc1Detune);
const double mult2 = pitchMult(Osc2Octave, Osc2Semi, Osc2Detune);
- const float lvl1 = get(Osc1Level), lvl2 = get(Osc2Level);
+ const float lvl1 = (float)std::clamp(get(Osc1Level) + macroBlk[0], 0.0, 2.0);
+ const float lvl2 = (float)std::clamp(get(Osc2Level) + macroBlk[1], 0.0, 2.0);
const double r1 = get(Osc1Route), r2 = get(Osc2Route), rn = get(NoiseRoute);
- const float noiseLvl = get(NoiseLevel);
+ const float noiseLvl = (float)std::clamp(get(NoiseLevel) + macroBlk[2], 0.0, 2.0);
const double nColor = std::clamp((double)get(NoiseColor), 0.0, 1.0);
const double nCoef = 0.02 + 0.9 * nColor; // one-pole toward white as color rises
const int t1 = filtTypeOf(Fil1Type), t2 = filtTypeOf(Fil2Type);
const bool slope1 = get(Fil1Slope) > 0.5f, slope2 = get(Fil2Slope) > 0.5f; // true = 24 dB (cascade)
const double f1base = expMap(get(Fil1Freq), 20.0, 18000.0);
- const double f2base = expMap(get(Fil2Freq), 20.0, 18000.0);
+ const double f2base = expMap(std::clamp(get(Fil2Freq) + macroBlk[3], 0.0, 1.0), 20.0, 18000.0);
const double reso1 = get(Fil1Reso), reso2 = get(Fil2Reso);
const double f1Env = bip(Fil1EnvAmt), f1Lfo = bip(Fil1LfoAmt), f1Key = get(Fil1KeyAmt), toF2 = get(Fil1ToF2);
const double f2Env = bip(Fil2EnvAmt), f2Lfo = bip(Fil2LfoAmt), f2Key = get(Fil2KeyAmt);
@@ -263,13 +307,16 @@ public:
// LFOs: shape + depth + optional tempo sync.
const int lfo1shape = shapeOf(Lfo1Shape), lfo2shape = shapeOf(Lfo2Shape);
- const double lfo1Inc = lfoInc(Lfo1Rate, Lfo1Sync);
- const double lfo2Inc = lfoInc(Lfo2Rate, Lfo2Sync);
+ // A macro on an LFO's rate scales its increment, so it works synced as well as free.
+ const double lfo1Inc = lfoInc(Lfo1Rate, Lfo1Sync) * std::exp2(macroBlk[4] * 2.0);
+ const double lfo2Inc = lfoInc(Lfo2Rate, Lfo2Sync) * std::exp2(macroBlk[5] * 2.0);
const float lfo1Depth = get(Lfo1Depth), lfo2Depth = get(Lfo2Depth);
const float fade1Inc = fadeInc(Lfo1Fade), fade2Inc = fadeInc(Lfo2Fade);
+ const float modWheel = get(ModWheel);
const double vibInc = expMap(get(VibRate), 0.1, 12.0) / sampleRate_;
- const double vibCents = get(VibAmt) * 50.0;
+ // "By the wheel": the vibrato depth the patch dials becomes the wheel's ceiling.
+ const double vibCents = get(VibAmt) * 50.0 * (get(VibWheel) > 0.5f ? (double)modWheel : 1.0);
const double uni = get(Unison);
const double uniDet = std::exp2(uni * 25.0 / 1200.0); // side-osc detune (up to ~25 cents)
const float uniLvl = (float)(uni * 0.9);
@@ -279,22 +326,18 @@ public:
const float volume = get(Volume);
const float outPan = bipF(OutPan);
const float opL = std::cos((outPan + 1.0f) * 0.25f * (float)kPi), opR = std::sin((outPan + 1.0f) * 0.25f * (float)kPi);
- const float modWheel = get(ModWheel);
+
+ // Pitch-bend wheel, in the range the patch declares (1..12 semitones).
+ const double bendMul = std::exp2((get(Bend) - 0.5) * 2.0 * std::round(1.0 + get(BendRange) * 11.0) / 12.0);
// ---- modulation matrix: compact list of active (src,dst,amount) ----
int amS[kSources * kDests], amD[kSources * kDests], amCount = 0;
double amA[kSources * kDests];
- double macroDst[kDests] = { 0, 0, 0, 0, 0, 0 };
for (int s = 0; s < kSources; ++s)
for (int d = 0; d < kDests; ++d) {
double a = (get((Param)matrixIdx(s, d)) - 0.5) * 2.0;
if (std::fabs(a) > 1e-4) { amS[amCount] = s; amD[amCount] = d; amA[amCount] = a; ++amCount; }
}
- for (int m = 0; m < kMacros; ++m) {
- double val = get((Param)macroIdx(m, 0));
- double amt = (get((Param)macroIdx(m, 2)) - 0.5) * 2.0;
- if (std::fabs(val * amt) > 1e-4) macroDst[destOf(get((Param)macroIdx(m, 1)))] += val * amt;
- }
const bool pitchMod = amActive(amD, amCount, 0) || amActive(amD, amCount, 1) || macroDst[0] != 0.0 || macroDst[1] != 0.0;
const bool panMod = amActive(amD, amCount, 5) || macroDst[5] != 0.0;
const bool lvlMod = amActive(amD, amCount, 4) || macroDst[4] != 0.0;
@@ -335,7 +378,7 @@ public:
}
if (glideCoef < 1.0) v.freqCur += (v.freqTarget - v.freqCur) * glideCoef; else v.freqCur = v.freqTarget;
- double base = v.freqCur * vibMult * invSr;
+ double base = v.freqCur * vibMult * bendMul * invSr;
double m1 = mult1, m2 = mult2;
if (pitchMod) {
const double pm = std::exp2(dst[0] * 2.0); // ±24 semitones at full
@@ -421,7 +464,7 @@ private:
int waveOf(Param p) const { return std::clamp((int)std::lround(get(p) * 3.0f), 0, 3); }
int filtTypeOf(Param p) const { return std::clamp((int)std::lround(get(p) * 3.0f), 0, 3); }
int shapeOf(Param p) const { return std::clamp((int)std::lround(get(p) * 3.0f), 0, 3); }
- static int destOf(float v) { return std::clamp((int)std::lround(v * (kDests - 1)), 0, kDests - 1); }
+ static int macroDestOf(float v) { return std::clamp((int)std::lround(v * (kMacroDests - 1)), 0, kMacroDests - 1); }
static bool amActive(const int* d, int n, int dest) { for (int k = 0; k < n; ++k) if (d[k] == dest) return true; return false; }
static double resoToK(double reso) { return std::clamp(2.0 - 1.9 * std::clamp(reso, 0.0, 1.0), 0.05, 2.0); }
diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.cs
index 771a16f8..ff780749 100644
--- a/tests/Nota.SmokeTest/Program.cs
+++ b/tests/Nota.SmokeTest/Program.cs
@@ -1234,7 +1234,7 @@ Console.WriteLine("-- Nota Volt --");
Check(ve.DeviceName(t, -1) == "Nota Volt", $"instrument is Nota Volt (got '{ve.DeviceName(t, -1)}')");
int pc = ve.PluginParamCount(t, -1);
- Check(pc == 130, $"Nota Volt exposes 130 params (got {pc})");
+ Check(pc == 133, $"Nota Volt exposes 133 params (got {pc})");
int cut = -1; bool idsOk = true;
for (int i = 0; i < pc; i++)
{
@@ -1249,7 +1249,7 @@ Console.WriteLine("-- Nota Volt --");
// State round-trips to another track (project save/load path).
ve.PluginParamSet(t, -1, cut, 0.88f);
var state = ve.GetPluginState(t, -1);
- Check(state.Length >= 130 * 4, $"volt state serialized ({state.Length} bytes)");
+ Check(state.Length >= 133 * 4, $"volt state serialized ({state.Length} bytes)");
int t2 = ve.AddVoltSynthTrack();
ve.SetPluginState(t2, -1, state);
Check(Math.Abs(ve.PluginParamGet(t2, -1, cut) - 0.88f) < 1e-4, "volt state restores params on another track");
@@ -1313,6 +1313,95 @@ Console.WriteLine("-- Nota Volt --");
Check(wet > 0.001f && Math.Abs(wet - dry) > 1e-5f, $"mod-matrix LFO→Level changes output (dry {dry:F3} / wet {wet:F3})");
Check(voices >= 1, $"voice meter reports sounding voices ({voices})");
}
+
+ // v5: the performance wheels and the vibrato-by-wheel switch.
+ Check(IdOf("bend") >= 0 && IdOf("bendrange") >= 0 && IdOf("vibwheel") >= 0,
+ "wheel params present (bend / bendrange / vibwheel)");
+ {
+ // Each case gets its own engine so a voice left sounding by one render cannot leak
+ // into the next, and each renders the same note for the same length.
+ float[] RenderWith(params (string Id, float Value)[] ps)
+ {
+ using var we = new NotaEngine();
+ we.SetBpm(120); we.SetTimeSignature(4, 4);
+ int tw = we.AddVoltSynthTrack();
+ foreach (var (id, value) in ps)
+ for (int i = 0; i < we.PluginParamCount(tw, -1); i++)
+ if (we.PluginParamId(tw, -1, i) == id) we.PluginParamSet(tw, -1, i, value);
+ we.AddMidiClip(tw, 0.0, 4.0);
+ we.SetClipNotes(tw, 0, new[] { new NotaNote(60, 0.0, 2.0, 0.9f) });
+ var b = new float[8192 * 2];
+ we.Seek(0.0); we.Play(); we.RenderOffline(b, 8192); we.StopTransport();
+ return b;
+ }
+ // Zero crossings stand in for pitch: bending up an octave roughly doubles them.
+ int Crossings(float[] b, int n)
+ {
+ int c = 0; for (int i = 2; i < n * 2; i += 2) if ((b[i - 2] < 0) != (b[i] < 0)) c++;
+ return c;
+ }
+ var flat = RenderWith(("osc2level", 0f), ("fil1freq", 0.9f));
+ var bent = RenderWith(("osc2level", 0f), ("fil1freq", 0.9f), ("bend", 1f), ("bendrange", 1f));
+ bool bfin = true; foreach (var x in bent) if (!float.IsFinite(x) || Math.Abs(x) > 8f) { bfin = false; break; }
+ int cf = Crossings(flat, 8192), cb = Crossings(bent, 8192);
+ Check(bfin && cb > cf * 1.5, $"pitch bend +12 st raises the pitch ({cf} → {cb} crossings)");
+
+ // Vibrato by wheel: with the wheel down the vibrato is silent, so the patch renders
+ // exactly as one with no vibrato at all; opening the wheel changes the sound.
+ var noVib = RenderWith(("vibamt", 0f), ("osc2level", 0f));
+ var wheelDown = RenderWith(("vibamt", 1f), ("vibwheel", 1f), ("modwheel", 0f), ("osc2level", 0f));
+ var wheelUp = RenderWith(("vibamt", 1f), ("vibwheel", 1f), ("modwheel", 1f), ("osc2level", 0f));
+ float Diff(float[] a, float[] b) { float d = 0; for (int i = 0; i < a.Length; i++) d += Math.Abs(a[i] - b[i]); return d / a.Length; }
+ Check(Diff(noVib, wheelDown) < 1e-6f, "vibrato by wheel is silent with the wheel down");
+ Check(Diff(noVib, wheelUp) > 1e-4f, "vibrato by wheel opens up with the wheel up");
+ }
+
+ // v5: macros reach twelve destinations, six of which act on the block snapshot. The
+ // six older ones keep the normalized value an old project saved for them.
+ {
+ // Its own engine per case: this one's earlier tracks still hold clips, and their
+ // output would swamp the one voice under test.
+ float MacroRms(params (string Id, float Value)[] ps)
+ {
+ using var me2 = new NotaEngine();
+ me2.SetBpm(120); me2.SetTimeSignature(4, 4);
+ int tmm = me2.AddVoltSynthTrack();
+ void Put(string id, float v)
+ {
+ for (int i = 0; i < me2.PluginParamCount(tmm, -1); i++)
+ if (me2.PluginParamId(tmm, -1, i) == id) { me2.PluginParamSet(tmm, -1, i, v); return; }
+ }
+ Put("osc2level", 0f);
+ foreach (var (id, value) in ps) Put(id, value);
+ me2.AddMidiClip(tmm, 0.0, 4.0);
+ me2.SetClipNotes(tmm, 0, new[] { new NotaNote(60, 0.0, 2.0, 0.9f) });
+ var b = new float[8192 * 2];
+ me2.Seek(0.0); me2.Play(); me2.RenderOffline(b, 8192); me2.StopTransport();
+ return Rms(b, 8192);
+ }
+ // Macro 1 → Osc 2 level (target 3 of 12), full amount: osc 2 comes back.
+ float plain = MacroRms();
+ float lifted = MacroRms(("mac0val", 1f), ("mac0dest", 3f / 11f), ("mac0amt", 1f));
+ Check(lifted > plain * 1.1f, $"a macro on Osc 2 level is audible ({plain:F3} → {lifted:F3})");
+ // The legacy six: 0.8 used to mean "Level" and still does.
+ float neutral = MacroRms(("mac0val", 1f), ("mac0dest", 0.8f), ("mac0amt", 0.5f));
+ float louder = MacroRms(("mac0val", 1f), ("mac0dest", 0.8f), ("mac0amt", 1f));
+ Check(louder > neutral * 1.1f, $"an old macro pointing at Level still lands there ({neutral:F3} → {louder:F3})");
+ }
+
+ // Factory presets: 25 ship, every named param is a real Volt id, each applies in place.
+ {
+ var voltIds = new System.Collections.Generic.HashSet<string>();
+ for (int i = 0; i < pc; i++) voltIds.Add(ve.PluginParamId(t, -1, i));
+ var cat = new FactoryPresetCatalog();
+ var mine = cat.All().Where(p => p.IsInstrument && p.BuiltinKind == 6).ToList();
+ Check(mine.Count == 25, $"Nota Volt ships 25 factory presets (got {mine.Count})");
+ var bad = mine.SelectMany(p => cat.Document(p.Id)!.NamedParams!.Keys.Where(k => !voltIds.Contains(k)).Select(k => $"{p.DisplayName}:{k}")).ToList();
+ Check(bad.Count == 0, $"every Volt preset param id exists{(bad.Count > 0 ? " — bad: " + string.Join(", ", bad) : "")}");
+ int tp = ve.AddVoltSynthTrack();
+ int fails = mine.Count(p => cat.ApplyInPlace(ve, p.Id, tp, -1).Length != 0);
+ Check(fails == 0, $"every Volt preset applies in place ({fails} failed)");
+ }
}
// ============================ Nota Bass ====================================