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.

Add ten factory kits for the Drum Rack

Egor Khindikaynene62ffe1eaefb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c4d028df..2cab9b30 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,27 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
## [Unreleased]
### Added
+- **Ten factory kits for the Drum Rack.** *Volta* (warm analog boom), *Kompakt* (punchy
+ analog house), *Micron* (small vintage rhythm box), *Linnwood* (80s PCM machine, gated
+ snare), *Atelier* (acoustic studio kit), *Cellar* (dusty vinyl break), *Neon* (modern
+ sub-forward, with tuned 808 bass hits), *Foundry* (industrial metal), *Terra* (hand
+ percussion) and *Aether* (ambient, long tails). Each is 16 pads laid out on the General
+ MIDI drum map (36–51), with the three hats sharing a choke group and the kit's own swing
+ and humanize. Load one from the browser — they sit under **Nota Drum Rack** in the
+ Instruments tab — onto a new track, or drop it on an existing Drum Rack to replace its
+ pads. The result is an ordinary Drum Rack: every pad is a Sampler you can retune,
+ reshape and add effects to.
+- **The kits are synthesized on your machine rather than bundled as audio**, so they cost
+ the installer nothing: Nota ships the recipes and renders the WAVs once, on first launch,
+ in well under a second. They land in Nota's data folder and appear in the browser's Files
+ tab under **Nota Kits**, so the individual one-shots can be dragged anywhere a sample
+ goes. The synthesis models the instruments rather than sampling them — rung resonators
+ for the analog voices, struck bodies with real mode spacing for the acoustic ones — and
+ runs at 4× the output rate through a zero-phase decimator, so nothing aliases.
+- **Drum Rack pads can be named.** Pads used to read "Nota Sampler" all sixteen times over;
+ now a pad carries its own name, shown on the pad, in the mixer view, and as the row label
+ in the Pattern grid. Kits name their pads, a dropped sample names its pad after the file,
+ and the name travels with the project.
- **A Snap latch in the transport.** Separate from the grid denomination, which only says
*how far apart*: switch Snap off to position clips freely for a while, instead of holding
⌥ for every drag. The grid keeps its spacing, so switching back resumes where you were.
diff --git a/FEATURES.md b/FEATURES.md
index af7569c9..9036c0e7 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -367,8 +367,17 @@ and user presets, automation, persistence and cloning.
with **key and velocity zones**, gain/meter/M·S, horizontal device cards (GUI / Params),
a zone map, rack output (Volume/Glide), Fold/Save.
- **Nota Drum Rack** — 4×4 pads (banks C1–C4, up to 64 pads), Pads and Mixer views, per-pad
- Volume/Pan/Tune/Decay, choke groups (monophonic cut), Swing/Humanize, hot-swap. Its clips
- can be stepped in the detail panel's **Pattern** tab (see below).
+ Volume/Pan/Tune/Decay, named pads, choke groups (monophonic cut), Swing/Humanize,
+ hot-swap. Its clips can be stepped in the detail panel's **Pattern** tab (see below).
+- **Ten factory kits** under Nota Drum Rack in the browser: *Volta* (warm analog boom),
+ *Kompakt* (punchy analog house), *Micron* (small vintage rhythm box), *Linnwood* (80s PCM
+ machine), *Atelier* (acoustic studio kit), *Cellar* (dusty vinyl break), *Neon* (modern
+ sub-forward, tuned 808 bass), *Foundry* (industrial metal), *Terra* (hand percussion),
+ *Aether* (ambient). 16 pads each on the General MIDI map (36–51), hats choked together,
+ with the kit's own swing and humanize. Load onto a new track or drop onto an existing
+ Drum Rack to replace its pads. The one-shots are synthesized on first launch rather than
+ shipped as audio (nothing added to the installer) and appear in the Files tab under
+ **Nota Kits**, ready to drag anywhere a sample goes.
- **Nota Audio Effect Rack** — **Parallel / Series / Select** modes (by input level),
Dry/Wet + Gain, PDC, Fold, Save; chains with gain/meter/M·S; named macros and mappings;
the "+ Device" menu lists built-in effects and a Plug-ins submenu.
diff --git a/src/managed/Nota.App/App.axaml.cs b/src/managed/Nota.App/App.axaml.cs
index 390e35a0..05908fc1 100644
--- a/src/managed/Nota.App/App.axaml.cs
+++ b/src/managed/Nota.App/App.axaml.cs
@@ -37,6 +37,7 @@ public partial class App : Avalonia.Application
services.AddSingleton<IProjectStore, ProjectStore>();
services.AddSingleton<IPresetStore, PresetStore>();
services.AddSingleton<IFactoryPresets, FactoryPresetCatalog>();
+ services.AddSingleton<IDrumKits, DrumKitService>();
services.AddSingleton<IBrowserLibrary, BrowserLibraryService>();
services.AddSingleton<IAudioDeviceService, AudioDeviceService>();
services.AddSingleton<IMidiDeviceService, MidiDeviceService>();
diff --git a/src/managed/Nota.App/BrowserView.cs b/src/managed/Nota.App/BrowserView.cs
index dd12c7bb..7f423a81 100644
--- a/src/managed/Nota.App/BrowserView.cs
+++ b/src/managed/Nota.App/BrowserView.cs
@@ -691,7 +691,8 @@ public sealed class BrowserView : UserControl
// The row's full identity lives in the tooltip, where the tag has no room for it
// (a plug-in's format, a sample's folder).
- ToolTip.SetTip(row, item.Sub.Length > 0 ? $"{item.Name} · {item.Sub}" : item.Name);
+ string tip = item.Tip.Length > 0 ? item.Tip : item.Sub;
+ ToolTip.SetTip(row, tip.Length > 0 ? $"{item.Name} · {tip}" : item.Name);
return row;
}
@@ -1253,7 +1254,9 @@ public sealed class BrowserView : UserControl
switch (item.Kind)
{
case BrowserItemKind.Sample:
- case BrowserItemKind.Preset when item.Path.Length > 0 && !item.Path.StartsWith("factory:", StringComparison.Ordinal): // saved preset file on disk
+ // A saved preset file on disk. Synthetic rows (factory presets, drum kits)
+ // carry a scheme instead of a path and have nothing to reveal.
+ case BrowserItemKind.Preset when System.IO.Path.IsPathRooted(item.Path):
{
var reveal = new MenuItem { Header = "Reveal in Finder" };
reveal.Click += (_, _) => RevealRequested?.Invoke(item);
diff --git a/src/managed/Nota.App/DeviceCards/Rack/RackCardView.cs b/src/managed/Nota.App/DeviceCards/Rack/RackCardView.cs
index feaa41e3..bc4da694 100644
--- a/src/managed/Nota.App/DeviceCards/Rack/RackCardView.cs
+++ b/src/managed/Nota.App/DeviceCards/Rack/RackCardView.cs
@@ -1056,6 +1056,13 @@ internal sealed class RackCardView(DeviceCardContext ctx)
return new Border { Width = 314, Padding = new Thickness(8, 7), Child = uni };
}
+ // A pad's display name: the chain name if set, else the chain instrument's.
+ private string PadName(IRackAccess a, int chain)
+ {
+ string n = E.RackChainName(T, chain);
+ return n.Length > 0 ? n : a.ChainInstrumentName(chain);
+ }
+
private Control DrumPad(IRackAccess a, int note)
{
int chain = ChainForNote(a, note);
@@ -1063,7 +1070,9 @@ internal sealed class RackCardView(DeviceCardContext ctx)
bool selected = filled && chain == Sel;
Color hue = filled ? PadHue(chain) : Colors.Black;
int choke = filled ? E.RackChainChoke(T, chain) : 0;
- string name = filled ? a.ChainInstrumentName(chain) : NoteName(note);
+ // The pad's own name when it has one (kit voice, dropped sample); otherwise the
+ // instrument's — which for a Sampler is the same word on every pad.
+ string name = filled ? PadName(a, chain) : NoteName(note);
var nameTb = new TextBlock { Text = name, FontSize = 9, FontWeight = FontWeight.SemiBold, Foreground = filled ? IrTxt : IrMuted, TextTrimming = TextTrimming.CharacterEllipsis, VerticalAlignment = VerticalAlignment.Top };
var noteTb = IrMono(NoteName(note), filled ? NotaPalette.TextSecondary : IrMuted, 7);
@@ -1136,7 +1145,7 @@ internal sealed class RackCardView(DeviceCardContext ctx)
var head = new DockPanel { LastChildFill = false, Children = {
new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, VerticalAlignment = VerticalAlignment.Center, Children = {
new Border { Width = 7, Height = 7, CornerRadius = new CornerRadius(2), Background = new SolidColorBrush(hue), VerticalAlignment = VerticalAlignment.Center },
- new TextBlock { Text = a.ChainInstrumentName(c), FontSize = 9, FontWeight = FontWeight.SemiBold, Foreground = IrTxt, VerticalAlignment = VerticalAlignment.Center },
+ new TextBlock { Text = PadName(a, c), FontSize = 9, FontWeight = FontWeight.SemiBold, Foreground = IrTxt, VerticalAlignment = VerticalAlignment.Center },
IrMono($"{NoteName(note)} · {(choke > 0 ? $"choke CH {choke}" : "no choke")} · {devs} dev", IrMuted) } },
WithRight(DrumOpenChip(a, c)) } };
@@ -1244,7 +1253,7 @@ internal sealed class RackCardView(DeviceCardContext ctx)
var g = new Grid { ColumnDefinitions = new ColumnDefinitions("96,26,*,40,44"), ColumnSpacing = 6, Height = 13 };
var nameCell = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 5, VerticalAlignment = VerticalAlignment.Center, Children = {
new Border { Width = 4, Height = 10, CornerRadius = new CornerRadius(1), Background = new SolidColorBrush(hue), VerticalAlignment = VerticalAlignment.Center },
- new TextBlock { Text = a.ChainInstrumentName(c), FontSize = 9, Foreground = c == Sel ? IrAmberLit : IrTxt, TextTrimming = TextTrimming.CharacterEllipsis, VerticalAlignment = VerticalAlignment.Center } } };
+ new TextBlock { Text = PadName(a, c), FontSize = 9, Foreground = c == Sel ? IrAmberLit : IrTxt, TextTrimming = TextTrimming.CharacterEllipsis, VerticalAlignment = VerticalAlignment.Center } } };
nameCell.PointerPressed += (_, _) => SelectPad(c);
Grid.SetColumn(nameCell, 0); g.Children.Add(nameCell);
var noteTb = IrMono(NoteName(note), IrMuted); Grid.SetColumn(noteTb, 1); g.Children.Add(noteTb);
@@ -1869,7 +1878,13 @@ internal sealed class RackCardView(DeviceCardContext ctx)
case Nota.Presentation.BrowserItemKind.Sample:
if (existing >= 0) a.RemoveChain(existing);
int cs = E.RackAddSamplerChain(T, item.Path, note, false);
- if (cs >= 0) E.RackSetChainTriggerNote(T, cs, note);
+ if (cs >= 0)
+ {
+ E.RackSetChainTriggerNote(T, cs, note);
+ // Label the pad with the sample's name — 16 pads all reading
+ // "Nota Sampler" tell the user nothing.
+ E.RackSetChainName(T, cs, System.IO.Path.GetFileNameWithoutExtension(item.Path));
+ }
break;
case Nota.Presentation.BrowserItemKind.BuiltinInstrument:
if (existing >= 0) a.RemoveChain(existing);
diff --git a/src/managed/Nota.App/DrumPatternView.cs b/src/managed/Nota.App/DrumPatternView.cs
index acd7bc12..fc326d0f 100644
--- a/src/managed/Nota.App/DrumPatternView.cs
+++ b/src/managed/Nota.App/DrumPatternView.cs
@@ -132,7 +132,13 @@ public sealed class DrumPatternView : UserControl
for (int c = 0; c < n; c++)
{
int note = _e.RackChainTriggerNote(TrackId, c);
- if (note >= 0) pads.Add(new Pad(c, note, _e.RackChainInstrumentName(TrackId, c)));
+ // Prefer the pad's own name (kit voice / dropped sample) — every Sampler pad
+ // reports the same instrument name, which makes the grid unreadable.
+ if (note >= 0)
+ {
+ string nm = _e.RackChainName(TrackId, c);
+ pads.Add(new Pad(c, note, nm.Length > 0 ? nm : _e.RackChainInstrumentName(TrackId, c)));
+ }
}
pads.Sort((x, y) => x.Note.CompareTo(y.Note)); // kick (lowest pad) on top, as on the pad grid
return pads;
diff --git a/src/managed/Nota.App/MainWindow.Browser.cs b/src/managed/Nota.App/MainWindow.Browser.cs
index 56267181..065439d1 100644
--- a/src/managed/Nota.App/MainWindow.Browser.cs
+++ b/src/managed/Nota.App/MainWindow.Browser.cs
@@ -42,6 +42,7 @@ public partial class MainWindow
// track (targetTrackId is ignored for them); effect presets target the track.
private string ApplyPresetItem(BrowserItem item, int targetTrackId)
{
+ if (IsKitRow(item)) return ApplyDrumKit(item, targetTrackId);
bool factory = item.Path.StartsWith("factory:", StringComparison.Ordinal);
string factoryId = factory ? item.Path["factory:".Length..] : "";
// Apply doesn't say where the preset landed, so diff the chain around it: a new track
@@ -64,6 +65,33 @@ public partial class MainWindow
return warn;
}
+ /// <summary>A factory drum-kit row (browser Path "kit:&lt;id&gt;").</summary>
+ private static bool IsKitRow(BrowserItem item)
+ => item.Kind == BrowserItemKind.Preset && item.Path.StartsWith("kit:", StringComparison.Ordinal);
+
+ // Loads a factory kit. Dropped on an existing Drum Rack it replaces that rack's pads;
+ // anywhere else it spawns its own Drum Rack track, the way an instrument preset does.
+ // The kit's samples are synthesized on first use, which is why this can be slow once.
+ private string ApplyDrumKit(BrowserItem item, int targetTrackId)
+ {
+ string id = item.Path["kit:".Length..];
+ if (targetTrackId > 0 && Engine.TrackInstrumentKind(targetTrackId) == 4)
+ {
+ _kits.LoadInto(Engine, targetTrackId, id, out string replaceWarn);
+ ShowDevices(targetTrackId);
+ return replaceWarn;
+ }
+ int track = _kits.CreateTrack(Engine, id, out string warn);
+ if (track > 0)
+ {
+ Engine.AddMidiClip(track, 0.0, 4.0);
+ _lastInstrumentTrackId = track;
+ Timeline.Refresh();
+ ShowDevices(track);
+ }
+ return warn;
+ }
+
private HashSet<int> TrackIds()
{
var ids = new HashSet<int>();
@@ -162,10 +190,12 @@ public partial class MainWindow
return; // OpenProject rebuilds everything itself
case BrowserItemKind.Preset:
{
+ bool kit = IsKitRow(item);
string warn = ApplyPresetItem(item, Timeline.SelectedTrackId);
Timeline.Refresh();
- if (Timeline.SelectedTrackId > 0) ShowDevices(Timeline.SelectedTrackId);
- _vm.StatusText = warn.Length == 0 ? $"Applied preset {item.Name}" : warn;
+ if (!kit && Timeline.SelectedTrackId > 0) ShowDevices(Timeline.SelectedTrackId);
+ _vm.StatusText = warn.Length > 0 ? warn
+ : kit ? $"Loaded {item.Name} kit" : $"Applied preset {item.Name}";
break;
}
}
diff --git a/src/managed/Nota.App/MainWindow.Dnd.cs b/src/managed/Nota.App/MainWindow.Dnd.cs
index 8a6ef9b9..84244b14 100644
--- a/src/managed/Nota.App/MainWindow.Dnd.cs
+++ b/src/managed/Nota.App/MainWindow.Dnd.cs
@@ -228,9 +228,11 @@ public partial class MainWindow
// drop target; an effect preset reports "Select a track first." via Apply itself.
if (item.Kind == BrowserItemKind.Preset)
{
+ bool kit = IsKitRow(item);
string warn = ApplyPresetItem(item, trackId);
- if (trackId > 0) ShowDevices(trackId);
- _vm.StatusText = warn.Length == 0 ? $"Applied preset {item.Name}" : warn;
+ if (!kit && trackId > 0) ShowDevices(trackId);
+ _vm.StatusText = warn.Length > 0 ? warn
+ : kit ? $"Loaded {item.Name} kit" : $"Applied preset {item.Name}";
return;
}
if (trackId <= 0) { _vm.StatusText = "Drop onto a track."; return; }
diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.cs
index 38e2ea53..c2813742 100644
--- a/src/managed/Nota.App/MainWindow.axaml.cs
+++ b/src/managed/Nota.App/MainWindow.axaml.cs
@@ -14,6 +14,7 @@ using Avalonia.Interactivity;
using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.Platform.Storage;
+using Avalonia.Threading;
using Avalonia.VisualTree;
using Microsoft.Extensions.DependencyInjection;
using Nota.Application;
@@ -37,6 +38,7 @@ public partial class MainWindow : Window
private IProjectStore _projects = default!;
private IPresetStore _presets = default!;
private IFactoryPresets _factory = default!;
+ private IDrumKits _kits = default!;
private IRecoveryStore _recovery = default!;
private IAudioExporter _exporter = default!;
@@ -114,6 +116,23 @@ public partial class MainWindow : Window
}
// Custom frameless title bar (Phase 2): drag the window by its top bar; a
+ // The factory drum kits ship as recipes, not audio: synthesize whatever is missing
+ // (first run, or after an update changed a kit) off the UI thread, then refresh the
+ // Files tab so the new folders appear. Cheap enough to do on every launch — when
+ // everything is current it is a handful of file-existence checks.
+ private void EnsureFactoryKits() => Task.Run(() =>
+ {
+ try
+ {
+ int n = _kits.EnsureRendered();
+ if (n > 0) Dispatcher.UIThread.Post(() => _vm?.Browser.RebuildSamples());
+ }
+ catch (Exception ex)
+ {
+ App.Services.GetRequiredService<ILogSink>().Error("Rendering the factory drum kits failed", ex);
+ }
+ });
+
// double-click toggles maximise/restore (standard title-bar behaviour).
private void OnTitleBarPressed(object? sender, PointerPressedEventArgs e)
{
@@ -142,6 +161,8 @@ public partial class MainWindow : Window
_projects = App.Services.GetRequiredService<IProjectStore>();
_presets = App.Services.GetRequiredService<IPresetStore>();
_factory = App.Services.GetRequiredService<IFactoryPresets>();
+ _kits = App.Services.GetRequiredService<IDrumKits>();
+ EnsureFactoryKits();
_recovery = App.Services.GetRequiredService<IRecoveryStore>();
_exporter = App.Services.GetRequiredService<IAudioExporter>();
diff --git a/src/managed/Nota.App/Mcp/McpAppServices.cs b/src/managed/Nota.App/Mcp/McpAppServices.cs
index f08e563a..8a66a63d 100644
--- a/src/managed/Nota.App/Mcp/McpAppServices.cs
+++ b/src/managed/Nota.App/Mcp/McpAppServices.cs
@@ -69,7 +69,7 @@ public sealed class MidiLearnAccess(MidiLearnService svc) : IMidiLearnAccess
public sealed class McpService(
IAudioEngine engine, IEngineDispatch dispatch, IArrangementRefresh refresh, ISettingsService settings, ILogSink log,
IPluginCatalog pluginCatalog, IFactoryPresets factoryPresets, IPresetStore presetStore, IPresetLibrary presetLibrary,
- IAudioExporter exporter, IMidiDeviceService midiDevices, MidiLearnService midiLearn)
+ IAudioExporter exporter, IMidiDeviceService midiDevices, MidiLearnService midiLearn, IDrumKits drumKits)
{
private readonly NotaMcpServer _server = new();
@@ -82,6 +82,7 @@ public sealed class McpService(
s.AddSingleton(settings);
s.AddSingleton(pluginCatalog);
s.AddSingleton(factoryPresets);
+ s.AddSingleton(drumKits);
s.AddSingleton(presetStore);
s.AddSingleton(presetLibrary);
s.AddSingleton(exporter);
diff --git a/src/managed/Nota.Application/Engine/IAudioEngine.cs b/src/managed/Nota.Application/Engine/IAudioEngine.cs
index e6cd2818..2593f9d8 100644
--- a/src/managed/Nota.Application/Engine/IAudioEngine.cs
+++ b/src/managed/Nota.Application/Engine/IAudioEngine.cs
@@ -421,6 +421,10 @@ public interface IAudioEngine : IDisposable
int RackAddPluginChainDevice(int trackId, int chain, int catalogIndex);
int RackChainTriggerNote(int trackId, int chain);
void RackSetChainTriggerNote(int trackId, int chain, int note);
+ /// <summary>The chain's display name — a Drum Rack pad label. Empty means "use the
+ /// chain instrument's own name" (every Sampler pad would otherwise read the same).</summary>
+ string RackChainName(int trackId, int chain);
+ void RackSetChainName(int trackId, int chain, string name);
int RackChainCount(int trackId);
int RackAddChain(int trackId, int instKind); // 0=Synth, 2=Physical
bool RackRemoveChain(int trackId, int chain);
diff --git a/src/managed/Nota.Application/Ports/IDrumKits.cs b/src/managed/Nota.Application/Ports/IDrumKits.cs
new file mode 100644
index 00000000..d99907a6
--- /dev/null
+++ b/src/managed/Nota.Application/Ports/IDrumKits.cs
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+
+namespace Nota.Application;
+
+/// <summary>A shipped Drum Rack kit, described for the browser.</summary>
+public readonly record struct DrumKitInfo(
+ string Id, // stable; the browser row's Path is "kit:" + Id
+ string Name,
+ string Blurb, // one-line description for the row
+ int PadCount);
+
+/// <summary>The factory drum kits. Their samples are synthesized on the user's machine
+/// rather than shipped as audio, so a kit may need rendering before it can be loaded —
+/// <see cref="EnsureRendered"/> does that and is safe to call repeatedly.</summary>
+public interface IDrumKits
+{
+ /// <summary>All shipped kits, in catalog order.</summary>
+ IReadOnlyList<DrumKitInfo> All();
+
+ /// <summary>Folder holding the rendered one-shots of every kit.</summary>
+ string Root { get; }
+
+ /// <summary>Folder of one kit's rendered one-shots ("" for an unknown id).</summary>
+ string FolderOf(string id);
+
+ /// <summary>True when the kit's samples are on disk and current.</summary>
+ bool IsRendered(string id);
+
+ /// <summary>Renders the kit (or every kit when <paramref name="id"/> is empty) if it
+ /// is missing or out of date. Returns the number of samples written.</summary>
+ int EnsureRendered(string id = "");
+
+ /// <summary>Creates a Drum Rack track loaded with the kit. Returns the new track id,
+ /// or -1; <paramref name="warning"/> is "" on success.</summary>
+ int CreateTrack(IAudioEngine engine, string id, out string warning);
+
+ /// <summary>Replaces the pads of an existing Drum Rack track with the kit.</summary>
+ bool LoadInto(IAudioEngine engine, int trackId, string id, out string warning);
+}
diff --git a/src/managed/Nota.Infrastructure/Interop/NativeMethods.Rack.cs b/src/managed/Nota.Infrastructure/Interop/NativeMethods.Rack.cs
index a6304c18..7771b064 100644
--- a/src/managed/Nota.Infrastructure/Interop/NativeMethods.Rack.cs
+++ b/src/managed/Nota.Infrastructure/Interop/NativeMethods.Rack.cs
@@ -57,6 +57,12 @@ internal static partial class NativeMethods
[LibraryImport(Lib, EntryPoint = "nota_rack_set_chain_trigger_note")]
internal static partial void RackSetChainTriggerNote(IntPtr engine, int trackId, int chain, int note);
+ [LibraryImport(Lib, EntryPoint = "nota_rack_chain_name")]
+ internal static partial IntPtr RackChainName(IntPtr engine, int trackId, int chain);
+
+ [LibraryImport(Lib, EntryPoint = "nota_rack_set_chain_name", StringMarshalling = StringMarshalling.Utf8)]
+ internal static partial void RackSetChainName(IntPtr engine, int trackId, int chain, string name);
+
[LibraryImport(Lib, EntryPoint = "nota_rack_chain_count")]
internal static partial int RackChainCount(IntPtr engine, int trackId);
diff --git a/src/managed/Nota.Infrastructure/Interop/NotaEngine.Rack.cs b/src/managed/Nota.Infrastructure/Interop/NotaEngine.Rack.cs
index 7ad2e4e1..a2f025ed 100644
--- a/src/managed/Nota.Infrastructure/Interop/NotaEngine.Rack.cs
+++ b/src/managed/Nota.Infrastructure/Interop/NotaEngine.Rack.cs
@@ -65,6 +65,12 @@ public sealed partial class NotaEngine
public void RackSetChainTriggerNote(int trackId, int chain, int note)
{ ThrowIfDisposed(); NativeMethods.RackSetChainTriggerNote(_handle, trackId, chain, note); }
+ public string RackChainName(int trackId, int chain)
+ { ThrowIfDisposed(); return Marshal.PtrToStringUTF8(NativeMethods.RackChainName(_handle, trackId, chain)) ?? ""; }
+
+ public void RackSetChainName(int trackId, int chain, string name)
+ { ThrowIfDisposed(); NativeMethods.RackSetChainName(_handle, trackId, chain, name ?? ""); }
+
public int RackChainCount(int trackId)
{ ThrowIfDisposed(); return NativeMethods.RackChainCount(_handle, trackId); }
diff --git a/src/managed/Nota.Infrastructure/Kits/DrumKitService.cs b/src/managed/Nota.Infrastructure/Kits/DrumKitService.cs
new file mode 100644
index 00000000..654f2ab1
--- /dev/null
+++ b/src/managed/Nota.Infrastructure/Kits/DrumKitService.cs
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// IDrumKits over the code-defined kit catalog: renders a kit's one-shots on demand
+// (KitLibrary) and assembles a Drum Rack from them — one Sampler chain per pad, with
+// the pad's trigger note, choke group, pan, gain and name, plus the kit's swing and
+// humanize. Loading a kit is an ordinary sequence of engine calls, so the result is an
+// ordinary Drum Rack the user can take apart pad by pad.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Nota.Application;
+using Nota.Infrastructure.Kits;
+
+namespace Nota.Infrastructure;
+
+public sealed class DrumKitService : IDrumKits
+{
+ public string Root => KitLibrary.Root;
+
+ public IReadOnlyList<DrumKitInfo> All()
+ {
+ var list = new List<DrumKitInfo>(KitCatalog.All.Count);
+ foreach (var k in KitCatalog.All) list.Add(new DrumKitInfo(k.Id, k.Name, k.Blurb, k.Pads.Count));
+ return list;
+ }
+
+ public string FolderOf(string id)
+ {
+ var kit = KitCatalog.ById(id);
+ return kit is null ? "" : KitLibrary.DirOf(kit);
+ }
+
+ public bool IsRendered(string id)
+ {
+ var kit = KitCatalog.ById(id);
+ return kit is not null && KitLibrary.IsRendered(kit);
+ }
+
+ public int EnsureRendered(string id = "")
+ {
+ if (string.IsNullOrEmpty(id)) return KitLibrary.EnsureAll();
+ var kit = KitCatalog.ById(id);
+ return kit is null ? 0 : KitLibrary.Ensure(kit);
+ }
+
+ public int CreateTrack(IAudioEngine engine, string id, out string warning)
+ {
+ var kit = KitCatalog.ById(id);
+ if (kit is null) { warning = "Unknown drum kit."; return -1; }
+ int track = engine.AddDrumRackTrack();
+ if (track <= 0) { warning = "Couldn't create a Drum Rack track."; return -1; }
+ Fill(engine, track, kit, out warning);
+ return track;
+ }
+
+ public bool LoadInto(IAudioEngine engine, int trackId, string id, out string warning)
+ {
+ var kit = KitCatalog.ById(id);
+ if (kit is null) { warning = "Unknown drum kit."; return false; }
+ // Clear the existing pads first — a kit replaces the rack's contents rather than
+ // layering onto whatever was there.
+ for (int c = engine.RackChainCount(trackId) - 1; c >= 0; c--) engine.RackRemoveChain(trackId, c);
+ Fill(engine, trackId, kit, out warning);
+ return true;
+ }
+
+ private static void Fill(IAudioEngine engine, int track, KitDefinition kit, out string warning)
+ {
+ KitLibrary.Ensure(kit);
+
+ var missing = new List<string>();
+ foreach (var pad in kit.Pads)
+ {
+ var path = KitLibrary.PathOf(kit, pad);
+ if (!File.Exists(path)) { missing.Add(pad.Name); continue; }
+
+ // rootNote = the pad's own note, so the sample plays back untransposed and
+ // the pad's Tune control stays the only pitch offset.
+ int chain = engine.RackAddSamplerChain(track, path, pad.Note, false);
+ if (chain < 0) { missing.Add(pad.Name); continue; }
+
+ engine.RackSetChainTriggerNote(track, chain, pad.Note);
+ engine.RackSetChainName(track, chain, pad.Name);
+ if (pad.Choke > 0) engine.RackSetChainChoke(track, chain, pad.Choke);
+ if (pad.Pan != 0f) engine.RackSetChainPan(track, chain, pad.Pan);
+ if (Math.Abs(pad.Gain - 1f) > 1e-3f) engine.RackSetChainGain(track, chain, pad.Gain);
+ }
+
+ engine.RackSetSwing(track, kit.Swing);
+ engine.RackSetHumanize(track, kit.Humanize);
+
+ warning = missing.Count == 0
+ ? ""
+ : $"{kit.Name}: {missing.Count} pad(s) couldn't be loaded ({string.Join(", ", missing)}).";
+ }
+}
diff --git a/src/managed/Nota.Infrastructure/Kits/KitCatalog.cs b/src/managed/Nota.Infrastructure/Kits/KitCatalog.cs
new file mode 100644
index 00000000..6dbcfdea
--- /dev/null
+++ b/src/managed/Nota.Infrastructure/Kits/KitCatalog.cs
@@ -0,0 +1,367 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// The shipped factory kits, as recipes. Ten kits x 16 pads, defined here rather than
+// bundled as audio: the installer carries a few kilobytes of parameters and the WAVs
+// are rendered on the user's machine the first time Nota runs (KitLibrary).
+//
+// Pad layout follows the General MIDI drum map for notes 36-51, so a pattern written
+// for any other drum instrument lands on the right pads here:
+//
+// 36 Kick 37 Rim 38 Snare 39 Clap
+// 40 Snare 2 41 Tom Low 42 Cl Hat 43 Tom Mid
+// 44 Pd Hat 45 Tom Hi 46 Op Hat 47 Perc 1
+// 48 Perc 2 49 Crash 50 Perc 3 51 Ride
+//
+// GM reserves 47/48/50 for further toms; kits that only have three toms use those
+// slots for their own character percussion instead, and the pad name says which.
+// All three hats share choke group 1, so closed cuts open the way hardware does.
+//
+// The sound design aims at warm rather than clean: most voices carry some saturation
+// and the Warmth glue stage, and none of them are normalized to the ceiling — there is
+// headroom left for the user to drive them further.
+
+using System.Collections.Generic;
+
+namespace Nota.Infrastructure.Kits;
+
+public static class KitCatalog
+{
+ private static IReadOnlyList<KitDefinition>? _all;
+
+ /// <summary>Every shipped kit, in browser order.</summary>
+ public static IReadOnlyList<KitDefinition> All => _all ??= Build();
+
+ public static KitDefinition? ById(string id)
+ {
+ foreach (var k in All) if (k.Id == id) return k;
+ return null;
+ }
+
+ private static List<KitDefinition> Build() => new()
+ {
+ Volta(), Kompakt(), Micron(), Linnwood(), Atelier(),
+ Cellar(), Neon(), Foundry(), Terra(), Aether(),
+ };
+
+ // ======================================================================
+ // 1. Volta — the long, round analog boom of the first programmable boxes.
+ // Everything is a rung circuit: a sub that decays for two seconds, a
+ // noise-and-tone snare, and six squares of metal for the hats.
+ // ======================================================================
+ private static KitDefinition Volta() => new()
+ {
+ Id = "volta",
+ Name = "Volta",
+ Blurb = "warm analog boom · long sub kick, metal hats, cowbell",
+ Swing = 0f,
+ Humanize = 0.05f,
+ Pads = new List<KitPad>
+ {
+ new() { Name = "Kick", Model = DrumModel.KickAnalog, Note = 36, Freq = 47, Decay = 1.55, PitchAmt = 1.3, PitchDecay = 0.04, Tone = 0.16, Body = 0.85, Click = 0.20, Drive = 0.22, Warmth = 0.6, Drift = 0.3, Length = 2.6, PeakDb = -1.5 },
+ new() { Name = "Rim", Model = DrumModel.Rim, Note = 37, Freq = 372, Decay = 0.05, Tone = 0.55, Body = 0.4, Drive = 0.25, Warmth = 0.5, HpHz = 200, Drift = 0.4, Length = 0.3, PeakDb = -9 },
+ new() { Name = "Snare", Model = DrumModel.SnareAnalog,Note = 38, Freq = 184, Decay = 0.36, Tone = 0.60, Body = 0.55, Noise = 0.9, NoiseDecay = 0.18, Click = 0.40, Drive = 0.25, Warmth = 0.55, Drift = 0.3, Length = 0.8, PeakDb = -2.5 },
+ new() { Name = "Clap", Model = DrumModel.Clap, Note = 39, Freq = 1040,Decay = 0.24, Tone = 0.5, Body = 0.55, Drive = 0.2, Warmth = 0.5, Drift = 0.5, Length = 0.7, PeakDb = -4 },
+ new() { Name = "Snare Tight",Model = DrumModel.SnareAnalog,Note = 40, Freq = 246, Decay = 0.20, Tone = 0.74, Body = 0.4, Noise = 1.0, NoiseDecay = 0.10, Click = 0.52, Drive = 0.28, Warmth = 0.5, Drift = 0.3, Length = 0.5, PeakDb = -4 },
+ new() { Name = "Tom Low", Model = DrumModel.Tom, Note = 41, Freq = 78, Decay = 0.62, PitchAmt = 0.32, PitchDecay = 0.05, Tone = 0.35, Body = 0.30, Noise = 0.10, NoiseDecay = 0.04, Drive = 0.18, Warmth = 0.55, Drift = 0.3, Length = 1.1, PeakDb = -5 },
+ new() { Name = "Closed Hat", Model = DrumModel.HatMetal, Note = 42, Choke = 1, Freq = 205, Decay = 0.055, Tone = 0.22, Body = 0.55, Noise = 0.15, Drive = 0.15, Warmth = 0.4, Drift = 0.4, Length = 0.3, PeakDb = -10 },
+ new() { Name = "Tom Mid", Model = DrumModel.Tom, Note = 43, Freq = 104, Decay = 0.52, PitchAmt = 0.32, PitchDecay = 0.045,Tone = 0.35, Body = 0.30, Noise = 0.10, NoiseDecay = 0.04, Drive = 0.18, Warmth = 0.55, Drift = 0.3, Length = 0.95,PeakDb = -5 },
+ new() { Name = "Pedal Hat", Model = DrumModel.HatMetal, Note = 44, Choke = 1, Freq = 205, Decay = 0.035, Tone = 0.20, Body = 0.5, Noise = 0.12, Drive = 0.12, Warmth = 0.4, Drift = 0.4, Length = 0.2, PeakDb = -13 },
+ new() { Name = "Tom Hi", Model = DrumModel.Tom, Note = 45, Freq = 142, Decay = 0.44, PitchAmt = 0.32, PitchDecay = 0.04, Tone = 0.35, Body = 0.30, Noise = 0.10, NoiseDecay = 0.04, Drive = 0.18, Warmth = 0.55, Drift = 0.3, Length = 0.85,PeakDb = -5 },
+ new() { Name = "Open Hat", Model = DrumModel.HatMetal, Note = 46, Choke = 1, Freq = 205, Decay = 0.55, Tone = 0.24, Body = 0.55, Noise = 0.18, Drive = 0.15, Warmth = 0.4, Drift = 0.4, Length = 1.2, PeakDb = -9 },
+ new() { Name = "Conga Low", Model = DrumModel.Conga, Note = 47, Freq = 180, Decay = 0.34, Tone = 0.35, Body = 0.35, Click = 0.30, Drive = 0.2, Warmth = 0.55, Drift = 0.3, Length = 0.7, PeakDb = -6 },
+ new() { Name = "Conga Mid", Model = DrumModel.Conga, Note = 48, Freq = 245, Decay = 0.30, Tone = 0.38, Body = 0.35, Click = 0.30, Drive = 0.2, Warmth = 0.55, Drift = 0.3, Length = 0.6, PeakDb = -6 },
+ new() { Name = "Crash", Model = DrumModel.Cymbal, Note = 49, Freq = 296, Decay = 2.6, Tone = 0.42, Body = 0.6, Noise = 0.35, Drive = 0.12, Warmth = 0.35, Drift = 0.4, Length = 3.2, PeakDb = -7 },
+ new() { Name = "Conga Hi", Model = DrumModel.Conga, Note = 50, Freq = 330, Decay = 0.26, Tone = 0.42, Body = 0.35, Click = 0.30, Drive = 0.2, Warmth = 0.55, Drift = 0.3, Length = 0.55,PeakDb = -6 },
+ new() { Name = "Cowbell", Model = DrumModel.Cowbell, Note = 51, Freq = 540, Decay = 0.30, Tone = 0.45, Body = 0.5, Click = 0.35, Drive = 0.25, Warmth = 0.5, Drift = 0.3, Length = 0.7, PeakDb = -8 },
+ },
+ };
+
+ // ======================================================================
+ // 2. Kompakt — the club machine: short, hard kick with a steep pitch drop,
+ // noise-forward snare, hats bright enough to cut through a mix.
+ // ======================================================================
+ private static KitDefinition Kompakt() => new()
+ {
+ Id = "kompakt",
+ Name = "Kompakt",
+ Blurb = "punchy analog house · clicky kick, noisy snare, bright hats",
+ Humanize = 0.04f,
+ Pads = new List<KitPad>
+ {
+ new() { Name = "Kick", Model = DrumModel.KickPunch, Note = 36, Freq = 55, Decay = 0.48, PitchAmt = 3.6, PitchDecay = 0.013, Tone = 0.55, Body = 0.55, Click = 0.55, Drive = 0.35, Warmth = 0.5, Drift = 0.2, Length = 1.1, PeakDb = -1.5 },
+ new() { Name = "Rim", Model = DrumModel.Rim, Note = 37, Freq = 448, Decay = 0.04, Tone = 0.62, Body = 0.5, Drive = 0.3, Warmth = 0.45, HpHz = 240, Drift = 0.3, Length = 0.25, PeakDb = -9 },
+ new() { Name = "Snare", Model = DrumModel.SnarePunch, Note = 38, Freq = 192, Decay = 0.26, Tone = 0.55, Body = 0.45, Noise = 0.9, NoiseDecay = 0.13, Drive = 0.32, Warmth = 0.45, Drift = 0.2, Length = 0.6, PeakDb = -2.5 },
+ new() { Name = "Clap", Model = DrumModel.Clap, Note = 39, Freq = 1180,Decay = 0.26, Tone = 0.6, Body = 0.6, Drive = 0.25, Warmth = 0.45, Drift = 0.5, Length = 0.7, PeakDb = -4 },
+ new() { Name = "Snare Tight",Model = DrumModel.SnarePunch, Note = 40, Freq = 238, Decay = 0.16, Tone = 0.7, Body = 0.35, Noise = 1.0, NoiseDecay = 0.07, Drive = 0.35, Warmth = 0.4, Drift = 0.2, Length = 0.4, PeakDb = -4 },
+ new() { Name = "Tom Low", Model = DrumModel.Tom, Note = 41, Freq = 90, Decay = 0.40, PitchAmt = 0.55, PitchDecay = 0.035, Tone = 0.45, Body = 0.4, Noise = 0.22, NoiseDecay = 0.05, Drive = 0.25, Warmth = 0.45, Drift = 0.2, Length = 0.8, PeakDb = -5 },
+ new() { Name = "Closed Hat", Model = DrumModel.HatMetal, Note = 42, Choke = 1, Freq = 318, Decay = 0.045, Tone = 0.45, Body = 0.6, Noise = 0.35, Drive = 0.2, Warmth = 0.3, Drift = 0.3, Length = 0.25, PeakDb = -10 },
+ new() { Name = "Tom Mid", Model = DrumModel.Tom, Note = 43, Freq = 124, Decay = 0.34, PitchAmt = 0.55, PitchDecay = 0.032, Tone = 0.45, Body = 0.4, Noise = 0.22, NoiseDecay = 0.05, Drive = 0.25, Warmth = 0.45, Drift = 0.2, Length = 0.7, PeakDb = -5 },
+ new() { Name = "Pedal Hat", Model = DrumModel.HatMetal, Note = 44, Choke = 1, Freq = 318, Decay = 0.028, Tone = 0.42, Body = 0.55,Noise = 0.3, Drive = 0.18, Warmth = 0.3, Drift = 0.3, Length = 0.2, PeakDb = -13 },
+ new() { Name = "Tom Hi", Model = DrumModel.Tom, Note = 45, Freq = 168, Decay = 0.28, PitchAmt = 0.55, PitchDecay = 0.03, Tone = 0.45, Body = 0.4, Noise = 0.22, NoiseDecay = 0.05, Drive = 0.25, Warmth = 0.45, Drift = 0.2, Length = 0.6, PeakDb = -5 },
+ new() { Name = "Open Hat", Model = DrumModel.HatMetal, Note = 46, Choke = 1, Freq = 318, Decay = 0.40, Tone = 0.48, Body = 0.6, Noise = 0.4, Drive = 0.2, Warmth = 0.3, Drift = 0.3, Length = 1.0, PeakDb = -9 },
+ new() { Name = "Clap Tight", Model = DrumModel.Clap, Note = 47, Freq = 1500,Decay = 0.10, Tone = 0.7, Body = 0.3, Drive = 0.3, Warmth = 0.35, Drift = 0.4, Length = 0.35, PeakDb = -6 },
+ new() { Name = "Rim Hard", Model = DrumModel.Rim, Note = 48, Freq = 690, Decay = 0.03, Tone = 0.75, Body = 0.6, Drive = 0.4, Warmth = 0.35, HpHz = 400, Drift = 0.3, Length = 0.2, PeakDb = -8 },
+ new() { Name = "Crash", Model = DrumModel.Cymbal, Note = 49, Freq = 336, Decay = 2.2, Tone = 0.55, Body = 0.55, Noise = 0.5, Drive = 0.15, Warmth = 0.3, Drift = 0.3, Length = 2.8, PeakDb = -7 },
+ new() { Name = "Zap", Model = DrumModel.Zap, Note = 50, Freq = 120, Decay = 0.12, PitchAmt = 9, PitchDecay = 0.02, Tone = 0.3, Body = 0.5, Drive = 0.3, Warmth = 0.4, Length = 0.35, PeakDb = -7 },
+ new() { Name = "Ride", Model = DrumModel.Cymbal, Note = 51, Freq = 420, Decay = 1.1, Tone = 0.75, Body = 0.4, Noise = 0.25, Drive = 0.12, Warmth = 0.3, Drift = 0.3, Length = 1.6, PeakDb = -10 },
+ },
+ };
+
+ // ======================================================================
+ // 3. Micron — the small, cheap rhythm box: thin, band-limited and hissy,
+ // which is exactly its charm. Everything is low-passed and a little
+ // noisy, and the kit is quieter overall than the big machines.
+ // ======================================================================
+ private static KitDefinition Micron() => new()
+ {
+ Id = "micron",
+ Name = "Micron",
+ Blurb = "small vintage rhythm box · thin, hissy, band-limited",
+ Humanize = 0.08f,
+ Pads = new List<KitPad>
+ {
+ new() { Name = "Kick", Model = DrumModel.KickAnalog, Note = 36, Freq = 62, Decay = 0.42, PitchAmt = 1.9, PitchDecay = 0.02, Tone = 0.35, Body = 0.5, Click = 0.35, Drive = 0.28, Warmth = 0.7, LpHz = 6500, Hiss = 0.35, Drift = 0.6, Length = 0.9, PeakDb = -2 },
+ new() { Name = "Rim", Model = DrumModel.Rim, Note = 37, Freq = 530, Decay = 0.03, Tone = 0.6, Body = 0.35, Drive = 0.3, Warmth = 0.6, HpHz = 300, LpHz = 9000, Hiss = 0.3, Drift = 0.7, Length = 0.2, PeakDb = -10 },
+ new() { Name = "Snare", Model = DrumModel.SnareAnalog,Note = 38, Freq = 238, Decay = 0.19, Tone = 0.72, Body = 0.35, Noise = 0.85, NoiseDecay = 0.09, Click = 0.35, Drive = 0.3, Warmth = 0.65, LpHz = 8500, Hiss = 0.4, Drift = 0.5, Length = 0.5, PeakDb = -3 },
+ new() { Name = "Clap", Model = DrumModel.Clap, Note = 39, Freq = 1250,Decay = 0.14, Tone = 0.45, Body = 0.4, Drive = 0.25, Warmth = 0.6, LpHz = 8000, Hiss = 0.35, Drift = 0.6, Length = 0.45, PeakDb = -5 },
+ new() { Name = "Snare Alt", Model = DrumModel.SnareAnalog,Note = 40, Freq = 300, Decay = 0.13, Tone = 0.8, Body = 0.28, Noise = 0.95, NoiseDecay = 0.06, Click = 0.45, Drive = 0.3, Warmth = 0.6, LpHz = 9000, Hiss = 0.4, Drift = 0.5, Length = 0.4, PeakDb = -5 },
+ new() { Name = "Tom Low", Model = DrumModel.Tom, Note = 41, Freq = 96, Decay = 0.30, PitchAmt = 0.4, PitchDecay = 0.03, Tone = 0.4, Body = 0.25, Noise = 0.18, NoiseDecay = 0.035, Drive = 0.25, Warmth = 0.65, LpHz = 6000, Hiss = 0.3, Drift = 0.5, Length = 0.6, PeakDb = -6 },
+ new() { Name = "Closed Hat", Model = DrumModel.HatNoise, Note = 42, Choke = 1, Freq = 900, Decay = 0.035, Tone = 0.5, Body = 0.45, Click = 0.3, Drive = 0.2, Warmth = 0.5, LpHz = 11000, Hiss = 0.3, Drift = 0.6, Length = 0.2, PeakDb = -11 },
+ new() { Name = "Tom Mid", Model = DrumModel.Tom, Note = 43, Freq = 132, Decay = 0.26, PitchAmt = 0.4, PitchDecay = 0.028,Tone = 0.4, Body = 0.25, Noise = 0.18, NoiseDecay = 0.035, Drive = 0.25, Warmth = 0.65, LpHz = 6500, Hiss = 0.3, Drift = 0.5, Length = 0.55, PeakDb = -6 },
+ new() { Name = "Pedal Hat", Model = DrumModel.HatNoise, Note = 44, Choke = 1, Freq = 900, Decay = 0.022, Tone = 0.45, Body = 0.4, Click = 0.25, Drive = 0.18, Warmth = 0.5, LpHz = 10000, Hiss = 0.25, Drift = 0.6, Length = 0.15, PeakDb = -14 },
+ new() { Name = "Tom Hi", Model = DrumModel.Tom, Note = 45, Freq = 178, Decay = 0.22, PitchAmt = 0.4, PitchDecay = 0.026,Tone = 0.4, Body = 0.25, Noise = 0.18, NoiseDecay = 0.035, Drive = 0.25, Warmth = 0.65, LpHz = 7000, Hiss = 0.3, Drift = 0.5, Length = 0.5, PeakDb = -6 },
+ new() { Name = "Open Hat", Model = DrumModel.HatNoise, Note = 46, Choke = 1, Freq = 900, Decay = 0.26, Tone = 0.55, Body = 0.45, Click = 0.25, Drive = 0.2, Warmth = 0.5, LpHz = 11000, Hiss = 0.35, Drift = 0.6, Length = 0.7, PeakDb = -10 },
+ new() { Name = "Maraca", Model = DrumModel.Shaker, Note = 47, Freq = 5200,Decay = 0.075,Tone = 0.5, Body = 0.7, Click = 0.7, Drive = 0.15, Warmth = 0.45, LpHz = 12000, Hiss = 0.25, Drift = 0.6, Length = 0.3, PeakDb = -11 },
+ new() { Name = "Claves", Model = DrumModel.Block, Note = 48, Freq = 2350,Decay = 0.05, Tone = 0.35, Body = 0.4, Drive = 0.2, Warmth = 0.5, LpHz = 12000, Hiss = 0.2, Drift = 0.5, Length = 0.25, PeakDb = -9 },
+ new() { Name = "Cymbal", Model = DrumModel.Cymbal, Note = 49, Freq = 340, Decay = 0.9, Tone = 0.55, Body = 0.4, Noise = 0.45, Drive = 0.18, Warmth = 0.5, LpHz = 11000, Hiss = 0.4, Drift = 0.5, Length = 1.4, PeakDb = -9 },
+ new() { Name = "Cowbell", Model = DrumModel.Cowbell, Note = 50, Freq = 600, Decay = 0.22, Tone = 0.5, Body = 0.45, Click = 0.3, Drive = 0.28, Warmth = 0.55, LpHz = 9000, Hiss = 0.3, Drift = 0.5, Length = 0.5, PeakDb = -9 },
+ new() { Name = "Hi Conga", Model = DrumModel.Conga, Note = 51, Freq = 340, Decay = 0.2, Tone = 0.4, Body = 0.3, Click = 0.3, Drive = 0.25, Warmth = 0.6, LpHz = 8000, Hiss = 0.3, Drift = 0.5, Length = 0.45, PeakDb = -8 },
+ },
+ };
+
+ // ======================================================================
+ // 4. Linnwood — the 80s PCM machine: real drums, sampled at 8 bits and a
+ // low rate. The crusher is the point, not a defect; the gated snare is
+ // the sound of the decade.
+ // ======================================================================
+ private static KitDefinition Linnwood() => new()
+ {
+ Id = "linnwood",
+ Name = "Linnwood",
+ Blurb = "80s PCM drum machine · 8-bit sampled kit, gated snare",
+ Humanize = 0.03f,
+ Pads = new List<KitPad>
+ {
+ new() { Name = "Kick", Model = DrumModel.KickAcoustic, Note = 36, Freq = 58, Decay = 0.42, PitchAmt = 0.7, PitchDecay = 0.02, Tone = 0.5, Body = 0.55, Click = 0.45, Drive = 0.25, Warmth = 0.6, Bits = 9, CrushHz = 30000, LpHz = 11000, Drift = 0.15, Length = 0.9, PeakDb = -1.5 },
+ new() { Name = "Side Stick", Model = DrumModel.Rim, Note = 37, Freq = 520, Decay = 0.045, Tone = 0.5, Body = 0.45, Drive = 0.25, Warmth = 0.5, Bits = 9, CrushHz = 30000, HpHz = 260, Length = 0.25, PeakDb = -9 },
+ new() { Name = "Snare", Model = DrumModel.SnareAcoustic,Note = 38, Freq = 196, Decay = 0.38, Tone = 0.5, Body = 0.6, Noise = 0.85, NoiseDecay = 0.2, Click = 0.45, Drive = 0.28, Warmth = 0.55, Bits = 9, CrushHz = 30000, LpHz = 12000, Room = 0.34, RoomSize = 0.55, RoomDecay = 0.20, RoomDamp = 0.4, Width = 0.6, Length = 1.0, PeakDb = -2.5 },
+ new() { Name = "Clap", Model = DrumModel.Clap, Note = 39, Freq = 1150,Decay = 0.24, Tone = 0.5, Body = 0.55, Drive = 0.22, Warmth = 0.5, Bits = 9, CrushHz = 30000, Room = 0.22, RoomSize = 0.45, Width = 0.7, Length = 0.8, PeakDb = -4 },
+ new() { Name = "Snare Gate", Model = DrumModel.SnareAcoustic,Note = 40, Freq = 210, Decay = 0.30, Tone = 0.55, Body = 0.6, Noise = 0.95, NoiseDecay = 0.16, Click = 0.5, Drive = 0.35, Warmth = 0.5, Bits = 9, CrushHz = 30000, Room = 0.55, RoomSize = 0.7, RoomDecay = 0.55, RoomDamp = 0.3, RoomGate = 0.22, Width = 0.8, Length = 0.85, PeakDb = -3 },
+ new() { Name = "Tom Low", Model = DrumModel.Tom, Note = 41, Freq = 84, Decay = 0.55, PitchAmt = 0.3, PitchDecay = 0.05, Tone = 0.45, Body = 0.5, Noise = 0.3, NoiseDecay = 0.06, Drive = 0.22, Warmth = 0.55, Bits = 9, CrushHz = 30000, Room = 0.25, RoomSize = 0.5, Width = 0.6, Length = 1.2, PeakDb = -5 },
+ new() { Name = "Closed Hat", Model = DrumModel.HatNoise, Note = 42, Choke = 1, Freq = 1100, Decay = 0.05, Tone = 0.6, Body = 0.5, Click = 0.35, Drive = 0.15, Warmth = 0.4, Bits = 8, CrushHz = 26000, Length = 0.25, PeakDb = -10 },
+ new() { Name = "Tom Mid", Model = DrumModel.Tom, Note = 43, Freq = 112, Decay = 0.48, PitchAmt = 0.3, PitchDecay = 0.045,Tone = 0.45, Body = 0.5, Noise = 0.3, NoiseDecay = 0.06, Drive = 0.22, Warmth = 0.55, Bits = 9, CrushHz = 30000, Room = 0.25, RoomSize = 0.5, Width = 0.6, Length = 1.1, PeakDb = -5 },
+ new() { Name = "Pedal Hat", Model = DrumModel.HatNoise, Note = 44, Choke = 1, Freq = 1100, Decay = 0.03, Tone = 0.55, Body = 0.45, Click = 0.3, Drive = 0.15, Warmth = 0.4, Bits = 8, CrushHz = 26000, Length = 0.2, PeakDb = -13 },
+ new() { Name = "Tom Hi", Model = DrumModel.Tom, Note = 45, Freq = 152, Decay = 0.42, PitchAmt = 0.3, PitchDecay = 0.04, Tone = 0.45, Body = 0.5, Noise = 0.3, NoiseDecay = 0.06, Drive = 0.22, Warmth = 0.55, Bits = 9, CrushHz = 30000, Room = 0.25, RoomSize = 0.5, Width = 0.6, Length = 1.0, PeakDb = -5 },
+ new() { Name = "Open Hat", Model = DrumModel.HatNoise, Note = 46, Choke = 1, Freq = 1100, Decay = 0.32, Tone = 0.62, Body = 0.5, Click = 0.3, Drive = 0.15, Warmth = 0.4, Bits = 8, CrushHz = 26000, Length = 0.85, PeakDb = -9 },
+ new() { Name = "Tambourine", Model = DrumModel.Shaker, Note = 47, Freq = 7000,Decay = 0.16, Tone = 0.65, Body = 0.85, Click = 0.8, Drive = 0.15, Warmth = 0.35, Bits = 8, CrushHz = 26000, Length = 0.45, PeakDb = -10 },
+ new() { Name = "Cabasa", Model = DrumModel.Shaker, Note = 48, Freq = 5600,Decay = 0.08, Tone = 0.5, Body = 0.9, Click = 0.5, Drive = 0.12, Warmth = 0.35, Bits = 8, CrushHz = 26000, Length = 0.3, PeakDb = -11 },
+ new() { Name = "Crash", Model = DrumModel.Cymbal, Note = 49, Freq = 310, Decay = 2.0, Tone = 0.5, Body = 0.55, Noise = 0.5, Drive = 0.12, Warmth = 0.35, Bits = 9, CrushHz = 30000, Length = 2.6, PeakDb = -7 },
+ new() { Name = "Cowbell", Model = DrumModel.Cowbell, Note = 50, Freq = 560, Decay = 0.26, Tone = 0.5, Body = 0.5, Click = 0.35, Drive = 0.25, Warmth = 0.45, Bits = 9, CrushHz = 30000, Length = 0.6, PeakDb = -9 },
+ new() { Name = "Ride", Model = DrumModel.Cymbal, Note = 51, Freq = 430, Decay = 1.0, Tone = 0.78, Body = 0.4, Noise = 0.25, Drive = 0.12, Warmth = 0.35, Bits = 9, CrushHz = 30000, Length = 1.5, PeakDb = -10 },
+ },
+ };
+
+ // ======================================================================
+ // 5. Atelier — an acoustic kit in a small treated room. Struck bodies with
+ // real mode spacing, a stick crack on the snare, and just enough room
+ // on every pad that they sound like they were recorded together.
+ // ======================================================================
+ private static KitDefinition Atelier() => new()
+ {
+ Id = "atelier",
+ Name = "Atelier",
+ Blurb = "acoustic studio kit · close-miked, small warm room",
+ Humanize = 0.14f,
+ Pads = new List<KitPad>
+ {
+ new() { Name = "Kick", Model = DrumModel.KickAcoustic, Note = 36, Freq = 54, Decay = 0.5, PitchAmt = 0.75, PitchDecay = 0.022, Tone = 0.45, Body = 0.65, Click = 0.5, Drive = 0.18, Warmth = 0.6, Room = 0.18, RoomSize = 0.35, RoomDecay = 0.12, RoomDamp = 0.65, Width = 0.5, Drift = 0.2, Length = 1.1, PeakDb = -1.5 },
+ new() { Name = "Side Stick", Model = DrumModel.Rim, Note = 37, Freq = 495, Decay = 0.05, Tone = 0.45, Body = 0.5, Drive = 0.15, Warmth = 0.55, HpHz = 240, Room = 0.2, RoomSize = 0.35, Width = 0.6, Drift = 0.3, Length = 0.35, PeakDb = -9 },
+ new() { Name = "Snare", Model = DrumModel.SnareAcoustic,Note = 38, Freq = 188, Decay = 0.4, Tone = 0.5, Body = 0.6, Noise = 0.8, NoiseDecay = 0.19, Click = 0.42, Drive = 0.2, Warmth = 0.55, Room = 0.26, RoomSize = 0.38, RoomDecay = 0.14, RoomDamp = 0.55, Width = 0.65, Drift = 0.25, Length = 1.1, PeakDb = -2.5 },
+ new() { Name = "Clap", Model = DrumModel.Clap, Note = 39, Freq = 1080,Decay = 0.2, Tone = 0.45, Body = 0.5, Drive = 0.15, Warmth = 0.5, Room = 0.25, RoomSize = 0.4, Width = 0.8, Drift = 0.5, Length = 0.8, PeakDb = -4.5 },
+ new() { Name = "Snare Rim", Model = DrumModel.SnareAcoustic,Note = 40, Freq = 236, Decay = 0.26, Tone = 0.62, Body = 0.5, Noise = 0.9, NoiseDecay = 0.12, Click = 0.6, Drive = 0.25, Warmth = 0.5, Room = 0.22, RoomSize = 0.38, Width = 0.65, Drift = 0.25, Length = 0.8, PeakDb = -4 },
+ new() { Name = "Floor Tom", Model = DrumModel.Tom, Note = 41, Freq = 72, Decay = 0.75, PitchAmt = 0.22, PitchDecay = 0.06, Tone = 0.4, Body = 0.6, Noise = 0.35, NoiseDecay = 0.07, Drive = 0.15, Warmth = 0.55, Room = 0.24, RoomSize = 0.42, Width = 0.7, Drift = 0.25, Length = 1.5, PeakDb = -5 },
+ new() { Name = "Closed Hat", Model = DrumModel.HatNoise, Note = 42, Choke = 1, Freq = 1250, Decay = 0.055, Tone = 0.6, Body = 0.55, Click = 0.4, Drive = 0.1, Warmth = 0.4, Room = 0.12, RoomSize = 0.3, Width = 0.5, Drift = 0.4, Length = 0.3, PeakDb = -10 },
+ new() { Name = "Low Tom", Model = DrumModel.Tom, Note = 43, Freq = 96, Decay = 0.65, PitchAmt = 0.22, PitchDecay = 0.055,Tone = 0.42, Body = 0.6, Noise = 0.35, NoiseDecay = 0.07, Drive = 0.15, Warmth = 0.55, Room = 0.24, RoomSize = 0.42, Width = 0.7, Drift = 0.25, Length = 1.4, PeakDb = -5 },
+ new() { Name = "Pedal Hat", Model = DrumModel.HatNoise, Note = 44, Choke = 1, Freq = 1150, Decay = 0.035, Tone = 0.5, Body = 0.5, Click = 0.35, Drive = 0.1, Warmth = 0.4, Room = 0.1, Width = 0.5, Drift = 0.4, Length = 0.25, PeakDb = -13 },
+ new() { Name = "Hi Tom", Model = DrumModel.Tom, Note = 45, Freq = 134, Decay = 0.55, PitchAmt = 0.22, PitchDecay = 0.05, Tone = 0.44, Body = 0.6, Noise = 0.35, NoiseDecay = 0.07, Drive = 0.15, Warmth = 0.55, Room = 0.24, RoomSize = 0.42, Width = 0.7, Drift = 0.25, Length = 1.25, PeakDb = -5 },
+ new() { Name = "Open Hat", Model = DrumModel.HatNoise, Note = 46, Choke = 1, Freq = 1250, Decay = 0.38, Tone = 0.65, Body = 0.55, Click = 0.35, Drive = 0.1, Warmth = 0.4, Room = 0.16, RoomSize = 0.35, Width = 0.6, Drift = 0.4, Length = 1.0, PeakDb = -9 },
+ new() { Name = "Tambourine", Model = DrumModel.Shaker, Note = 47, Freq = 7400,Decay = 0.18, Tone = 0.7, Body = 0.85, Click = 0.85, Drive = 0.1, Warmth = 0.35, Room = 0.16, Width = 0.8, Drift = 0.5, Length = 0.5, PeakDb = -10 },
+ new() { Name = "Sticks", Model = DrumModel.Block, Note = 48, Freq = 2700,Decay = 0.035,Tone = 0.4, Body = 0.35, Drive = 0.12, Warmth = 0.45, Room = 0.14, Width = 0.6, Drift = 0.5, Length = 0.25, PeakDb = -11 },
+ new() { Name = "Crash", Model = DrumModel.Cymbal, Note = 49, Freq = 288, Decay = 2.8, Tone = 0.45, Body = 0.6, Noise = 0.55, Drive = 0.08, Warmth = 0.35, Room = 0.18, RoomSize = 0.5, RoomDecay = 0.22, Width = 0.85, Drift = 0.4, Length = 3.6, PeakDb = -7 },
+ new() { Name = "Splash", Model = DrumModel.Cymbal, Note = 50, Freq = 520, Decay = 0.9, Tone = 0.6, Body = 0.45, Noise = 0.5, Drive = 0.08, Warmth = 0.35, Room = 0.16, Width = 0.8, Drift = 0.4, Length = 1.4, PeakDb = -9 },
+ new() { Name = "Ride", Model = DrumModel.Cymbal, Note = 51, Freq = 396, Decay = 1.5, Tone = 0.8, Body = 0.45, Noise = 0.3, Drive = 0.08, Warmth = 0.35, Room = 0.14, RoomSize = 0.45, Width = 0.7, Drift = 0.4, Length = 2.2, PeakDb = -10 },
+ },
+ };
+
+ // ======================================================================
+ // 6. Cellar — the dusty sampled break: an acoustic kit put through a low
+ // bit depth, a narrow band and tape-style saturation, with a noise bed
+ // under every hit. Aimed at slow, heavy, sample-based music.
+ // ======================================================================
+ private static KitDefinition Cellar() => new()
+ {
+ Id = "cellar",
+ Name = "Cellar",
+ Blurb = "dusty vinyl break · filtered, crushed, tape-saturated",
+ Swing = 0.16f,
+ Humanize = 0.12f,
+ Pads = new List<KitPad>
+ {
+ new() { Name = "Kick", Model = DrumModel.KickAcoustic, Note = 36, Freq = 52, Decay = 0.42, PitchAmt = 0.6, PitchDecay = 0.025, Tone = 0.35, Body = 0.6, Click = 0.35, Drive = 0.45, Warmth = 0.85, Lofi = 0.35, CrushHz = 22050, HpHz = 38, LpHz = 6200, Hiss = 0.45, Room = 0.12, RoomSize = 0.3, RoomDamp = 0.8, Width = 0.4, Drift = 0.5, Length = 0.9, PeakDb = -2 },
+ new() { Name = "Side Stick", Model = DrumModel.Rim, Note = 37, Freq = 460, Decay = 0.05, Tone = 0.4, Body = 0.45, Drive = 0.4, Warmth = 0.8, Lofi = 0.3, CrushHz = 22050, HpHz = 200, LpHz = 7000, Hiss = 0.4, Drift = 0.6, Length = 0.3, PeakDb = -9 },
+ new() { Name = "Snare", Model = DrumModel.SnareAcoustic,Note = 38, Freq = 180, Decay = 0.34, Tone = 0.38, Body = 0.65, Noise = 0.75, NoiseDecay = 0.16, Click = 0.35, Drive = 0.45, Warmth = 0.85, Lofi = 0.35, CrushHz = 22050, HpHz = 90, LpHz = 6800, Hiss = 0.5, Room = 0.2, RoomSize = 0.35, RoomDamp = 0.8, Width = 0.55, Drift = 0.5, Length = 0.9, PeakDb = -3 },
+ new() { Name = "Clap", Model = DrumModel.Clap, Note = 39, Freq = 950, Decay = 0.2, Tone = 0.35, Body = 0.5, Drive = 0.4, Warmth = 0.8, Lofi = 0.35, CrushHz = 22050, LpHz = 6500, Hiss = 0.45, Room = 0.18, Width = 0.6, Drift = 0.6, Length = 0.7, PeakDb = -5 },
+ new() { Name = "Snare Ghost",Model = DrumModel.SnareAcoustic,Note = 40, Freq = 215, Decay = 0.16, Tone = 0.45, Body = 0.45, Noise = 0.8, NoiseDecay = 0.07, Click = 0.3, Drive = 0.4, Warmth = 0.8, Lofi = 0.35, CrushHz = 22050, HpHz = 110, LpHz = 6500, Hiss = 0.45, Drift = 0.5, Length = 0.45, PeakDb = -8 },
+ new() { Name = "Tom Low", Model = DrumModel.Tom, Note = 41, Freq = 76, Decay = 0.6, PitchAmt = 0.25, PitchDecay = 0.055, Tone = 0.3, Body = 0.55, Noise = 0.3, NoiseDecay = 0.06, Drive = 0.4, Warmth = 0.85, Lofi = 0.3, CrushHz = 22050, LpHz = 5500, Hiss = 0.4, Room = 0.16, Width = 0.5, Drift = 0.5, Length = 1.2, PeakDb = -5 },
+ new() { Name = "Closed Hat", Model = DrumModel.HatNoise, Note = 42, Choke = 1, Freq = 1000, Decay = 0.045, Tone = 0.4, Body = 0.5, Click = 0.35, Drive = 0.35, Warmth = 0.7, Lofi = 0.35, CrushHz = 22050, LpHz = 8000, Hiss = 0.4, Drift = 0.6, Length = 0.25, PeakDb = -11 },
+ new() { Name = "Tom Mid", Model = DrumModel.Tom, Note = 43, Freq = 102, Decay = 0.52, PitchAmt = 0.25, PitchDecay = 0.05, Tone = 0.32, Body = 0.55, Noise = 0.3, NoiseDecay = 0.06, Drive = 0.4, Warmth = 0.85, Lofi = 0.3, CrushHz = 22050, LpHz = 5800, Hiss = 0.4, Room = 0.16, Width = 0.5, Drift = 0.5, Length = 1.1, PeakDb = -5 },
+ new() { Name = "Pedal Hat", Model = DrumModel.HatNoise, Note = 44, Choke = 1, Freq = 950, Decay = 0.028, Tone = 0.35, Body = 0.45, Click = 0.3, Drive = 0.35, Warmth = 0.7, Lofi = 0.35, CrushHz = 22050, LpHz = 7500, Hiss = 0.35, Drift = 0.6, Length = 0.2, PeakDb = -14 },
+ new() { Name = "Tom Hi", Model = DrumModel.Tom, Note = 45, Freq = 140, Decay = 0.45, PitchAmt = 0.25, PitchDecay = 0.045,Tone = 0.34, Body = 0.55, Noise = 0.3, NoiseDecay = 0.06, Drive = 0.4, Warmth = 0.85, Lofi = 0.3, CrushHz = 22050, LpHz = 6000, Hiss = 0.4, Room = 0.16, Width = 0.5, Drift = 0.5, Length = 1.0, PeakDb = -5 },
+ new() { Name = "Open Hat", Model = DrumModel.HatNoise, Note = 46, Choke = 1, Freq = 1000, Decay = 0.3, Tone = 0.45, Body = 0.5, Click = 0.3, Drive = 0.35, Warmth = 0.7, Lofi = 0.35, CrushHz = 22050, LpHz = 8000, Hiss = 0.45, Drift = 0.6, Length = 0.8, PeakDb = -10 },
+ new() { Name = "Shaker", Model = DrumModel.Shaker, Note = 47, Freq = 4600,Decay = 0.09, Tone = 0.4, Body = 0.8, Click = 0.5, Drive = 0.3, Warmth = 0.6, Lofi = 0.35, CrushHz = 22050, LpHz = 8500, Hiss = 0.4, Drift = 0.6, Length = 0.3, PeakDb = -12 },
+ new() { Name = "Rim Click", Model = DrumModel.Block, Note = 48, Freq = 1900,Decay = 0.04, Tone = 0.35, Body = 0.35, Drive = 0.35, Warmth = 0.7, Lofi = 0.35, CrushHz = 22050, LpHz = 7000, Hiss = 0.35, Drift = 0.6, Length = 0.25, PeakDb = -10 },
+ new() { Name = "Crash", Model = DrumModel.Cymbal, Note = 49, Freq = 270, Decay = 1.8, Tone = 0.4, Body = 0.55, Noise = 0.5, Drive = 0.3, Warmth = 0.7, Lofi = 0.3, CrushHz = 22050, LpHz = 7500, Hiss = 0.45, Drift = 0.5, Length = 2.4, PeakDb = -8 },
+ new() { Name = "Conga", Model = DrumModel.Conga, Note = 50, Freq = 260, Decay = 0.28, Tone = 0.35, Body = 0.4, Click = 0.3, Drive = 0.35, Warmth = 0.8, Lofi = 0.3, CrushHz = 22050, LpHz = 6000, Hiss = 0.4, Drift = 0.5, Length = 0.6, PeakDb = -7 },
+ new() { Name = "Ride", Model = DrumModel.Cymbal, Note = 51, Freq = 380, Decay = 0.95,Tone = 0.72, Body = 0.4, Noise = 0.3, Drive = 0.28, Warmth = 0.7, Lofi = 0.3, CrushHz = 22050, LpHz = 8000, Hiss = 0.4, Drift = 0.5, Length = 1.4, PeakDb = -10 },
+ },
+ };
+
+ // ======================================================================
+ // 7. Neon — modern sub-forward production: a tuned 808 bass on the kick
+ // slot's neighbour, a tight layered kick, and the fast, thin hats that
+ // rolls are built from.
+ // ======================================================================
+ private static KitDefinition Neon() => new()
+ {
+ Id = "neon",
+ Name = "Neon",
+ Blurb = "modern sub-forward kit · tuned 808 bass, tight snares, roll hats",
+ Pads = new List<KitPad>
+ {
+ new() { Name = "Kick", Model = DrumModel.KickPunch, Note = 36, Freq = 58, Decay = 0.26, PitchAmt = 4.2, PitchDecay = 0.009, Tone = 0.65, Body = 0.4, Click = 0.7, Drive = 0.4, Warmth = 0.45, HpHz = 30, Length = 0.6, PeakDb = -1.5 },
+ new() { Name = "808 Bass", Model = DrumModel.SubHit, Note = 37, Freq = 46, Decay = 1.9, PitchAmt = 0.45, PitchDecay = 0.022, Tone = 0.42, Drive = 0.4, Warmth = 0.55, Length = 3.0, PeakDb = -1.5 },
+ new() { Name = "Snare", Model = DrumModel.SnarePunch, Note = 38, Freq = 210, Decay = 0.2, Tone = 0.62, Body = 0.4, Noise = 0.95, NoiseDecay = 0.1, Drive = 0.3, Warmth = 0.4, HpHz = 140, Length = 0.5, PeakDb = -2.5 },
+ new() { Name = "Clap", Model = DrumModel.Clap, Note = 39, Freq = 1320,Decay = 0.18, Tone = 0.7, Body = 0.45, Drive = 0.3, Warmth = 0.4, HpHz = 300, Length = 0.55, PeakDb = -3.5 },
+ new() { Name = "Rim Snare", Model = DrumModel.Rim, Note = 40, Freq = 780, Decay = 0.035, Tone = 0.8, Body = 0.6, Drive = 0.4, Warmth = 0.35, HpHz = 420, Length = 0.2, PeakDb = -7 },
+ new() { Name = "808 Low", Model = DrumModel.SubHit, Note = 41, Freq = 36, Decay = 2.4, PitchAmt = 0.4, PitchDecay = 0.025, Tone = 0.34, Drive = 0.45, Warmth = 0.6, Length = 3.4, PeakDb = -2 },
+ new() { Name = "Closed Hat", Model = DrumModel.HatMetal, Note = 42, Choke = 1, Freq = 420, Decay = 0.03, Tone = 0.5, Body = 0.7, Noise = 0.4, Drive = 0.25, Warmth = 0.25, HpHz = 3000, Length = 0.2, PeakDb = -10 },
+ new() { Name = "Hat Roll", Model = DrumModel.HatMetal, Note = 43, Choke = 1, Freq = 480, Decay = 0.018, Tone = 0.55, Body = 0.7, Noise = 0.45, Drive = 0.25, Warmth = 0.25, HpHz = 4000, Length = 0.15, PeakDb = -12 },
+ new() { Name = "Pedal Hat", Model = DrumModel.HatMetal, Note = 44, Choke = 1, Freq = 420, Decay = 0.022, Tone = 0.45, Body = 0.65,Noise = 0.35, Drive = 0.22, Warmth = 0.25, HpHz = 3000, Length = 0.18, PeakDb = -13 },
+ new() { Name = "808 Hi", Model = DrumModel.SubHit, Note = 45, Freq = 62, Decay = 1.3, PitchAmt = 0.5, PitchDecay = 0.018, Tone = 0.5, Drive = 0.4, Warmth = 0.5, Length = 2.2, PeakDb = -2.5 },
+ new() { Name = "Open Hat", Model = DrumModel.HatMetal, Note = 46, Choke = 1, Freq = 420, Decay = 0.3, Tone = 0.55, Body = 0.7, Noise = 0.45, Drive = 0.25, Warmth = 0.25, HpHz = 3000, Length = 0.8, PeakDb = -10 },
+ new() { Name = "Perc Zap", Model = DrumModel.Zap, Note = 47, Freq = 180, Decay = 0.1, PitchAmt = 7, PitchDecay = 0.015, Tone = 0.45, Body = 0.6, Drive = 0.35, Warmth = 0.35, Length = 0.3, PeakDb = -7 },
+ new() { Name = "Bell", Model = DrumModel.PercMetal, Note = 48, Freq = 640, Decay = 0.55, Tone = 0.62, Body = 0.55, Drive = 0.2, Warmth = 0.35, HpHz = 300, Length = 1.0, PeakDb = -9 },
+ new() { Name = "Crash", Model = DrumModel.Cymbal, Note = 49, Freq = 350, Decay = 1.9, Tone = 0.6, Body = 0.5, Noise = 0.55, Drive = 0.15, Warmth = 0.25, Length = 2.4, PeakDb = -8 },
+ new() { Name = "Snare Alt", Model = DrumModel.SnarePunch, Note = 50, Freq = 260, Decay = 0.14, Tone = 0.75, Body = 0.3, Noise = 1.0, NoiseDecay = 0.06, Drive = 0.35, Warmth = 0.35, HpHz = 200, Length = 0.4, PeakDb = -5 },
+ new() { Name = "Ride", Model = DrumModel.Cymbal, Note = 51, Freq = 450, Decay = 0.85, Tone = 0.8, Body = 0.4, Noise = 0.25, Drive = 0.12, Warmth = 0.25, Length = 1.3, PeakDb = -11 },
+ },
+ };
+
+ // ======================================================================
+ // 8. Foundry — struck metal and hard-clipped low end. The percussion is
+ // all high-Q modes with inharmonic spacing, i.e. plate and pipe rather
+ // than drum; the kicks are driven until they distort.
+ // ======================================================================
+ private static KitDefinition Foundry() => new()
+ {
+ Id = "foundry",
+ Name = "Foundry",
+ Blurb = "industrial metal · struck plate, pipe and hard-clipped kicks",
+ Humanize = 0.06f,
+ Pads = new List<KitPad>
+ {
+ new() { Name = "Kick", Model = DrumModel.KickPunch, Note = 36, Freq = 50, Decay = 0.4, PitchAmt = 3.0, PitchDecay = 0.016, Tone = 0.6, Body = 0.6, Click = 0.6, Drive = 0.75, Warmth = 0.5, Length = 0.9, PeakDb = -1.5 },
+ new() { Name = "Anvil", Model = DrumModel.PercMetal, Note = 37, Freq = 520, Decay = 0.35, Tone = 0.72, Body = 0.75, Drive = 0.5, Warmth = 0.4, HpHz = 280, Length = 0.7, PeakDb = -7 },
+ new() { Name = "Snare", Model = DrumModel.SnarePunch, Note = 38, Freq = 200, Decay = 0.24, Tone = 0.6, Body = 0.55, Noise = 0.9, NoiseDecay = 0.12, Drive = 0.65, Warmth = 0.45, Length = 0.6, PeakDb = -2.5 },
+ new() { Name = "Clap Metal", Model = DrumModel.Clap, Note = 39, Freq = 1450,Decay = 0.22, Tone = 0.75, Body = 0.6, Drive = 0.55, Warmth = 0.4, Length = 0.7, PeakDb = -5 },
+ new() { Name = "Snare Trash",Model = DrumModel.SnarePunch, Note = 40, Freq = 275, Decay = 0.18, Tone = 0.78, Body = 0.4, Noise = 1.0, NoiseDecay = 0.09, Drive = 0.8, Warmth = 0.4, Length = 0.5, PeakDb = -4 },
+ new() { Name = "Pipe Low", Model = DrumModel.PercMetal, Note = 41, Freq = 148, Decay = 0.8, Tone = 0.45, Body = 0.8, Drive = 0.45, Warmth = 0.5, Length = 1.4, PeakDb = -6 },
+ new() { Name = "Closed Hat", Model = DrumModel.HatMetal, Note = 42, Choke = 1, Freq = 350, Decay = 0.04, Tone = 0.3, Body = 0.8, Noise = 0.2, Drive = 0.45, Warmth = 0.3, Length = 0.25, PeakDb = -10 },
+ new() { Name = "Pipe Mid", Model = DrumModel.PercMetal, Note = 43, Freq = 224, Decay = 0.65, Tone = 0.5, Body = 0.8, Drive = 0.45, Warmth = 0.5, Length = 1.2, PeakDb = -6 },
+ new() { Name = "Pedal Hat", Model = DrumModel.HatMetal, Note = 44, Choke = 1, Freq = 350, Decay = 0.025, Tone = 0.28, Body = 0.75,Noise = 0.18, Drive = 0.4, Warmth = 0.3, Length = 0.2, PeakDb = -13 },
+ new() { Name = "Pipe Hi", Model = DrumModel.PercMetal, Note = 45, Freq = 336, Decay = 0.5, Tone = 0.58, Body = 0.8, Drive = 0.45, Warmth = 0.5, Length = 1.0, PeakDb = -6 },
+ new() { Name = "Open Hat", Model = DrumModel.HatMetal, Note = 46, Choke = 1, Freq = 350, Decay = 0.42, Tone = 0.32, Body = 0.8, Noise = 0.25, Drive = 0.45, Warmth = 0.3, Length = 1.0, PeakDb = -9 },
+ new() { Name = "Scrap", Model = DrumModel.Block, Note = 47, Freq = 1650,Decay = 0.07, Tone = 0.85, Body = 0.8, Drive = 0.6, Warmth = 0.35, HpHz = 500, Length = 0.3, PeakDb = -9 },
+ new() { Name = "Plate", Model = DrumModel.Cymbal, Note = 48, Freq = 240, Decay = 1.4, Tone = 0.3, Body = 0.7, Noise = 0.2, Drive = 0.4, Warmth = 0.4, Length = 2.0, PeakDb = -8 },
+ new() { Name = "Crash", Model = DrumModel.Cymbal, Note = 49, Freq = 320, Decay = 2.4, Tone = 0.5, Body = 0.6, Noise = 0.45, Drive = 0.35, Warmth = 0.35, Length = 3.0, PeakDb = -7 },
+ new() { Name = "Impact", Model = DrumModel.Zap, Note = 50, Freq = 60, Decay = 0.5, PitchAmt = 5, PitchDecay = 0.06, Tone = 0.6, Body = 0.8, Drive = 0.7, Warmth = 0.5, Length = 1.0, PeakDb = -4 },
+ new() { Name = "Ride Bell", Model = DrumModel.PercMetal, Note = 51, Freq = 760, Decay = 0.7, Tone = 0.66, Body = 0.6, Drive = 0.3, Warmth = 0.35, HpHz = 350, Length = 1.2, PeakDb = -10 },
+ },
+ };
+
+ // ======================================================================
+ // 9. Terra — hands, wood and skin. Membrane modes for the drums, high-Q
+ // wood for the sticks, grainy noise for the shakers, and a wide, dry
+ // room so an ensemble spreads across the stereo field.
+ // ======================================================================
+ private static KitDefinition Terra() => new()
+ {
+ Id = "terra",
+ Name = "Terra",
+ Blurb = "hand percussion · congas, bongos, wood and shakers",
+ Swing = 0.1f,
+ Humanize = 0.2f,
+ Pads = new List<KitPad>
+ {
+ new() { Name = "Cajon Bass", Model = DrumModel.KickAcoustic, Note = 36, Freq = 68, Decay = 0.32, PitchAmt = 0.5, PitchDecay = 0.02, Tone = 0.4, Body = 0.7, Click = 0.45, Drive = 0.2, Warmth = 0.6, Room = 0.2, RoomSize = 0.35, Width = 0.5, Drift = 0.3, Length = 0.8, PeakDb = -2 },
+ new() { Name = "Clave", Model = DrumModel.Block, Note = 37, Freq = 2400, Decay = 0.05, Tone = 0.3, Body = 0.45, Drive = 0.15, Warmth = 0.5, Room = 0.16, Width = 0.6, Pan = -0.25f, Drift = 0.4, Length = 0.3, PeakDb = -8 },
+ new() { Name = "Cajon Slap", Model = DrumModel.SnareAcoustic,Note = 38, Freq = 230, Decay = 0.2, Tone = 0.55, Body = 0.5, Noise = 0.55, NoiseDecay = 0.09, Click = 0.6, Drive = 0.22, Warmth = 0.55, Room = 0.22, RoomSize = 0.35, Width = 0.6, Drift = 0.3, Length = 0.6, PeakDb = -3 },
+ new() { Name = "Clap", Model = DrumModel.Clap, Note = 39, Freq = 980, Decay = 0.18, Tone = 0.4, Body = 0.5, Drive = 0.15, Warmth = 0.5, Room = 0.26, RoomSize = 0.45, Width = 0.85, Drift = 0.6, Length = 0.7, PeakDb = -5 },
+ new() { Name = "Tabla", Model = DrumModel.Conga, Note = 40, Freq = 290, Decay = 0.4, Tone = 0.55, Body = 0.75, Click = 0.45, Drive = 0.18, Warmth = 0.5, Room = 0.18, Width = 0.6, Pan = 0.2f, Drift = 0.35, Length = 0.9, PeakDb = -4 },
+ new() { Name = "Conga Low", Model = DrumModel.Conga, Note = 41, Freq = 148, Decay = 0.44, Tone = 0.32, Body = 0.5, Click = 0.3, Drive = 0.2, Warmth = 0.6, Room = 0.2, RoomSize = 0.4, Width = 0.7, Pan = -0.3f, Drift = 0.3, Length = 1.0, PeakDb = -4 },
+ new() { Name = "Shaker", Model = DrumModel.Shaker, Note = 42, Freq = 5400, Decay = 0.085, Tone = 0.5, Body = 0.85, Click = 0.55, Drive = 0.1, Warmth = 0.4, Room = 0.12, Width = 0.7, Pan = 0.3f, Drift = 0.6, Length = 0.3, PeakDb = -10 },
+ new() { Name = "Conga Mid", Model = DrumModel.Conga, Note = 43, Freq = 208, Decay = 0.38, Tone = 0.38, Body = 0.5, Click = 0.32, Drive = 0.2, Warmth = 0.6, Room = 0.2, RoomSize = 0.4, Width = 0.7, Pan = -0.1f, Drift = 0.3, Length = 0.9, PeakDb = -4 },
+ new() { Name = "Cabasa", Model = DrumModel.Shaker, Note = 44, Freq = 6600, Decay = 0.055, Tone = 0.6, Body = 0.95, Click = 0.7, Drive = 0.1, Warmth = 0.35, Room = 0.1, Width = 0.7, Pan = 0.4f, Drift = 0.6, Length = 0.25, PeakDb = -11 },
+ new() { Name = "Bongo Low", Model = DrumModel.Conga, Note = 45, Freq = 330, Decay = 0.22, Tone = 0.5, Body = 0.45, Click = 0.5, Drive = 0.2, Warmth = 0.55, Room = 0.18, Width = 0.7, Pan = 0.15f, Drift = 0.35, Length = 0.55, PeakDb = -5 },
+ new() { Name = "Tambourine", Model = DrumModel.Shaker, Note = 46, Freq = 7600, Decay = 0.22, Tone = 0.72, Body = 0.9, Click = 0.85, Drive = 0.1, Warmth = 0.35, Room = 0.18, Width = 0.85, Drift = 0.6, Length = 0.6, PeakDb = -9 },
+ new() { Name = "Bongo Hi", Model = DrumModel.Conga, Note = 47, Freq = 452, Decay = 0.18, Tone = 0.56, Body = 0.45, Click = 0.55, Drive = 0.2, Warmth = 0.55, Room = 0.18, Width = 0.7, Pan = 0.35f, Drift = 0.35, Length = 0.5, PeakDb = -5 },
+ new() { Name = "Woodblock", Model = DrumModel.Block, Note = 48, Freq = 1750, Decay = 0.06, Tone = 0.45, Body = 0.5, Drive = 0.15, Warmth = 0.5, Room = 0.16, Width = 0.6, Pan = -0.35f, Drift = 0.4, Length = 0.3, PeakDb = -8 },
+ new() { Name = "Triangle", Model = DrumModel.PercMetal, Note = 49, Freq = 2100, Decay = 1.6, Tone = 0.8, Body = 0.55, Drive = 0.08, Warmth = 0.3, Room = 0.16, Width = 0.8, Pan = 0.45f, Drift = 0.5, Length = 2.2, PeakDb = -11 },
+ new() { Name = "Conga Hi", Model = DrumModel.Conga, Note = 50, Freq = 268, Decay = 0.32, Tone = 0.45, Body = 0.5, Click = 0.35, Drive = 0.2, Warmth = 0.6, Room = 0.2, RoomSize = 0.4, Width = 0.7, Pan = 0.1f, Drift = 0.3, Length = 0.8, PeakDb = -4 },
+ new() { Name = "Agogo", Model = DrumModel.Cowbell, Note = 51, Freq = 720, Decay = 0.3, Tone = 0.55, Body = 0.5, Click = 0.3, Drive = 0.2, Warmth = 0.45, Room = 0.16, Width = 0.6, Pan = -0.2f, Drift = 0.35, Length = 0.7, PeakDb = -9 },
+ },
+ };
+
+ // ======================================================================
+ // 10. Aether — percussion as texture. Long decays, heavy room on nearly
+ // every pad, softened transients: for beds and slow music where the
+ // hits are part of the harmony rather than the grid.
+ // ======================================================================
+ private static KitDefinition Aether() => new()
+ {
+ Id = "aether",
+ Name = "Aether",
+ Blurb = "ambient & cinematic · soft, spacious, long tails",
+ Humanize = 0.18f,
+ Pads = new List<KitPad>
+ {
+ new() { Name = "Deep Kick", Model = DrumModel.KickAnalog, Note = 36, Freq = 42, Decay = 1.3, PitchAmt = 1.0, PitchDecay = 0.06, Tone = 0.12, Body = 0.9, Click = 0.1, Drive = 0.15, Warmth = 0.7, LpHz = 3200, Room = 0.3, RoomSize = 0.7, RoomDecay = 0.6, RoomDamp = 0.7, Width = 0.8, Drift = 0.3, Length = 3.0, PeakDb = -2 },
+ new() { Name = "Wood Tap", Model = DrumModel.Block, Note = 37, Freq = 1450,Decay = 0.09, Tone = 0.4, Body = 0.4, Drive = 0.1, Warmth = 0.55, Room = 0.5, RoomSize = 0.65, RoomDecay = 0.6, Width = 0.9, Drift = 0.5, Length = 1.4, PeakDb = -9 },
+ new() { Name = "Soft Snare", Model = DrumModel.SnareAcoustic,Note = 38, Freq = 172, Decay = 0.42, Tone = 0.4, Body = 0.6, Noise = 0.6, NoiseDecay = 0.22, Click = 0.2, Drive = 0.12, Warmth = 0.6, LpHz = 9000, Room = 0.55, RoomSize = 0.75, RoomDecay = 0.65, RoomDamp = 0.5, Width = 0.9, Drift = 0.3, Length = 2.4, PeakDb = -3 },
+ new() { Name = "Air Clap", Model = DrumModel.Clap, Note = 39, Freq = 900, Decay = 0.3, Tone = 0.4, Body = 0.6, Drive = 0.1, Warmth = 0.55, LpHz = 8000, Room = 0.6, RoomSize = 0.8, RoomDecay = 0.7, Width = 1.0, Drift = 0.6, Length = 2.6, PeakDb = -5 },
+ new() { Name = "Rim Bloom", Model = DrumModel.Rim, Note = 40, Freq = 420, Decay = 0.09, Tone = 0.5, Body = 0.5, Drive = 0.1, Warmth = 0.5, Room = 0.62, RoomSize = 0.8, RoomDecay = 0.7, Width = 0.95, Drift = 0.5, Length = 2.4, PeakDb = -7 },
+ new() { Name = "Low Drum", Model = DrumModel.Tom, Note = 41, Freq = 66, Decay = 0.9, PitchAmt = 0.2, PitchDecay = 0.07, Tone = 0.3, Body = 0.7, Noise = 0.25, NoiseDecay = 0.09, Drive = 0.12, Warmth = 0.6, LpHz = 5000, Room = 0.42, RoomSize = 0.7, RoomDecay = 0.6, Width = 0.85, Drift = 0.3, Length = 2.6, PeakDb = -4 },
+ new() { Name = "Tick", Model = DrumModel.HatNoise, Note = 42, Choke = 1, Freq = 1600, Decay = 0.045, Tone = 0.6, Body = 0.5, Click = 0.3, Drive = 0.08, Warmth = 0.4, Room = 0.4, RoomSize = 0.6, Width = 0.9, Drift = 0.5, Length = 1.0, PeakDb = -11 },
+ new() { Name = "Mid Drum", Model = DrumModel.Tom, Note = 43, Freq = 98, Decay = 0.75, PitchAmt = 0.2, PitchDecay = 0.06, Tone = 0.32, Body = 0.7, Noise = 0.25, NoiseDecay = 0.09, Drive = 0.12, Warmth = 0.6, LpHz = 5500, Room = 0.42, RoomSize = 0.7, RoomDecay = 0.6, Width = 0.85, Drift = 0.3, Length = 2.4, PeakDb = -4 },
+ new() { Name = "Breath", Model = DrumModel.Shaker, Note = 44, Choke = 1, Freq = 3200, Decay = 0.2, Tone = 0.4, Body = 0.5, Click = 0.15, Drive = 0.08, Warmth = 0.45, LpHz = 9000, Room = 0.5, RoomSize = 0.7, Width = 1.0, Drift = 0.6, Length = 1.6, PeakDb = -12 },
+ new() { Name = "Hi Drum", Model = DrumModel.Tom, Note = 45, Freq = 142, Decay = 0.62, PitchAmt = 0.2, PitchDecay = 0.055,Tone = 0.34, Body = 0.7, Noise = 0.25, NoiseDecay = 0.09, Drive = 0.12, Warmth = 0.6, LpHz = 6000, Room = 0.42, RoomSize = 0.7, RoomDecay = 0.6, Width = 0.85, Drift = 0.3, Length = 2.2, PeakDb = -4 },
+ new() { Name = "Wash", Model = DrumModel.HatNoise, Note = 46, Choke = 1, Freq = 1400, Decay = 0.5, Tone = 0.6, Body = 0.5, Click = 0.15, Drive = 0.08, Warmth = 0.4, Room = 0.55, RoomSize = 0.75, RoomDecay = 0.7, Width = 1.0, Drift = 0.5, Length = 2.4, PeakDb = -10 },
+ new() { Name = "Glass", Model = DrumModel.PercMetal, Note = 47, Freq = 1180,Decay = 1.5, Tone = 0.72, Body = 0.6, Drive = 0.08, Warmth = 0.35, Room = 0.5, RoomSize = 0.75, RoomDecay = 0.7, Width = 0.95, Pan = 0.3f, Drift = 0.5, Length = 3.4, PeakDb = -9 },
+ new() { Name = "Bell", Model = DrumModel.PercMetal, Note = 48, Freq = 580, Decay = 2.0, Tone = 0.55, Body = 0.7, Drive = 0.1, Warmth = 0.4, Room = 0.45, RoomSize = 0.75, RoomDecay = 0.7, Width = 0.9, Pan = -0.3f, Drift = 0.5, Length = 4.0, PeakDb = -8 },
+ new() { Name = "Swell", Model = DrumModel.Cymbal, Note = 49, Freq = 260, Decay = 3.2, Tone = 0.4, Body = 0.6, Noise = 0.6, Drive = 0.08, Warmth = 0.4, LpHz = 12000, Room = 0.55, RoomSize = 0.85, RoomDecay = 0.8, Width = 1.0, Drift = 0.4, Length = 4.5, PeakDb = -8 },
+ new() { Name = "Sub Drop", Model = DrumModel.SubHit, Note = 50, Freq = 38, Decay = 2.2, PitchAmt = 0.6, PitchDecay = 0.1, Tone = 0.3, Drive = 0.25, Warmth = 0.6, Length = 3.4, PeakDb = -3 },
+ new() { Name = "Shimmer", Model = DrumModel.Cymbal, Note = 51, Freq = 520, Decay = 2.2, Tone = 0.78, Body = 0.45, Noise = 0.35, Drive = 0.06, Warmth = 0.3, Room = 0.5, RoomSize = 0.8, RoomDecay = 0.75, Width = 1.0, Drift = 0.4, Length = 3.4, PeakDb = -11 },
+ },
+ };
+}
diff --git a/src/managed/Nota.Infrastructure/Kits/KitDsp.cs b/src/managed/Nota.Infrastructure/Kits/KitDsp.cs
new file mode 100644
index 00000000..5605a2a9
--- /dev/null
+++ b/src/managed/Nota.Infrastructure/Kits/KitDsp.cs
@@ -0,0 +1,328 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// DSP primitives for the offline drum-kit renderer (see KitRenderer). Nothing here
+// runs on the audio thread — it renders one-shots into arrays, so the code trades
+// speed for quality: every voice is synthesized at 4x the target rate, saturated
+// there, and decimated through a zero-phase Butterworth, which is what keeps the
+// results free of the aliasing "fizz" that makes cheap synthetic drums sound plastic.
+// Pure, dependency-free and deterministic: the same seed always yields the same file.
+
+using System;
+
+namespace Nota.Infrastructure.Kits;
+
+/// <summary>Deterministic xorshift32 noise source — one per voice, seeded from the
+/// sample's identity so regenerating a kit reproduces it bit-for-bit.</summary>
+internal sealed class Rng
+{
+ private uint _s;
+ public Rng(uint seed) => _s = seed == 0 ? 0x9E3779B9u : seed;
+
+ public uint NextUInt() { _s ^= _s << 13; _s ^= _s >> 17; _s ^= _s << 5; return _s; }
+ /// <summary>Uniform white noise in [-1, 1).</summary>
+ public double Next() => (NextUInt() & 0xFFFFFF) / 8388608.0 - 1.0;
+ public double Next01() => (NextUInt() & 0xFFFFFF) / 16777216.0;
+ /// <summary>Gaussian-ish noise (sum of three uniforms) — a denser, less "crackly"
+ /// noise floor than a raw uniform draw, closer to the analog noise it stands in for.</summary>
+ public double NextGauss() => (Next() + Next() + Next()) * 0.5774;
+}
+
+/// <summary>Direct-form-I biquad with the usual RBJ cookbook designs. Offline, so it
+/// keeps double state and is re-used by the tone stage, the room and the decimator.</summary>
+internal sealed class Biquad
+{
+ private double _b0 = 1, _b1, _b2, _a1, _a2;
+ private double _x1, _x2, _y1, _y2;
+
+ public void Reset() { _x1 = _x2 = _y1 = _y2 = 0; }
+
+ public double Process(double x)
+ {
+ double y = _b0 * x + _b1 * _x1 + _b2 * _x2 - _a1 * _y1 - _a2 * _y2;
+ _x2 = _x1; _x1 = x; _y2 = _y1; _y1 = y;
+ return y;
+ }
+
+ private void Set(double b0, double b1, double b2, double a0, double a1, double a2)
+ {
+ _b0 = b0 / a0; _b1 = b1 / a0; _b2 = b2 / a0; _a1 = a1 / a0; _a2 = a2 / a0;
+ Reset();
+ }
+
+ public static Biquad LowPass(double freq, double q, double sr)
+ {
+ var f = new Biquad();
+ double w = 2 * Math.PI * Clamp(freq, sr) / sr, cs = Math.Cos(w), sn = Math.Sin(w), al = sn / (2 * q);
+ f.Set((1 - cs) / 2, 1 - cs, (1 - cs) / 2, 1 + al, -2 * cs, 1 - al);
+ return f;
+ }
+
+ public static Biquad HighPass(double freq, double q, double sr)
+ {
+ var f = new Biquad();
+ double w = 2 * Math.PI * Clamp(freq, sr) / sr, cs = Math.Cos(w), sn = Math.Sin(w), al = sn / (2 * q);
+ f.Set((1 + cs) / 2, -(1 + cs), (1 + cs) / 2, 1 + al, -2 * cs, 1 - al);
+ return f;
+ }
+
+ /// <summary>Constant-peak-gain band-pass (0 dB at centre).</summary>
+ public static Biquad BandPass(double freq, double q, double sr)
+ {
+ var f = new Biquad();
+ double w = 2 * Math.PI * Clamp(freq, sr) / sr, cs = Math.Cos(w), sn = Math.Sin(w), al = sn / (2 * q);
+ f.Set(al, 0, -al, 1 + al, -2 * cs, 1 - al);
+ return f;
+ }
+
+ public static Biquad Peaking(double freq, double q, double gainDb, double sr)
+ {
+ var f = new Biquad();
+ double a = Math.Pow(10, gainDb / 40);
+ double w = 2 * Math.PI * Clamp(freq, sr) / sr, cs = Math.Cos(w), sn = Math.Sin(w), al = sn / (2 * q);
+ f.Set(1 + al * a, -2 * cs, 1 - al * a, 1 + al / a, -2 * cs, 1 - al / a);
+ return f;
+ }
+
+ public static Biquad LowShelf(double freq, double gainDb, double sr, double slope = 0.9)
+ {
+ var f = new Biquad();
+ double a = Math.Pow(10, gainDb / 40);
+ double w = 2 * Math.PI * Clamp(freq, sr) / sr, cs = Math.Cos(w), sn = Math.Sin(w);
+ double al = sn / 2 * Math.Sqrt((a + 1 / a) * (1 / slope - 1) + 2);
+ double t = 2 * Math.Sqrt(a) * al;
+ f.Set(a * ((a + 1) - (a - 1) * cs + t), 2 * a * ((a - 1) - (a + 1) * cs), a * ((a + 1) - (a - 1) * cs - t),
+ (a + 1) + (a - 1) * cs + t, -2 * ((a - 1) + (a + 1) * cs), (a + 1) + (a - 1) * cs - t);
+ return f;
+ }
+
+ public static Biquad HighShelf(double freq, double gainDb, double sr, double slope = 0.9)
+ {
+ var f = new Biquad();
+ double a = Math.Pow(10, gainDb / 40);
+ double w = 2 * Math.PI * Clamp(freq, sr) / sr, cs = Math.Cos(w), sn = Math.Sin(w);
+ double al = sn / 2 * Math.Sqrt((a + 1 / a) * (1 / slope - 1) + 2);
+ double t = 2 * Math.Sqrt(a) * al;
+ f.Set(a * ((a + 1) + (a - 1) * cs + t), -2 * a * ((a - 1) + (a + 1) * cs), a * ((a + 1) + (a - 1) * cs - t),
+ (a + 1) - (a - 1) * cs + t, 2 * ((a - 1) - (a + 1) * cs), (a + 1) - (a - 1) * cs - t);
+ return f;
+ }
+
+ // Keep the design frequency inside the stable range of the bilinear transform.
+ private static double Clamp(double f, double sr) => Math.Clamp(f, 5.0, sr * 0.49);
+}
+
+/// <summary>A decaying modal resonator: a two-pole filter whose impulse response is an
+/// exponentially decaying sinusoid. Excite it with a click and it rings — the model
+/// behind the analog kick's bridged-T, the snare's shell tones and every metal voice.</summary>
+internal sealed class Modal
+{
+ private readonly double _a1, _a2, _gain;
+ private double _y1, _y2;
+
+ /// <param name="decay">Time to -60 dB, in seconds.</param>
+ public Modal(double freq, double decay, double sr)
+ {
+ double r = Math.Exp(-6.907755 / Math.Max(1e-4, decay) / sr);
+ double w = 2 * Math.PI * Math.Clamp(freq, 1.0, sr * 0.48) / sr;
+ _a1 = 2 * r * Math.Cos(w);
+ _a2 = -r * r;
+ // Normalize for an impulse: the two-pole response peaks at 1/sin(w), so sin(w)
+ // brings every mode to unity whatever its frequency or ring time. (Scaling by
+ // (1-r) as well would be the steady-state normalization, and would bury the
+ // low, long-ringing modes — the body of the drum — under everything else.)
+ _gain = Math.Sin(w);
+ }
+
+ public double Process(double x)
+ {
+ double y = _gain * x + _a1 * _y1 + _a2 * _y2;
+ _y2 = _y1; _y1 = y;
+ return y;
+ }
+}
+
+/// <summary>Subsonic cleanup. Asymmetric saturation rectifies part of the signal into a
+/// slow, envelope-shaped offset, which lands below 20 Hz: inaudible, but it eats headroom
+/// and makes the normalizer under-level the hit. A second-order 18 Hz high-pass removes
+/// it and still leaves the deepest sub voices (36 Hz) untouched.</summary>
+internal sealed class DcBlock
+{
+ private readonly Biquad _hp;
+ public DcBlock(double sr) => _hp = Biquad.HighPass(18, 0.7071, sr);
+ public double Process(double x) => _hp.Process(x);
+}
+
+internal static class KitDsp
+{
+ /// <summary>Per-sample coefficient of an exponential decay reaching -60 dB in
+ /// <paramref name="seconds"/>.</summary>
+ public static double DecayCoef(double seconds, double sr)
+ => Math.Exp(-6.907755 / (Math.Max(1e-4, seconds) * sr));
+
+ public static double Db(double db) => Math.Pow(10, db / 20);
+
+ /// <summary>Asymmetric soft saturation. The cubic term adds the even harmonics a
+ /// symmetric tanh cannot produce — that second harmonic is most of what "warm" means
+ /// here; <paramref name="drive"/> 0 leaves the signal untouched.</summary>
+ public static double Saturate(double x, double drive, double asym)
+ {
+ if (drive <= 1e-6) return x;
+ double g = 1 + drive * 6;
+ double v = x * g;
+ v += asym * drive * v * v * 0.35; // even-order bias
+ double y = Math.Tanh(v);
+ return y / (1 + drive * 2.2); // keep the level roughly constant
+ }
+
+ /// <summary>Bit + sample-rate reduction, for the lo-fi kits. <paramref name="bits"/>
+ /// under 24 quantizes; <paramref name="hold"/> is the sample-and-hold period in frames.</summary>
+ public static void Crush(double[] buf, double bits, int hold)
+ {
+ if (bits < 24)
+ {
+ double steps = Math.Pow(2, Math.Max(2, bits) - 1);
+ for (int i = 0; i < buf.Length; i++) buf[i] = Math.Round(buf[i] * steps) / steps;
+ }
+ if (hold > 1)
+ {
+ double held = 0;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ if (i % hold == 0) held = buf[i];
+ buf[i] = held;
+ }
+ }
+ }
+
+ /// <summary>Zero-phase filtering (forward then reverse). Used for the decimation
+ /// low-pass so the transient keeps its shape instead of being smeared by phase.</summary>
+ public static void FiltFilt(double[] buf, Func<Biquad> make)
+ {
+ var f = make();
+ for (int i = 0; i < buf.Length; i++) buf[i] = f.Process(buf[i]);
+ var b = make();
+ for (int i = buf.Length - 1; i >= 0; i--) buf[i] = b.Process(buf[i]);
+ }
+
+ /// <summary>Decimates an oversampled buffer by <paramref name="factor"/> after a
+ /// zero-phase 4th-order low-pass just under the target Nyquist.</summary>
+ public static double[] Decimate(double[] src, int factor, double targetSr)
+ {
+ double osSr = targetSr * factor;
+ double cut = targetSr * 0.455;
+ KitDsp.FiltFilt(src, () => Biquad.LowPass(cut, 0.7071, osSr));
+ KitDsp.FiltFilt(src, () => Biquad.LowPass(cut, 0.7071, osSr));
+ var dst = new double[src.Length / factor];
+ for (int i = 0; i < dst.Length; i++) dst[i] = src[i * factor];
+ return dst;
+ }
+
+ /// <summary>Peak level of a buffer.</summary>
+ public static double Peak(double[] buf)
+ {
+ double p = 0;
+ foreach (double v in buf) { double a = Math.Abs(v); if (a > p) p = a; }
+ return p;
+ }
+
+ public static void Scale(double[] buf, double g)
+ {
+ for (int i = 0; i < buf.Length; i++) buf[i] *= g;
+ }
+
+ /// <summary>Trims the decayed tail (everything after the last frame above
+ /// <paramref name="floorDb"/>) and fades the new end over ~6 ms so the file ends
+ /// silently instead of on a click. Returns the kept length in frames.</summary>
+ public static int TrimTail(double[][] chans, double floorDb, double sr)
+ {
+ int n = chans[0].Length;
+ double floor = Db(floorDb);
+ int last = 0;
+ for (int i = 0; i < n; i++)
+ foreach (var c in chans)
+ if (Math.Abs(c[i]) > floor) { last = i; break; }
+ // 8 ms of air after the last audible frame, then the fade.
+ int keep = Math.Min(n, last + (int)(sr * 0.008) + 2);
+ int fade = Math.Min(keep, (int)(sr * 0.006));
+ foreach (var c in chans)
+ for (int i = 0; i < fade; i++)
+ {
+ int idx = keep - fade + i;
+ double t = 1.0 - (double)i / fade;
+ c[idx] *= t * t;
+ }
+ return Math.Max(1, keep);
+ }
+}
+
+/// <summary>A small stereo room: four parallel combs into two allpasses per side, with
+/// slightly different delays left and right. Not a showcase reverb — just the early
+/// energy that stops an acoustic-style hit from sounding like it was recorded in a
+/// vacuum, and the width source for the ambient kits.</summary>
+internal sealed class Room
+{
+ private readonly double[][] _comb = new double[8][];
+ private readonly int[] _combPos = new int[8];
+ private readonly double[] _combFb = new double[8];
+ private readonly double[] _combLp = new double[8];
+ private readonly double[][] _ap = new double[4][];
+ private readonly int[] _apPos = new int[4];
+ private readonly double _damp;
+
+ /// <param name="size">0..1 — small booth to large room.</param>
+ /// <param name="decay">0..1 — tail length, mapped to an RT60 of 0.15 s .. 2.5 s.</param>
+ /// <param name="damp">0..1 — high-frequency absorption in the tail.</param>
+ public Room(double size, double decay, double damp, double sr)
+ {
+ _damp = Math.Clamp(damp, 0, 0.95);
+ // Mutually prime-ish comb delays; the right channel is stretched ~1.6 % for width.
+ double[] baseMs = { 29.7, 37.1, 41.1, 43.7 };
+ double scale = 0.45 + size * 1.25;
+ // Each comb's feedback is derived from its own delay so they all reach -60 dB at
+ // the same time: a single shared feedback value would make the long combs ring far
+ // longer than the short ones, and "decay" would barely change the tail at all.
+ double rt60 = 0.15 + Math.Clamp(decay, 0, 1) * 2.35;
+ for (int i = 0; i < 8; i++)
+ {
+ double ms = baseMs[i % 4] * scale * (i < 4 ? 1.0 : 1.016);
+ _comb[i] = new double[Math.Max(4, (int)(ms * 0.001 * sr))];
+ _combFb[i] = Math.Clamp(Math.Pow(10, -3.0 * (ms * 0.001) / rt60), 0.0, 0.93);
+ }
+ double[] apMs = { 5.0, 1.7 };
+ for (int i = 0; i < 4; i++)
+ {
+ double ms = apMs[i % 2] * (i < 2 ? 1.0 : 1.11);
+ _ap[i] = new double[Math.Max(4, (int)(ms * 0.001 * sr))];
+ }
+ }
+
+ public void Process(double x, out double l, out double r)
+ {
+ l = Tank(x, 0); r = Tank(x, 4);
+ }
+
+ private double Tank(double x, int off)
+ {
+ double sum = 0;
+ for (int i = off; i < off + 4; i++)
+ {
+ double y = _comb[i][_combPos[i]];
+ _combLp[i] = y * (1 - _damp) + _combLp[i] * _damp;
+ _comb[i][_combPos[i]] = x + _combLp[i] * _combFb[i];
+ if (++_combPos[i] >= _comb[i].Length) _combPos[i] = 0;
+ sum += y;
+ }
+ sum *= 0.25;
+ int a0 = off == 0 ? 0 : 2;
+ for (int i = a0; i < a0 + 2; i++)
+ {
+ double d = _ap[i][_apPos[i]];
+ double y = -sum + d;
+ _ap[i][_apPos[i]] = sum + d * 0.5;
+ if (++_apPos[i] >= _ap[i].Length) _apPos[i] = 0;
+ sum = y;
+ }
+ return sum;
+ }
+}
diff --git a/src/managed/Nota.Infrastructure/Kits/KitLibrary.cs b/src/managed/Nota.Infrastructure/Kits/KitLibrary.cs
new file mode 100644
index 00000000..bda10abb
--- /dev/null
+++ b/src/managed/Nota.Infrastructure/Kits/KitLibrary.cs
@@ -0,0 +1,144 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Materializes the factory kits on disk. Nothing ships as audio: the first time Nota
+// runs (and after any change to a recipe or to the renderer) the kit's WAVs are
+// synthesized into the per-user data folder, once, in the background.
+//
+// Each kit folder carries a stamp file holding the renderer version plus a hash of the
+// kit's recipes, so a kit is re-rendered exactly when its sound would change and is
+// skipped otherwise. Rendering is idempotent and safe to call from anywhere.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Nota.Infrastructure.Kits;
+
+public static class KitLibrary
+{
+ /// <summary>Bump when the synthesis or the post chain changes in a way that should
+ /// re-render every shipped kit. Recipe edits are caught by the per-kit hash.</summary>
+ private const int RendererVersion = 1;
+
+ private const string StampFile = ".kit-stamp";
+
+ private static readonly object Gate = new();
+
+ /// <summary>Where the rendered kits live: a managed folder under the Nota data dir,
+ /// deliberately not the user's own samples folder — these are regenerable, and they
+ /// should not appear in (or disappear with) a folder the user curates.</summary>
+ public static string Root => NotaPaths.SubDir("kits");
+
+ public static string DirOf(KitDefinition kit) => Path.Combine(Root, kit.Id);
+
+ /// <summary>File name of a pad's one-shot. The index prefix keeps a kit folder in
+ /// pad order in any file browser.</summary>
+ public static string FileNameOf(KitDefinition kit, KitPad pad)
+ {
+ int i = IndexOf(kit, pad);
+ return i < 0 ? $"{Sanitize(pad.Name)}.wav" : $"{i + 1:00} {Sanitize(pad.Name)}.wav";
+ }
+
+ // Pads are compared by identity first (the catalog is built once, so instances are
+ // stable) and by trigger note as a fallback, so a copy of a pad still resolves.
+ private static int IndexOf(KitDefinition kit, KitPad pad)
+ {
+ for (int i = 0; i < kit.Pads.Count; i++) if (ReferenceEquals(kit.Pads[i], pad)) return i;
+ for (int i = 0; i < kit.Pads.Count; i++) if (kit.Pads[i].Note == pad.Note) return i;
+ return -1;
+ }
+
+ public static string PathOf(KitDefinition kit, KitPad pad)
+ => Path.Combine(DirOf(kit), FileNameOf(kit, pad));
+
+ /// <summary>True when every pad of the kit is on disk and current.</summary>
+ public static bool IsRendered(KitDefinition kit)
+ {
+ var dir = DirOf(kit);
+ if (!Directory.Exists(dir)) return false;
+ try
+ {
+ var stamp = Path.Combine(dir, StampFile);
+ if (!File.Exists(stamp) || File.ReadAllText(stamp).Trim() != StampFor(kit)) return false;
+ }
+ catch { return false; }
+ foreach (var pad in kit.Pads) if (!File.Exists(PathOf(kit, pad))) return false;
+ return true;
+ }
+
+ /// <summary>Renders the kit if it is missing or stale. Returns the number of files
+ /// written (0 when it was already current).</summary>
+ public static int Ensure(KitDefinition kit, CancellationToken ct = default)
+ {
+ // One renderer at a time: two windows (or the MCP server and the app) starting
+ // together must not race on the same folder.
+ lock (Gate)
+ {
+ if (IsRendered(kit)) return 0;
+ var dir = DirOf(kit);
+ Directory.CreateDirectory(dir);
+
+ int written = 0;
+ Parallel.For(0, kit.Pads.Count, new ParallelOptions { CancellationToken = ct }, i =>
+ {
+ var pad = kit.Pads[i];
+ KitRenderer.RenderToFile(pad, SeedFor(kit, pad), PathOf(kit, pad));
+ Interlocked.Increment(ref written);
+ });
+
+ // Drop stale files from an older revision of the kit (renamed or removed pads).
+ var keep = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { StampFile };
+ foreach (var pad in kit.Pads) keep.Add(FileNameOf(kit, pad));
+ foreach (var f in Directory.EnumerateFiles(dir))
+ if (!keep.Contains(Path.GetFileName(f)))
+ try { File.Delete(f); } catch { /* best-effort */ }
+
+ File.WriteAllText(Path.Combine(dir, StampFile), StampFor(kit));
+ return written;
+ }
+ }
+
+ /// <summary>Renders every shipped kit that is missing or stale.</summary>
+ public static int EnsureAll(CancellationToken ct = default)
+ {
+ int n = 0;
+ foreach (var kit in KitCatalog.All)
+ {
+ ct.ThrowIfCancellationRequested();
+ n += Ensure(kit, ct);
+ }
+ return n;
+ }
+
+ /// <summary>Per-pad render seed — stable across runs and distinct per pad, so the
+ /// "analog drift" of a kit is fixed character rather than render-to-render noise.</summary>
+ private static uint SeedFor(KitDefinition kit, KitPad pad) => Fnv($"{kit.Id}/{pad.Name}/{pad.Note}");
+
+ // The stamp covers the renderer version and every recipe field: KitPad is a record,
+ // so its ToString() names them all and a new parameter can't silently skip a rebuild.
+ private static string StampFor(KitDefinition kit)
+ {
+ var sb = new StringBuilder();
+ sb.Append(kit.Id).Append('|').Append(kit.Swing).Append('|').Append(kit.Humanize);
+ foreach (var pad in kit.Pads) sb.Append('|').Append(pad);
+ return $"v{RendererVersion}-{Fnv(sb.ToString()):x8}";
+ }
+
+ private static uint Fnv(string s)
+ {
+ uint h = 2166136261;
+ foreach (char c in s) { h ^= c; h *= 16777619; }
+ return h;
+ }
+
+ private static string Sanitize(string name)
+ {
+ var sb = new StringBuilder(name.Length);
+ foreach (char c in name) sb.Append(Path.GetInvalidFileNameChars().AsSpan().Contains(c) ? '-' : c);
+ return sb.ToString();
+ }
+}
diff --git a/src/managed/Nota.Infrastructure/Kits/KitPad.cs b/src/managed/Nota.Infrastructure/Kits/KitPad.cs
new file mode 100644
index 00000000..8a94f403
--- /dev/null
+++ b/src/managed/Nota.Infrastructure/Kits/KitPad.cs
@@ -0,0 +1,168 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// The recipe for one drum one-shot, and its placement on a Drum Rack pad. A kit is
+// just a list of these: the whole factory library is code, not audio files, so the
+// installer carries recipes (a few kilobytes) instead of a sample library, and the
+// WAVs are rendered on the user's machine (see KitLibrary).
+//
+// Parameters are deliberately shared across models rather than one struct per voice —
+// "Freq / Decay / Tone / Body / Noise / Click / Drive" mean the analogous thing
+// everywhere, so a recipe reads the same whether it drives a kick or a cowbell. The
+// per-model meaning of Tone and Body is documented on DrumModel.
+
+namespace Nota.Infrastructure.Kits;
+
+/// <summary>The synthesis model behind a one-shot. Each is a compact physical or
+/// analog-circuit sketch rather than a general synth voice.</summary>
+public enum DrumModel
+{
+ /// <summary>Bridged-T style analog kick: a long sine ring with a pitch drop and a
+ /// trigger click. Tone = knock (upper body) amount. Body = sub sustain.</summary>
+ KickAnalog,
+ /// <summary>Punchy dance kick: deep, fast pitch envelope over a shorter ring, with a
+ /// pronounced attack pulse. Tone = attack brightness.</summary>
+ KickPunch,
+ /// <summary>Acoustic bass drum: shell resonances excited by a beater, over a short
+ /// sub. Tone = beater brightness. Body = shell ring.</summary>
+ KickAcoustic,
+ /// <summary>A long, deep, tuned sine hit — the sub-bass "808" that gets played as a
+ /// pitched note rather than a drum. Tone = harmonic drive.</summary>
+ SubHit,
+ /// <summary>Analog snare: two shell tones plus high-passed noise. Tone = tone↔noise
+ /// balance. Body = tone-oscillator ring.</summary>
+ SnareAnalog,
+ /// <summary>Noisier dance snare: band-passed noise over two short tones and a crack.
+ /// Tone = noise brightness.</summary>
+ SnarePunch,
+ /// <summary>Acoustic snare: shell modes, snare-wire noise and a stick crack. Tone =
+ /// wire brightness. Body = shell ring.</summary>
+ SnareAcoustic,
+ /// <summary>Hand clap: a burst train into a resonant band, then a reverberant tail.
+ /// Tone = band brightness. Body = tail level.</summary>
+ Clap,
+ /// <summary>Rimshot / side stick: a very short cluster of high-Q modes.</summary>
+ Rim,
+ /// <summary>Metallic hat: six detuned square oscillators through a bright band.
+ /// Tone = noise blended into the metal. Body = band resonance.</summary>
+ HatMetal,
+ /// <summary>Noise hat: filtered noise with a pair of resonances — the softer,
+ /// airier hat used by acoustic and lo-fi kits.</summary>
+ HatNoise,
+ /// <summary>Cymbal (crash / ride): a dense partial cluster plus noise, decaying in
+ /// three bands so the highs wash out before the body does. Tone = ping vs. wash.</summary>
+ Cymbal,
+ /// <summary>Tom: pitched membrane with a pitch drop, skin noise and optional shell
+ /// modes. Body = shell ring.</summary>
+ Tom,
+ /// <summary>Hand drum (conga / bongo / tabla-ish): membrane modes struck with a
+ /// filtered slap. Tone = slap brightness.</summary>
+ Conga,
+ /// <summary>Shaker / maraca: granular band-passed noise with a swell. Tone = band
+ /// centre. Body = grain density.</summary>
+ Shaker,
+ /// <summary>Cowbell: two square oscillators through a narrow band.</summary>
+ Cowbell,
+ /// <summary>Woodblock / clave: a couple of very short, very high-Q modes.</summary>
+ Block,
+ /// <summary>Zap / laser: a fast downward pitch sweep with optional FM.</summary>
+ Zap,
+ /// <summary>Metallic percussion: ring-modulated partials with a modal ring — bells,
+ /// clanks, triangle-ish hits. Tone = modulator ratio.</summary>
+ PercMetal,
+}
+
+/// <summary>One pad of a factory kit: the recipe for the one-shot plus where it sits on
+/// the Drum Rack. Defaults are the neutral case, so a recipe only names what it bends.</summary>
+public sealed record KitPad
+{
+ // --- identity / placement ---------------------------------------------
+ public required string Name { get; init; }
+ public required DrumModel Model { get; init; }
+ /// <summary>MIDI note the pad triggers (36 = C1, the first pad of bank 1).</summary>
+ public required int Note { get; init; }
+ /// <summary>Drum Rack choke group (0 = none). Hats share one so closed cuts open.</summary>
+ public int Choke { get; init; }
+ /// <summary>Pad pan in the rack, -1..+1 — the file itself stays centred.</summary>
+ public float Pan { get; init; }
+ /// <summary>Pad gain in the rack (1 = unity), for kit balance beyond the rendered level.</summary>
+ public float Gain { get; init; } = 1f;
+
+ // --- core synthesis ----------------------------------------------------
+ /// <summary>Base frequency in Hz — the pitch of the fundamental mode or oscillator.</summary>
+ public double Freq { get; init; } = 60;
+ /// <summary>Amplitude decay to -60 dB, in seconds.</summary>
+ public double Decay { get; init; } = 0.4;
+ /// <summary>Extra pitch at the attack, as a multiple of <see cref="Freq"/>
+ /// (2 = starts an octave and a half up).</summary>
+ public double PitchAmt { get; init; }
+ /// <summary>Time constant of the pitch drop, in seconds.</summary>
+ public double PitchDecay { get; init; } = 0.03;
+ /// <summary>Noise layer level, 0..1 (snare wires, skin, breath).</summary>
+ public double Noise { get; init; }
+ /// <summary>Decay of the noise layer, in seconds.</summary>
+ public double NoiseDecay { get; init; } = 0.12;
+ /// <summary>Model-specific timbre control, 0..1 — see <see cref="DrumModel"/>.</summary>
+ public double Tone { get; init; } = 0.5;
+ /// <summary>Model-specific body / resonance amount, 0..1.</summary>
+ public double Body { get; init; } = 0.5;
+ /// <summary>Transient / attack level, 0..1.</summary>
+ public double Click { get; init; }
+
+ // --- colour ------------------------------------------------------------
+ /// <summary>Saturation, 0..1 — asymmetric, so it thickens as well as compresses.</summary>
+ public double Drive { get; init; }
+ /// <summary>Analog glue, 0..1: a low-mid lift plus an upper-treble roll-off. The
+ /// difference between a synthetic hit and one that sounds like it went through
+ /// circuitry. Applied to every sample; 0 disables it.</summary>
+ public double Warmth { get; init; } = 0.35;
+ /// <summary>Post high-pass in Hz (0 = off) — clears sub rumble off small voices.</summary>
+ public double HpHz { get; init; }
+ /// <summary>Post low-pass in Hz (0 = off).</summary>
+ public double LpHz { get; init; }
+ /// <summary>Random pitch/level variation, 0..1 — the drift of an analog circuit.
+ /// Deterministic per sample (seeded), so it varies between pads, not between renders.</summary>
+ public double Drift { get; init; }
+ /// <summary>Noise-floor bed, 0..1, shaped by the hit's own envelope.</summary>
+ public double Hiss { get; init; }
+
+ // --- space -------------------------------------------------------------
+ /// <summary>Room send, 0..1. Above 0 the sample is rendered in stereo.</summary>
+ public double Room { get; init; }
+ public double RoomSize { get; init; } = 0.4;
+ public double RoomDecay { get; init; } = 0.15;
+ public double RoomDamp { get; init; } = 0.55;
+ /// <summary>Stereo width of the room, 0..1 (0 = mono-summed room).</summary>
+ public double Width { get; init; } = 0.7;
+ /// <summary>Gated reverb: cut the room tail dead this many seconds after the hit
+ /// (0 = let it decay). The 80s gated-snare sound.</summary>
+ public double RoomGate { get; init; }
+
+ // --- lo-fi -------------------------------------------------------------
+ /// <summary>Lo-fi amount, 0..1 — scales the bit/rate crush and its band-limiting.</summary>
+ public double Lofi { get; init; }
+ /// <summary>Bit depth for the crusher (24 = clean).</summary>
+ public double Bits { get; init; } = 24;
+ /// <summary>Sample-and-hold rate of the crusher, in Hz (0 = off).</summary>
+ public double CrushHz { get; init; }
+
+ // --- output ------------------------------------------------------------
+ /// <summary>Rendered length before tail trimming, in seconds.</summary>
+ public double Length { get; init; } = 1.2;
+ /// <summary>Normalization target in dBFS. Voices are levelled against each other
+ /// here, so a kit sounds balanced before the user touches a pad fader.</summary>
+ public double PeakDb { get; init; } = -3;
+}
+
+/// <summary>A factory kit — a named set of pads plus the kit-level Drum Rack settings.</summary>
+public sealed record KitDefinition
+{
+ public required string Id { get; init; } // stable, path- and preset-safe
+ public required string Name { get; init; }
+ public required string Blurb { get; init; } // one line for the browser row
+ public required IReadOnlyList<KitPad> Pads { get; init; }
+ /// <summary>Drum Rack swing, 0..1.</summary>
+ public float Swing { get; init; }
+ /// <summary>Drum Rack humanize, 0..1.</summary>
+ public float Humanize { get; init; }
+}
diff --git a/src/managed/Nota.Infrastructure/Kits/KitRenderer.cs b/src/managed/Nota.Infrastructure/Kits/KitRenderer.cs
new file mode 100644
index 00000000..5e7bef25
--- /dev/null
+++ b/src/managed/Nota.Infrastructure/Kits/KitRenderer.cs
@@ -0,0 +1,166 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Renders one KitPad recipe into a finished one-shot and writes it as a WAV.
+//
+// The signal path: synthesize the dry voice at 4x the target rate (KitVoices) → lo-fi →
+// the "analog glue" tone stage → shaping filters → noise floor → decimate through a
+// zero-phase low-pass → room → DC block, tail trim, normalize. Oversampling only the
+// stages that actually generate harmonics (oscillators and saturation) keeps this cheap
+// while removing the aliasing that gives synthetic percussion its glassy edge.
+
+using System;
+using System.IO;
+
+namespace Nota.Infrastructure.Kits;
+
+/// <summary>A rendered one-shot: interleaved float frames ready for the WAV writer.</summary>
+public sealed record RenderedSample(float[] Interleaved, int Channels, int Frames, int SampleRate);
+
+public static class KitRenderer
+{
+ /// <summary>Render rate of the shipped kits. 48 kHz is the engine's usual device rate,
+ /// so pads play back without resampling on most setups.</summary>
+ public const int SampleRate = 48000;
+
+ private const int Oversample = 4;
+
+ /// <summary>Synthesizes <paramref name="pad"/>. <paramref name="seed"/> makes the
+ /// result reproducible — the same kit always renders to the same audio.</summary>
+ public static RenderedSample Render(KitPad pad, uint seed)
+ {
+ double osSr = SampleRate * (double)Oversample;
+ int osLen = Math.Max(Oversample * 64, (int)(pad.Length * osSr));
+ var buf = new double[osLen];
+ var rng = new Rng(seed);
+
+ KitVoices.Render(pad, buf, osSr, rng);
+
+ if (pad.Lofi > 0 || pad.Bits < 24 || pad.CrushHz > 0)
+ {
+ int hold = pad.CrushHz > 0 ? Math.Max(1, (int)(osSr / pad.CrushHz)) : 1;
+ double bits = pad.Bits < 24 ? pad.Bits : 24 - pad.Lofi * 12;
+ KitDsp.Crush(buf, bits, hold);
+ }
+
+ ApplyGlue(pad, buf, osSr, rng);
+
+ var mono = KitDsp.Decimate(buf, Oversample, SampleRate);
+
+ double[][] chans = pad.Room > 0
+ ? ApplyRoom(pad, mono, SampleRate)
+ : new[] { mono };
+
+ foreach (var c in chans)
+ {
+ var dc = new DcBlock(SampleRate);
+ for (int i = 0; i < c.Length; i++) c[i] = dc.Process(c[i]);
+ }
+
+ int frames = KitDsp.TrimTail(chans, -66, SampleRate);
+
+ double peak = 0;
+ foreach (var c in chans)
+ for (int i = 0; i < frames; i++) peak = Math.Max(peak, Math.Abs(c[i]));
+ double gain = peak > 1e-9 ? KitDsp.Db(pad.PeakDb) / peak : 0;
+
+ int ch = chans.Length;
+ var inter = new float[frames * ch];
+ for (int i = 0; i < frames; i++)
+ for (int c = 0; c < ch; c++)
+ inter[i * ch + c] = (float)(chans[c][i] * gain);
+
+ return new RenderedSample(inter, ch, frames, SampleRate);
+ }
+
+ /// <summary>Renders <paramref name="pad"/> straight to a 24-bit WAV at
+ /// <paramref name="path"/>. 24-bit because these files are a library the user will
+ /// keep processing — quantization noise has no business being baked in.</summary>
+ public static void RenderToFile(KitPad pad, uint seed, string path)
+ {
+ var s = Render(pad, seed);
+ var tmp = path + ".part";
+ using (var w = new WavWriter(tmp, s.SampleRate, s.Channels, WavBitDepth.Pcm24))
+ w.WriteFrames(s.Interleaved, s.Frames);
+ File.Move(tmp, path, overwrite: true); // never leave a half-written sample behind
+ }
+
+ // The "analog glue": a low-mid lift and an upper-treble roll-off around a gentle
+ // asymmetric saturation, plus an optional noise bed. None of it is dramatic on its
+ // own; together it is most of the difference between a synthetic hit and one that
+ // sounds like it came off a machine with transformers in it.
+ private static void ApplyGlue(KitPad pad, double[] buf, double sr, Rng rng)
+ {
+ double w = Math.Clamp(pad.Warmth, 0, 1);
+ if (w > 0)
+ {
+ var shelf = Biquad.LowShelf(160, 1.6 * w, sr);
+ var air = Biquad.HighShelf(9000, -3.2 * w, sr);
+ var body = Biquad.Peaking(420, 0.8, 1.1 * w, sr);
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double x = air.Process(body.Process(shelf.Process(buf[i])));
+ buf[i] = KitDsp.Saturate(x, w * 0.18, 0.8);
+ }
+ }
+
+ if (pad.HpHz > 0)
+ {
+ var hp = Biquad.HighPass(pad.HpHz, 0.7071, sr);
+ for (int i = 0; i < buf.Length; i++) buf[i] = hp.Process(buf[i]);
+ }
+ if (pad.LpHz > 0)
+ {
+ var lp = Biquad.LowPass(pad.LpHz, 0.7071, sr);
+ for (int i = 0; i < buf.Length; i++) buf[i] = lp.Process(buf[i]);
+ }
+
+ if (pad.Hiss > 0)
+ {
+ // Gate the bed with the hit's own envelope: a noise floor that keeps running
+ // under silence is hiss, not character, and it would defeat the tail trim.
+ var tilt = Biquad.LowPass(6000, 0.7071, sr);
+ double env = 0, atk = 0.002, rel = 0.0004;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double a = Math.Abs(buf[i]);
+ env += (a > env ? atk : rel) * (a - env);
+ buf[i] += tilt.Process(rng.NextGauss()) * pad.Hiss * 0.02 * Math.Sqrt(Math.Min(1, env * 4));
+ }
+ }
+ }
+
+ // A short stereo room. The dry hit stays centred and only the room spreads, so the
+ // sample still collapses cleanly to mono.
+ private static double[][] ApplyRoom(KitPad pad, double[] mono, double sr)
+ {
+ // Give the tail somewhere to go — the dry render usually ends near silence.
+ int extra = (int)(sr * (0.25 + pad.RoomDecay * 1.4));
+ int n = mono.Length + extra;
+ var l = new double[n];
+ var r = new double[n];
+ var room = new Room(pad.RoomSize, pad.RoomDecay, pad.RoomDamp, sr);
+ var preLp = Biquad.LowPass(7000, 0.7071, sr);
+ var preHp = Biquad.HighPass(180, 0.7071, sr);
+ int preDelay = (int)(sr * 0.006 * (0.4 + pad.RoomSize));
+ double send = pad.Room;
+ double width = Math.Clamp(pad.Width, 0, 1);
+ // Gated reverb: cut the tail dead after RoomGate seconds. A studio trick of the
+ // 80s that a plain decay cannot imitate — the tail is loud right up to the cut.
+ int gateAt = pad.RoomGate > 0 ? (int)(sr * pad.RoomGate) : int.MaxValue;
+ int gateFade = Math.Max(1, (int)(sr * 0.012));
+
+ for (int i = 0; i < n; i++)
+ {
+ double dry = i < mono.Length ? mono[i] : 0;
+ double x = i >= preDelay && i - preDelay < mono.Length ? mono[i - preDelay] : 0;
+ room.Process(preHp.Process(preLp.Process(x)) * send, out double wl, out double wr);
+ double g = 0.9;
+ if (i >= gateAt) g *= i >= gateAt + gateFade ? 0 : 1.0 - (double)(i - gateAt) / gateFade;
+ double mid = (wl + wr) * 0.5;
+ l[i] = dry + (mid + (wl - mid) * width) * g;
+ r[i] = dry + (mid + (wr - mid) * width) * g;
+ }
+ return new[] { l, r };
+ }
+}
diff --git a/src/managed/Nota.Infrastructure/Kits/KitVoices.cs b/src/managed/Nota.Infrastructure/Kits/KitVoices.cs
new file mode 100644
index 00000000..ae9fcf2c
--- /dev/null
+++ b/src/managed/Nota.Infrastructure/Kits/KitVoices.cs
@@ -0,0 +1,519 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// The synthesis models behind the factory kits. Each writes one dry mono one-shot into
+// a buffer running at the renderer's oversampled rate (see KitRenderer) — the analog
+// glue, room, lo-fi and normalization stages live there, so everything in this file is
+// just the sound source.
+//
+// The models are sketches of how the real instruments make sound rather than generic
+// synth patches: analog drum voices are modelled as rung resonators with a trigger
+// pulse (which is what the bridged-T networks in those machines actually are), and the
+// acoustic ones as a struck body — a short excitation feeding a handful of modes.
+// That is what keeps them from sounding like a sine with an envelope on it.
+
+using System;
+
+namespace Nota.Infrastructure.Kits;
+
+internal static class KitVoices
+{
+ private const double TwoPi = Math.PI * 2;
+
+ /// <summary>Renders the dry voice for <paramref name="p"/> into <paramref name="buf"/>
+ /// (mono, <paramref name="sr"/> = the oversampled render rate).</summary>
+ public static void Render(KitPad p, double[] buf, double sr, Rng rng)
+ {
+ // Analog drift: a small, per-sample-but-fixed detune, so no two pads of a kit sit
+ // at exactly their nominal pitch — real machines never do.
+ double freq = p.Freq * (1 + (rng.Next() * 0.012 + 0.004 * rng.Next()) * p.Drift * 2);
+
+ switch (p.Model)
+ {
+ case DrumModel.KickAnalog: Kick(p, buf, sr, rng, freq, analog: true); break;
+ case DrumModel.KickPunch: Kick(p, buf, sr, rng, freq, analog: false); break;
+ case DrumModel.KickAcoustic: KickAcoustic(p, buf, sr, rng, freq); break;
+ case DrumModel.SubHit: SubHit(p, buf, sr, rng, freq); break;
+ case DrumModel.SnareAnalog: SnareAnalog(p, buf, sr, rng, freq); break;
+ case DrumModel.SnarePunch: SnarePunch(p, buf, sr, rng, freq); break;
+ case DrumModel.SnareAcoustic: SnareAcoustic(p, buf, sr, rng, freq); break;
+ case DrumModel.Clap: Clap(p, buf, sr, rng, freq); break;
+ case DrumModel.Rim: Rim(p, buf, sr, rng, freq); break;
+ case DrumModel.HatMetal: Metal(p, buf, sr, rng, freq, cymbal: false); break;
+ case DrumModel.Cymbal: Metal(p, buf, sr, rng, freq, cymbal: true); break;
+ case DrumModel.HatNoise: HatNoise(p, buf, sr, rng, freq); break;
+ case DrumModel.Tom: Tom(p, buf, sr, rng, freq); break;
+ case DrumModel.Conga: Conga(p, buf, sr, rng, freq); break;
+ case DrumModel.Shaker: Shaker(p, buf, sr, rng, freq); break;
+ case DrumModel.Cowbell: Cowbell(p, buf, sr, rng, freq); break;
+ case DrumModel.Block: Block(p, buf, sr, rng, freq); break;
+ case DrumModel.Zap: Zap(p, buf, sr, rng, freq); break;
+ default: PercMetal(p, buf, sr, rng, freq); break;
+ }
+ }
+
+ // --- shared helpers ----------------------------------------------------
+
+ // A 0.4 ms raised-cosine fade-in. Drum voices start at full level; without this the
+ // buffer opens on a step, which reads as a click and eats headroom after saturation.
+ private static double AttackRamp(int i, double sr)
+ {
+ int n = (int)(sr * 0.0004);
+ return i >= n ? 1.0 : 0.5 - 0.5 * Math.Cos(Math.PI * i / n);
+ }
+
+ // Band-limited noise. Real drum noise — wires, skin, beads, air — is not white: it
+ // rolls off well before 20 kHz, and noise that does not is the single clearest tell
+ // of a synthetic drum. Every noise layer here goes through one of these.
+ private sealed class NoiseGen
+ {
+ private readonly Rng _rng;
+ private readonly Biquad _lp;
+ public NoiseGen(Rng rng, double cutoff, double sr)
+ {
+ _rng = rng;
+ _lp = Biquad.LowPass(cutoff, 0.7071, sr);
+ }
+ public double Next() => _lp.Process(_rng.NextGauss());
+ }
+
+ // A short noise burst — the "strike". Modal bodies need a physical excitation with
+ // some width to them; a single-sample impulse rings the modes but sounds thin.
+ private static double Excite(int i, double sr, double ms, Rng rng)
+ {
+ int n = Math.Max(1, (int)(sr * ms * 0.001));
+ if (i >= n) return 0;
+ double t = 1.0 - (double)i / n;
+ return (i == 0 ? 1.0 : rng.NextGauss()) * t * t;
+ }
+
+ // --- kicks -------------------------------------------------------------
+
+ private static void Kick(KitPad p, double[] buf, double sr, Rng rng, double freq, bool analog)
+ {
+ double ampC = KitDsp.DecayCoef(p.Decay, sr);
+ // The punchy variant drops faster and further: that steep sweep through the
+ // low mids is the "thwack" a long analog ring doesn't have.
+ double pitchTau = p.PitchDecay * (analog ? 1.0 : 0.55);
+ double pitchAmt = p.PitchAmt <= 0 ? (analog ? 1.6 : 3.2) : p.PitchAmt;
+ double pitchC = Math.Exp(-1.0 / Math.Max(1e-4, pitchTau * sr));
+
+ var knock = new Modal(freq * 4.2, Math.Min(p.Decay * 0.25, 0.09), sr);
+ var clickBp = Biquad.BandPass(analog ? 1400 : 2600, 0.9, sr);
+ var clickHp = Biquad.HighPass(600, 0.7071, sr);
+ var clickN = new NoiseGen(rng, analog ? 9000 : 13000, sr);
+ double clickC = KitDsp.DecayCoef(analog ? 0.004 : 0.008, sr);
+
+ double env = 1, penv = 1, cenv = 1, ph = 0;
+ double sub = 0.55 + p.Body * 0.65;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double f = freq * (1 + pitchAmt * penv);
+ ph += f / sr; if (ph >= 1) ph -= 1;
+ double s = Math.Sin(TwoPi * ph) * env * sub;
+
+ // Upper body ("knock") — the mid ring that survives on a small speaker.
+ double exc = Excite(i, sr, 1.2, rng);
+ s += knock.Process(exc) * p.Tone * 1.4;
+
+ // Trigger click: filtered noise, not a bare impulse, so it sits in the tone.
+ double cl = clickHp.Process(clickBp.Process(clickN.Next())) * cenv * p.Click * 2.2;
+ s += cl;
+
+ buf[i] = KitDsp.Saturate(s, p.Drive, 0.6) * AttackRamp(i, sr);
+ env *= ampC; penv *= pitchC; cenv *= clickC;
+ }
+ }
+
+ private static void KickAcoustic(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ // A struck shell: three modes with different ring times over a short sub, and a
+ // beater transient on top. The mode spacing is inharmonic — a drum shell is not
+ // a string, and harmonic ratios here are exactly what sounds synthetic.
+ var m1 = new Modal(freq, p.Decay * 0.55, sr);
+ var m2 = new Modal(freq * 1.63, p.Decay * 0.30, sr);
+ var m3 = new Modal(freq * 2.81, p.Decay * 0.14, sr);
+ var beaterBp = Biquad.BandPass(2400 + p.Tone * 3600, 0.8, sr);
+ var beaterHp = Biquad.HighPass(1200, 0.7071, sr);
+ var beaterN = new NoiseGen(rng, 13000, sr);
+ double beatC = KitDsp.DecayCoef(0.007, sr);
+ double subC = KitDsp.DecayCoef(Math.Min(p.Decay * 0.4, 0.16), sr);
+ double pitchC = Math.Exp(-1.0 / Math.Max(1e-4, p.PitchDecay * sr));
+
+ double subEnv = 1, benv = 1, penv = 1, ph = 0;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double f = freq * (1 + (p.PitchAmt <= 0 ? 0.8 : p.PitchAmt) * penv);
+ ph += f / sr; if (ph >= 1) ph -= 1;
+ double s = Math.Sin(TwoPi * ph) * subEnv * (0.7 + p.Body * 0.5);
+
+ double exc = Excite(i, sr, 2.0, rng);
+ s += (m1.Process(exc) * 1.0 + m2.Process(exc) * 0.5 + m3.Process(exc) * 0.22) * p.Body * 1.6;
+ s += beaterHp.Process(beaterBp.Process(beaterN.Next())) * benv * p.Click * 3.0;
+
+ buf[i] = KitDsp.Saturate(s, p.Drive, 0.4) * AttackRamp(i, sr);
+ subEnv *= subC; benv *= beatC; penv *= pitchC;
+ }
+ }
+
+ private static void SubHit(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ double ampC = KitDsp.DecayCoef(p.Decay, sr);
+ double pitchC = Math.Exp(-1.0 / Math.Max(1e-4, p.PitchDecay * sr));
+ var lp = Biquad.LowPass(200 + p.Tone * 2400, 0.7071, sr);
+ double env = 1, penv = 1, ph = 0;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double f = freq * (1 + p.PitchAmt * penv);
+ ph += f / sr; if (ph >= 1) ph -= 1;
+ double s = Math.Sin(TwoPi * ph) * env;
+ // Saturating a sine is the whole trick here: it grows the harmonics that let
+ // a 45 Hz note be heard on a phone, without lifting the fundamental.
+ s = KitDsp.Saturate(s, 0.15 + p.Drive * 0.85, 0.25);
+ buf[i] = lp.Process(s) * AttackRamp(i, sr);
+ env *= ampC; penv *= pitchC;
+ }
+ }
+
+ // --- snares ------------------------------------------------------------
+
+ private static void SnareAnalog(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ // Two shell tones a rough fifth-and-a-bit apart plus high-passed noise — the
+ // classic two-oscillator analog snare.
+ var t1 = new Modal(freq, p.Decay * (0.45 + p.Body * 0.5), sr);
+ var t2 = new Modal(freq * 1.588, p.Decay * (0.32 + p.Body * 0.4), sr);
+ var nHp = Biquad.HighPass(900 + p.Tone * 2200, 0.7071, sr);
+ var nPk = Biquad.Peaking(4200, 1.1, 4 * p.Tone, sr);
+ var nGen = new NoiseGen(rng, 12000, sr);
+ double nC = KitDsp.DecayCoef(p.NoiseDecay, sr);
+ double snapC = KitDsp.DecayCoef(0.012, sr);
+ double nEnv = 1, snap = 1;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double exc = Excite(i, sr, 1.0, rng);
+ double tone = t1.Process(exc) * 1.0 + t2.Process(exc) * 0.72;
+ double n = nPk.Process(nHp.Process(nGen.Next()));
+ double s = tone * (1 - p.Tone) * 1.5
+ + n * nEnv * p.Noise * 2.0
+ + n * snap * p.Click * 1.5;
+ buf[i] = KitDsp.Saturate(s, p.Drive, 0.35) * AttackRamp(i, sr);
+ nEnv *= nC; snap *= snapC;
+ }
+ }
+
+ private static void SnarePunch(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ var t1 = new Modal(freq, p.Decay * 0.3, sr);
+ var t2 = new Modal(freq * 1.47, p.Decay * 0.22, sr);
+ var nHp = Biquad.HighPass(260, 0.7071, sr);
+ var nPk = Biquad.Peaking(2600 + p.Tone * 4200, 0.9, 6, sr);
+ var nLp = Biquad.LowPass(7000 + p.Tone * 8000, 0.7071, sr);
+ var nGen = new NoiseGen(rng, 14000, sr);
+ double nC = KitDsp.DecayCoef(p.NoiseDecay, sr);
+ double bodyC = KitDsp.DecayCoef(p.NoiseDecay * 2.4, sr); // the noise "body" under the snap
+ double nEnv = 1, bEnv = 1;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double exc = Excite(i, sr, 0.8, rng);
+ double tone = (t1.Process(exc) + t2.Process(exc) * 0.6) * p.Body * 1.6;
+ double raw = nGen.Next();
+ double n = nLp.Process(nPk.Process(nHp.Process(raw)));
+ double s = tone + n * (nEnv * 1.1 + bEnv * 0.45) * (0.4 + p.Noise);
+ buf[i] = KitDsp.Saturate(s, p.Drive, 0.3) * AttackRamp(i, sr);
+ nEnv *= nC; bEnv *= bodyC;
+ }
+ }
+
+ private static void SnareAcoustic(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ // Shell modes + snare wires + stick crack. The wires are noise with their own
+ // longer, brighter decay; the crack is the 5 ms of broadband the stick makes.
+ var m1 = new Modal(freq, p.Decay * 0.5, sr);
+ var m2 = new Modal(freq * 1.52, p.Decay * 0.35, sr);
+ var m3 = new Modal(freq * 2.34, p.Decay * 0.2, sr);
+ var wireHp = Biquad.HighPass(1600 + p.Tone * 2400, 0.7071, sr);
+ var wirePk = Biquad.Peaking(6500, 1.0, 3 + p.Tone * 5, sr);
+ var crackBp = Biquad.BandPass(3200, 0.7, sr);
+ var nGen = new NoiseGen(rng, 14000, sr);
+ double wireC = KitDsp.DecayCoef(p.NoiseDecay, sr);
+ double crackC = KitDsp.DecayCoef(0.006, sr);
+ double wEnv = 1, cEnv = 1;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double exc = Excite(i, sr, 1.6, rng);
+ double shell = (m1.Process(exc) + m2.Process(exc) * 0.6 + m3.Process(exc) * 0.3) * p.Body * 1.5;
+ double raw = nGen.Next();
+ double wire = wirePk.Process(wireHp.Process(raw)) * wEnv * p.Noise * 1.6;
+ double crack = crackBp.Process(raw) * cEnv * p.Click * 2.4;
+ buf[i] = KitDsp.Saturate(shell + wire + crack, p.Drive, 0.3) * AttackRamp(i, sr);
+ wEnv *= wireC; cEnv *= crackC;
+ }
+ }
+
+ // --- hands / sticks ----------------------------------------------------
+
+ private static void Clap(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ // Four hands never land together: three short bursts a few milliseconds apart,
+ // then the room-ish tail that follows. The spacing jitter is what stops a clap
+ // from sounding like one flammed noise gate.
+ double[] offs = { 0, 0.0105, 0.0205, 0.0295 };
+ var bp = Biquad.BandPass(freq, 0.9 + p.Body * 0.8, sr);
+ var hp = Biquad.HighPass(420, 0.7071, sr);
+ var pk = Biquad.Peaking(freq * 2.6, 1.2, 4 * p.Tone, sr);
+ var nGen = new NoiseGen(rng, 9500, sr);
+ double burstC = KitDsp.DecayCoef(0.018, sr);
+ double tailC = KitDsp.DecayCoef(p.Decay, sr);
+
+ var starts = new int[offs.Length];
+ for (int k = 0; k < offs.Length; k++)
+ starts[k] = (int)((offs[k] + offs[k] * rng.Next() * 0.18 * (1 + p.Drift)) * sr);
+
+ double tail = 0, burst = 0;
+ int next = 0;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ if (next < starts.Length && i >= starts[next]) { burst = 1.0 - next * 0.12; next++; }
+ if (i == starts[^1]) tail = 1;
+ double n = nGen.Next();
+ double s = pk.Process(hp.Process(bp.Process(n))) * (burst * 1.6 + tail * p.Body * 0.8);
+ buf[i] = KitDsp.Saturate(s, p.Drive, 0.25) * AttackRamp(i, sr);
+ burst *= burstC; tail *= tailC;
+ }
+ }
+
+ private static void Rim(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ var m1 = new Modal(freq, p.Decay, sr);
+ var m2 = new Modal(freq * 2.74, p.Decay * 0.6, sr);
+ var m3 = new Modal(freq * 5.12, p.Decay * 0.35, sr);
+ var hp = Biquad.HighPass(220, 0.7071, sr);
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double exc = Excite(i, sr, 0.5, rng);
+ double s = m1.Process(exc) * (1 - p.Tone * 0.4)
+ + m2.Process(exc) * (0.6 + p.Tone * 0.5)
+ + m3.Process(exc) * p.Tone * 0.7;
+ s = hp.Process(s * (1.4 + p.Body));
+ buf[i] = KitDsp.Saturate(s, p.Drive, 0.3) * AttackRamp(i, sr);
+ }
+ }
+
+ // --- metal -------------------------------------------------------------
+
+ // The six square-wave frequencies of the classic analog hat circuit, as ratios of
+ // the lowest. Squares (not sines) because the cluster's value is the intermodulation
+ // between all those harmonics once it hits the band-pass.
+ private static readonly double[] MetalRatios = { 1.0, 1.4827, 1.8003, 2.5461, 2.6303, 3.8968 };
+ private static readonly double[] CymbalExtra = { 5.2331, 6.8072 };
+
+ private static void Metal(KitPad p, double[] buf, double sr, Rng rng, double freq, bool cymbal)
+ {
+ int n = cymbal ? MetalRatios.Length + CymbalExtra.Length : MetalRatios.Length;
+ var ph = new double[n];
+ var fr = new double[n];
+ for (int k = 0; k < n; k++)
+ {
+ double ratio = k < MetalRatios.Length ? MetalRatios[k] : CymbalExtra[k - MetalRatios.Length];
+ fr[k] = freq * ratio * (1 + rng.Next() * 0.02 * p.Drift);
+ ph[k] = rng.Next01();
+ }
+
+ var hp = Biquad.HighPass(cymbal ? 2600 : 5200 + p.Tone * 3000, 0.7071, sr);
+ var pk = Biquad.Peaking(cymbal ? 9000 : 10500, 0.9 + p.Body, 5 + p.Body * 5, sr);
+ var nHp = Biquad.HighPass(6000, 0.7071, sr);
+ var nGen = new NoiseGen(rng, 16000, sr);
+
+ // A cymbal's shimmer dies long before its body does; splitting the decay into
+ // bands is what gives the wash instead of a single fading hiss.
+ var bandHi = Biquad.HighPass(7000, 0.7071, sr);
+ var bandMid = Biquad.BandPass(4000, 0.6, sr);
+ double envC = KitDsp.DecayCoef(p.Decay, sr);
+ double hiC = KitDsp.DecayCoef(p.Decay * (cymbal ? 0.28 : 0.7), sr);
+ double midC = KitDsp.DecayCoef(p.Decay * (cymbal ? 0.6 : 0.85), sr);
+ double env = 1, hiEnv = 1, midEnv = 1;
+
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double metal = 0;
+ for (int k = 0; k < n; k++)
+ {
+ ph[k] += fr[k] / sr; if (ph[k] >= 1) ph[k] -= 1;
+ metal += ph[k] < 0.5 ? 1 : -1;
+ }
+ metal /= n;
+ double mix = metal * (1 - p.Tone * 0.6) + nGen.Next() * p.Tone * 0.6;
+ double s = pk.Process(hp.Process(mix));
+ if (cymbal)
+ s = s * env * 0.5 + bandHi.Process(s) * hiEnv * 0.7 + bandMid.Process(s) * midEnv * 0.6;
+ else
+ s *= env;
+ s += nHp.Process(nGen.Next()) * env * p.Noise * 0.5;
+ buf[i] = KitDsp.Saturate(s, p.Drive, 0.2) * AttackRamp(i, sr);
+ env *= envC; hiEnv *= hiC; midEnv *= midC;
+ }
+ }
+
+ private static void HatNoise(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ var hp = Biquad.HighPass(freq * (4 + p.Tone * 6), 0.7071, sr);
+ var pk1 = Biquad.Peaking(7200, 1.4, 6 * p.Body, sr);
+ var pk2 = Biquad.Peaking(11500, 1.8, 5 * p.Body, sr);
+ var lp = Biquad.LowPass(9000 + p.Tone * 9000, 0.7071, sr);
+ var nGen = new NoiseGen(rng, 16000, sr);
+ double envC = KitDsp.DecayCoef(p.Decay, sr);
+ double tickC = KitDsp.DecayCoef(0.003, sr);
+ double env = 1, tick = 1;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double n = nGen.Next();
+ double s = lp.Process(pk2.Process(pk1.Process(hp.Process(n))));
+ buf[i] = KitDsp.Saturate(s * (env + tick * p.Click * 2.0), p.Drive, 0.2) * AttackRamp(i, sr);
+ env *= envC; tick *= tickC;
+ }
+ }
+
+ // --- drums & percussion ------------------------------------------------
+
+ private static void Tom(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ double ampC = KitDsp.DecayCoef(p.Decay, sr);
+ double pitchC = Math.Exp(-1.0 / Math.Max(1e-4, p.PitchDecay * sr));
+ var shell = new Modal(freq * 1.59, p.Decay * 0.45, sr);
+ var shell2 = new Modal(freq * 2.14, p.Decay * 0.28, sr);
+ var skinBp = Biquad.BandPass(1800 + p.Tone * 2600, 0.8, sr);
+ var nGen = new NoiseGen(rng, 9000, sr);
+ double skinC = KitDsp.DecayCoef(p.NoiseDecay, sr);
+ double env = 1, penv = 1, skin = 1, ph = 0;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double f = freq * (1 + (p.PitchAmt <= 0 ? 0.5 : p.PitchAmt) * penv);
+ ph += f / sr; if (ph >= 1) ph -= 1;
+ double s = Math.Sin(TwoPi * ph) * env;
+ double exc = Excite(i, sr, 1.5, rng);
+ s += (shell.Process(exc) * 0.7 + shell2.Process(exc) * 0.35) * p.Body * 1.5;
+ s += skinBp.Process(nGen.Next()) * skin * p.Noise * 1.4;
+ buf[i] = KitDsp.Saturate(s, p.Drive, 0.4) * AttackRamp(i, sr);
+ env *= ampC; penv *= pitchC; skin *= skinC;
+ }
+ }
+
+ private static void Conga(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ // Circular-membrane mode ratios (Bessel zeros), which is what makes a hand drum
+ // read as a skin rather than a tuned bar.
+ var m1 = new Modal(freq, p.Decay, sr);
+ var m2 = new Modal(freq * 1.593, p.Decay * 0.55, sr);
+ var m3 = new Modal(freq * 2.135, p.Decay * 0.33, sr);
+ var m4 = new Modal(freq * 2.917, p.Decay * 0.2, sr);
+ var slapBp = Biquad.BandPass(900 + p.Tone * 5000, 0.9, sr);
+ var nGen = new NoiseGen(rng, 11000, sr);
+ double slapC = KitDsp.DecayCoef(0.009 + p.NoiseDecay * 0.4, sr);
+ double slap = 1;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double exc = Excite(i, sr, 1.4, rng);
+ double s = m1.Process(exc) * (1.1 - p.Tone * 0.4)
+ + m2.Process(exc) * 0.55 * p.Body
+ + m3.Process(exc) * 0.3 * p.Body
+ + m4.Process(exc) * 0.16 * p.Body;
+ s += slapBp.Process(nGen.Next()) * slap * p.Click * 2.2;
+ buf[i] = KitDsp.Saturate(s * 1.5, p.Drive, 0.3) * AttackRamp(i, sr);
+ slap *= slapC;
+ }
+ }
+
+ private static void Shaker(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ // Beads, not hiss: the noise is amplitude-modulated by a fast random contour, so
+ // the hit has grain in it. A swell replaces the usual instant attack.
+ var bp = Biquad.BandPass(freq, 0.7 + p.Tone * 1.2, sr);
+ var hp = Biquad.HighPass(freq * 0.5, 0.7071, sr);
+ var nGen = new NoiseGen(rng, 16000, sr);
+ int swell = Math.Max(1, (int)(sr * (0.004 + (1 - p.Click) * 0.016)));
+ double envC = KitDsp.DecayCoef(p.Decay, sr);
+ int grainLen = Math.Max(1, (int)(sr / (700 + p.Body * 2600)));
+ double env = 1, grain = 1;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ if (i % grainLen == 0) grain = 0.45 + rng.Next01() * 0.55;
+ double atk = i < swell ? (double)i / swell : 1.0;
+ double n = nGen.Next();
+ double s = hp.Process(bp.Process(n)) * env * atk * (0.5 + grain * 0.9);
+ buf[i] = KitDsp.Saturate(s * 1.6, p.Drive, 0.2) * AttackRamp(i, sr);
+ if (i >= swell) env *= envC;
+ }
+ }
+
+ private static void Cowbell(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ double f2 = freq * 1.4815; // the two-square interval of the analog original
+ var bp = Biquad.BandPass(freq * (3.0 + p.Tone * 3.0), 0.7 + p.Body, sr);
+ var hp = Biquad.HighPass(freq * 0.8, 0.7071, sr);
+ double envC = KitDsp.DecayCoef(p.Decay, sr);
+ double clickC = KitDsp.DecayCoef(0.004, sr);
+ double env = 1, cl = 1, p1 = 0, p2 = rng.Next01();
+ for (int i = 0; i < buf.Length; i++)
+ {
+ p1 += freq / sr; if (p1 >= 1) p1 -= 1;
+ p2 += f2 / sr; if (p2 >= 1) p2 -= 1;
+ double sq = ((p1 < 0.5 ? 1 : -1) + (p2 < 0.5 ? 1 : -1)) * 0.5;
+ double s = hp.Process(bp.Process(sq)) * (env + cl * p.Click);
+ buf[i] = KitDsp.Saturate(s * 1.5, p.Drive, 0.25) * AttackRamp(i, sr);
+ env *= envC; cl *= clickC;
+ }
+ }
+
+ private static void Block(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ var m1 = new Modal(freq, p.Decay, sr);
+ var m2 = new Modal(freq * 1.47, p.Decay * 0.55, sr);
+ var m3 = new Modal(freq * 2.09, p.Decay * 0.3, sr);
+ var hp = Biquad.HighPass(600, 0.7071, sr);
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double exc = Excite(i, sr, 0.4, rng);
+ double s = m1.Process(exc) + m2.Process(exc) * p.Tone * 0.8 + m3.Process(exc) * p.Tone * 0.4;
+ s = hp.Process(s * (1.6 + p.Body));
+ buf[i] = KitDsp.Saturate(s, p.Drive, 0.25) * AttackRamp(i, sr);
+ }
+ }
+
+ private static void Zap(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ double ampC = KitDsp.DecayCoef(p.Decay, sr);
+ double pitchC = Math.Exp(-1.0 / Math.Max(1e-4, p.PitchDecay * sr));
+ double env = 1, penv = 1, ph = 0, mph = 0;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ double f = freq * (1 + (p.PitchAmt <= 0 ? 12 : p.PitchAmt) * penv);
+ mph += f * (1.5 + p.Body * 3) / sr; if (mph >= 1) mph -= 1;
+ double fm = Math.Sin(TwoPi * mph) * p.Tone * 4;
+ ph += f / sr; if (ph >= 1) ph -= 1;
+ double s = Math.Sin(TwoPi * ph + fm) * env;
+ buf[i] = KitDsp.Saturate(s, p.Drive, 0.3) * AttackRamp(i, sr);
+ env *= ampC; penv *= pitchC;
+ }
+ }
+
+ private static void PercMetal(KitPad p, double[] buf, double sr, Rng rng, double freq)
+ {
+ double ratio = 1.4 + p.Tone * 3.2;
+ var ring = new Modal(freq * (1 + ratio) * 0.5, p.Decay * 0.7, sr);
+ var ring2 = new Modal(freq * ratio * 1.71, p.Decay * 0.4, sr);
+ var hp = Biquad.HighPass(freq * 0.6, 0.7071, sr);
+ double envC = KitDsp.DecayCoef(p.Decay, sr);
+ double env = 1, ph = 0, mph = 0;
+ for (int i = 0; i < buf.Length; i++)
+ {
+ ph += freq / sr; if (ph >= 1) ph -= 1;
+ mph += freq * ratio / sr; if (mph >= 1) mph -= 1;
+ double s = Math.Sin(TwoPi * ph) * Math.Sin(TwoPi * mph) * env;
+ double exc = Excite(i, sr, 1.0, rng);
+ s += (ring.Process(exc) + ring2.Process(exc) * 0.6) * p.Body * 1.4;
+ buf[i] = KitDsp.Saturate(hp.Process(s), p.Drive, 0.25) * AttackRamp(i, sr);
+ env *= envC;
+ }
+ }
+}
diff --git a/src/managed/Nota.Mcp/Tools/DrumKitTools.cs b/src/managed/Nota.Mcp/Tools/DrumKitTools.cs
new file mode 100644
index 00000000..7cab37e7
--- /dev/null
+++ b/src/managed/Nota.Mcp/Tools/DrumKitTools.cs
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// MCP tools — the shipped Drum Rack kits. The kits are synthesized from recipes on the
+// user's machine rather than bundled as audio, so loading one may render its samples
+// first; that happens inside the call and takes well under a second per kit.
+
+using System.ComponentModel;
+using ModelContextProtocol.Server;
+using Nota.Application;
+
+namespace Nota.Mcp.Tools;
+
+[McpServerToolType]
+public sealed class DrumKitTools(IAudioEngine engine, IEngineDispatch dispatch, IArrangementRefresh refresh, IDrumKits kits)
+ : EngineTools(engine, dispatch, refresh)
+{
+ public sealed record KitRow(string Id, string Name, string Description, int Pads, bool Rendered);
+ public sealed record KitLoadResult(int TrackId, int Pads, string Warning);
+
+ [McpServerTool(Name = "list_drum_kits"), Description(
+ "List the factory Drum Rack kits: id, name, a one-line description, pad count, and "
+ + "whether its samples have been rendered yet. Pads follow the General MIDI drum map "
+ + "on notes 36-51.")]
+ public Task<KitRow[]> ListDrumKits() => Read(() =>
+ {
+ var all = kits.All();
+ var rows = new KitRow[all.Count];
+ for (int i = 0; i < all.Count; i++)
+ rows[i] = new KitRow(all[i].Id, all[i].Name, all[i].Blurb, all[i].PadCount, kits.IsRendered(all[i].Id));
+ return rows;
+ });
+
+ [McpServerTool(Name = "add_drum_kit_track"), Description(
+ "Add a Drum Rack track loaded with a factory kit (see list_drum_kits for ids). "
+ + "Returns the new track id and how many pads were loaded.")]
+ public Task<KitLoadResult> AddDrumKitTrack(string kitId) => Mutate(() =>
+ {
+ int t = kits.CreateTrack(E, kitId, out string warning);
+ return new KitLoadResult(t, t > 0 ? E.RackChainCount(t) : 0, warning);
+ });
+
+ [McpServerTool(Name = "load_drum_kit"), Description(
+ "Replace the pads of an existing Drum Rack track with a factory kit.")]
+ public Task<KitLoadResult> LoadDrumKit(int trackId, string kitId) => Mutate(() =>
+ {
+ bool ok = kits.LoadInto(E, trackId, kitId, out string warning);
+ return new KitLoadResult(ok ? trackId : -1, ok ? E.RackChainCount(trackId) : 0, warning);
+ });
+}
diff --git a/src/managed/Nota.Mcp/Tools/RackTools.cs b/src/managed/Nota.Mcp/Tools/RackTools.cs
index 36a8e48a..275f6e18 100644
--- a/src/managed/Nota.Mcp/Tools/RackTools.cs
+++ b/src/managed/Nota.Mcp/Tools/RackTools.cs
@@ -19,7 +19,7 @@ public sealed class RackTools(IAudioEngine engine, IEngineDispatch dispatch, IAr
: EngineTools(engine, dispatch, refresh)
{
public sealed record ChainInfo(int Index, int InstrumentKind, string InstrumentName, int TriggerNote,
- float Gain, float Pan, bool Mute, bool Solo, int DeviceCount);
+ float Gain, float Pan, bool Mute, bool Solo, int DeviceCount, string Name);
public sealed record RackSnapshot(float Volume, ChainInfo[] Chains);
public sealed record Param(int Index, string Id, string Name, float Value);
public sealed record MacroInfo(int Index, string Name, float Value);
@@ -37,7 +37,8 @@ public sealed class RackTools(IAudioEngine engine, IEngineDispatch dispatch, IAr
for (int c = 0; c < n; c++)
chains[c] = new ChainInfo(c, E.RackChainInstrumentKind(trackId, c), E.RackChainInstrumentName(trackId, c),
E.RackChainTriggerNote(trackId, c), E.RackChainGain(trackId, c), E.RackChainPan(trackId, c),
- E.RackChainMute(trackId, c), E.RackChainSolo(trackId, c), E.RackChainDeviceCount(trackId, c));
+ E.RackChainMute(trackId, c), E.RackChainSolo(trackId, c), E.RackChainDeviceCount(trackId, c),
+ E.RackChainName(trackId, c));
return new RackSnapshot(E.RackVolume(trackId), chains);
});
@@ -155,4 +156,13 @@ public sealed class RackTools(IAudioEngine engine, IEngineDispatch dispatch, IAr
[McpServerTool(Name = "set_kit_humanize"), Description("Drum Rack: set kit-wide humanize/timing randomisation (0..1).")]
public Task SetKitHumanize(int trackId, float value) => Mutate(() => E.RackSetHumanize(trackId, Math.Clamp(value, 0f, 1f)));
+
+ [McpServerTool(Name = "set_chain_name"), Description(
+ "Name a rack chain / Drum Rack pad (\"Kick\", \"Snare\"…). An empty name falls back to the "
+ + "chain instrument's own name, which is the same word on every Sampler pad.")]
+ public Task<bool> SetChainName(int trackId, int chain, string name) => Mutate(() =>
+ {
+ E.RackSetChainName(trackId, chain, name ?? "");
+ return true;
+ });
}
diff --git a/src/managed/Nota.Presentation/ViewModels/BrowserViewModel.cs b/src/managed/Nota.Presentation/ViewModels/BrowserViewModel.cs
index 4a52f525..6e47ade2 100644
--- a/src/managed/Nota.Presentation/ViewModels/BrowserViewModel.cs
+++ b/src/managed/Nota.Presentation/ViewModels/BrowserViewModel.cs
@@ -33,6 +33,9 @@ public sealed class BrowserItem
public string Sub { get; init; } = ""; // type / manufacturer / folder
public string Format { get; init; } = ""; // plug-ins: "VST3" / "AU" (Sub carries the vendor)
public string Path { get; init; } = ""; // file/bundle path for samples/projects/presets
+ /// <summary>Long-form description for the row's tooltip, where <see cref="Sub"/> (the
+ /// narrow tag column) has no room for it. Falls back to Sub when empty.</summary>
+ public string Tip { get; init; } = "";
/// <summary>Section-header row (see <see cref="BrowserItemKind.Group"/>): Name is the
/// caption and <see cref="GroupCount"/> how many rows it heads.</summary>
@@ -78,6 +81,7 @@ public sealed partial class BrowserViewModel : ObservableObject
private readonly IPluginCatalog _catalog;
private readonly IPresetLibrary _presets;
private readonly IFactoryPresets _factory;
+ private readonly IDrumKits? _kits;
private readonly ISettingsService? _settings;
private readonly IBrowserLibrary? _library;
@@ -120,11 +124,13 @@ public sealed partial class BrowserViewModel : ObservableObject
public ObservableCollection<BrowserItem> Presets { get; } = new();
public BrowserViewModel(IPluginCatalog catalog, IPresetLibrary presets, IFactoryPresets factory,
- ISettingsService? settings = null, IBrowserLibrary? library = null)
+ ISettingsService? settings = null, IBrowserLibrary? library = null,
+ IDrumKits? kits = null)
{
_catalog = catalog;
_presets = presets;
_factory = factory;
+ _kits = kits;
_settings = settings;
_library = library;
if (_library is not null) _library.Changed += OnLibraryChanged;
@@ -273,6 +279,24 @@ public sealed partial class BrowserViewModel : ObservableObject
Depth = 1,
});
}
+ // Factory drum kits hang under the Drum Rack alongside its presets — a kit is
+ // what a "preset" means for that device.
+ if (_kits is not null)
+ {
+ var rack = _instrTree.Find(d => d.Kind == BrowserItemKind.BuiltinInstrument && d.BuiltinKind == 4);
+ if (rack is not null)
+ foreach (var kit in _kits.All())
+ rack.Children.Add(new BrowserItem
+ {
+ Name = kit.Name,
+ Kind = BrowserItemKind.Preset,
+ Sub = "kit",
+ Tip = $"{kit.Blurb} · {kit.PadCount} pads",
+ Path = "kit:" + kit.Id,
+ Depth = 1,
+ });
+ }
+
// Preset groups start collapsed; the user expands a device to reveal its presets.
foreach (var tree in new[] { _instrTree, _fxTree, _midiTree })
foreach (var d in tree) d.IsExpanded = false;
@@ -451,10 +475,58 @@ public sealed partial class BrowserViewModel : ObservableObject
Depth = depth,
});
}
+ AppendKitFolders();
SortSampleTree(_sampleTree);
RebuildSampleVisible();
}
+ // The rendered factory kits, as a browsable folder alongside the user's own samples.
+ // They live in Nota's data folder rather than the user's samples folder (they are
+ // regenerable, and they should not appear in a folder the user curates), so the tree
+ // gets them from the kit service instead of the folder scan above.
+ private void AppendKitFolders()
+ {
+ if (_kits is null) return;
+ var root = _kits.Root;
+ if (string.IsNullOrEmpty(root) || !Directory.Exists(root)) return;
+
+ var rootNode = new BrowserItem
+ {
+ Name = "Nota Kits",
+ Kind = BrowserItemKind.Folder,
+ Sub = "factory",
+ Path = root,
+ Depth = 0,
+ IsExpanded = _expandedTreeKeys.Contains(root),
+ };
+ foreach (var kit in _kits.All())
+ {
+ var dir = _kits.FolderOf(kit.Id);
+ if (string.IsNullOrEmpty(dir) || !Directory.Exists(dir)) continue;
+ var kitNode = new BrowserItem
+ {
+ Name = kit.Name,
+ Kind = BrowserItemKind.Folder,
+ Sub = "",
+ Tip = kit.Blurb,
+ Path = dir,
+ Depth = 1,
+ IsExpanded = _expandedTreeKeys.Contains(dir),
+ };
+ foreach (var f in Directory.EnumerateFiles(dir, "*.wav").OrderBy(f => f, StringComparer.Ordinal))
+ kitNode.Children.Add(new BrowserItem
+ {
+ Name = Path.GetFileName(f),
+ Kind = BrowserItemKind.Sample,
+ Sub = "",
+ Path = f,
+ Depth = 2,
+ });
+ if (kitNode.Children.Count > 0) rootNode.Children.Add(kitNode);
+ }
+ if (rootNode.Children.Count > 0) _sampleTree.Add(rootNode);
+ }
+
// Ensures the folder chain from root down to `dir` exists, returning the child list the
// file should join and the file's tree depth. Root-level files land directly in the roots.
private List<BrowserItem> GetOrCreateFolder(string root, string dir,
diff --git a/src/native/nota.engine/include/nota/nota_engine.h b/src/native/nota.engine/include/nota/nota_engine.h
index 3438bf46..4504b5c5 100644
--- a/src/native/nota.engine/include/nota/nota_engine.h
+++ b/src/native/nota.engine/include/nota/nota_engine.h
@@ -891,6 +891,10 @@ NOTA_API int32_t nota_rack_add_plugin_chain_device(NotaEngine* engine, int32
NOTA_API int32_t nota_rackdev_add_plugin_chain_device(NotaEngine* engine, int32_t track_id, int32_t device_index, int32_t chain, int32_t catalog_index);
NOTA_API int32_t nota_rack_chain_trigger_note(const NotaEngine* engine, int32_t track_id, int32_t chain);
NOTA_API void nota_rack_set_chain_trigger_note(NotaEngine* engine, int32_t track_id, int32_t chain, int32_t note);
+/* Chain/pad display name. Empty means "use the chain instrument's own name"; a Drum
+ * Rack pad holding a Sampler sets it to the sample (or kit voice) it plays. */
+NOTA_API const char* nota_rack_chain_name(const NotaEngine* engine, int32_t track_id, int32_t chain);
+NOTA_API void nota_rack_set_chain_name(NotaEngine* engine, int32_t track_id, int32_t chain, const char* name);
NOTA_API int32_t nota_rackdev_chain_trigger_note(const NotaEngine* engine, int32_t track_id, int32_t device_index, int32_t chain);
NOTA_API void nota_rackdev_set_chain_trigger_note(NotaEngine* engine, int32_t track_id, int32_t device_index, int32_t chain, int32_t note);
NOTA_API int32_t nota_rack_chain_count(const NotaEngine* engine, int32_t track_id);
diff --git a/src/native/nota.engine/src/Engine.h b/src/native/nota.engine/src/Engine.h
index de88ef52..6dece2b8 100644
--- a/src/native/nota.engine/src/Engine.h
+++ b/src/native/nota.engine/src/Engine.h
@@ -642,6 +642,8 @@ public:
// Drum Rack pad note per chain (-1 = all notes; instrument/effect racks ignore it).
int32_t rackChainTriggerNote(int32_t trackId, int32_t deviceIndex, int32_t chain) const;
void rackSetChainTriggerNote(int32_t trackId, int32_t deviceIndex, int32_t chain, int32_t note);
+ std::string rackChainName(int32_t trackId, int32_t deviceIndex, int32_t chain) const;
+ void rackSetChainName(int32_t trackId, int32_t deviceIndex, int32_t chain, const std::string& name);
int32_t rackChainCount(int32_t trackId, int32_t deviceIndex) const;
int32_t rackAddChain(int32_t trackId, int32_t deviceIndex, int32_t instKind); // 0=Synth, 2=Physical, <0=none
bool rackRemoveChain(int32_t trackId, int32_t deviceIndex, int32_t chain);
diff --git a/src/native/nota.engine/src/Engine_Rack.cpp b/src/native/nota.engine/src/Engine_Rack.cpp
index 1afab642..1c28264d 100644
--- a/src/native/nota.engine/src/Engine_Rack.cpp
+++ b/src/native/nota.engine/src/Engine_Rack.cpp
@@ -94,6 +94,13 @@ void Engine::rackSetChainTriggerNote(int32_t t, int32_t di, int32_t c, int32_t n
if (auto* r = rackCoreAt(t, di)) r->setChainTriggerNote(c, note);
}
+std::string Engine::rackChainName(int32_t t, int32_t di, int32_t c) const {
+ auto* r = rackCoreAt(t, di); return r ? r->chainName(c) : std::string{};
+}
+void Engine::rackSetChainName(int32_t t, int32_t di, int32_t c, const std::string& name) {
+ if (auto* r = rackCoreAt(t, di)) r->setChainName(c, name);
+}
+
int32_t Engine::rackAddSamplerChain(int32_t t, int32_t di, const std::string& path, int32_t rootNote, bool loop) {
auto* r = rackCoreAt(t, di);
if (!r) return -1;
diff --git a/src/native/nota.engine/src/RackCore.h b/src/native/nota.engine/src/RackCore.h
index 4d89fc12..92bd1c10 100644
--- a/src/native/nota.engine/src/RackCore.h
+++ b/src/native/nota.engine/src/RackCore.h
@@ -97,6 +97,10 @@ public:
std::shared_ptr<Instrument> instrument; // null for effect-rack chains
std::vector<std::shared_ptr<Device>> devices; // insert chain
std::shared_ptr<ChainControls> ctl = std::make_shared<ChainControls>();
+ // Display name (v8). Message thread only — the audio thread never reads it.
+ // Empty means "fall back to the chain instrument's name": a Drum Rack pad that
+ // holds a Sampler would otherwise read "Nota Sampler" on all 16 pads.
+ std::string name;
};
// A macro (0..1) drives one target param over [rangeMin, rangeMax] in the
@@ -159,6 +163,19 @@ public:
}
}
+ // ---- chain name (message thread; UI metadata) -------------------------
+ std::string chainName(int32_t c) const {
+ RackState* st = live();
+ return (st && c >= 0 && c < static_cast<int32_t>(st->chains.size())) ? st->chains[c].name : std::string{};
+ }
+ bool setChainName(int32_t c, const std::string& name) {
+ auto ns = copyState();
+ if (c < 0 || c >= static_cast<int32_t>(ns->chains.size())) return false;
+ ns->chains[c].name = name;
+ commit(ns);
+ return true;
+ }
+
// ---- structural editing (message thread) ------------------------------
int32_t chainCount() const {
RackState* st = live(); return st ? static_cast<int32_t>(st->chains.size()) : 0;
@@ -474,6 +491,7 @@ public:
putI32(b, c.ctl->chokeGroup.load(std::memory_order_relaxed));
putI32(b, c.ctl->tune.load(std::memory_order_relaxed));
putF32(b, c.ctl->decay.load(std::memory_order_relaxed));
+ putString(b, c.name); // v8: pad/chain display name
const int32_t ik = c.instrument ? c.instrument->kind() : -1;
putI32(b, ik);
// v4: kind -1 = hosted plugin instrument OR no instrument; the id (empty
@@ -562,6 +580,7 @@ public:
c.ctl->tune.store(getI32(cur), std::memory_order_relaxed);
c.ctl->decay.store(getF32(cur), std::memory_order_relaxed);
}
+ if (ver >= 8) c.name = getString(cur);
const int32_t ik = getI32(cur);
std::string instPluginId;
if (ik == -1 && ver >= 4) instPluginId = getString(cur); // v4 plugin/none id
@@ -782,7 +801,7 @@ private:
static float clamp01(float v) { return std::isfinite(v) ? std::clamp(v, 0.0f, 1.0f) : 0.0f; }
static constexpr uint32_t kMagic = 0x314B524E; // 'NRK1'
- static constexpr uint32_t kBlobVersion = 7; // v2 triggerNote; v3 Sampler; v4 plugins; v5 zones/names/rack-out/curve; v6 drum pad shaping + swing/humanize; v7 effect-rack mode/dry-wet/pdc/select
+ static constexpr uint32_t kBlobVersion = 8; // v2 triggerNote; v3 Sampler; v4 plugins; v5 zones/names/rack-out/curve; v6 drum pad shaping + swing/humanize; v7 effect-rack mode/dry-wet/pdc/select; v8 chain name
std::shared_ptr<RackState> authoring_;
std::vector<std::shared_ptr<RackState>> states_;
diff --git a/src/native/nota.engine/src/nota_engine_rack.cpp b/src/native/nota.engine/src/nota_engine_rack.cpp
index d5f061e5..954fe962 100644
--- a/src/native/nota.engine/src/nota_engine_rack.cpp
+++ b/src/native/nota.engine/src/nota_engine_rack.cpp
@@ -35,6 +35,12 @@ int32_t nota_rackdev_add_plugin_chain_device(NotaEngine* e, int32_t t, int32_t d
}
int32_t nota_rack_chain_trigger_note(const NotaEngine* e, int32_t t, int32_t c) { return e ? CENG(e)->rackChainTriggerNote(t, -1, c) : -1; }
void nota_rack_set_chain_trigger_note(NotaEngine* e, int32_t t, int32_t c, int32_t note) { if (e) ENG(e)->rackSetChainTriggerNote(t, -1, c, note); }
+const char* nota_rack_chain_name(const NotaEngine* e, int32_t t, int32_t c) {
+ static std::string s; s = e ? CENG(e)->rackChainName(t, -1, c) : std::string{}; return s.c_str();
+}
+void nota_rack_set_chain_name(NotaEngine* e, int32_t t, int32_t c, const char* name) {
+ if (e) ENG(e)->rackSetChainName(t, -1, c, name ? name : "");
+}
int32_t nota_rackdev_chain_trigger_note(const NotaEngine* e, int32_t t, int32_t di, int32_t c) { return e ? CENG(e)->rackChainTriggerNote(t, di, c) : -1; }
void nota_rackdev_set_chain_trigger_note(NotaEngine* e, int32_t t, int32_t di, int32_t c, int32_t note) { if (e) ENG(e)->rackSetChainTriggerNote(t, di, c, note); }
diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.cs
index 32e3edf5..60ada3c8 100644
--- a/tests/Nota.SmokeTest/Program.cs
+++ b/tests/Nota.SmokeTest/Program.cs
@@ -4998,6 +4998,12 @@ Console.WriteLine("-- Drum Rack: engine + C ABI + persistence --");
re.StopTransport();
Check(Rms(dbuf, frames) > 1e-4f, $"drum-rack sampler pad is audible (rms={Rms(dbuf, frames):0.0000})");
+ // Pad names (blob v8): a Sampler pad reports the same instrument name on every pad,
+ // so the rack carries its own per-chain label.
+ Check(re.RackChainName(t, p2).Length == 0, "pad name starts empty (falls back to the instrument name)");
+ re.RackSetChainName(t, p0, "Kick"); re.RackSetChainName(t, p2, "Snare");
+ Check(re.RackChainName(t, p0) == "Kick" && re.RackChainName(t, p2) == "Snare", "pad names round-trip");
+
// Per-pad shaping (choke / tune / decay) + kit-level swing/humanize (blob v6).
re.RackSetChainChoke(t, p0, 1); re.RackSetChainChoke(t, p1, 1);
re.RackSetChainTune(t, p2, 7); re.RackSetChainDecay(t, p2, 0.4f);
@@ -5031,6 +5037,7 @@ Console.WriteLine("-- Drum Rack: engine + C ABI + persistence --");
Check(dst.RackChainInstrumentKind(ft, 2) == 1 && dst.RackChainTriggerNote(ft, 2) == 40, "sampler pad + note restored (rack blob)");
Check(dst.RackChainChoke(ft, 0) == 1 && dst.RackChainTune(ft, 2) == 7 && Math.Abs(dst.RackChainDecay(ft, 2) - 0.4f) < 1e-4, "pad choke/tune/decay restored (blob v6)");
Check(Math.Abs(dst.RackSwing(ft) - 0.3f) < 1e-4 && Math.Abs(dst.RackHumanize(ft) - 0.15f) < 1e-4, "kit swing/humanize restored (blob v6)");
+ Check(dst.RackChainName(ft, 0) == "Kick" && dst.RackChainName(ft, 2) == "Snare", "pad names restored (blob v8)");
}
finally
{
@@ -5038,6 +5045,74 @@ Console.WriteLine("-- Drum Rack: engine + C ABI + persistence --");
}
}
+// ================= Factory drum kits: recipes → samples → Drum Rack =========
+// The shipped kits are code, not audio: the catalog is checked for structure, the
+// renderer for determinism and level, and the service for assembling a playable rack.
+Console.WriteLine("-- Factory drum kits --");
+{
+ var kits = Nota.Infrastructure.Kits.KitCatalog.All;
+ Check(kits.Count == 10, $"ten factory kits ({kits.Count})");
+
+ var kitIds = new System.Collections.Generic.HashSet<string>();
+ bool padsOk = true, notesOk = true, namesOk = true;
+ foreach (var k in kits)
+ {
+ if (!kitIds.Add(k.Id)) padsOk = false;
+ if (k.Pads.Count != 16) padsOk = false;
+ var padNotes = new System.Collections.Generic.HashSet<int>();
+ foreach (var pad in k.Pads)
+ {
+ if (pad.Note < 36 || pad.Note > 51 || !padNotes.Add(pad.Note)) notesOk = false;
+ if (string.IsNullOrWhiteSpace(pad.Name)) namesOk = false;
+ }
+ }
+ Check(padsOk, "every kit has a unique id and 16 pads");
+ Check(notesOk, "pad notes are unique and inside the GM bank (36..51)");
+ Check(namesOk, "every pad is named");
+
+ // Rendering: deterministic, on target level, finite, and long enough to be a drum.
+ var kick = kits[0].Pads[0];
+ var r1 = Nota.Infrastructure.Kits.KitRenderer.Render(kick, 12345);
+ var r2 = Nota.Infrastructure.Kits.KitRenderer.Render(kick, 12345);
+ bool same = r1.Frames == r2.Frames && r1.Channels == r2.Channels;
+ if (same) for (int i = 0; i < r1.Interleaved.Length; i++) if (r1.Interleaved[i] != r2.Interleaved[i]) { same = false; break; }
+ Check(same, "the same seed renders the same audio");
+ Check(Nota.Infrastructure.Kits.KitRenderer.Render(kick, 999).Frames != 0, "a different seed still renders");
+
+ double peak = 0; bool finite = true;
+ foreach (var v in r1.Interleaved) { peak = Math.Max(peak, Math.Abs(v)); if (!float.IsFinite(v)) finite = false; }
+ Check(finite, "rendered audio is finite");
+ Check(peak <= 1.0 && Math.Abs(20 * Math.Log10(peak) - kick.PeakDb) < 0.6,
+ $"rendered peak hits the recipe's target ({20 * Math.Log10(peak):0.0} dBFS, want {kick.PeakDb:0.0})");
+ Check(r1.Frames > r1.SampleRate / 50, $"one-shot is longer than 20 ms ({r1.Frames * 1000 / r1.SampleRate} ms)");
+
+ // Building a rack from a kit: every pad loaded, named, choked and audible.
+ var svc = new DrumKitService();
+ Check(svc.All().Count == kits.Count, "the kit service lists the catalog");
+ using var ke = new NotaEngine();
+ int kt = svc.CreateTrack(ke, kits[0].Id, out string kitWarn);
+ Check(kt > 0 && kitWarn.Length == 0, $"kit loaded onto a new Drum Rack track ({(kitWarn.Length == 0 ? "no warnings" : kitWarn)})");
+ Check(ke.TrackInstrumentKind(kt) == 4, "the kit's track is a Drum Rack");
+ Check(ke.RackChainCount(kt) == 16, $"all 16 pads loaded ({ke.RackChainCount(kt)})");
+ Check(ke.RackChainName(kt, 0) == kits[0].Pads[0].Name, $"pad 1 is named '{ke.RackChainName(kt, 0)}'");
+ Check(ke.RackChainTriggerNote(kt, 0) == 36, "pad 1 triggers on C1");
+ int hats = 0;
+ for (int c = 0; c < ke.RackChainCount(kt); c++) if (ke.RackChainChoke(kt, c) == 1) hats++;
+ Check(hats == 3, $"the three hats share a choke group ({hats})");
+
+ int kclip = ke.AddMidiClip(kt, 0.0, 4.0);
+ ke.SetClipNotes(kt, kclip, new[] { new NotaNote(36, 0.0, 1.0, 1.0f), new NotaNote(38, 1.0, 1.0, 1.0f) });
+ ke.SetBpm(120); ke.Seek(0); ke.Play();
+ var kbuf = new float[frames * 2];
+ ke.RenderOffline(kbuf, frames);
+ ke.StopTransport();
+ Check(Rms(kbuf, frames) > 1e-4f && float.IsFinite(kbuf[0]), $"a kit pad plays from a clip (rms={Rms(kbuf, frames):0.0000})");
+
+ // Loading a second kit into the same rack replaces its pads rather than stacking.
+ Check(svc.LoadInto(ke, kt, kits[1].Id, out _) && ke.RackChainCount(kt) == 16, "loading another kit replaces the pads");
+ Check(ke.RackChainName(kt, 0) == kits[1].Pads[0].Name, "the replaced pads carry the new kit's names");
+}
+
// ===================== M9-D: automation segment curves =====================
// Device-free: per-segment curvature shaping + the curve field round-trips
// through get/set points (widened NotaAutomationPoint).