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.

(fix) Quick wins: tooltips, Shortcuts filter, Math gain, Custom export range, preview waveform (#149)

Chris Laupama1ea26c600995
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e83aa32d..9e5c8337 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -59,6 +59,26 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
resizing, duplicating and deleting a section are each one undo step. Sections are now
stored in the project file; a project saved by an earlier version keeps its sections and
moves them into the project file on the next save.
+- **Transport tooltips name their real shortcuts** (nota-daw/nota#10): Play (Space),
+ Stop (Return), Record (⌘R) and the metronome (⌘M) now show their keys. The metronome tip
+ said a bare M, which does nothing. On Windows and Linux the tips spell Ctrl instead of ⌘.
+- **The Shortcuts filter searches group titles and each word** (nota-daw/nota#40): in
+ Settings → Shortcuts, `keyboard` now finds the whole "Play notes (computer keyboard)"
+ group, and a query of several words (`play keyboard`, `loop record`) matches rows that
+ contain every word, in any order.
+- **Modular: the Math node's Gain uses its whole range** (nota-daw/nota#92): Gain now goes
+ up to 2.00 as the knob shows. Before, anything above 1.00 was cut back to 1.00 and the
+ knob snapped back.
+- **Export audio: Custom range, and Loop exports the real loop** (nota-daw/nota#102): pick
+ **Custom** and type a start and an end as bar.beat (`5.1`, or `5.2.3` to the sixteenth,
+ counted from 1 as in the transport; the export stops at the end, so `1` to `5` is four bars);
+ the readout shows both ends and the length, and Export waits until the end comes after
+ the start. **Loop** now exports the transport's loop region wherever it is. Before, it
+ always bounced bars 1–5, and exporting reset the loop region to bars 1–5. MCP:
+ `export_master` and `export_stems` take a `startBeat`.
+- **The browser preview follows Appearance → Waveform** (nota-daw/nota#107): with Solid
+ chosen, the sample player under the browser draws a continuous waveform too, and
+ switching the setting redraws a preview that is already showing.
### Added
- **Loop recording: Overdub or Replace** (nota-daw/nota#29): when you record MIDI in a loop,
diff --git a/FEATURES.md b/FEATURES.md
index 3ebc08c0..fde457fa 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -907,8 +907,9 @@ and user presets, automation, persistence and cloning.
group by source, favourites first — each remembered across sessions — plus the tag editor.
- A **status line** counts what the tab is showing (`13 built-in · 4 plug-ins`), and the
search box counts the matches.
-- **Sample player** under the Files tab: the file's real waveform (click to play from a
- point, hover for the time), Play / Stop, time readout, Loop, Auto (play on select) and a
+- **Sample player** under the Files tab: the file's real waveform, drawn as Bars or Solid
+ like the arrangement (Settings → Appearance → Waveform; click to play from a point,
+ hover for the time), Play / Stop, time readout, Loop, Auto (play on select) and a
preview volume fader; ↑ ↓ step through files and Space plays the selected one. It stays
hidden until you use a list and tightens in a narrow browser. Space in the arrangement
always drives the project transport.
@@ -964,7 +965,8 @@ and user presets, automation, persistence and cloning.
## Export
-- **Export the master** to WAV, FLAC or MP3: range, sample rate and, per format,
+- **Export the master** to WAV, FLAC or MP3: range (the loop region, the full song, or a
+ Custom start and end typed as bar.beat), sample rate and, per format,
bit depth (**pcm16 / pcm24 / float32** WAV; **16/24-bit** FLAC) or MP3 quality
(**CBR 128/192/256/320 kbps**, 320 default). MP3 tops out at 48 kHz, so 96 kHz is
not selectable for it; the footer size estimate follows the format.
@@ -1116,7 +1118,8 @@ Coverage:
- **Audio Effect Rack**: snapshot, Parallel/Series/Select mode, dry/wet, volume,
chain-select, add and remove chains, parameters, 8 macros.
- **Export** the master or stems to WAV (pcm16/pcm24/float32), FLAC (pcm16/pcm24) or
- MP3 (CBR 128–320 kbps) — `format` picks it, `bitrateKbps` tunes MP3.
+ MP3 (CBR 128–320 kbps) — `format` picks it, `bitrateKbps` tunes MP3, `startBeat` sets
+ where the render starts.
- **AI models**: `list_ai_models` (installed or not), `separate_stems` (a clip → a group of
Drums / Bass / Other / Vocals tracks), `convert_audio_to_midi` (melody or harmony with
basic-pitch → a new MIDI track). Installing models stays with the user.
diff --git a/src/managed/Nota.App/ExportWindow.cs b/src/managed/Nota.App/ExportWindow.cs
index 15240590..fdaa650f 100644
--- a/src/managed/Nota.App/ExportWindow.cs
+++ b/src/managed/Nota.App/ExportWindow.cs
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
//
-// Export audio (mockup 1i). Range (Loop / Full song are real; Custom is M7+),
+// Export audio (mockup 1i). Range (the transport loop, the full song, or a typed
+// Custom start / end),
// format (WAV / FLAC / MP3) / sample-rate / bit-depth-or-bitrate (M6-4 + M7
// codecs), release tail, normalize (−1 dBTP true peak) and dither (16-bit
// targets only), plus stem export. The option rows adapt to the format: FLAC
@@ -22,7 +23,8 @@ namespace Nota.App;
public sealed record ExportOptions(int SampleRate, WavBitDepth Depth, double TailBeats, double RangeBeats,
bool Stems, bool Normalize, bool Dither,
- ExportFormat Format = ExportFormat.Wav, int BitrateKbps = 320);
+ ExportFormat Format = ExportFormat.Wav, int BitrateKbps = 320,
+ double StartBeats = 0);
public sealed class ExportWindow : NotaWindow
{
@@ -43,8 +45,14 @@ public sealed class ExportWindow : NotaWindow
private const int BeatsPerBar = 4;
private readonly double _bpm;
- private double _rangeBeats;
+ private double _startBeats, _rangeBeats; // the range: where it starts and how long it is
+ private int _rangeMode; // 0 loop · 1 full song · 2 custom
+ private double _customStart, _customEnd;
+ private bool _customValid = true;
private TextBlock _rangeReadout = null!;
+ private TextBlock _customError = null!;
+ private Control _customRow = null!;
+ private Border? _export;
private TextBlock _estimate = null!;
private ComboBox _format = null!;
private ComboBox _rate = null!;
@@ -59,10 +67,28 @@ public sealed class ExportWindow : NotaWindow
private Action? _refreshDitherEnabled;
private TextBlock _exportLabel = null!;
- public ExportWindow(double fullBeats, double loopBeats, double bpm)
+ /// <summary>A loop region from the song start, <paramref name="loopBeats"/> long.</summary>
+ public ExportWindow(double fullBeats, double loopBeats, double bpm) : this(fullBeats, 0, loopBeats, bpm) { }
+
+ /// <param name="fullBeats">The song's end (last clip end).</param>
+ /// <param name="loopStart">The transport loop region's start; <paramref name="loopEnd"/> its end.</param>
+ public ExportWindow(double fullBeats, double loopStart, double loopEnd, double bpm)
{
_bpm = bpm;
- _rangeBeats = loopBeats > 0 ? loopBeats : fullBeats;
+ bool hasLoop = loopEnd > loopStart;
+ // Custom starts from the loop region when there is one, else the whole song.
+ (_customStart, _customEnd) = hasLoop ? (loopStart, loopEnd) : (0, fullBeats);
+ void SetRange(int mode)
+ {
+ _rangeMode = mode;
+ (_startBeats, _rangeBeats) = mode switch
+ {
+ 1 => (0, fullBeats),
+ 2 => (_customStart, _customEnd - _customStart),
+ _ => hasLoop ? (loopStart, loopEnd - loopStart) : (0, fullBeats),
+ };
+ }
+ SetRange(0);
Title = "Export audio";
Width = 560;
SizeToContent = SizeToContent.Height;
@@ -74,19 +100,55 @@ public sealed class ExportWindow : NotaWindow
var body = new StackPanel { Margin = new Thickness(18, 16), Spacing = 14 };
- // Range.
+ // Range. Custom shows a start and an end (bar.beat), checked as you type (#102).
_rangeReadout = Mono("", TextSecondary);
- var range = Segmented(new[] { ("Loop", true), ("Full song", true), ("Custom", false) }, 0, i =>
+ var range = Segmented(new[] { ("Loop", true), ("Full song", true), ("Custom", true) }, 0, i =>
{
- _rangeBeats = i == 1 ? fullBeats : loopBeats > 0 ? loopBeats : fullBeats;
+ SetRange(i);
RefreshRange();
});
var rangeRow = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10, VerticalAlignment = VerticalAlignment.Center };
rangeRow.Children.Add(range);
- var customNa = new NaBadge { Kind = NaBadgeKind.Future, VerticalAlignment = VerticalAlignment.Center };
- rangeRow.Children.Add(customNa);
rangeRow.Children.Add(_rangeReadout);
- body.Children.Add(Section("Range", rangeRow));
+ var startBox = PositionBox(_customStart);
+ var endBox = PositionBox(_customEnd);
+ _customError = new TextBlock { FontSize = 10, Foreground = NotaPalette.Danger, VerticalAlignment = VerticalAlignment.Center };
+ void ReadCustom()
+ {
+ var a = ParsePosition(startBox.Text);
+ var b = ParsePosition(endBox.Text);
+ _customValid = a is not null && b is not null && b > a;
+ _customError.Text = a is null || b is null ? "Not a position: type bar.beat, like 5.1"
+ : b <= a ? "The end must be after the start" : "";
+ if (_customValid) { _customStart = a!.Value; _customEnd = b!.Value; }
+ SetRange(2);
+ RefreshRange();
+ }
+ startBox.TextChanged += (_, _) => ReadCustom();
+ endBox.TextChanged += (_, _) => ReadCustom();
+ // Say what the numbers are: bar, beat and sixteenth, counted from 1 as the transport
+ // counter shows them, and that the end is where the export stops (#102).
+ var unitsHint = new TextBlock
+ {
+ Text = "Positions are bar.beat.sixteenth, counted from 1 as in the transport: 5 or 5.1 is the "
+ + "start of bar 5, 5.3 its third beat. The export stops at the end position, so 1 to 5 is four bars.",
+ FontSize = 10, Foreground = TextTertiary, TextWrapping = TextWrapping.Wrap, MaxWidth = 520,
+ HorizontalAlignment = HorizontalAlignment.Left,
+ };
+ _customRow = new StackPanel
+ {
+ Spacing = 6,
+ Children =
+ {
+ new StackPanel
+ {
+ Orientation = Orientation.Horizontal, Spacing = 8, VerticalAlignment = VerticalAlignment.Center,
+ Children = { Caption("Start"), startBox, Caption("End"), endBox, _customError },
+ },
+ unitsHint,
+ },
+ };
+ body.Children.Add(Section("Range", new StackPanel { Spacing = 8, Children = { rangeRow, _customRow } }));
// Format / SR / bit-depth-or-quality. The third column swaps its control
// (and title) with the format: depth for WAV/FLAC, bitrate for MP3.
@@ -134,7 +196,7 @@ public sealed class ExportWindow : NotaWindow
_estimate = new TextBlock { FontSize = 10, Foreground = TextTertiary, VerticalAlignment = VerticalAlignment.Center };
// The dialog's primary action: set apart by weight and one tone step, not by colour
// (orange is for what is live or chosen).
- var export = new Border
+ var export = _export = new Border
{
Background = NotaPalette.SurfaceHover, BorderBrush = NotaPalette.Seam, BorderThickness = new Thickness(1),
CornerRadius = NotaRadius.Control, Padding = new Thickness(18, 0), Height = 28,
@@ -144,6 +206,7 @@ public sealed class ExportWindow : NotaWindow
export.BindResource(Border.BoxShadowProperty, "Shadow.Raised");
export.PointerPressed += (_, _) =>
{
+ if (!RangeValid) return;
var fmt = SelectedFormat;
int sr = Rates[_rate.SelectedIndex < 0 ? 1 : _rate.SelectedIndex];
// MP3 has no bit-depth target; Pcm24 keeps Depth well-formed for the request.
@@ -152,7 +215,7 @@ public sealed class ExportWindow : NotaWindow
double tailBeats = _tailOn ? BeatsPerBar : 0.0;
bool dither = _dither && d == WavBitDepth.Pcm16; // only meaningful for 16-bit targets
int kbps = Bitrates[_quality.SelectedIndex < 0 ? 0 : _quality.SelectedIndex];
- Close(new ExportOptions(sr, d, tailBeats, _rangeBeats, _stems, _normalize, dither, fmt, kbps));
+ Close(new ExportOptions(sr, d, tailBeats, _rangeBeats, _stems, _normalize, dither, fmt, kbps, _startBeats));
};
var cancel = new TextBlock { Text = "Cancel", FontSize = 11, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center, Cursor = new Cursor(StandardCursorType.Hand) };
cancel.PointerPressed += (_, _) => Close(null);
@@ -210,19 +273,58 @@ public sealed class ExportWindow : NotaWindow
_exportLabel.Text = _stems ? "Export stems" : $"Export {SelectedFormat.ToString().ToUpperInvariant()}";
}
+ private bool RangeValid => _rangeMode != 2 || _customValid;
+
private void RefreshRange()
{
+ _customRow.IsVisible = _rangeMode == 2;
+ _rangeReadout.IsVisible = RangeValid;
double sec = _bpm > 0 ? _rangeBeats * 60.0 / _bpm : 0;
- int endBar = (int)(_rangeBeats / BeatsPerBar) + 1;
- _rangeReadout.Text = string.Format(NotaNum.Culture, "1.1.1 → {0}.1.1 · {1:0.0} s", endBar, sec);
+ _rangeReadout.Text = string.Format(NotaNum.Culture, "{0} → {1} · {2:0.0} s",
+ BarBeatText(_startBeats), BarBeatText(_startBeats + _rangeBeats), sec);
+ if (_export is not null) Inactive.Set(_export, !RangeValid);
RefreshEstimate();
}
+ // bar.beat.sixteenth, 1-based, as the readout shows a position.
+ private static string BarBeatText(double beats)
+ {
+ int bar = (int)Math.Floor(beats / BeatsPerBar) + 1;
+ double inBar = beats - (bar - 1) * BeatsPerBar;
+ int beat = (int)Math.Floor(inBar) + 1;
+ int six = (int)Math.Floor((inBar - (beat - 1)) * 4 + 1e-9) + 1;
+ return string.Format(NotaNum.Culture, "{0}.{1}.{2}", bar, beat, six);
+ }
+
+ /// <summary>Reads a typed position — "5", "5.2" or "5.2.3" (bar, beat, sixteenth, all
+ /// 1-based) — as beats from the song start; null when it isn't one.</summary>
+ internal static double? ParsePosition(string? text)
+ {
+ var parts = (text ?? "").Trim().Split('.');
+ if (parts.Length > 3) return null;
+ var n = new[] { 1, 1, 1 };
+ for (int i = 0; i < parts.Length; i++)
+ if (!int.TryParse(parts[i], NumberStyles.None, CultureInfo.InvariantCulture, out n[i]) || n[i] < 1) return null;
+ if (n[1] > BeatsPerBar || n[2] > 4) return null;
+ return (n[0] - 1) * BeatsPerBar + (n[1] - 1) + (n[2] - 1) / 4.0;
+ }
+
+ private TextBox PositionBox(double beats)
+ {
+ var box = new TextBox { Text = BarBeatText(beats), Width = 72, FontSize = 11, PlaceholderText = "bar.beat" };
+ ToolTip.SetTip(box, "Bar.beat.sixteenth, counted from 1 — e.g. 5.1 or 5.3.2");
+ box.BindResource(TextBox.FontFamilyProperty, "Font.Mono");
+ return box;
+ }
+
+ private TextBlock Caption(string text)
+ => new() { Text = text, FontSize = 10, Foreground = TextTertiary, VerticalAlignment = VerticalAlignment.Center };
+
private void RefreshEstimate()
{
if (_estimate is null) return;
double tail = _tailOn ? BeatsPerBar : 0;
- double sec = _bpm > 0 ? (_rangeBeats + tail) * 60.0 / _bpm : 0;
+ double sec = _bpm > 0 ? (Math.Max(0, _rangeBeats) + tail) * 60.0 / _bpm : 0;
int sr = Rates[_rate.SelectedIndex < 0 ? 1 : _rate.SelectedIndex];
int bytesPerSample = _depth.SelectedIndex switch { 0 => 2, 2 => 4, _ => 3 };
double mb = SelectedFormat switch
diff --git a/src/managed/Nota.App/MainWindow.Files.cs b/src/managed/Nota.App/MainWindow.Files.cs
index d91e6285..86c5e169 100644
--- a/src/managed/Nota.App/MainWindow.Files.cs
+++ b/src/managed/Nota.App/MainWindow.Files.cs
@@ -61,8 +61,10 @@ public partial class MainWindow
}
double bpm = (double)_vm.Transport.Bpm;
- const double loopBeats = 4 * 4; // transport loop region (0..4 bars)
- var opts = await new ExportWindow(endBeats, loopBeats, bpm).ShowDialog<ExportOptions?>(this);
+ // The transport's loop region; with none set yet, the first four bars (as Loop on uses).
+ double loopStart = Engine.LoopStart, loopEnd = Engine.LoopEnd;
+ if (loopEnd <= loopStart) (loopStart, loopEnd) = (0, 4 * 4);
+ var opts = await new ExportWindow(endBeats, loopStart, loopEnd, bpm).ShowDialog<ExportOptions?>(this);
if (opts is null) return;
Activate(); // keep the native panel focused (see DoImportAsync)
@@ -105,7 +107,7 @@ public partial class MainWindow
path, opts.RangeBeats + opts.TailBeats, bpm, opts.SampleRate, opts.Depth,
RestoreLoop: _vm.Transport.LoopOn, RestoreMetronome: _vm.Transport.MetronomeOn,
Normalize: opts.Normalize, Dither: opts.Dither,
- Format: opts.Format, Mp3BitrateKbps: opts.BitrateKbps);
+ Format: opts.Format, Mp3BitrateKbps: opts.BitrateKbps, StartBeats: opts.StartBeats);
await RunBlockingAsync("Export", opts.Stems ? "Exporting stems…" : "Exporting…", async prog =>
{
var frac = new Progress<double>(f =>
diff --git a/src/managed/Nota.App/MainWindow.MenuKeys.cs b/src/managed/Nota.App/MainWindow.MenuKeys.cs
index d9a7fcf9..084e596e 100644
--- a/src/managed/Nota.App/MainWindow.MenuKeys.cs
+++ b/src/managed/Nota.App/MainWindow.MenuKeys.cs
@@ -26,6 +26,9 @@ public partial class MainWindow
{
BindCommands();
ToolTip.SetTip(AutomationToggle, MenuKit.Keys("Show parameter-automation lanes (⌘⇧A)"));
+ // The XAML tips name the macOS keys; spell them Ctrl+… on Windows / Linux (#10).
+ foreach (var c in new Control[] { RecordBtn, LoopRecordCell, MetronomeBtn })
+ if (ToolTip.GetTip(c) is string tip) ToolTip.SetTip(c, MenuKit.Keys(tip));
if (NativeMenu.GetMenu(this) is not { } menu) return;
Collect(menu);
diff --git a/src/managed/Nota.App/MainWindow.axaml b/src/managed/Nota.App/MainWindow.axaml
index 6ee1aa77..bc5158fc 100644
--- a/src/managed/Nota.App/MainWindow.axaml
+++ b/src/managed/Nota.App/MainWindow.axaml
@@ -181,15 +181,15 @@
<StackPanel Orientation="Horizontal" Spacing="1" VerticalAlignment="Center">
<!-- Shapes built from geometry: stop a square, play a filled triangle, record a
filled disc. No glyph font. Keys butt against each other on 1px seams. -->
- <Button x:Name="StopBtn" Classes="tp-icon" ToolTip.Tip="Stop"
+ <Button x:Name="StopBtn" Classes="tp-icon" ToolTip.Tip="Stop (Return)"
Foreground="{DynamicResource Brush.TextStrong}" Command="{Binding Transport.StopCommand}">
<app:Glyph x:Name="StopGlyph" Kind="Stop" Width="9" Height="9"/>
</Button>
- <Button x:Name="PlayBtn" Classes="tp-play" ToolTip.Tip="Play"
+ <Button x:Name="PlayBtn" Classes="tp-play" ToolTip.Tip="Play (Space)"
Classes.playing="{Binding Transport.IsPlaying}" Command="{Binding Transport.PlayCommand}">
<app:Glyph x:Name="PlayGlyph" Kind="Play" Width="10" Height="12" Margin="2,0,0,0"/>
</Button>
- <ToggleButton x:Name="RecordBtn" Classes="tp-icon rec" ToolTip.Tip="Record"
+ <ToggleButton x:Name="RecordBtn" Classes="tp-icon rec" ToolTip.Tip="Record (⌘R)"
IsChecked="{Binding Transport.RecordOn}">
<app:Glyph x:Name="RecordGlyph" Kind="Record" Width="10" Height="10"/>
</ToggleButton>
@@ -292,7 +292,7 @@
<!-- Metronome: body, pendulum rod, weight -->
<ToggleButton x:Name="MetronomeBtn" Classes="tp-icon" IsChecked="{Binding Transport.MetronomeOn}"
ContextRequested="OnMetronomeContext"
- ToolTip.Tip="Turn the metronome on or off (M) · right-click for count-in">
+ ToolTip.Tip="Turn the metronome on or off (⌘M) · right-click for count-in">
<app:Glyph Kind="Metronome" Size="15"/>
</ToggleButton>
<!-- Follow playhead: keep the arrangement scrolling with the cursor. The
diff --git a/src/managed/Nota.App/PreferencesWindow.cs b/src/managed/Nota.App/PreferencesWindow.cs
index a2ab10dd..ad4557d6 100644
--- a/src/managed/Nota.App/PreferencesWindow.cs
+++ b/src/managed/Nota.App/PreferencesWindow.cs
@@ -944,8 +944,8 @@ public sealed partial class PreferencesWindow : NotaWindow
}
}
- // Bars / Solid for the arrangement's audio-clip waveforms. Saving fires Settings.Changed,
- // which the main window applies to the lanes at once.
+ // Bars / Solid for the arrangement's audio-clip waveforms and the browser preview. Saving
+ // fires Settings.Changed, which the lanes and the preview apply at once.
private static Control WaveformPicker()
{
var settings = App.Services.GetRequiredService<ISettingsService>();
@@ -1055,7 +1055,7 @@ public sealed partial class PreferencesWindow : NotaWindow
TopRow("Colour theme", ThemePicker()),
Row("", Caption("Themes change colours only. Follow system switches between your dark-mode and light-mode theme with the OS appearance.")),
Row("Waveform", WaveformPicker()),
- Row("", Caption("How audio clips draw on the arrangement: Bars spaces the peaks out so the rhythm reads; Solid draws every pixel."))),
+ Row("", Caption("How audio clips draw on the arrangement, and samples in the browser's preview: Bars spaces the peaks out so the rhythm reads; Solid draws every pixel."))),
Section("AI control (MCP)", 12, enable, details));
}
@@ -1240,12 +1240,14 @@ public sealed partial class PreferencesWindow : NotaWindow
void Render()
{
groups.Children.Clear();
- var q = _shortcutFilter.Trim();
+ // Each word must appear in the row's action, its keys or its group's title, so
+ // "keyboard" finds the whole "Play notes (computer keyboard)" group (#40).
+ var words = _shortcutFilter.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
foreach (var (title, rows) in ShortcutGroups)
{
- var shown = rows.Where(r => q.Length == 0
- || MenuKit.Keys(r.Action).Contains(q, StringComparison.OrdinalIgnoreCase)
- || MenuKit.Keys(r.Key).Contains(q, StringComparison.OrdinalIgnoreCase)).ToList();
+ var shown = rows.Where(r => words.All(w => title.Contains(w, StringComparison.OrdinalIgnoreCase)
+ || MenuKit.Keys(r.Action).Contains(w, StringComparison.OrdinalIgnoreCase)
+ || MenuKit.Keys(r.Key).Contains(w, StringComparison.OrdinalIgnoreCase))).ToList();
if (shown.Count == 0) continue;
var head = new StackPanel
{
diff --git a/src/managed/Nota.App/PreviewPlayer.cs b/src/managed/Nota.App/PreviewPlayer.cs
index f0bfc9d2..9a53cdba 100644
--- a/src/managed/Nota.App/PreviewPlayer.cs
+++ b/src/managed/Nota.App/PreviewPlayer.cs
@@ -258,6 +258,10 @@ public sealed class PreviewPlayer : UserControl
var track = settings.Current.BrowserPreviewFxTrack;
_fxTrack = track == AuditionTrackIds.Sample || audition.Tracks.Any(t => t.Id == track) ? track : AuditionTrackIds.Auto;
SetSpectrum(settings.Current.BrowserPreviewSpectrum, persist: false);
+ // The Appearance → Waveform choice draws the well too, and follows it live (#107).
+ void ApplyWaveform() => _wave.Style = (WaveformStyle)Math.Clamp(settings.Current.ArrangementWaveform, 0, 1);
+ ApplyWaveform();
+ settings.Changed += ApplyWaveform;
}
/// <summary>The browser selection moved. A sample loads its waveform, a preset or built-in
@@ -916,6 +920,14 @@ public sealed class PreviewWaveform : Control
public void SetPeaks(float[]? peaks) { _peaks = peaks; InvalidateVisual(); }
+ /// <summary>Bars (spaced strokes) or Solid (one column per pixel), as Appearance → Waveform sets.</summary>
+ public WaveformStyle Style
+ {
+ get => _style;
+ set { if (_style == value) return; _style = value; InvalidateVisual(); }
+ }
+ private WaveformStyle _style = WaveformStyle.Bars;
+
public void SetState(double duration, double pos, bool playing)
{
_duration = duration; _pos = pos; _playing = playing;
@@ -1035,9 +1047,12 @@ public sealed class PreviewWaveform : Control
ctx.FillRectangle(NotaPalette.GridBeat, new Rect(1, Math.Floor(h / 2), w - 2, 1));
if (_peaks is { Length: > 0 } peaks && innerW > 8)
{
- // ~3.8px a bar with a 1px gap, as in the mockup (72 bars across its 274px well).
- int n = Math.Max(8, (int)((innerW + 1) / 3.8));
- double bw = (innerW - (n - 1)) / n;
+ // Bars: ~3.8px a bar with a 1px gap, as in the mockup (72 bars across its 274px
+ // well). Solid: one gapless column per pixel, so the outline reads continuous.
+ bool solid = _style == WaveformStyle.Solid;
+ double gap = solid ? 0 : 1;
+ int n = solid ? Math.Max(8, (int)innerW) : Math.Max(8, (int)((innerW + 1) / 3.8));
+ double bw = (innerW - (n - 1) * gap) / n;
for (int b = 0; b < n; b++)
{
int s0 = b * peaks.Length / n, s1 = Math.Max(s0 + 1, (b + 1) * peaks.Length / n);
@@ -1052,7 +1067,7 @@ public sealed class PreviewWaveform : Control
: _playing ? NotaPalette.TextMuted
: NotaPalette.TextFaint;
double bh = innerH * amp;
- ctx.FillRectangle(c, new Rect(InsetX + b * (bw + 1), mid - bh / 2, bw, bh), 1);
+ ctx.FillRectangle(c, new Rect(InsetX + b * (bw + gap), mid - bh / 2, bw, bh), solid ? 0 : 1);
}
}
if (started && _duration > 0)
diff --git a/src/managed/Nota.Application/Ports/IAudioExporter.cs b/src/managed/Nota.Application/Ports/IAudioExporter.cs
index 08e09c56..dca373df 100644
--- a/src/managed/Nota.Application/Ports/IAudioExporter.cs
+++ b/src/managed/Nota.Application/Ports/IAudioExporter.cs
@@ -28,7 +28,8 @@ public enum ExportFormat
/// <paramref name="Dither"/> adds TPDF dither before 16-bit quantization (ignored
/// for 24-bit / float output and for MP3, which has no integer target).
/// <paramref name="Format"/> picks the file format (WAV default);
-/// <paramref name="Mp3BitrateKbps"/> is the MP3 CBR bitrate (Format == Mp3 only).</summary>
+/// <paramref name="Mp3BitrateKbps"/> is the MP3 CBR bitrate (Format == Mp3 only).
+/// <paramref name="StartBeats"/> is where the bounce starts; it lasts <paramref name="TotalBeats"/>.</summary>
public readonly record struct ExportRequest(
string Path,
double TotalBeats,
@@ -40,7 +41,8 @@ public readonly record struct ExportRequest(
bool Normalize = false,
bool Dither = false,
ExportFormat Format = ExportFormat.Wav,
- int Mp3BitrateKbps = 320);
+ int Mp3BitrateKbps = 320,
+ double StartBeats = 0);
/// <summary>Renders the master bus offline to an audio file (WAV / FLAC / MP3 —
/// M6-4). Stops the audio backend for exclusive engine access, then restarts it;
diff --git a/src/managed/Nota.Infrastructure/Audio/AudioExporter.cs b/src/managed/Nota.Infrastructure/Audio/AudioExporter.cs
index cf05e28b..170f9961 100644
--- a/src/managed/Nota.Infrastructure/Audio/AudioExporter.cs
+++ b/src/managed/Nota.Infrastructure/Audio/AudioExporter.cs
@@ -24,6 +24,7 @@ public sealed class AudioExporter : IAudioExporter
long totalFrames = FramesFor(r);
bool wasRunning = engine.IsRunning; // restart afterwards only what was running
+ var loop = (engine.LoopStart, engine.LoopEnd); // the region to put back afterwards
engine.Stop(); // halt the audio backend: no audio thread during render
engine.SetLoop(false, 0, 0); // don't wrap; render the whole range once
engine.SetMetronome(false); // keep clicks out of the bounce
@@ -40,7 +41,7 @@ public sealed class AudioExporter : IAudioExporter
string tmp = r.Path + ".norm.tmp";
try
{
- float peak = RenderToTemp(engine, tmp, totalFrames, sr, ref firstOverall, progress, 0.0, 0.7);
+ float peak = RenderToTemp(engine, tmp, totalFrames, sr, r.StartBeats, ref firstOverall, progress, 0.0, 0.7);
Transcode(tmp, r.Path, sr, r, GainFor(peak), progress, 0.7, 0.3);
}
finally { if (File.Exists(tmp)) File.Delete(tmp); }
@@ -51,7 +52,7 @@ public sealed class AudioExporter : IAudioExporter
0.0, 1.0);
}
- Restore(engine, r, wasRunning);
+ Restore(engine, r, wasRunning, loop);
progress?.Report(1.0);
}
@@ -71,6 +72,7 @@ public sealed class AudioExporter : IAudioExporter
for (int i = 0; i < tracks.Count; i++) savedMute[i] = tracks[i].Muted != 0;
bool wasRunning = engine.IsRunning;
+ var loop = (engine.LoopStart, engine.LoopEnd);
engine.Stop();
engine.SetLoop(false, 0, 0);
engine.SetMetronome(false);
@@ -84,7 +86,7 @@ public sealed class AudioExporter : IAudioExporter
double stemsBase = 0.0;
if (r.Normalize)
{
- gain = GainFor(ScanPeak(engine, totalFrames, sr, ref firstOverall, progress, 0.0, 0.15));
+ gain = GainFor(ScanPeak(engine, totalFrames, sr, r.StartBeats, ref firstOverall, progress, 0.0, 0.15));
stemsBase = 0.15;
}
int written = 0;
@@ -102,13 +104,13 @@ public sealed class AudioExporter : IAudioExporter
}
for (int j = 0; j < count; j++) engine.SetTrackMute(tracks[j].Id, savedMute[j]); // restore mutes
- Restore(engine, r, wasRunning);
+ Restore(engine, r, wasRunning, loop);
progress?.Report(1.0);
return written;
}
// Renders `totalFrames` of the current graph to one output file (WAV / FLAC /
- // MP3 per the request). Seeks to 0 and plays (audio clips only render while
+ // MP3 per the request). Seeks to the range start and plays (audio clips only render while
// playing). The first render overall sets the export sample rate; later ones
// inherit it. Reports progress into [baseFrac, baseFrac+spanFrac] as the render
// advances (throttled to whole-percent changes).
@@ -118,7 +120,7 @@ public sealed class AudioExporter : IAudioExporter
float gain = 1f)
{
engine.StopTransport();
- engine.Seek(0);
+ engine.Seek(r.StartBeats);
engine.Play();
var buf = new float[Chunk * 2];
@@ -159,12 +161,12 @@ public sealed class AudioExporter : IAudioExporter
// Renders the current graph once to a temp float32 WAV, returning its true peak.
// Used by master normalize so the transcode pass scales the exact samples measured.
- private static float RenderToTemp(IAudioEngine engine, string tmpPath, long totalFrames, int sr,
+ private static float RenderToTemp(IAudioEngine engine, string tmpPath, long totalFrames, int sr, double startBeats,
ref bool firstOverall, IProgress<double>? progress,
double baseFrac, double spanFrac)
{
engine.StopTransport();
- engine.Seek(0);
+ engine.Seek(startBeats);
engine.Play();
var scanner = new TruePeakScanner();
@@ -241,11 +243,11 @@ public sealed class AudioExporter : IAudioExporter
// Renders the current graph once without writing, returning its true peak (for
// normalize). Same render path as the write pass, so the measured peak matches.
- private static float ScanPeak(IAudioEngine engine, long totalFrames, int sr, ref bool firstOverall,
+ private static float ScanPeak(IAudioEngine engine, long totalFrames, int sr, double startBeats, ref bool firstOverall,
IProgress<double>? progress, double baseFrac, double spanFrac)
{
engine.StopTransport();
- engine.Seek(0);
+ engine.Seek(startBeats);
engine.Play();
var scanner = new TruePeakScanner();
@@ -332,11 +334,11 @@ public sealed class AudioExporter : IAudioExporter
private static long FramesFor(ExportRequest r)
=> (long)System.Math.Ceiling(r.TotalBeats * (r.SampleRate * 60.0 / r.Bpm));
- private static void Restore(IAudioEngine engine, ExportRequest r, bool wasRunning)
+ private static void Restore(IAudioEngine engine, ExportRequest r, bool wasRunning, (double Start, double End) loop)
{
engine.StopTransport();
engine.Seek(0);
- engine.SetLoop(r.RestoreLoop, 0, 16);
+ engine.SetLoop(r.RestoreLoop, loop.Start, loop.End); // the user's region, not a fixed 1–5 (#102)
engine.SetMetronome(r.RestoreMetronome);
// Resume live audio at the device sample rate — only if it was live: an engine that
// was never started (headless, no output device) has nothing to resume.
diff --git a/src/managed/Nota.Mcp/Tools/ExportTools.cs b/src/managed/Nota.Mcp/Tools/ExportTools.cs
index 4748ea09..a2ef684e 100644
--- a/src/managed/Nota.Mcp/Tools/ExportTools.cs
+++ b/src/managed/Nota.Mcp/Tools/ExportTools.cs
@@ -37,7 +37,7 @@ public sealed class ExportTools(IAudioEngine engine, IEngineDispatch dispatch, I
private static readonly int[] ValidBitrates = { 128, 192, 256, 320 };
private ExportRequest BuildRequest(string path, double totalBeats, string bitDepth,
- string format, int bitrateKbps)
+ string format, int bitrateKbps, double startBeat)
{
int sr = (int)Math.Round(E.SampleRate);
if (sr <= 0) sr = 48000; // engine hasn't negotiated a device rate yet — pick a sane default
@@ -55,18 +55,19 @@ public sealed class ExportTools(IAudioEngine engine, IEngineDispatch dispatch, I
int kbps = ValidBitrates.Contains(bitrateKbps) ? bitrateKbps : 320;
return new ExportRequest(path, Math.Max(0.25, totalBeats), E.Bpm > 0 ? E.Bpm : 120, sr, depth,
RestoreLoop: E.LoopEnabled, RestoreMetronome: false,
- Format: fmt, Mp3BitrateKbps: kbps);
+ Format: fmt, Mp3BitrateKbps: kbps, StartBeats: Math.Max(0, startBeat));
}
[McpServerTool(Name = "export_master"), Description(
"Render the master bus offline to an audio file. path = output file, totalBeats = how many beats to render, "
+ + "startBeat = where the render starts (default 0), "
+ "bitDepth = pcm16 | pcm24 | float32 (wav/flac), format = wav | flac | mp3 (default wav), "
+ "bitrateKbps = 128 | 192 | 256 | 320 (mp3 only, default 320). Stops playback first. Returns the output path.")]
public Task<string> ExportMaster(string path, double totalBeats, string bitDepth = "float32",
- string format = "wav", int bitrateKbps = 320) => Mutate(() =>
+ string format = "wav", int bitrateKbps = 320, double startBeat = 0) => Mutate(() =>
{
E.StopTransport();
- var req = BuildRequest(path, totalBeats, bitDepth, format, bitrateKbps);
+ var req = BuildRequest(path, totalBeats, bitDepth, format, bitrateKbps, startBeat);
_exporter.ExportMaster(E, req);
string note = req.Format == ExportFormat.Wav ? "" : $" ({format.ToLowerInvariant()})";
if (req.Format == ExportFormat.Mp3 && (int)Math.Round(E.SampleRate) > 48000)
@@ -76,13 +77,13 @@ public sealed class ExportTools(IAudioEngine engine, IEngineDispatch dispatch, I
[McpServerTool(Name = "export_stems"), Description(
"Render one file per non-return track (stems) into the given folder. folder = output directory, "
- + "totalBeats = how many beats to render, bitDepth = pcm16 | pcm24 | float32 (wav/flac), "
+ + "totalBeats = how many beats to render, startBeat = where the render starts (default 0), bitDepth = pcm16 | pcm24 | float32 (wav/flac), "
+ "format = wav | flac | mp3 (default wav), bitrateKbps = 128 | 192 | 256 | 320 (mp3 only, default 320). "
+ "Returns the number of stems written.")]
public Task<int> ExportStems(string folder, double totalBeats, string bitDepth = "float32",
- string format = "wav", int bitrateKbps = 320) => Mutate(() =>
+ string format = "wav", int bitrateKbps = 320, double startBeat = 0) => Mutate(() =>
{
E.StopTransport();
- return _exporter.ExportStems(E, BuildRequest(folder, totalBeats, bitDepth, format, bitrateKbps));
+ return _exporter.ExportStems(E, BuildRequest(folder, totalBeats, bitDepth, format, bitrateKbps, startBeat));
});
}
diff --git a/src/native/nota.engine/src/Engine_Modulation.cpp b/src/native/nota.engine/src/Engine_Modulation.cpp
index e0d9e8e3..172700c3 100644
--- a/src/native/nota.engine/src/Engine_Modulation.cpp
+++ b/src/native/nota.engine/src/Engine_Modulation.cpp
@@ -538,7 +538,12 @@ bool Engine::modulationSelfTest() {
modulatorSet(tid, mth, static_cast<int32_t>(ModField::InputA), (float)ma);
modulatorSet(tid, mth, static_cast<int32_t>(ModField::InputB), (float)mb);
updateModulators(authoring_.get(), 0.0, 0.0, 0.01);
- const bool mathOk = std::fabs(modulatorValue(tid, mth) - 0.7f) < 1e-3f;
+ bool mathOk = std::fabs(modulatorValue(tid, mth) - 0.7f) < 1e-3f;
+ // Scale with a gain above 1 (the Math gain runs 0..2, #92): 0.3 × 1.5 = 0.45.
+ modulatorSet(tid, mth, static_cast<int32_t>(ModField::Waveform), 4); // op Scale
+ modulatorSet(tid, mth, static_cast<int32_t>(ModField::Depth), 1.5f);
+ updateModulators(authoring_.get(), 0.0, 0.0, 0.01);
+ mathOk = mathOk && std::fabs(modulatorValue(tid, mth) - 0.45f) < 1e-3f;
envOk = envOk && mathOk;
// Removing the modulator must drop all its remaining links.
diff --git a/src/native/nota.engine/src/Modulation.h b/src/native/nota.engine/src/Modulation.h
index 2b9153f1..211150f9 100644
--- a/src/native/nota.engine/src/Modulation.h
+++ b/src/native/nota.engine/src/Modulation.h
@@ -48,7 +48,7 @@ struct Modulator {
std::atomic<int32_t> tempoSync{1}; // 1 = beats/cycle, 0 = free Hz
std::atomic<float> rateHz{1.0f}; // free-run rate
std::atomic<float> rateSyncBeats{0.5f}; // beats per cycle when synced (0.5 = 1/8)
- std::atomic<float> depth{1.0f}; // 0..1 output amplitude
+ std::atomic<float> depth{1.0f}; // 0..1 output amplitude (Math: gain 0..2)
std::atomic<float> phase01{0.0f}; // 0..1 phase offset
std::atomic<float> attackMs{10.0f}; // env follower / ADSR rise time
std::atomic<float> releaseMs{120.0f}; // env follower / ADSR fall time
@@ -127,7 +127,8 @@ struct Modulator {
case ModField::TempoSync: tempoSync.store(v > 0.5f ? 1 : 0, std::memory_order_relaxed); break;
case ModField::RateHz: rateHz.store(v, std::memory_order_relaxed); break;
case ModField::RateSyncBeats: rateSyncBeats.store(v, std::memory_order_relaxed); break;
- case ModField::Depth: depth.store(std::clamp(v, 0.0f, 1.0f), std::memory_order_relaxed); break;
+ case ModField::Depth: // a Math node's gain runs 0..2; every other depth 0..1 (#92)
+ depth.store(std::clamp(v, 0.0f, kind == ModulatorKind::Math ? 2.0f : 1.0f), std::memory_order_relaxed); break;
case ModField::Phase: phase01.store(v, std::memory_order_relaxed); break;
case ModField::Attack: attackMs.store(std::max(0.1f, v), std::memory_order_relaxed); break;
case ModField::Release: releaseMs.store(std::max(1.0f, v), std::memory_order_relaxed); break;
diff --git a/tests/Nota.SmokeTest/DesignTokenCheck.Labels.cs b/tests/Nota.SmokeTest/DesignTokenCheck.Labels.cs
index b67785d5..bc029ef3 100644
--- a/tests/Nota.SmokeTest/DesignTokenCheck.Labels.cs
+++ b/tests/Nota.SmokeTest/DesignTokenCheck.Labels.cs
@@ -28,11 +28,13 @@ namespace Nota.SmokeTest;
internal static partial class DesignTokenCheck
{
// Capitalised mid-label because they name a thing, not because of Title Case: the views
- // and panels, the product and its themes, plug-in formats.
+ // and panels, the product and its themes, plug-in formats, keys.
private static readonly HashSet<string> ProperNouns = new(StringComparer.Ordinal)
{
"Arrangement", "Session", "Modular", "Mixer", "Finder", "Nota", "Studio", "Ember",
"Graphite", "Paper", "MIDI", "VST3", "AU", "CLAP",
+ // Keys, named as the keyboard and Settings → Shortcuts spell them: "Play (Space)".
+ "Space", "Return", "Enter", "Esc", "Tab", "Delete", "Shift", "Ctrl", "Alt",
};
// Local helpers that build a label from their first argument.
diff --git a/tests/Nota.SmokeTest/LabelAllowList.txt b/tests/Nota.SmokeTest/LabelAllowList.txt
index 100ac40e..75f16dda 100644
--- a/tests/Nota.SmokeTest/LabelAllowList.txt
+++ b/tests/Nota.SmokeTest/LabelAllowList.txt
@@ -11,6 +11,5 @@
Nota.App/AboutWindow.cs © 2026 Egor Khindikaynen (Ambertape) # data: proper names (author, label)
Nota.App/DeviceCards/Bodies/ShutterDeviceBody.cs Ramp Up # data: Shutter pattern preset name
Nota.App/DeviceCards/Instruments/PendulumInstrumentCard.cs The voice: soft Keys, bright Glass, Saw, hollow Square or inharmonic Bell # data: names the Pendulum voice models
-Nota.App/DeviceCards/Midi/RandomMidiBody.cs Distribution: Gauss / Even / Walk — click for the next, Shift-click for the previous # data: names the Random distribution modes
Nota.App/DetailWindow.cs Devices / Clip # data: names the window's two tabs, Devices and Clip
Nota.App/MainWindow.Downloads.cs Open Settings → Downloads # data: names the Settings window and its Downloads page
diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.cs
index 6d151ecf..b9254946 100644
--- a/tests/Nota.SmokeTest/Program.cs
+++ b/tests/Nota.SmokeTest/Program.cs
@@ -8685,6 +8685,38 @@ Check(engine.SessionAudioRecordSelfTest(), "session audio slot captures + loops
}
}
+// -- Export range start (#102): a Custom range that doesn't start at 1.1 renders from
+// its start, and the bounce puts the user's loop region back afterwards. ---------
+{
+ using var re = new NotaEngine();
+ re.SetBpm(120); re.SetTimeSignature(4, 4);
+ string sine = Path.Combine(Path.GetTempPath(), $"nota-sine-{Guid.NewGuid():N}.wav");
+ Nota.SmokeTest.WavWriter.WriteSine(sine, 2.0, 440.0, 48000); // 2 s = 4 beats at 120
+ int rTrk = re.AddAudioTrack();
+ re.AddAudioClip(rTrk, sine, 8.0); // bar 3 to bar 4
+ re.SetMetronome(false); re.SetLoop(true, 4.0, 12.0);
+ string late = Path.Combine(Path.GetTempPath(), $"nota-range-{Guid.NewGuid():N}.wav");
+ string early = late.Replace(".wav", ".early.wav");
+ try
+ {
+ new AudioExporter().ExportMaster(re, new ExportRequest(late, 4.0, 120, 48000, WavBitDepth.Pcm24,
+ RestoreLoop: true, RestoreMetronome: false, StartBeats: 8.0));
+ new AudioExporter().ExportMaster(re, new ExportRequest(early, 4.0, 120, 48000, WavBitDepth.Pcm24,
+ RestoreLoop: true, RestoreMetronome: false));
+ var lateMono = NotaEngine.DecodeMono(late, 10.0, out _);
+ var earlyMono = NotaEngine.DecodeMono(early, 10.0, out _);
+ Check(lateMono is not null && Math.Abs(lateMono.Length - 96000) <= 8 && MonoRms(lateMono) > 0.1f,
+ $"export from beat 8 renders the clip there ({lateMono?.Length} frames, rms {(lateMono is null ? 0 : MonoRms(lateMono)):F3})");
+ Check(earlyMono is not null && MonoRms(earlyMono) < 1e-4f, "export from beat 0 over the same length is silent");
+ Check(re.LoopEnabled && Math.Abs(re.LoopStart - 4.0) < 1e-9 && Math.Abs(re.LoopEnd - 12.0) < 1e-9,
+ $"export puts the loop region back ({re.LoopStart}–{re.LoopEnd})");
+ }
+ finally
+ {
+ try { File.Delete(sine); File.Delete(late); File.Delete(early); } catch { }
+ }
+}
+
// -- M7: MP3 master export — CBR size, duration, decodes audible --------------
{
using var me = new NotaEngine();
@@ -9324,6 +9356,36 @@ Console.WriteLine("-- M9-A1: parameter automation core --");
Check(ok, "CV modulation round-trips through save/load (v18)");
try { System.IO.Directory.Delete(pdir, true); } catch { }
}
+
+ // A Math node's gain spans 0..2 (#92): above 1.0 it sticks, scales the input and survives
+ // save/load, while an LFO's depth stays clamped to 0..1.
+ {
+ using var me = new NotaEngine();
+ int mt = me.AddInstrumentTrack();
+ int mac = me.ModulatorAdd(mt, 4); // Macro, value 0.4
+ me.ModulatorSet(mt, mac, 4, 0.4f);
+ int mth = me.ModulatorAdd(mt, 5); // Math
+ me.ModulatorSet(mt, mth, 0, 4); // op Scale: a × gain + offset
+ me.ModulatorSet(mt, mth, 10, mac); // input A
+ me.ModulatorSet(mt, mth, 4, 1.5f); // gain
+ int lfo = me.ModulatorAdd(mt, 0);
+ me.ModulatorSet(mt, lfo, 4, 1.5f);
+ Check(Math.Abs(me.ModulatorGet(mt, mth, 4) - 1.5f) < 1e-3, "Math gain keeps 1.5 (range 0..2)");
+ Check(Math.Abs(me.ModulatorGet(mt, lfo, 4) - 1.0f) < 1e-3, "LFO depth still clamps to 1.0");
+ me.ModulatorSet(mt, mth, 4, 3f);
+ Check(Math.Abs(me.ModulatorGet(mt, mth, 4) - 2.0f) < 1e-3, "Math gain clamps to 2.0");
+ me.ModulatorSet(mt, mth, 4, 1.5f);
+ var w = new System.Collections.Generic.List<string>();
+ var doc = ProjectService.Capture(me, new TransportState(120, 1, false, false), w);
+ string pdir = Path.Combine(Path.GetTempPath(), "nota-math-gain-" + Guid.NewGuid().ToString("N"));
+ ProjectService.Save(doc, pdir, me);
+ using var me2 = new NotaEngine();
+ ProjectService.Apply(ProjectService.Load(pdir), me2, pdir);
+ bool ok = me2.TryGetTrackInfo(0, out var t2) && me2.ModulatorCount(t2.Id) == 3
+ && Math.Abs(me2.ModulatorGet(t2.Id, me2.ModulatorIdAt(t2.Id, 1), 4) - 1.5f) < 1e-3;
+ Check(ok, "Math gain 1.5 round-trips through save/load");
+ try { System.IO.Directory.Delete(pdir, true); } catch { }
+ }
}
// ===================== Instrument Rack: engine core =====================