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.

(feat) Nota Vocoder audio effect (#113) (#218)

Egor Khindikaynene173014276b3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb0f32a4..f583b2d5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,14 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
## [Unreleased]
### Added
+- **Nota Vocoder** (nota-daw/nota#113): a new audio effect with two inputs. The track it
+ sits on is the voice; drop it on a vocal and you hear a robot voice straight away, from an
+ internal **Saw** (at a chosen **Pitch**). Switch the carrier to **Noise** for a whisper, or
+ to **Track** and pick another track — a pad, a synth — to make it speak the words; mute
+ that track and it keeps feeding the vocoder. 8–32 bands, **Formant** to make the voice
+ smaller or larger, **Unvoiced** to keep consonants clear, **Hold** to freeze the bands, and
+ a live graph of each band whose edges you drag to set the range. Seven presets (Robot
+ choir, Talk box, Whisper…). Agents route a carrier track with `set_device_sidechain`.
- **Make the whole interface larger or smaller** (nota-daw/nota#38): **Settings → Appearance
→ Interface scale** offers 75, 100, 125, 150 and 200 %. The change applies at once to every
window, menu, tooltip and dialog — text, buttons, knobs, track headers, device cards — and
@@ -31,6 +39,11 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
small to read on a laptop screen, or 75 % to fit more tracks on a small one.
### Fixed
+- Duplicating a track keeps each effect's sidechain source and tap; the compressor's key
+ was dropped on the copy.
+- A sidechain source keeps feeding its key when it is muted or another track is soloed (the
+ pre tap, like a console's pre-fader send): ducking against a muted kick, or a vocoder under
+ a muted vocal, no longer goes quiet. A deleted source now counts as no key at all.
- **macOS: About Nota and Settings… sit directly in the Nota app menu** (nota-daw/nota#160):
they used to hide inside an extra **Nota ›** submenu. The bold **Nota** menu now opens
with About Nota, then Settings… (⌘,), then Services, Hide and Quit, as in other Mac apps.
diff --git a/FEATURES.md b/FEATURES.md
index 0e6e0b26..47c8be9b 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -794,6 +794,13 @@ audio effects after it keep running and keep their settings; saved with the proj
Amount, bipolar Feedback ±90 %, Width 0–200 %, Warmth (dark, saturated BBD line), Mix. Every voice's
delay or detune over two cycles (drag for Amount), the voices' stereo field, the detune and delay
ranges, and a status strip; 34 factory presets; MCP `read_chorus` / `set_chorus`.
+- **Nota Vocoder** (26) — a channel vocoder: the track it sits on is the voice (modulator, Mod gain,
+ key meter); the carrier is an internal Saw (at a Pitch, C0–C7 — a robot voice by default), Noise,
+ or another track picked on the card with its colour (Pre / Post tap; keeps feeding while muted),
+ with a Tilt. 8–32 bands between Low and High, Q, Formant ±12 st, Attack, Release; Unvoiced noise
+ for consonants, Hold, Mix, Gain. A live graph of each band's voice level and the carrier, with
+ draggable range edges; 7 factory presets; a carrier track is routed over MCP with
+ `set_device_sidechain`.
- **Forge**, **Valve** and **Vintage** each carry an **OVERSAMPLE** selector
(Off/2×/4×/8×) to suppress aliasing under heavy drive.
diff --git a/specs/028-vocoder-effect/checklists/requirements.md b/specs/028-vocoder-effect/checklists/requirements.md
new file mode 100644
index 00000000..eef8a680
--- /dev/null
+++ b/specs/028-vocoder-effect/checklists/requirements.md
@@ -0,0 +1,38 @@
+# Specification Quality Checklist: Nota Vocoder audio effect
+
+**Purpose**: Validate specification completeness and quality before proceeding to planning
+**Created**: 2026-10-20
+**Feature**: [spec.md](../spec.md)
+
+## Content Quality
+
+- [x] No implementation details (languages, frameworks, APIs)
+- [x] Focused on user value and business needs
+- [x] Written for non-technical stakeholders
+- [x] All mandatory sections completed
+
+## Requirement Completeness
+
+- [x] No [NEEDS CLARIFICATION] markers remain
+- [x] Requirements are testable and unambiguous
+- [x] Success criteria are measurable
+- [x] Success criteria are technology-agnostic (no implementation details)
+- [x] All acceptance scenarios are defined
+- [x] Edge cases are identified
+- [x] Scope is clearly bounded
+- [x] Dependencies and assumptions identified
+
+## Feature Readiness
+
+- [x] All functional requirements have clear acceptance criteria
+- [x] User scenarios cover primary flows
+- [x] Feature meets measurable outcomes defined in Success Criteria
+- [x] No implementation details leak into specification
+
+## Notes
+
+- FR-007 resolved 2026-10-20: a Pitch control on the card, default C3.
+- The Nota Context section names engine / managed / UI areas and the compressor's sidechain
+ mechanism on purpose — the project template asks for it to drive the plan; the
+ requirements themselves stay behavioural.
+- Items marked incomplete require spec updates before `/speckit-clarify` or `/speckit-plan`
diff --git a/specs/028-vocoder-effect/contracts/device-params.md b/specs/028-vocoder-effect/contracts/device-params.md
new file mode 100644
index 00000000..3235134e
--- /dev/null
+++ b/specs/028-vocoder-effect/contracts/device-params.md
@@ -0,0 +1,61 @@
+# Contract: Nota Vocoder parameters and scope
+
+Engine-facing contract for builtin kind **26**. Read through the existing C ABI
+(`nota_device_param_*`, `nota_device_get_param` / `set_param`,
+`nota_builtin_device_param_default`, `nota_device_scope`). No new ABI.
+
+## Parameters
+
+All values are normalized 0..1 at the ABI (`paramMin 0`, `paramMax 1`). Index order is the
+persisted layout — **append only, never reorder**. Names are what presets (`Fx(...)`), the
+automation menu and MCP show; they are sentence case.
+
+| # | Name | Mapping (normalized → unit) | Default (unit / norm) |
+|---|---|---|---|
+| 0 | Bands | `8 + round(v · 24)` | 16 / 0.3333 |
+| 1 | Low | exp 20 Hz – 1 kHz | 80 Hz / 0.3544 |
+| 2 | High | exp 2 kHz – 20 kHz | 8 kHz / 0.6021 |
+| 3 | Q | `1 + 9v` | 5.0 / 0.4444 |
+| 4 | Formant | `round((v − 0.5) · 24)` st | 0 st / 0.5 |
+| 5 | Attack | exp 0.5 – 100 ms | 2.0 ms / 0.2616 |
+| 6 | Release | exp 5 – 1000 ms | 40 ms / 0.3925 |
+| 7 | Mod gain | `(v − 0.5) · 48` dB | 0 dB / 0.5 |
+| 8 | Carrier | `round(v · 2)`: 0 Saw · 1 Noise · 2 Track (the sidechain) | Saw / 0 |
+| 9 | Tilt | `(v − 0.5) · 24` dB | +3 dB / 0.625 |
+| 10 | Pitch | `round(v · 84)` semitones above C0 (C0–C7) | C3 / 0.4286 |
+| 11 | Unvoiced | `v · 100` % | 35 % / 0.35 |
+| 12 | Mix | `v · 100` %, equal-power | 100 % / 1.0 |
+| 13 | Gain | `(v − 0.5) · 24` dB | 0 dB / 0.5 |
+| 14 | Hold | `v ≥ 0.5` | off / 0 |
+
+The input is the modulator (the voice). `acceptsSidechain() == true` — the sidechain is the
+carrier track, used when Carrier = Track; a new instance sets `sidechainTapPre = 1`.
+
+## Scope layout (`nota_device_scope`)
+
+Written once per audio block; UI reads at 60 Hz, torn reads allowed. Returns 100 floats
+(fewer if `max_samples` is smaller).
+
+| Offset | Count | Meaning |
+|---|---|---|
+| 0 | 1 | Key (modulator after Mod gain) peak, linear |
+| 1 | 2 | Output peak L, R, linear |
+| 3 | 1 | Active band count N (8–32) |
+| 4 | 32 | Band envelope 0..1 (display-scaled; first N valid) |
+| 36 | 32 | Carrier band level 0..1 (first N valid) |
+| 68 | 32 | Analysis band centre, Hz (first N valid) |
+
+## Behaviour guarantees (tested in the smoke test)
+
+- Param count 15; names as above; defaults as above (`nota_builtin_device_param_default`).
+- Param round-trip and `cloneDevice` (duplicate track) preserve all 15 values and the
+ sidechain source / tap.
+- Defaults on a speech track → a robot voice (Saw), audible, finite, near the voice's level,
+ following the syllables; Mod gain −20 dB → about −20 dB out.
+- A silent track → silence.
+- Carrier = Track with a chord track → audible; a voice 20 dB quieter vocodes within 3 dB;
+ within 6 dB of the chord track alone; a muted chord track still feeds it (Pre).
+- Carrier = Track with no track, or its track deleted → the output equals the bypassed track
+ (after a 10 ms fade). A routed but silent carrier track → silent wet.
+- Every factory preset on a speech track is audible and peaks below 0 dBFS.
+- Two offline renders of the same project are sample-identical.
diff --git a/specs/028-vocoder-effect/contracts/mcp.md b/specs/028-vocoder-effect/contracts/mcp.md
new file mode 100644
index 00000000..24b6d0f7
--- /dev/null
+++ b/specs/028-vocoder-effect/contracts/mcp.md
@@ -0,0 +1,15 @@
+# Contract: Nota Vocoder over MCP
+
+No new MCP tools. The vocoder is reachable through the existing generic ones.
+
+| Task | Tool | Notes |
+|---|---|---|
+| Find it | effect list (from `BuiltinDeviceCatalog`) | Entry "Nota Vocoder", kind 26, role / aliases: vocoder, robot voice, talk box, choir. |
+| Add it | the existing add-built-in-device tool with kind 26 | Same as any audio effect. |
+| Read / set params | the existing device param tools | Names and ranges per [device-params.md](device-params.md). |
+| Use another track as the carrier | set param **Carrier** to 1.0 (Track), then `set_device_sidechain(trackId, deviceIndex, sourceTrackId, tapPre?, gainDb?)` | The vocoder's own track is the voice. `gainDb` trims the carrier track. |
+| Watch it | `get_device_sidechain` | No vocoder-specific reader in v1. |
+
+Only change: the descriptions of `get_device_sidechain` / `set_device_sidechain` list
+"Nota Vocoder (kind 26) — its carrier track" among the devices that take a key, so an agent
+knows to route one.
diff --git a/specs/028-vocoder-effect/data-model.md b/specs/028-vocoder-effect/data-model.md
new file mode 100644
index 00000000..0ac6aae5
--- /dev/null
+++ b/specs/028-vocoder-effect/data-model.md
@@ -0,0 +1,53 @@
+# Data Model: Nota Vocoder
+
+Phase 1 of [plan.md](plan.md). The persisted parameter table and the scope layout are the
+contract in [contracts/device-params.md](contracts/device-params.md); this file describes
+the entities and their rules.
+
+## Vocoder device
+
+A built-in audio effect on a track's chain, `builtinKind() == 26`, `name() == "Nota Vocoder"`.
+
+| Field | Kind | Notes |
+|---|---|---|
+| params[15] | normalized 0..1 floats | Order = persisted layout, **append-only** (see contract). |
+| bypassed | bool | Base `Device`; power switch. |
+| sidechain source | track id or −1 | Base sidechain; the carrier track (Carrier = Track). |
+| sidechain tap | 0 post / 1 pre | Base sidechain; default **1 (pre)** for a new Vocoder. |
+| sidechain gain | dB | Base sidechain; default 0, trims the carrier track. |
+
+**Validation**
+- Low is clamped so that `High / Low ≥ 2` (one octave) when either moves.
+- Bands, Carrier, Pitch, Hold are discrete: `round(v · (steps − 1))`.
+- A source equal to the device's own track or one of its ancestor groups is refused by the
+ picker (R-12); the engine accepts any id, as today.
+
+**State transitions**
+- *Carrier track*: None → Track (picker / MCP; picking sets Carrier = Track) → None (picker, MCP, or source track deleted — the
+ existing sidechain fallback). Undo restores the previous source.
+- *Carrier*: Saw ⇄ Noise ⇄ Track, 10 ms crossfade. Track with no source passes the track through.
+- *Band layout*: (Bands, Low, High, Q, Formant) change → coefficients recomputed at control
+ rate; a Bands change additionally ducks 5 ms out / reset / 5 ms in.
+- *Hold*: off → on freezes envelopes; on → off resumes following from the frozen values.
+
+## Band (runtime only, not persisted)
+
+| Field | Notes |
+|---|---|
+| analysis centre | `Low · (High/Low)^((i+0.5)/N)` |
+| synthesis centre | analysis centre · `2^(Formant/12)`; muted if `> 0.45 · fs` |
+| width | from Q |
+| envelope | follower output, 0..4 |
+| carrier level | follower on the synthesis band input, for the graph only |
+
+## Modulator source (existing)
+
+The engine's device sidechain — route slot per source track (max 8 per project), pre-FX
+pre-fader or post-FX post-fader tap, previous-block buffer. Persisted in
+`ProjectModel` device entries (`SidechainSource` as a track index, `SidechainTapPre`,
+`SidechainGain`). No change.
+
+## Factory preset
+
+`Fx("vocoder", 26, "<Name>", ("<Param name>", v), …)` in `FactoryPresetCatalog.cs`;
+modulator not stored (presets are params only). Six presets — see research R-11.
diff --git a/specs/028-vocoder-effect/plan.md b/specs/028-vocoder-effect/plan.md
new file mode 100644
index 00000000..a29bf473
--- /dev/null
+++ b/specs/028-vocoder-effect/plan.md
@@ -0,0 +1,145 @@
+# Implementation Plan: Nota Vocoder audio effect
+
+**Branch**: `feat/vocoder-effect` | **Date**: 2026-10-20 | **Spec**: [spec.md](spec.md)
+
+**Input**: Feature specification from `/specs/028-vocoder-effect/spec.md`
+
+**Note**: This template is filled in by the `/speckit-plan` command; its definition describes the execution workflow.
+
+## Summary
+
+A new built-in audio effect, **Nota Vocoder** (builtin kind **26**): a classic channel vocoder
+in one header, `src/native/nota.engine/src/Vocoder.h` (`: public Device`). The track the
+effect sits on is the **modulator** (the voice). The **carrier** is an internal band-limited
+saw at a **Pitch** (the default — a robot voice at once), white noise, or another track that
+comes in through the **existing device sidechain** (`acceptsSidechain() → true`, the engine's
+route buses, pre / post tap, generic project persistence and the MCP `set_device_sidechain` /
+`get_device_sidechain` tools), so no new routing, ABI or project format is needed. 8–32
+analysis band-passes with envelope followers drive matching synthesis band-passes (shifted
+by **Formant**), plus sibilance-gated unvoiced noise, Mix and Gain. Live data for the card
+goes out through the generic `nota_device_scope`. The managed side is the light
+audio-effect path: `VocoderDeviceBody` (700 × 260), a `VocoderGraph` control, catalogue /
+category entries, factory presets, smoke test. (The model was turned round after user
+testing — research R-15; the earlier "track = carrier" plan text below is kept where it
+does not conflict.)
+
+## Nota: Read Before Planning
+
+Consult the matching source of truth before designing:
+
+- **Engine work** → [`ARCHITECTURE.md`](../../ARCHITECTURE.md): the AR rules table is binding (AR-4 lock-free queue, AR-5 immutable snapshots, AR-6 audio-thread restrictions, AR-7 pure C ABI, AR-9 `Transport` is the only source of musical time).
+- **UI work** → [`DESIGN.md`](../../DESIGN.md) (Studio design language) and the `nota-design` skill.
+- **A built-in instrument / audio or MIDI effect** → the `nota-instrument` skill (DSP class, kind registration across C++ and C#, device-card UI).
+- **Build / packaging** → [`BUILD.md`](../../BUILD.md).
+- **Anything** → [`CONTRIBUTING.md`](../../CONTRIBUTING.md): licensing, dependency policy, PR expectations.
+
+All five apply. The design reference is [`design/vocoder/index.html`](../../design/vocoder/index.html).
+
+## Technical Context
+
+**Language/Version**: C++20 (engine DSP + three factory switches), C# / .NET 10 (card,
+catalogue, presets, MCP description, smoke test).
+
+**Primary Dependencies**: None new. Avalonia (existing) for the card.
+
+**Storage**: Generic — device params are persisted by `builtinKind()` + param values;
+the sidechain source / tap / gain are already in `ProjectModel` (format v16). No format bump.
+
+**Audio-Thread Impact** *(required — state explicitly)*: New DSP runs inside
+`Device::process` on the audio thread. All buffers (band filter states for 32 bands × 3
+paths, scope buffer) are fixed-size members, sized at construction — no allocation, lock or
+I/O (AR-6). Params are `std::atomic<float>` written by the message thread (existing device
+param path, AR-4). Filter coefficients are recomputed at control rate (every 32 samples)
+when a param moves; band-count changes are applied by a short output duck, not by
+reallocating. The modulator buffer is the engine's previous-block route bus (read-only,
+existing). Scope data is written to an atomic-free float array that the UI reads with
+torn reads allowed (existing `scope()` contract).
+
+**Testing**: `tests/Nota.SmokeTest` (kind / name / param count / defaults / round-trip /
+clone / render: carrier + modulator → audible and finite, no modulator → silent wet,
+modulator silent → silent wet, determinism of two offline renders); the `--palette` and
+design guard checks; a visual check of the card per `nota-ui-verify`.
+
+**Target Platform**: macOS (arm64 + x86_64), Windows, Linux — the engine is portable C++.
+
+**Project Type**: Desktop DAW (native engine + managed UI).
+
+**Performance Goals**: ≤ the CPU of Nota Chamber per instance at 32 bands, 48 kHz
+(SC-004); 8 instances without xruns at a 128-sample buffer.
+
+**Constraints**: Zero added latency (no PDC). Click-free param changes. The modulator is
+one block late (route-bus contract) — accepted, see research R-2. At most 8 distinct
+sidechain source tracks per project (`Engine::kMaxRoutes`), shared with other devices.
+
+**Scale/Scope**: 1 DSP header (~600 lines), 3 engine switch entries, 1 card body + 1 graph
+control, catalogue / category / presets, smoke-test block, docs.
+
+## Constitution Check
+
+*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
+
+| Principle | Status | Note |
+|---|---|---|
+| I. Real-Time Audio Safety | Pass | Pre-sized state, atomics for params, no alloc / lock / I/O in `process`; band-count change without reallocation (R-4). |
+| II. Boundary Discipline | Pass | No new ABI: params, sidechain and scope already cross through `nota_engine.h`. Only the `nota_device_accepts_sidechain` doc comment gains "Nota Vocoder". No JUCE. |
+| III. Licensing Hygiene | Pass | New files carry the SPDX header; no dependency. |
+| IV. Verification Gate | Pass | Smoke test extended (see Testing). |
+| V. One Logical Change per PR | Pass | One effect, one PR; the mockup in `design/vocoder/` goes with it or is dropped before merge (user's call). |
+| VI. Documentation Stays in Sync | Pass | CHANGELOG `[Unreleased]`, `nota-features`, `nota-docs` (EN + RU page for the effect). No shortcut changes. |
+| VII. Spec-First | Pass | This spec → plan → tasks. |
+| VIII. Safety rules not weakened | Pass | Nothing bent. |
+
+**Post-design re-check (after Phase 1)**: unchanged — Pass on all eight. The design adds no
+ABI, no format change and no allocation path.
+
+## Project Structure
+
+### Documentation (this feature)
+
+```text
+specs/028-vocoder-effect/
+├── plan.md # This file
+├── research.md # Phase 0: DSP and integration decisions
+├── data-model.md # Phase 1: params, scope layout, sidechain state
+├── quickstart.md # Phase 1: how to verify end-to-end
+├── contracts/
+│ ├── device-params.md # the param table (persisted, append-only) + scope layout
+│ └── mcp.md # what MCP exposes and how
+└── tasks.md # /speckit-tasks (not created here)
+```
+
+### Source Code (repository root)
+
+```text
+src/native/nota.engine/
+├── include/nota/nota_engine.h # doc comment only: accepts_sidechain lists the Vocoder
+└── src/
+ ├── Vocoder.h # NEW — the DSP (Device, builtinKind 26)
+ └── Engine_Devices.cpp # +include, +case 26 in addTrackBuiltinDevice / cloneDevice / makeBuiltinDevice
+
+src/managed/
+├── Nota.App/
+│ ├── DeviceCards/Bodies/VocoderDeviceBody.cs # NEW — the 700 × 260 card
+│ ├── DeviceCards/DeviceCardFactory.cs # [26] = new VocoderDeviceBody()
+│ └── Controls/VocoderGraph.cs # NEW — envelope graph (NotaGraph), Low / High edge drag
+├── Nota.Application/Palette/
+│ ├── BuiltinDeviceCatalog.cs # "Nota Vocoder", AudioEffect, kind 26, descriptor
+│ └── DeviceCategories.cs # under "Modulation"
+├── Nota.Infrastructure/Persistence/
+│ └── FactoryPresetCatalog.cs # Fx("vocoder", 26, …) × 6
+└── Nota.Mcp/Tools/DeviceTools.cs # sidechain tool descriptions mention the Vocoder
+
+tests/Nota.SmokeTest/Program.cs # Vocoder block (+ a helper file if Program.cs grows)
+
+CHANGELOG.md · FEATURES.md · ../nota-docs (EN + RU)
+```
+
+**Structure Decision**: The light built-in audio-effect path from the `nota-instrument`
+skill (§2 "Audio effects"): one DSP header, three engine switches, one card body. The
+modulator reuses the device sidechain end to end (engine routing, persistence, MCP), the
+card's live data reuses `nota_device_scope`. Nothing in `Engine.h`, the C ABI, the project
+model or the add / drop path changes.
+
+## Complexity Tracking
+
+No constitution violations; nothing to justify.
diff --git a/specs/028-vocoder-effect/quickstart.md b/specs/028-vocoder-effect/quickstart.md
new file mode 100644
index 00000000..9c010ba9
--- /dev/null
+++ b/specs/028-vocoder-effect/quickstart.md
@@ -0,0 +1,63 @@
+# Quickstart: verify Nota Vocoder
+
+How to prove the feature end-to-end. Contracts: [device-params.md](contracts/device-params.md),
+[mcp.md](contracts/mcp.md).
+
+## Prerequisites
+
+- Release engine build in `build/` (see the engine build dirs note in BUILD.md — a −O0
+ engine causes xruns and invalidates SC-003 / SC-004).
+- A speech or sung WAV clip (deterministic; synth notes drift between renders) and a
+ sustained chord clip.
+
+## 1. Build and smoke test (gate)
+
+```bash
+scripts/build.sh
+```
+
+Expect the Vocoder block of the smoke test to pass: kind 26, name, 15 params, defaults,
+round-trip, clone, the four render checks and the determinism check (contract § Behaviour
+guarantees).
+
+## 2. The P1 flow in the app
+
+1. New project. Track 1: audio, the speech clip.
+2. Browser → Audio effects → Modulation → **Nota Vocoder** onto track 1. Play.
+3. Expect: a robot voice at C3 (Saw) at about the speech's level, following the syllables;
+ the key meter and the graph's bars move with it. **Pitch** changes the note without
+ clicks; **Noise** gives a whisper (Tilt and Pitch inactive).
+
+## 3. A pad that talks (Carrier = Track)
+
+1. Track 2: audio, the chord clip.
+2. On track 1's vocoder pick **Track 2** in the carrier picker (Carrier switches to Track),
+ tap **Pre**. Mute track 2.
+3. Expect: the chord speaks the words at about the chord's level; muting track 2 keeps it
+ working; **None** in the picker → track 1 heard unchanged. The picker does not list
+ track 1 or groups containing it.
+
+## 4. Shaping (US3) and click-free edits (SC-003)
+
+- At a 128-sample buffer, sweep every knob and drag the Low / High edges in the graph
+ during playback: no clicks, no xruns (check the CPU / xrun indicator).
+- Bands 8 → 32: graph shows 32 bars; Formant ±12 st changes size, not pitch; Unvoiced
+ makes "s" / "t" audible; Hold freezes the bars.
+
+## 5. Recall (US4, SC-005)
+
+- Save, close, reopen: same sound, same modulator and tap. Export twice → null test
+ residual ≤ −90 dBFS.
+- Delete track 2 → picker shows None; undo → Track 2 again.
+- Automate Formant → audible sweep. Load each factory preset → distinct, peaks < 0 dBFS.
+
+## 6. Design (FR-012, SC-007)
+
+- Visual check of the card per the `nota-ui-verify` recipe, in Studio Dark, Studio Light,
+ Ember Graphite, Ember Paper; compare with `design/vocoder/index.html`.
+- `RunStudio`, `RunThemes`, `RunLabels`, `RunIcons` and `--palette` pass in the smoke test.
+
+## 7. MCP
+
+- `set_device_sidechain(track1, idx, track2, tapPre: true)` → `get_device_sidechain`
+ returns `Accepts: true, SourceTrackId: track2`.
diff --git a/specs/028-vocoder-effect/research.md b/specs/028-vocoder-effect/research.md
new file mode 100644
index 00000000..3e0f4e59
--- /dev/null
+++ b/specs/028-vocoder-effect/research.md
@@ -0,0 +1,201 @@
+# Research: Nota Vocoder audio effect
+
+Phase 0 of [plan.md](plan.md). Each entry: decision, rationale, alternatives.
+
+## R-1 · How the modulator reaches the effect
+
+- **Decision**: Reuse the device sidechain. `Vocoder::acceptsSidechain()` returns true;
+ `sidechainSourceTrackId` / `setSidechainSourceTrackId` / `setSidechain` store the
+ source and the per-block buffer exactly like `Compressor.h`. The engine
+ (`Engine_Render.cpp`, step 2 of the track render) already hands every sidechain consumer
+ its source's route bus before `process()`; `recomputeRouting()` already assigns slots.
+- **Rationale**: Routing, the pre / post tap, project persistence (`ProjectModel`
+ `SidechainSource` / `SidechainTapPre`, format v16), undo, and the MCP tools all exist and
+ are generic over devices. Zero new ABI or format.
+- **Alternatives**: A dedicated second input bus on `Device` (a real two-input device) —
+ more correct for latency but touches the render loop, routing, ABI and persistence; no
+ gain for this request.
+
+## R-2 · Modulator timing (one block late) and FR-017
+
+- **Finding**: Route buses are double-buffered (`Engine.h`, "Signal routing (Phase B)"):
+ a consumer reads the source's **previous** block. Offline export pumps `renderOffline`
+ with caller-chosen block sizes.
+- **Decision**: Accept one block of modulator delay (≤ 2.7 ms at 128 / 48 kHz, ≤ 10.7 ms at
+ 512). FR-017 is read as: two offline renders of the same project are identical, and a
+ real-time render differs from an offline one only by that block offset when the block
+ sizes differ. The spec's FR-017 is updated to say so.
+- **Rationale**: Vocoder envelopes have ≥ 0.5 ms attack and typically 5–60 ms; a few ms of
+ modulator lag is inaudible in use and matches how the compressor behaves.
+- **Alternatives**: Render the source track first (order dependency, double render) —
+ rejected by the engine's routing design.
+
+## R-3 · Tap labels: "pre-fader" vs "pre-FX"
+
+- **Finding**: `tapPre = 1` taps **pre-FX, pre-fader**; `0` taps **post-FX, post-fader**
+ (`Device.h`). The compressor card labels them **Pre / Post**.
+- **Decision**: Same tap and labels ("Pre" / "Post" segments at the picker menu foot; tooltip
+ "Pre: before the source's effects and fader · Post: after both"). The spec's
+ "pre-fader / post-fader" wording is satisfied (pre is also pre-fader); the mockup's
+ "Pre-fader / Post-fader" button text becomes "Pre" / "Post" for consistency.
+
+## R-4 · Filter bank
+
+- **Decision**: Each band is a 4th-order band-pass = two cascaded TPT (Cytomic) SVF
+ band-pass sections, constant-peak-gain. Three banks of `kMaxBands = 32`: analysis (mono
+ modulator), synthesis L, synthesis R. State in fixed `std::array`s. Centres log-spaced:
+ `f_i = Low · (High/Low)^((i+0.5)/N)`; synthesis centres × `2^(Formant/12)`, clamped to
+ `0.45 · fs`; bands whose centre exceeds that are muted. Bandwidth from **Q** (1–10).
+ Coefficients recomputed every 32 samples only when Bands / Low / High / Q / Formant moved
+ (compare to cached normalized values), with the old/new Q and centres smoothed per block.
+- **Band-count change**: the new layout is staged; output gain ducks to 0 over 5 ms,
+ states are reset, the layout switches, gain returns over 5 ms. No allocation.
+- **Rationale**: SVFs are stable under modulation (Low / High dragged during playback,
+ SC-003), cheap (≈ 6 mul per section), and already used across the engine (Volt, Auto
+ Filter). 32 × 3 × 2 sections ≈ 190 SVF ticks / sample — well inside SC-004.
+- **Alternatives**: FFT / STFT vocoder (latency + PDC, spectral smearing; spec puts it out
+ of scope); 2nd-order bands (too much overlap at 32 bands → mushy).
+
+## R-5 · Envelope followers
+
+- **Decision**: Full-wave rectify the analysis band output, one-pole smoothing with
+ separate attack / release coefficients (`exp(−1 / (t · fs))`), times from **Attack**
+ (0.5–100 ms, exp map) and **Release** (5–1000 ms, exp map). **Hold** freezes the follower
+ (skip the update). **Mod gain** (−24…+24 dB, device param) is applied to the modulator
+ before the bank, summed in dB with the base `sidechainGainDb()` (default 0) so
+ `set_device_sidechain gainDb` stays meaningful.
+
+## R-6 · Carriers
+
+- **Input**: the track's stereo buffer, processed per channel.
+- **Saw**: polyBLEP saw at the **Pitch** note (C0–C7, 85 discrete steps, default C3 =
+ 130.81 Hz); written to both channels. Pitch change is glided over 10 ms (no click).
+- **Noise**: xorshift32 white noise, independent per channel.
+- **Tilt** (−12…+12 dB, default +3): first-order shelf pair pivoting at 1 kHz on the
+ carrier before the synthesis bank; skipped for Noise (spec: shown inactive).
+- Switching carrier crossfades over 10 ms (two sources rendered only during the fade).
+
+## R-7 · Unvoiced (sibilance) noise
+
+- **Decision**: A separate follower on the modulator high-passed at 4 kHz; its ratio to
+ the full-band follower (clamped 0..1, squared) gates high-passed (4 kHz) white noise,
+ scaled by **Unvoiced** and the HF follower level. Added to the wet path before Mix.
+- **Alternatives**: Copy the modulator's top band straight through (cheaper, but leaks the
+ voice unprocessed, which users perceive as "dry vocal bleed").
+
+## R-8 · Level and output
+
+- Wet sum is normalised by `sqrt(16 / N) · g(Q)` (calibrated in the smoke test so the
+ default preset with a −12 dBFS speech key and a −12 dBFS saw peaks at ≈ −6 dBFS across
+ band counts). **Mix** is an equal-power dry / wet blend; **Gain** (−12…+12 dB) last.
+- A silent modulator: envelopes decay to 0 → wet silent. No modulator routed at all: the
+ track passes through (FR-018, R-14).
+- Latency 0; `latencySamples()` not overridden.
+
+## R-9 · Live data for the card
+
+- **Decision**: `scope(float* out, int max)` (existing `nota_device_scope`) returns a fixed
+ layout (see [contracts/device-params.md](contracts/device-params.md)): key peak, out
+ peak L/R, active band count, band envelopes [32], carrier band levels [32], band
+ centres [32]. Written once per block on the audio thread into a member array; the UI reads
+ at 60 Hz with torn reads allowed (existing contract).
+- **Carrier line**: drawn through the per-band carrier levels (band resolution), not a fine
+ FFT spectrum as the mockup suggests — no FFT on the audio thread, and it shows exactly
+ what the bands see. The mockup's harmonic comb is illustrative.
+
+## R-10 · Card build (managed)
+
+- `VocoderDeviceBody : IDeviceBody`, `Width = 700`. Columns via `DeviceCardKit.Section`:
+ Modulator + Carrier (152) → Bands (fill) → Output (138), as in the mockup.
+- Modulator picker: a raised field with the source's track colour
+ (`ArrangementView.TrackBrush`) and name (`TrackNames.Of`); click opens a menu built
+ like the compressor's source list (every other track / return, "None" first) with a
+ Pre / Post `Segments` row at its foot. Writes through `SetDeviceSidechainSource` /
+ `SetDeviceSidechainTapPre` + `ctx.NotifyChanged()`.
+- Knobs: `KnobCell` × 7 (Bands, Low, High, Q, Formant, Attack, Release); sliders:
+ `SliderRow` (Gain, Tilt, Pitch, Unvoiced, Mix, Gain); `Segments` for Carrier;
+ `DeviceCardKit.Switch` for Hold; `MeterBar` for key and output. Inactive rules: Tilt
+ inactive on Noise, Pitch inactive unless Saw, band knobs + Mod gain inactive with no
+ source (`Inactive.Set`).
+- `VocoderGraph` (Controls/): `NotaGraph` well; viz-ink bars per band, teal carrier
+ polyline, `Rule` edges at Low / High, accent edge only while hovered / dragged; edge drag
+ writes Low / High params with `BeginAutomationWrite` / `EndAutomationWrite`; empty state
+ "Pick a modulator track to shape the carrier" (Ink 5).
+- 60 Hz refresh through `ctx.AddDeviceRefresher` reading `DeviceScope`.
+
+## R-11 · Presets
+
+Six `Fx("vocoder", 26, …)` presets by param name (values normalized):
+Init, Robot choir, Talk box, Whisper (Noise), Lo-fi robot (8 bands, Saw), Strings choir
+(32 bands, slow release). Folder "vocoder" — add it to `PresetDescriptors`' folder map if
+it is not vocabulary.
+
+## Spec adjustments from research
+
+- FR-017 reworded per R-2.
+- FR-003 / user story 1.4: tap labels "Pre" / "Post" per R-3 (meaning unchanged).
+
+## R-12 · Feedback through the modulator
+
+- **Finding**: The compressor's picker only hides its own track. For a compressor a loop
+ through a group is harmless (gain reduction is bounded); for a vocoder the wet output
+ could feed its own key and, with Mod gain up, grow.
+- **Decision**: The vocoder's picker hides its own track and every group it is nested in.
+ The envelope followers are clamped to 0..4 (≈ +12 dB) after Mod gain, so a loop through
+ a return still cannot run away. No change to the compressor's picker.
+
+## R-13 · Implementation notes (from /speckit-implement)
+
+- **Level**: the wet make-up is ×96 with a soft knee above −6 dBFS (never past 0 dBFS), and
+ envelopes clamp at 1.0; the test speech over the test chord peaks at about −5 dBFS.
+- **Unvoiced** is also gated by the carrier's level, so a silent carrier stays silent (US1.2).
+- **Preset audition**: the browser's audition rig has no other tracks, so it would play every
+ vocoder preset as silence. `Device::setPreviewKey` (no-op by default, called only by the
+ rig) hands the vocoder the phrase as its modulator for that preview.
+- **Duplicate track**: `Engine::cloneDevice` did not copy the sidechain source / tap / gain /
+ mix for any device; it does now (a compressor's key was lost on duplicate as well).
+- **Card**: the Pre / Post tap is a segment row under the picker rather than inside its menu
+ (a segmented control in a flyout does not fit the shared menu style).
+
+## R-14 · Level follows the carrier; no modulator passes through (user testing)
+
+- **Finding** (a Volt chord as carrier, the test speech as modulator): with the first build the
+ vocoded level tracked the modulator's level one-for-one — −17 dB at the test speech level,
+ −26 dB 10 dB quieter, −36 dB 20 dB quieter — while the voice track itself played at −23 dB,
+ so a normal vocal left the pad buried under the voice. With no modulator the output was
+ −180 dB: adding the effect silenced the track.
+- **Decision**: each band's weight is its envelope divided by the L2 norm of all envelopes,
+ followed by a slow AGC (5 ms up, 400 ms down) with a floor (0.003) under which the bands
+ stay shut; the wet sum takes √N · √(Q/5) · 7 make-up. Measured: the vocoded level stays
+ within ~3 dB over a 30 dB range of modulator level and within ~3 dB across 8 / 16 / 32
+ bands, and sits at the carrier's level. Unvoiced noise scales with the carrier's level.
+- **No modulator** (none routed, or the source track deleted): the output crossfades
+ (10 ms) to the input unchanged. The engine no longer gives a route slot to a source track
+ that is not in the graph, so a deleted source means "no key" for every keyed device (a
+ compressor then keys off its own input, as with no source) instead of a silent key.
+- **Mute**: a muted (or solo-gated) source track was skipped entirely, so muting the vocal
+ to hear only the pad silenced the vocoder. A sidechain source now keeps rendering for its
+ taps (pre tap live, post tap silent while muted) — FR-020.
+- **Alternatives**: an output AGC matching the wet level to the carrier's (drifts in
+ pauses and pumps); L1 normalisation (8 bands came out 7 dB louder than 16).
+
+## R-15 · The track is the voice; the carrier is Saw, Noise or another track (user testing)
+
+- **Finding**: the user dropped the vocoder on a track with a robot preset and no other track
+ and expected that track to come out as a robot voice — the classic hardware / Ableton model
+ (the input is the modulator, the carrier internal or external). The first build had it the
+ other way round (the input was the carrier, the voice came from another track), so nothing
+ vocoded until a second track was picked.
+- **Decision**: the input is always the modulator. Carrier (param 8) = **Saw** (0, default) ·
+ **Noise** (0.5) · **Track** (1, the device sidechain). The "pad on its own track hosts the
+ vocoder" setup is the same sound with the vocoder on the vocal and Carrier = Track (the
+ pad) — one model instead of two.
+- **Levels**: Saw / Noise weigh bands by the raw envelopes × 6.5, so the robot follows the
+ voice's level (measured: at the voice's level with the defaults; −20 dB voice → −20 dB
+ out). Track keeps R-14's energy-normalised weights, so the pad sits at its own level
+ whatever the voice's. The two blend through the carrier crossfade.
+- **No source**: only Carrier = Track with no track passes the voice through (FR-018);
+ Saw / Noise never need one. The preset audition's phrase stands in for a missing carrier
+ track.
+- **Persistence**: param 8 changes meaning (0 was Input). The effect is unreleased, so there
+ is no saved state to migrate.
diff --git a/specs/028-vocoder-effect/spec.md b/specs/028-vocoder-effect/spec.md
new file mode 100644
index 00000000..a48050af
--- /dev/null
+++ b/specs/028-vocoder-effect/spec.md
@@ -0,0 +1,310 @@
+# Feature Specification: Nota Vocoder audio effect
+
+**Feature Branch**: `feat/vocoder-effect`
+
+**Created**: 2026-10-20
+
+**Status**: Draft
+
+**Input**: User description: "Vocoder audio effect (nota-daw/nota#113): two inputs — carrier
+(the track the effect sits on, or an internal Saw/Noise carrier) and a modulator tapped from
+another track as a sidechain (pre/post fader). Design mockup: design/vocoder/index.html —
+card 700×260 with Modulator (source picker, gain, key meter), Carrier (Input/Saw/Noise,
+tilt), Bands (8–32 log-spaced bands, low/high range draggable in the envelope graph, Q,
+formant ±12 st, attack, release), Output (unvoiced noise, mix, gain, hold, output meter)."
+
+## Nota Context *(fill in — drives plan and tasks)*
+
+**Feature area** *(pick the main one)*:
+
+- [x] Engine (C++, `src/native/nota.engine`) — real-time audio rules apply, see `ARCHITECTURE.md` AR table
+- [x] Managed app (C#, `src/managed/*`) — domain, application, infrastructure, presentation
+- [x] UI (Avalonia, `src/managed/Nota.Presentation`) — follow `DESIGN.md` (Studio)
+- [ ] Plugin hosting (`pluginhost/`) — the only place JUCE is allowed
+- [ ] Build / packaging / CI (`scripts/`, `.github/`) — see `BUILD.md`
+- [ ] Docs only
+
+The main area is the engine: a new built-in audio effect kind (DSP + kind registration),
+plus its device card, browser / palette / MCP entries and factory presets. It reuses the
+sidechain source mechanism Nota Compressor already has (another track, pre / post tap);
+no new routing model.
+
+**Design reference**: [`design/vocoder/index.html`](../../design/vocoder/index.html) — the
+card at true size (running, picker open, no modulator), in all four colour themes.
+
+**Nota docs to keep in mind** *(links relative to `specs/<slug>/`, where this file lands)*:
+[`ARCHITECTURE.md`](../../ARCHITECTURE.md) (AR rules),
+[`CONTRIBUTING.md`](../../CONTRIBUTING.md) (licensing, dependency policy, PR
+expectations), [`BUILD.md`](../../BUILD.md), [`DESIGN.md`](../../DESIGN.md),
+[`FEATURES.md`](../../FEATURES.md).
+
+## Clarifications
+
+### Session 2026-10-20
+
+- Q: Where does the internal Saw carrier get its pitch? → A: A **Pitch** control on the
+ card (fixed note, default C3); it does not follow the track's notes.
+- Q (user testing): adding the vocoder silenced the track, and with a modulator the user
+ mostly heard the voice track itself. → A: interim fix — pass-through with no source, level
+ normalised by the voice's energy (research R-14). Superseded by the next answer.
+- Q (user testing): "I drop the vocoder on a track, there is no modulator, a robot-voice
+ preset is on — the track's own sound should come out as a robot voice (internal carrier)".
+ → A: **The track the vocoder sits on is the modulator (the voice).** The carrier is an
+ internal **Saw** (the default — a robot voice at once), **Noise**, or another **Track**
+ picked on the card. The earlier model (the track as the carrier, the voice picked from
+ another track) is dropped: the same result comes from putting the vocoder on the vocal
+ with Carrier = Track (the pad). Research R-15.
+
+## User Scenarios & Testing *(mandatory)*
+
+### User Story 1 - A robot voice from the track itself (Priority: P1)
+
+A producer drops Nota Vocoder on a vocal (or any) track. With its defaults — or a preset like
+Robot choir — the track's own sound comes out as a robot voice: the vocal's band levels shape
+an internal saw at the Pitch note. No other track is needed.
+
+**Why this priority**: It is what users expect when they drop a vocoder on a track, and the
+quickest way to hear the effect.
+
+**Independent Test**: Put the vocoder on a speech track with the defaults and play: a buzzy,
+intelligible robot voice at C3 that follows the syllables; Carrier = Noise gives a whisper.
+
+**Acceptance Scenarios**:
+
+1. **Given** a vocal track, **When** the user adds Nota Vocoder and plays, **Then** the vocal
+ is heard as a robot voice (Saw at C3) at about the vocal's own level, and the key meter and
+ the envelope graph move with the vocal.
+2. **Given** Carrier = Noise, **When** playing, **Then** the output is a whisper and Tilt is
+ shown inactive.
+3. **Given** the track is silent, **When** playing, **Then** the vocoder is silent too.
+4. **Given** Carrier = Saw, **When** switching to Noise and back, **Then** the switch is
+ click-free.
+
+---
+
+### User Story 2 - Make a pad "talk" with the vocal (Priority: P1)
+
+The producer has a sustained pad on another track. On the vocal track's vocoder they set
+Carrier = **Track** and pick the pad track: the pad articulates the vocal's words. They mute
+the pad track so only the vocoded sound is heard.
+
+**Why this priority**: The two-input case of #113.
+
+**Independent Test**: Vocal track with the vocoder, Carrier = Track, a chord track picked:
+the chord follows the speech's spectral envelope; muting the chord track keeps it working.
+
+**Acceptance Scenarios**:
+
+1. **Given** Carrier = Track and a pad track picked, **When** playing, **Then** the pad is
+ heard shaped by the vocal, at about the pad's level whatever the vocal's level.
+2. **Given** Carrier = Track and no track picked yet, **When** playing, **Then** the vocal
+ track is heard unchanged, as if the vocoder were bypassed.
+3. **Given** the carrier track is muted (Pre tap), **When** playing, **Then** the vocoded pad
+ is still heard.
+4. **Given** the carrier picker, **When** the user opens it, **Then** it lists every other
+ track and return with its colour and a **None** entry; this track and its groups are not
+ listed; a Pre / Post tap choice sits next to it. Picking a track sets Carrier = Track.
+
+---
+
+### User Story 3 - Shape the character (Priority: P2)
+
+The user tunes the sound: fewer bands for a lo-fi robot, more for intelligibility; moves
+the low / high band range by dragging its edges in the graph; narrows Q; shifts formants
+up or down to change the perceived size of the voice; sets attack / release for snappy or
+smeared articulation; adds unvoiced noise so "s" and "t" stay audible.
+
+**Why this priority**: Without these the effect sounds one way; with them it covers robot,
+choir, talk-box and whisper presets.
+
+**Independent Test**: With a fixed carrier and voice, change each control and observe the
+expected audible and visual change (graph bar count, range edges, spectrum).
+
+**Acceptance Scenarios**:
+
+1. **Given** Bands = 8, **When** the user sets 32, **Then** the graph shows 32 bars,
+ log-spaced between Low and High, and the result is more intelligible.
+2. **Given** the envelope graph, **When** the user drags the low or high range edge,
+ **Then** the matching knob follows, the edge is accent-coloured while dragged, and the
+ band layout updates without clicks or dropouts.
+3. **Given** Formant = 0 st, **When** set to +12 st, **Then** the voice sounds smaller /
+ brighter; −12 st larger / darker; the pitch does not change.
+4. **Given** a sibilant voice, **When** Unvoiced is raised, **Then** high-frequency noise
+ follows the sibilants and consonants become clearer.
+5. **Given** Hold is switched on, **When** the voice keeps changing, **Then** the band
+ envelopes freeze at their current levels (the carrier keeps sounding through them)
+ until Hold is switched off.
+
+---
+
+### User Story 4 - Recall, automate and reuse (Priority: P3)
+
+Settings, the carrier track and the tap are saved with the project, survive undo / redo,
+can be automated and MIDI-learned like any other device parameter, and come in factory
+presets (e.g. Robot choir, Talk box, Whisper, Lo-fi robot, Strings choir).
+
+**Why this priority**: Expected of every built-in device; not needed to prove the effect.
+
+**Independent Test**: Configure the effect, save, reopen: identical sound and carrier track.
+Automate Formant across a clip: audible sweep. Load each factory preset on a vocal track:
+each is audible and none clips.
+
+**Acceptance Scenarios**:
+
+1. **Given** a configured vocoder, **When** the project is saved and reopened, **Then**
+ every parameter, the carrier track and the tap are restored.
+2. **Given** the carrier track is deleted, **When** the user undoes the deletion,
+ **Then** the vocoder's carrier points to the restored track again.
+3. **Given** an agent connected over MCP, **When** it sets Carrier = Track and the device's
+ sidechain, **Then** it routes the carrier the same way it keys a Nota Compressor.
+
+---
+
+### Edge Cases
+
+- **Carrier = Track, no track picked** (None): the track passes through unchanged; the graph
+ shows one line, "Pick a carrier track · until then the sound passes through"; band knobs
+ are shown inactive.
+- **Carrier track deleted** while selected: the picker falls back to None and the track
+ passes through unchanged; undo restores the carrier track.
+- **Feedback**: the vocoder's own track and the groups it sits in are not offered as
+ carriers (their signal contains the vocoder's output, which would loop back through the
+ one-block route bus). Returns are offered; a return fed by this track can still loop, so
+ the envelopes and the wet path are level-limited and cannot run away (research R-12).
+- **Carrier is a return / group / master**: returns and groups are allowed; master is not
+ offered.
+- **Effect bypassed** (power off): the track passes unchanged; the graph stops moving.
+- **Low ≥ High**: Low is clamped below High so the range always spans at least one octave.
+- **Sample-rate change** or very high band count at 44.1 kHz: bands above the Nyquist
+ limit are dropped silently; no instability.
+- **Mono / stereo**: a stereo carrier is vocoded per channel with the same envelopes; the
+ voice is summed to mono for analysis.
+- **Hold on with no voice ever heard**: envelopes are zero; the wet path is silent.
+- **Freeze / bounce / offline export**: offline renders are deterministic and do not
+ depend on track order (a carrier track comes from the previous block's route bus).
+
+## Requirements *(mandatory)*
+
+### Functional Requirements
+
+- **FR-001**: Nota MUST offer a built-in audio effect named **Nota Vocoder** in the
+ browser, the command palette, rack menus and MCP's effect list, in the same category
+ group as other modulation / creative effects.
+- **FR-002**: The **modulator** MUST be the audio arriving at the effect on its own track
+ (the voice), summed to mono.
+- **FR-003**: The **carrier** MUST be chosen by a segmented control: **Saw** (internal,
+ default), **Noise** (internal), or **Track** — another track or return picked in a
+ picker, tapped **Pre** (before its effects and fader, default) or **Post**, using the same
+ sidechain mechanism, cycle rules and persistence as Nota Compressor. **None** MUST be
+ selectable; picking a track MUST set Carrier = Track.
+- **FR-004**: The effect MUST split the voice into **Bands** band-pass channels
+ (8–32, default 16), log-spaced between **Low** (20 Hz–1 kHz, default 80 Hz) and **High**
+ (2–20 kHz, default 8 kHz), with bandwidth set by **Q** (1.0–10.0), follow each band's
+ level with an envelope follower set by **Attack** (0.5–100 ms) and **Release**
+ (5–1000 ms), and apply each envelope to the matching carrier band.
+- **FR-005**: **Formant** (−12 to +12 st, default 0) MUST shift the carrier (synthesis)
+ band frequencies relative to the analysis bands without changing the analysis.
+- **FR-006**: **Tilt** (−12 to +12 dB, default +3 dB) MUST apply a spectral tilt to the
+ Saw or Track carrier before the bands; it is inactive (shown dim) when Carrier = Noise.
+- **FR-007**: When Carrier = Saw, the saw's pitch MUST be set by a **Pitch** control in
+ the Carrier section (a note, C0–C7, default C3, automatable). Pitch is shown inactive
+ otherwise. The saw does not follow notes played into the track.
+- **FR-008**: **Unvoiced** (0–100 %) MUST mix high-pass filtered noise into the output,
+ shaped by the voice's high-frequency (sibilant) energy.
+- **FR-009**: **Mix** (0–100 %, default 100 %) MUST blend the track (dry) and the vocoded
+ (wet) signal; **Gain** (−12 to +12 dB) MUST set the output level. The modulator **Gain**
+ (−24 to +24 dB) MUST trim the voice before analysis.
+- **FR-010**: **Hold** (switch) MUST freeze all band envelopes at their current values
+ while on.
+- **FR-011**: Every continuous control and Carrier / Hold MUST be an automatable,
+ MIDI-learnable device parameter; changes MUST be click-free (smoothed) and MUST NOT
+ cause dropouts.
+- **FR-012**: The device card MUST follow the spec's design mockup: 700 × 260; header with
+ name, preset picker, "Vocoder" badge, power; columns **Modulator** ("This track", Gain,
+ key meter) / **Carrier** (Saw · Noise · Track, carrier track picker with Pre / Post, Tilt,
+ Pitch) → **Bands** (envelope graph with voice bars, carrier line and draggable Low / High
+ edges; knobs Bands, Low, High, Q, Formant, Attack, Release) → **Output** (Unvoiced, Mix,
+ Gain, Hold, output meter). It MUST follow `DESIGN.md` in every colour theme.
+- **FR-013**: The envelope graph MUST show, live, the per-band voice envelope and the
+ carrier's level per band; dragging a range edge MUST change Low / High exactly as the
+ knobs do.
+- **FR-014**: The effect MUST report zero added latency, or report its latency for delay
+ compensation if the chosen design needs any.
+- **FR-015**: Parameters, the carrier track and the tap MUST persist in the project and in
+ user presets (presets never name a track); the effect MUST ship with at least 5 factory
+ presets covering robot, choir, talk-box, whisper and lo-fi characters.
+- **FR-016**: MCP MUST expose the vocoder like other built-in effects (add, read / set
+ parameters) and MUST reuse the existing device sidechain tools to set and read its
+ carrier track.
+- **FR-017**: Offline rendering (export, freeze, bounce) MUST be deterministic — two
+ renders of the same project are identical. A real-time render may differ from an
+ offline one only by a carrier track's one-block routing offset when block sizes differ
+ (the same rule as every sidechain consumer; see research R-2).
+- **FR-018**: With Carrier = Track and no track routed (None, or its track deleted) the
+ effect MUST pass the track's audio through unchanged, fading over about 10 ms.
+- **FR-019**: With Carrier = Saw or Noise the vocoded level MUST follow the voice's level
+ (at about the voice's own level with the defaults). With Carrier = Track it MUST follow
+ the carrier track's level, not the voice's: a voice 20 dB quieter MUST vocode within 3 dB,
+ and the result MUST sit within 6 dB of the carrier track alone. A silent voice MUST close
+ the bands.
+- **FR-020**: Muting the carrier track (or soloing another track) MUST NOT cut its Pre tap,
+ so the user can hear the vocoded sound alone. A muted source's Post tap is silent. This
+ holds for every keyed device (engine sidechain rule).
+
+### Key Entities
+
+- **Vocoder device**: a built-in audio effect instance on a track's chain; holds the
+ parameters above and, for a Track carrier, a carrier track reference.
+- **Carrier track**: a reference to another track or return plus a tap point (pre / post),
+ or none; the same concept as the compressor's sidechain key.
+- **Band**: one analysis / synthesis frequency slot; its centre comes from Low, High,
+ Bands (and Formant for synthesis), its width from Q, its level from the voice's
+ envelope.
+- **Factory preset**: a named set of parameter values shipped with the app (never a
+ carrier track, since it depends on the project).
+
+## Success Criteria *(mandatory)*
+
+### Measurable Outcomes
+
+- **SC-001**: A user who has never used the effect hears a robot voice from their own
+ track the moment they add the vocoder and press play, with no settings changed; a vocoded
+ pad (Carrier = Track, pad picked) takes under 30 seconds.
+- **SC-002**: With the default settings, a speech modulator and a sustained chord, a
+ listener can understand at least 8 of 10 short spoken test words.
+- **SC-003**: Sweeping any control or dragging a range edge during playback produces no
+ audible click, dropout, or xrun at a 128-sample buffer.
+- **SC-004**: At 32 bands and 48 kHz, one vocoder instance stays within the CPU budget of
+ the heaviest existing built-in effect, and a project with 8 instances plays without
+ dropouts on the reference machine.
+- **SC-005**: A saved project reopened later sounds identical (null test of the exported
+ render ≤ −90 dBFS residual).
+- **SC-006**: Every factory preset, dropped on the reference voice track, is audible and
+ peaks below 0 dBFS.
+- **SC-007**: The card passes the design guard tests in every colour theme, and its
+ layout matches the design reference at true size.
+
+## Assumptions
+
+- The sidechain source mechanism (track list, pre / post tap, cycle refusal, deletion
+ fallback, persistence, MCP tools) built for Nota Compressor can serve any built-in
+ effect that declares a sidechain input; the vocoder uses it as is.
+- The vocoder is a classic channel vocoder (filter bank + envelope followers); spectral
+ (FFT) vocoding and "talk box" style formant-only modes are out of scope for v1.
+- The voice is analysed in mono; the carrier keeps its channel count.
+- Band count changes may re-lay out bands at a block boundary with a short crossfade;
+ it is not required to morph continuously between counts.
+- The internal Noise carrier is white noise; the Saw carrier is band-limited.
+- Factory presets never name a carrier track; a Track preset passes the voice through
+ until the user picks one.
+- No new third-party dependency is needed.
+
+## Nota Compliance Checklist *(review before implementation; re-check in tasks.md)*
+
+- [ ] Every new source file will carry the AGPL-3.0-only SPDX header (two lines, see CONTRIBUTING.md)
+- [ ] No new dependency — or: license checked, AGPL-compatible, `LICENSES/third-party.md` row planned
+- [ ] Audio-thread impact considered: no alloc / lock / I/O on the audio thread (AR-6), command queue for data in (AR-4), immutable snapshots for structural edits (AR-5)
+- [ ] Managed/native crossings go through the pure C ABI in `nota_engine.h` only (AR-7); no JUCE outside `pluginhost/`
+- [ ] Smoke-test impact assessed: engine behaviour change → extend `tests/Nota.SmokeTest`
+- [ ] User-visible change → `CHANGELOG.md` `[Unreleased]` entry planned (and FEATURES.md / user docs via the nota-features / nota-docs skills when working with an agent that has them)
+- [ ] UI change → follows `DESIGN.md` (Studio design language)
diff --git a/specs/028-vocoder-effect/tasks.md b/specs/028-vocoder-effect/tasks.md
new file mode 100644
index 00000000..aea20108
--- /dev/null
+++ b/specs/028-vocoder-effect/tasks.md
@@ -0,0 +1,239 @@
+---
+
+description: "Task list for Nota Vocoder audio effect"
+---
+
+# Tasks: Nota Vocoder audio effect
+
+**Input**: Design documents from `/specs/028-vocoder-effect/`
+
+**Prerequisites**: [plan.md](plan.md), [spec.md](spec.md), [research.md](research.md),
+[data-model.md](data-model.md), [contracts/](contracts/), [quickstart.md](quickstart.md)
+
+**Tests**: Included — the constitution (IV) requires engine behaviour changes to extend
+`tests/Nota.SmokeTest`; the contract in [contracts/device-params.md](contracts/device-params.md)
+lists the guarantees to check. Tests live in a new `tests/Nota.SmokeTest/VocoderTests.cs`,
+wired from `Program.cs` like `KeysTests` (`foreach (var (ok, label) in VocoderTests.Run()) Check(ok, label);`).
+
+**Organization**: Tasks are grouped by user story to enable independent implementation and testing of each story.
+
+## Format: `[ID] [P?] [Story] Description`
+
+- **[P]**: Can run in parallel (different files, no dependencies)
+- **[Story]**: Which user story this task belongs to (US1–US4)
+- Every new source file starts with the two-line AGPL-3.0-only SPDX header and a comment
+ header saying why the file exists.
+
+## Path Conventions
+
+- **Engine (C++)**: `src/native/nota.engine/` — DSP in `src/Vocoder.h`, registration in `src/Engine_Devices.cpp`
+- **Managed (C#)**: `src/managed/Nota.App/` (card, graph), `src/managed/Nota.Application/Palette/`
+ (catalogue), `src/managed/Nota.Infrastructure/Persistence/` (presets), `src/managed/Nota.Mcp/`
+- **Tests**: `tests/Nota.SmokeTest/VocoderTests.cs`
+- **Design reference**: `design/vocoder/index.html`
+
+---
+
+## Phase 1: Setup (Shared Infrastructure)
+
+**Purpose**: The device exists, is registered and can be added — it passes audio through.
+
+- [X] T001 Create `src/native/nota.engine/src/Vocoder.h`: `class Vocoder final : public Device`, `builtinKind()` = 26, `name()` = "Nota Vocoder", 15 params as `std::atomic<float>` normalized 0..1 with the names, order and defaults from contracts/device-params.md (append-only — "Index order is the persisted layout"), `paramCount/paramName/paramMin(0)/paramMax(1)/getParam/setParam` and the per-index default used by `nota_builtin_device_param_default`; `setSampleRate`; `process(buf, frames)` passes audio through for now. Mirror `AutoFilter.h` / `Vintage.h` for the param interface.
+- [X] T002 Add sidechain plumbing to `src/native/nota.engine/src/Vocoder.h` exactly like `Compressor.h` (lines ~279–282): `acceptsSidechain()` → true, atomic source track id, `setSidechain(const float*, int32_t)` storing the previous-block buffer pointer; the constructor calls `setSidechainTapPre(1)` ("a new instance sets `sidechainTapPre = 1`").
+- [X] T003 Register kind 26 in `src/native/nota.engine/src/Engine_Devices.cpp`: `#include "Vocoder.h"` and `case 26` in `addTrackBuiltinDevice`, `cloneDevice` and `makeBuiltinDevice` (all three switches).
+- [X] T004 [P] Add `new("Nota Vocoder", A, 26, "vocoder", D(...))` to `src/managed/Nota.Application/Palette/BuiltinDeviceCatalog.cs` with a semantic descriptor (role vocoder; aliases robot voice, talk box, choir, channel vocoder; one-line description "Shapes this track's sound with another track's voice."), and add "Nota Vocoder" to the **Modulation** category in `src/managed/Nota.Application/Palette/DeviceCategories.cs`.
+- [X] T005 Update the doc comment of `nota_device_accepts_sidechain` in `src/native/nota.engine/include/nota/nota_engine.h` to list the built-in Nota Vocoder (comment only; no ABI change).
+
+---
+
+## Phase 2: Foundational (Blocking Prerequisites)
+
+**Purpose**: The band engine every story needs, plus the smoke-test identity checks.
+
+**⚠️ CRITICAL**: No user story work can begin until this phase is complete
+
+- [X] T006 Implement the band layout in `src/native/nota.engine/src/Vocoder.h` (research R-4): `kMaxBands = 32`; centres `f_i = Low · (High/Low)^((i+0.5)/N)`; synthesis centres × `2^(Formant/12)`, bands above `0.45 · fs` muted; Q → bandwidth; "Low is clamped so that `High / Low ≥ 2` (one octave) when either moves"; discrete params via `round(v · (steps − 1))`. Unit mappings exactly as the contract table (exp maps for Low, High, Attack, Release).
+- [X] T007 Implement the filter banks in `src/native/nota.engine/src/Vocoder.h`: each band = two cascaded TPT SVF band-pass sections; three fixed `std::array` banks (analysis mono, synthesis L, synthesis R); coefficients recomputed every 32 samples only when Bands / Low / High / Q / Formant changed, with smoothing so moves are click-free. No allocation after construction (AR-6).
+- [X] T008 Implement envelope followers in `src/native/nota.engine/src/Vocoder.h` (R-5): full-wave rectify, one-pole attack / release from the Attack / Release params; envelopes clamped to 0..4 after Mod gain (R-12).
+- [X] T009 Implement the scope feed in `src/native/nota.engine/src/Vocoder.h`: override the device `scope()` used by `nota_device_scope` with the 100-float layout from contracts/device-params.md (key peak, out L/R peak, N, envelopes[32], carrier levels[32], centres[32]), written once per block into a member array.
+- [X] T010 Create `tests/Nota.SmokeTest/VocoderTests.cs` and wire it in `tests/Nota.SmokeTest/Program.cs` (both run sites, next to `KeysTests`): add an audio track + `AddBuiltinDevice(track, 26)`; assert `DeviceName` = "Nota Vocoder", param count 15, every name and default per the contract, set/get round-trip of all 15, duplicate the track and compare all params plus sidechain source / tap, `DeviceAcceptsSidechain` = true, `DeviceSidechainTapPre` = true on a new instance.
+
+**Checkpoint**: The device loads, persists and clones; the band engine exists.
+
+---
+
+## Phase 3: User Story 1 - Make a pad "talk" with a vocal (Priority: P1) 🎯 MVP
+
+**Goal**: Carrier = the track's audio, modulator = another track; the output is the carrier shaped by the modulator, visible on the card.
+
+**Independent Test**: Chord clip on track 1 with the vocoder, speech clip on track 2 as modulator → the chord speaks; modulator silent → wet silent (quickstart §2).
+
+### Tests for User Story 1
+
+- [X] T011 [P] [US1] In `tests/Nota.SmokeTest/VocoderTests.cs`: render (offline) a deterministic WAV chord on the carrier track and a deterministic speech-like WAV (e.g. amplitude-modulated noise bursts) on a second track routed as sidechain (pre); assert output RMS > 0 and finite; with source −1 and Mix 100 % assert output RMS ≈ 0; with the modulator clip muted assert wet RMS ≈ 0; with Mix 0 % assert output ≈ input.
+
+### Implementation for User Story 1
+
+- [X] T012 [US1] Implement `process()` for Carrier = Input in `src/native/nota.engine/src/Vocoder.h`: modulator = sidechain buffer summed to mono × (Mod gain dB + `sidechainGainDb()`); analysis bank → followers → gain on the synthesis bands of each carrier channel; wet sum normalised by `sqrt(16 / N) · g(Q)` (R-8); equal-power Mix; output Gain; null sidechain → envelopes decay to 0. Latency 0.
+- [X] T013 [P] [US1] Create `src/managed/Nota.App/Controls/VocoderGraph.cs`: a `NotaGraph` well drawing N band bars in `VizInk` from the scope envelopes, at the log-frequency x of each centre (20 Hz – 20 kHz), corner axis labels "20 Hz" / "20 k", title "Envelope"; reads a `float[]` snapshot passed in; no animation easing (meters / spectra are never animated).
+- [X] T014 [US1] Create `src/managed/Nota.App/DeviceCards/Bodies/VocoderDeviceBody.cs` (`IDeviceBody`, `Width = 700`), layout per `design/vocoder/index.html` with `DeviceCardKit.Section`: left column **Modulator** — source picker (track colour via `ArrangementView.TrackBrush`, name via `TrackNames.Of`, "None" first; the list hides the device's own track **and every group it is nested in** (R-12); a **Pre / Post** `Segments` row at the menu foot writing `SetDeviceSidechainTapPre`), Mod gain `SliderRow`, key `MeterBar`; centre **Bands** with `VocoderGraph`; right **Output** — Mix and Gain `SliderRow`s and the output meter. Params via `DeviceGetParam` / `DeviceSetParam` with `BeginAutomationWrite` / `EndAutomationWrite`; `ctx.AddDeviceRefresher` reads `DeviceScope` at 60 Hz; source changes call `ctx.NotifyChanged()`.
+- [X] T015 [US1] Register `[26] = new VocoderDeviceBody()` in `src/managed/Nota.App/DeviceCards/DeviceCardFactory.cs`.
+
+**Checkpoint**: The P1 flow works end to end in the app and in the smoke test.
+
+---
+
+## Phase 4: User Story 2 - Vocode without a carrier track (Priority: P2)
+
+**Goal**: Internal Saw (at Pitch) and Noise carriers, with Tilt.
+
+**Independent Test**: Empty track, Carrier = Saw + speech modulator → robot voice at C3; Noise → whisper (quickstart §3).
+
+### Tests for User Story 2
+
+- [X] T016 [P] [US2] In `tests/Nota.SmokeTest/VocoderTests.cs`: on a track with no clips, Carrier = Saw (norm 0.5) and Noise (norm 1.0) with the speech modulator → output RMS > 0 and finite; Carrier = Input on the same empty track → RMS ≈ 0; switching Carrier mid-render produces no sample-to-sample jump above a threshold (click check).
+
+### Implementation for User Story 2
+
+- [X] T017 [US2] In `src/native/nota.engine/src/Vocoder.h`: polyBLEP saw at the Pitch note (`round(v · 84)` semitones above C0, C3 = 130.81 Hz, 10 ms glide), xorshift32 white noise per channel, Tilt as a first-order shelf pair pivoting at 1 kHz applied to Input and Saw only, and a 10 ms crossfade on Carrier changes (R-6).
+- [X] T018 [US2] In `src/managed/Nota.App/DeviceCards/Bodies/VocoderDeviceBody.cs`: **Carrier** section under Modulator — `Segments` Input / Saw / Noise, Tilt and Pitch `SliderRow`s (Pitch readout as a note name via `NoteName`); Tilt inactive when Carrier = Noise, Pitch inactive unless Carrier = Saw (`Inactive.Set`); live-follow so automation moves them.
+
+**Checkpoint**: US1 and US2 work independently.
+
+---
+
+## Phase 5: User Story 3 - Shape the character (Priority: P2)
+
+**Goal**: Bands, Low / High (knobs and graph edges), Q, Formant, Attack, Release, Unvoiced, Hold.
+
+**Independent Test**: With a fixed carrier and modulator, each control changes sound and graph as described (quickstart §4).
+
+### Tests for User Story 3
+
+- [X] T019 [P] [US3] In `tests/Nota.SmokeTest/VocoderTests.cs`: Bands 8 vs 32 both finite and audible, scope N reports 8 / 32; Formant −12 / +12 finite and differ from 0; Hold on → scope envelopes unchanged across two later blocks while the modulator moves; Unvoiced 100 % on a noise-burst modulator raises energy above 4 kHz vs 0 %; sweeping Bands, Low, High, Q, Formant every block for 2 s produces finite output with no jump above the click threshold (SC-003); Low set above High clamps to `High / Low ≥ 2`.
+
+### Implementation for User Story 3
+
+- [X] T020 [US3] In `src/native/nota.engine/src/Vocoder.h`: band-count change = stage the layout, duck output to 0 over 5 ms, reset band states, switch, ramp back over 5 ms (no allocation); Hold skips follower updates; Unvoiced per R-7 (HF follower at 4 kHz, ratio gate, high-passed noise × Unvoiced, added before Mix).
+- [X] T021 [US3] In `src/managed/Nota.App/DeviceCards/Bodies/VocoderDeviceBody.cs`: the knob row under the graph — `KnobCell` × 7 (Bands, Low, High, Q, Formant, Attack, Release) with mono readouts (`NotaNum`: Hz to 999 then "x.x k", ms, "st" signed with U+2212); Unvoiced `SliderRow` and Hold `DeviceCardKit.Switch` in Output; band knobs and Mod gain inactive while the source is None; the Bands section title shows "N · Low – High".
+- [X] T022 [US3] In `src/managed/Nota.App/Controls/VocoderGraph.cs`: teal carrier polyline through the scope's per-band carrier levels; `Rule` lines at Low / High; hover / drag on an edge turns it accent with `ew-resize`, dragging writes Low / High params (bracketed by `BeginAutomationWrite` / `EndAutomationWrite`) exactly as the knobs do; empty state line "Pick a modulator track to shape the carrier" (Ink 5) when the source is None.
+
+**Checkpoint**: All shaping controls work; the card matches the design reference.
+
+---
+
+## Phase 6: User Story 4 - Recall, automate and reuse (Priority: P3)
+
+**Goal**: Persistence, undo, automation / MIDI learn, factory presets, MCP.
+
+**Independent Test**: Save / reopen identical; automate Formant; load each preset; route a modulator over MCP (quickstart §5, §7).
+
+### Tests for User Story 4
+
+- [X] T023 [P] [US4] In `tests/Nota.SmokeTest/VocoderTests.cs`: save / load a project with the vocoder and a modulator → params, source and tap restored; two offline renders sample-identical (FR-017); delete the modulator track → source −1, undo → restored; every `vocoder` factory preset loads and its render on the reference pair peaks < 0 dBFS (SC-006); MCP `set_device_sidechain` / `get_device_sidechain` on the vocoder (use `McpTestSupport`). — *done: save/load, determinism, modulator deletion, presets. Undo restore and the MCP round-trip are not covered by a smoke check (they use the generic sidechain paths the compressor already tests).*
+
+### Implementation for User Story 4
+
+- [X] T024 [P] [US4] Add six presets in `src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs` as `Fx("vocoder", 26, "<Name>", ("<Param name>", v), …)` with normalized values: Init, Robot choir, Talk box, Whisper (Carrier Noise), Lo-fi robot (8 bands, Saw), Strings choir (32 bands, slow Release). Add the "vocoder" folder to `src/managed/Nota.Application/Palette/PresetDescriptors.cs`' folder map if it is not vocabulary. — *done: 7 presets (Voice: Init, Robot choir, Talk box, Whisper, Lo-fi robot; Pads: Strings choir, Deep giant).*
+- [X] T025 [P] [US4] In `src/managed/Nota.Mcp/Tools/DeviceTools.cs`: add "Nota Vocoder (kind 26) — the modulator" to the `get_device_sidechain` / `set_device_sidechain` descriptions and note that `gainDb` adds to the Mod gain param (contracts/mcp.md).
+- [X] T026 [US4] Verify the automation menu and MIDI Learn list all 15 vocoder params by name for a built-in effect (generic path); fix only if a param is missing or a name is not sentence case.
+
+**Checkpoint**: All user stories independently functional.
+
+---
+
+## Phase 7: Polish & Cross-Cutting Concerns
+
+- [X] T027 Performance: in `tests/Nota.SmokeTest/VocoderTests.cs` time 32 bands at 48 kHz against Nota Chamber on the same input (`TimingBudget`); assert ≤ Chamber (SC-004). Profile and optimise `Vocoder.h` if not. — *done: ≈ 23 ms vs Chamber ≈ 59 ms per 3 s.*
+- [X] T028 Visual check of the card per the `nota-ui-verify` recipe in Studio Dark, Studio Light, Ember Graphite, Ember Paper; compare with `design/vocoder/index.html`; trim leftover margins; nothing overflows 700 × 260. — *done headless (/tmp/vocharness), all four themes, live and no-modulator states.*
+- [X] T029 Run the design guard checks (`RunStudio`, `RunThemes`, `RunLabels`, `RunIcons`, `--palette`) and fix any finding in the new files without adding to the allow lists.
+- [ ] T030 Run the full quickstart.md validation (sections 2–7) in the app. — *partly: the smoke test and headless renders cover §1 and §3–§5 offline; a live in-app run (§2 playback, §4 at a 128 buffer) and the §7 MCP call are still to do.*
+- [X] T031 Ask the user whether `design/vocoder/` ships with the PR or is removed before merge (plan, principle V). — *2026-10-20: not shipped; the folder is removed, the spec keeps its links for history.*
+
+### Follow-up from user testing (2026-10-20)
+
+- [X] T038 [US1] Normalise band weights by the modulator's L2 energy with a slow AGC and floor; recalibrate make-up so the vocoded level follows the carrier (FR-019, research R-14) in `src/native/nota.engine/src/Vocoder.h`.
+- [X] T039 [US1] With no modulator routed, pass the track through unchanged with a 10 ms fade (FR-018) in `src/native/nota.engine/src/Vocoder.h`; give no route slot to a deleted source track in `Engine::recomputeRouting` (`src/native/nota.engine/src/Engine_Devices.cpp`).
+- [X] T041 [US1] Render a muted or solo-gated sidechain source for its taps (pre live, post silent while muted) in `src/native/nota.engine/src/Engine_Render.cpp` (FR-020); smoke check with a muted voice track.
+- [X] T040 [US1] Smoke checks in `tests/Nota.SmokeTest/VocoderTests.cs`: level independent of modulator level, near the carrier's level, no-modulator and deleted-modulator equal the bypassed track; card texts (empty state, Mod gain tooltip) and docs pages updated.
+
+### Follow-up 2: the track is the voice (2026-10-20, research R-15)
+
+- [X] T042 [US1] Make the input the modulator and Carrier = Saw (default) · Noise · Track (sidechain) in `src/native/nota.engine/src/Vocoder.h`; Saw / Noise follow the voice's level, Track keeps the AGC; pass-through only for Track with no source.
+- [X] T043 [US1] Card: Modulator = "This track" (Gain, key meter); Carrier segments Saw · Noise · Track with the carrier-track picker and Pre / Post in `src/managed/Nota.App/DeviceCards/Bodies/VocoderDeviceBody.cs`; graph empty state in `src/managed/Nota.App/Controls/VocoderGraph.cs`.
+- [X] T044 [US2] Presets (Saw default; Talk box and Strings choir use Track) in `FactoryPresetCatalog.cs`; MCP descriptions in `DeviceTools.cs`.
+- [X] T045 Smoke tests rewritten for the model in `tests/Nota.SmokeTest/VocoderTests.cs`; spec, contracts, data model, quickstart, docs (EN + RU), FEATURES and CHANGELOG updated.
+
+### Nota closing tasks *(PR gates)*
+
+- [X] T032 Run `scripts/build.sh` until native + managed + smoke test are green (Release engine build, see BUILD.md).
+- [X] T033 AGPL-3.0-only SPDX two-line header on `Vocoder.h`, `VocoderDeviceBody.cs`, `VocoderGraph.cs`, `VocoderTests.cs`.
+- [X] T034 New dependency: N/A (none added).
+- [X] T035 `CHANGELOG.md` `[Unreleased]` → Added: Nota Vocoder (issue #113).
+- [X] T036 FEATURES.md via the `nota-features` skill; the effect's EN + RU page in `../nota-docs` via `nota-docs` (with a card screenshot); shortcuts: N/A.
+- [X] T037 Smoke test extended: covered by T010, T011, T016, T019, T023, T027 — confirm all run in both `Program.cs` sites.
+
+---
+
+## Dependencies & Execution Order
+
+### Phase Dependencies
+
+- **Setup (Phase 1)**: none. T001 → T002 → T003 (same file / registration needs the class); T004, T005 parallel to them.
+- **Foundational (Phase 2)**: after T003. T006 → T007 → T008 → T009 (same file); T010 after T003, parallel to T006–T009.
+- **US1 (Phase 3)**: after Phase 2. T012 (engine) and T013 (graph) parallel; T014 after T013; T015 after T014; T011 after T012.
+- **US2 (Phase 4)**: after Phase 2; engine task T017 touches `Vocoder.h`, so run after T012 to avoid edit conflicts; T018 after T014.
+- **US3 (Phase 5)**: after Phase 2; T020 after T012 / T017 (same file); T021 after T014; T022 after T013.
+- **US4 (Phase 6)**: after US1 (presets need the sound to calibrate); T024, T025 parallel.
+- **Polish (Phase 7)**: after the stories wanted for the release.
+
+### User Story Dependencies
+
+- **US1 (P1)**: only Foundational.
+- **US2 (P2)**: Foundational; shares `Vocoder.h` and the card with US1 but is testable alone (empty track + Saw).
+- **US3 (P2)**: Foundational; testable with any carrier.
+- **US4 (P3)**: US1 for meaningful presets and render checks.
+
+### Parallel Opportunities
+
+- T004, T005 alongside T001–T003.
+- T010 alongside T006–T009.
+- T013 (managed graph) alongside T012 (engine DSP); likewise T018 / T021 / T022 alongside T017 / T020.
+- T024, T025 in parallel.
+- Test tasks marked [P] are separate methods in `VocoderTests.cs`; if two agents work at once, give each its own partial-class file to avoid conflicts.
+
+---
+
+## Parallel Example: User Story 1
+
+```bash
+# Engine and managed sides of US1 at the same time:
+Task: "T012 Implement process() for Carrier = Input in src/native/nota.engine/src/Vocoder.h"
+Task: "T013 Create src/managed/Nota.App/Controls/VocoderGraph.cs"
+```
+
+---
+
+## Implementation Strategy
+
+### MVP First (User Story 1 Only)
+
+1. Phase 1 + Phase 2 → the device loads and the band engine exists.
+2. Phase 3 → a pad talks with a vocal; card with picker, graph, Mix / Gain.
+3. **STOP and VALIDATE** with quickstart §2 and the smoke test.
+
+### Incremental Delivery
+
+1. MVP (US1).
+2. US2 → internal carriers (usable without a synth track).
+3. US3 → full shaping, the knob row and graph edges — the card now matches the mockup.
+4. US4 → presets, MCP description, persistence checks.
+5. Polish + PR gates.
+
+---
+
+## Notes
+
+- [P] tasks = different files, no dependencies
+- The user makes commits in Nota repos — leave changes uncommitted for review.
+- Stop at any checkpoint to validate a story independently.
diff --git a/src/managed/Nota.App/Controls/VocoderGraph.cs b/src/managed/Nota.App/Controls/VocoderGraph.cs
new file mode 100644
index 00000000..eb735239
--- /dev/null
+++ b/src/managed/Nota.App/Controls/VocoderGraph.cs
@@ -0,0 +1,159 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Nota Vocoder's envelope graph (specs/028-vocoder-effect, after its design mockup): one bar
+// per band at its centre on a 20 Hz – 20 kHz log axis, its height the modulator's envelope in
+// that band (viz ink); a teal line through the carrier's level in the same bands; and the
+// Low / High edges of the band range as rules. An edge is a handle: under the pointer or in the
+// hand it turns accent, and dragging it moves Low or High (the same params as the knobs). The
+// bars are set the moment a reading arrives — a meter that eases lies about the sound. With a
+// Track carrier and no track picked (this track then passes through unchanged) the window says
+// so in one line instead of drawing empty bars.
+
+using System;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Media;
+
+namespace Nota.App;
+
+internal sealed class VocoderGraph : Control
+{
+ private const double LoHz = 20, HiHz = 20000, Top = 16, Bottom = 13;
+ private const int Max = 32;
+ private readonly float[] _env = new float[Max], _car = new float[Max], _ctr = new float[Max];
+ private int _n;
+ private double _low = 80, _high = 8000;
+ private bool _on = true, _active = true;
+ private int _hover = -1, _drag = -1; // 0 = Low edge, 1 = High edge
+
+ /// <summary>An edge drag: 0 = Low, 1 = High, with the new frequency in Hz.</summary>
+ public event Action<int, double>? EdgeChanged;
+ public event Action<int>? GestureBegin;
+ public event Action<int>? GestureEnd;
+ public event Action<int>? ResetRequested;
+
+ public VocoderGraph() { ClipToBounds = true; MinHeight = 60; }
+
+ /// <summary>A fresh reading: <paramref name="scope"/> in the Vocoder scope layout
+ /// (band count at 3, envelopes from 4, carrier levels from 36, centres from 68).</summary>
+ public void Set(float[] scope, int count, double lowHz, double highHz, bool on, bool active)
+ {
+ _n = count > 3 ? Math.Clamp((int)scope[3], 0, Max) : 0;
+ for (int b = 0; b < Max; b++)
+ {
+ bool ok = b < _n && count > 68 + b;
+ _env[b] = ok ? scope[4 + b] : 0;
+ _car[b] = ok ? scope[36 + b] : 0;
+ _ctr[b] = ok ? scope[68 + b] : 0;
+ }
+ _low = lowHz; _high = highHz; _on = on; _active = active;
+ InvalidateVisual();
+ }
+
+ private double X(double hz) => Math.Log(Math.Clamp(hz, LoHz, HiHz) / LoHz) / Math.Log(HiHz / LoHz) * Bounds.Width;
+ private double Hz(double x) => LoHz * Math.Pow(HiHz / LoHz, Math.Clamp(x / Math.Max(1, Bounds.Width), 0, 1));
+
+ private int EdgeAt(Point p)
+ {
+ double dl = Math.Abs(p.X - X(_low)), dh = Math.Abs(p.X - X(_high));
+ if (Math.Min(dl, dh) > 6) return -1;
+ return dl <= dh ? 0 : 1;
+ }
+
+ protected override void OnPointerMoved(PointerEventArgs e)
+ {
+ base.OnPointerMoved(e);
+ var p = e.GetPosition(this);
+ if (_drag >= 0) { EdgeChanged?.Invoke(_drag, Hz(p.X)); return; }
+ int h = EdgeAt(p);
+ if (h != _hover) { _hover = h; Cursor = h >= 0 ? new Cursor(StandardCursorType.SizeWestEast) : Cursor.Default; InvalidateVisual(); }
+ }
+ protected override void OnPointerExited(PointerEventArgs e)
+ {
+ base.OnPointerExited(e);
+ if (_drag < 0 && _hover >= 0) { _hover = -1; InvalidateVisual(); }
+ }
+ protected override void OnPointerPressed(PointerPressedEventArgs e)
+ {
+ base.OnPointerPressed(e);
+ if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
+ int edge = EdgeAt(e.GetPosition(this));
+ if (edge < 0) return;
+ if (e.ClickCount == 2) { ResetRequested?.Invoke(edge); e.Handled = true; return; }
+ _drag = edge; GestureBegin?.Invoke(edge); e.Pointer.Capture(this); e.Handled = true; InvalidateVisual();
+ }
+ protected override void OnPointerReleased(PointerReleasedEventArgs e)
+ {
+ base.OnPointerReleased(e);
+ if (_drag < 0) return;
+ int edge = _drag; _drag = -1; e.Pointer.Capture(null); GestureEnd?.Invoke(edge); InvalidateVisual();
+ }
+ protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e)
+ {
+ // Capture taken away mid-drag (the window deactivates): end the gesture and drop the accent.
+ if (_drag >= 0) { int edge = _drag; _drag = -1; GestureEnd?.Invoke(edge); InvalidateVisual(); }
+ base.OnPointerCaptureLost(e);
+ }
+
+ public override void Render(DrawingContext ctx)
+ {
+ double w = Bounds.Width, h = Bounds.Height;
+ if (w <= 0 || h <= 0) return;
+ var frame = new Rect(0, 0, w, h);
+ NotaGraph.Window(ctx, frame);
+ double y0 = Top, y1 = h - Bottom, ph = Math.Max(1, y1 - y0);
+ foreach (double hz in new[] { 50.0, 100, 200, 500, 1000, 2000, 5000, 10000 })
+ ctx.DrawLine(NotaGraph.GridPen, new Point(Math.Round(X(hz)) + 0.5, y0), new Point(Math.Round(X(hz)) + 0.5, y1));
+
+ NotaGraph.Title(ctx, frame, "Envelope");
+ NotaGraph.Axis(ctx, frame, NotaGraph.Corner.BottomLeft, "20 Hz");
+ NotaGraph.Axis(ctx, frame, NotaGraph.Corner.BottomRight, "20 k");
+
+ if (_active)
+ {
+ NotaGraph.Legend(ctx, w - 6, 4, ("Modulator", NotaPalette.VizInk, NotaGraph.Mark.Line), ("Carrier", NotaPalette.Teal, NotaGraph.Mark.Line));
+ // Bars: each band's slot runs halfway to its neighbours on the log axis.
+ var ink = _on ? NotaPalette.VizInk : NotaPalette.TextAxis;
+ for (int b = 0; b < _n; b++)
+ {
+ if (_ctr[b] <= 0) continue;
+ double x = X(_ctr[b]);
+ double xl = b > 0 ? (x + X(_ctr[b - 1])) / 2 : x - (X(_ctr[Math.Min(_n - 1, 1)]) - x) / 2;
+ double xr = b < _n - 1 ? (x + X(_ctr[b + 1])) / 2 : x + (x - X(_ctr[Math.Max(0, _n - 2)])) / 2;
+ double bw = Math.Max(1, xr - xl - 2), bh = Math.Clamp(_env[b], 0, 1) * ph * 0.92;
+ if (bh >= 0.5) ctx.DrawRectangle(ink, null, new RoundedRect(new Rect(xl + 1, y1 - bh, bw, bh), NotaRadius.BarValue));
+ }
+ // The carrier's level per band, as one line.
+ if (_on && _n > 1)
+ {
+ var geo = new StreamGeometry();
+ using (var g = geo.Open())
+ {
+ for (int b = 0; b < _n; b++)
+ {
+ var pt = new Point(X(_ctr[b]), y1 - Math.Clamp(_car[b], 0, 1) * ph * 0.92);
+ if (b == 0) g.BeginFigure(pt, false); else g.LineTo(pt);
+ }
+ g.EndFigure(false);
+ }
+ ctx.DrawGeometry(null, NotaGraph.SecondaryPen(NotaPalette.Teal), geo);
+ }
+ }
+ else
+ {
+ var ft = new FormattedText("Pick a carrier track · until then the sound passes through", System.Globalization.CultureInfo.InvariantCulture,
+ FlowDirection.LeftToRight, NotaFonts.Sans, 10, NotaPalette.TextDisabled);
+ ctx.DrawText(ft, new Point((w - ft.Width) / 2, y0 + 14));
+ }
+
+ // The band range's edges: rules at rest, the accent under the hand.
+ for (int edge = 0; edge < 2; edge++)
+ {
+ bool hot = edge == _drag || (_drag < 0 && edge == _hover);
+ double x = Math.Round(X(edge == 0 ? _low : _high)) + 0.5;
+ ctx.DrawLine(new Pen(hot ? NotaPalette.Accent : NotaPalette.Rule, hot ? 1.5 : 1), new Point(x, y0 - 4), new Point(x, y1));
+ }
+ }
+}
diff --git a/src/managed/Nota.App/DeviceCards/Bodies/VocoderDeviceBody.cs b/src/managed/Nota.App/DeviceCards/Bodies/VocoderDeviceBody.cs
new file mode 100644
index 00000000..3fcbcaf4
--- /dev/null
+++ b/src/managed/Nota.App/DeviceCards/Bodies/VocoderDeviceBody.cs
@@ -0,0 +1,351 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Detail · Devices — built-in Nota Vocoder body (device kind 26, specs/028-vocoder-effect), a
+// build of the spec's design mockup (700 × 260) in three columns:
+//
+// Modulator / Carrier the modulator is this track (the voice): Mod gain and the key meter ·
+// the carrier: Saw / Noise / Track, the carrier track's picker (with
+// its colour; the device sidechain) and its Pre / Post tap, Tilt and
+// the saw's Pitch
+// Bands the envelope graph (bars = the modulator per band, teal = the
+// carrier, the Low / High edges drag) over Bands, Low, High, Q,
+// Formant, Attack and Release
+// Output Unvoiced, Mix, Gain, Hold and the output meter
+//
+// Every control but the picker and the tap is a device param (normalized 0..1), so automation /
+// MIDI learn / presets / A-B / persistence come for free; the carrier track and the tap are the
+// device's sidechain routing, like the compressor's key. The live reading comes from
+// Vocoder.h scopeRead.
+
+using System;
+using System.Collections.Generic;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
+using Avalonia.Controls.Shapes;
+using Avalonia.Input;
+using Avalonia.Layout;
+using Avalonia.Media;
+using Nota.Application;
+using static Nota.App.DeviceCardKit;
+
+namespace Nota.App;
+
+internal sealed class VocoderDeviceBody : IDeviceBody
+{
+ // ── Parameter indices (must match Vocoder.h) ─────────────────────────────
+ private const int Bands = 0, Low = 1, High = 2, Q = 3, Formant = 4, Attack = 5, Release = 6, ModGain = 7,
+ Carrier = 8, Tilt = 9, Pitch = 10, Unvoiced = 11, Mix = 12, Gain = 13, Hold = 14;
+ // Scope layout (Vocoder::S_* / kTele).
+ private const int S_KeyPeak = 0, S_OutPeakL = 1, S_OutPeakR = 2, kTele = 100;
+
+ public double Width => 700;
+ public string? Subtitle => "Vocoder";
+
+ // Unit mappings (Vocoder.h).
+ private static double ExpMap(double v, double lo, double hi) => lo * Math.Pow(hi / lo, Math.Clamp(v, 0, 1));
+ private static double ExpNorm(double x, double lo, double hi) => Math.Clamp(Math.Log(x / lo) / Math.Log(hi / lo), 0, 1);
+ private static double LowHz(double v) => ExpMap(v, 20, 1000);
+ private static double HighHz(double v) => ExpMap(v, 2000, 20000);
+ private static int BandsOf(double v) => 8 + (int)Math.Round(v * 24);
+ private static int SemisOf(double v) => (int)Math.Round((v - 0.5) * 24);
+ private static int PitchOf(double v) => (int)Math.Round(v * 84); // semitones above C0
+ private static int CarrierOf(double v) => Math.Clamp((int)Math.Round(v * 2), 0, 2);
+
+ private static string HzF(double hz) => hz < 999.5 ? NotaNum.F($"{hz:0} Hz") : NotaNum.F($"{hz / 1000:0.0} k");
+ private static string MsF(double ms) => ms < 10 ? NotaNum.F($"{ms:0.0} ms") : NotaNum.F($"{ms:0} ms");
+ private static string DbF(double db) => (db > 0.05 ? "+" : db < -0.05 ? "−" : "") + NotaNum.F($"{Math.Abs(db):0.0} dB");
+ private static string StF(int st) => (st > 0 ? "+" : st < 0 ? "−" : "") + NotaNum.F($"{Math.Abs(st)} st");
+
+ public Control Build(DeviceCardContext ctx, int index)
+ {
+ var engine = ctx.Engine;
+ int track = ctx.TrackId, di = index;
+ float P(int p) => engine.DeviceGetParam(track, di, p);
+ void Begin(int p) => engine.BeginAutomationWrite(track, AutomationTarget.DeviceParam, di, p, "");
+ void End(int p) => engine.EndAutomationWrite(track, AutomationTarget.DeviceParam, di, p, "");
+ void Raw(int p, double v) => engine.DeviceSetParam(track, di, p, (float)Math.Clamp(v, 0, 1));
+ // A discrete edit (a click) is one automation gesture, so it records while the transport does.
+ void SetP(int p, double v) { Begin(p); Raw(p, v); End(p); }
+ void Reset(int p) { Begin(p); Raw(p, engine.DeviceParamDefault(track, di, p)); End(p); }
+ void Learn(Control c, int p) => MidiLearn.Bind(c, MidiTarget.DeviceParam(track, di, p), engine.DeviceParamName(track, di, p));
+
+ var readouts = new List<Action>();
+ void RefreshAll() { for (int i = 0; i < readouts.Count; i++) readouts[i](); }
+ var scope = new float[kTele];
+ int scN = 0;
+ double Sc(int i) => scN > i ? scope[i] : 0;
+
+ bool On() => !engine.DeviceBypassed(track, di);
+ int Source() => engine.DeviceSidechainSource(track, di);
+ int CarrierI() => CarrierOf(P(Carrier)); // 0 Saw · 1 Noise · 2 Track
+ bool HasTrack() => Source() >= 0 && TrackExists(Source());
+ bool Passing() => CarrierI() == 2 && !HasTrack(); // Track carrier, none picked: the track passes through
+ bool TrackExists(int id)
+ {
+ for (int i = 0; i < engine.TrackCount; i++) if (engine.TryGetTrackInfo(i, out var ti) && ti.Id == id) return true;
+ return false;
+ }
+
+ // ---- small builders ---------------------------------------------------------
+ static TextBlock Title(string t) => new()
+ {
+ Text = NotaText.Label(t), FontSize = NotaType.DeviceSection, FontWeight = FontWeight.SemiBold,
+ Foreground = NotaPalette.TextMuted, VerticalAlignment = VerticalAlignment.Center,
+ };
+ static TextBlock Mono(string t, double fs, IBrush c) => new()
+ { Text = t, FontSize = fs, Foreground = c, FontFamily = NotaFonts.MonoFamily, VerticalAlignment = VerticalAlignment.Center };
+ static T Col<T>(T c, int col) where T : Control { Grid.SetColumn(c, col); return c; }
+ static T Row<T>(T c, int row) where T : Control { Grid.SetRow(c, row); return c; }
+
+ Grid Slider(string label, int p, Func<double, string> fmt, string tip, Func<bool>? dim = null, bool bipolar = false, int steps = 0)
+ {
+ var row = SliderRow(label, () => P(p), v =>
+ {
+ if (steps > 1) v = Math.Round(v * (steps - 1)) / (steps - 1);
+ Raw(p, v); RefreshAll();
+ }, () => fmt(P(p)), out var sync, begin: () => Begin(p), end: () => End(p), reset: () => { Reset(p); RefreshAll(); },
+ bipolar: bipolar, dim: dim, labelWidth: 44, valueWidth: 40);
+ readouts.Add(sync);
+ Learn(row, p);
+ ToolTip.SetTip(row, tip);
+ return row;
+ }
+
+ Control K(int p, string name, Func<double, string> fmt, string tip, int steps = 0)
+ {
+ var val = Mono(fmt(P(p)), 8, TextPrimary);
+ var knob = new Knob(P(p), 1.0) { Accent = true, Default = engine.DeviceParamDefault(track, di, p), Width = 34, Height = 34 };
+ knob.ValueChanged += v =>
+ {
+ if (steps > 1) v = Math.Round(v * (steps - 1)) / (steps - 1);
+ Raw(p, v); val.Text = fmt(P(p)); RefreshAll();
+ };
+ knob.GestureBegin += () => Begin(p);
+ knob.GestureEnd += () => End(p);
+ Learn(knob, p);
+ ToolTip.SetTip(knob, tip);
+ readouts.Add(() =>
+ {
+ if (!knob.Dragging) { double c = P(p); if (Math.Abs(c - knob.Value) > 1e-4) knob.Value = c; }
+ val.Text = fmt(P(p));
+ bool dim = Passing();
+ knob.IsDim = dim;
+ val.Foreground = dim ? TextDisabled : TextPrimary;
+ });
+ return KnobCell(name, knob, val, 53);
+ }
+
+ MeterBar Meter(string label, out Control row, string tip)
+ {
+ var bar = new MeterBar(horizontal: true) { Height = 8, MinWidth = 40, VerticalAlignment = VerticalAlignment.Center };
+ var g = new Grid { ColumnDefinitions = new ColumnDefinitions("44,*"), ColumnSpacing = 8, VerticalAlignment = VerticalAlignment.Center };
+ g.Children.Add(new TextBlock
+ {
+ Text = NotaText.Label(label), FontSize = NotaType.RowLabel, FontWeight = FontWeight.Medium,
+ Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center,
+ });
+ g.Children.Add(Col(bar, 1));
+ ToolTip.SetTip(g, tip);
+ row = g;
+ return bar;
+ }
+
+ // ======================================================================
+ // LEFT — Modulator (this track: Mod gain, key meter) · Carrier (Saw / Noise / Track,
+ // the carrier track's picker and tap, Tilt, Pitch)
+ // ======================================================================
+ var modWhat = new TextBlock
+ {
+ Text = "This track", FontSize = NotaType.RowLabel, Foreground = TextTertiary, VerticalAlignment = VerticalAlignment.Center,
+ };
+ ToolTip.SetTip(modWhat, "The modulator is the sound of the track the vocoder sits on — the voice");
+ var modGain = Slider("Gain", ModGain, v => DbF((v - 0.5) * 48), "Mod gain — trims the voice before the bands hear it, ±24 dB",
+ bipolar: true);
+ var keyMeter = Meter("Key", out var keyRow, "The voice's level after Mod gain");
+
+ var carSeg = Segments(new[] { "Saw", "Noise", "Track" }, CarrierI,
+ i => { SetP(Carrier, i / 2.0); RefreshAll(); }, out var carSync, fill: true, padX: 0);
+ readouts.Add(carSync);
+ Learn(carSeg, Carrier);
+ ToolTip.SetTip(carSeg, "Carrier — what the voice shapes: an internal saw (at Pitch), noise, or another track picked below");
+
+ // The tracks a carrier may come from: every other track and return, but not this track
+ // nor any group it sits in (their signal holds this vocoder's output — a loop).
+ List<(int Id, string Name, int Color)> Candidates()
+ {
+ var parent = new Dictionary<int, int>();
+ var infos = new List<NotaTrackInfo>();
+ for (int i = 0; i < engine.TrackCount; i++)
+ if (engine.TryGetTrackInfo(i, out var ti)) { infos.Add(ti); parent[ti.Id] = ti.GroupId; }
+ var banned = new HashSet<int> { track };
+ for (int g = parent.TryGetValue(track, out var p0) ? p0 : -1, guard = 0; g > 0 && guard < 32; guard++)
+ { banned.Add(g); g = parent.TryGetValue(g, out var pg) ? pg : -1; }
+ var list = new List<(int, string, int)>();
+ foreach (var ti in infos)
+ if (!banned.Contains(ti.Id)) list.Add((ti.Id, TrackNames.Of(engine, ti), ArrangementView.EffectiveColorIndex(engine, ti.Id)));
+ return list;
+ }
+
+ var dot = new Border { Width = 6, Height = 6, CornerRadius = NotaRadius.Bar, VerticalAlignment = VerticalAlignment.Center };
+ var srcName = new TextBlock { FontSize = 9, FontWeight = FontWeight.Medium, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis };
+ var chev = new Glyph { Kind = GlyphKind.ChevronDown, Width = 8, Height = 8, Foreground = TextTertiary, VerticalAlignment = VerticalAlignment.Center };
+ var pickRow = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto"), ColumnSpacing = 5 };
+ pickRow.Children.Add(dot);
+ pickRow.Children.Add(Col(srcName, 1));
+ pickRow.Children.Add(Col(chev, 2));
+ var picker = new Border
+ {
+ Height = 18, Padding = new Thickness(5, 0), CornerRadius = NotaRadius.Control, Background = Sunken,
+ BorderBrush = NotaPalette.Rule, BorderThickness = new Thickness(1), Cursor = new Cursor(StandardCursorType.Hand), Child = pickRow,
+ };
+ readouts.Add(() =>
+ {
+ bool has = HasTrack(), use = CarrierI() == 2;
+ srcName.Text = has ? TrackNames.Of(engine, Source()) : "None";
+ srcName.Foreground = has && use ? TextPrimary : TextDisabled;
+ dot.Background = has ? ArrangementView.TrackBrush(ArrangementView.EffectiveColorIndex(engine, Source())) : NotaPalette.Rule;
+ });
+ picker.PointerEntered += (_, _) => picker.BorderBrush = Brass;
+ picker.PointerExited += (_, _) => picker.BorderBrush = NotaPalette.Rule;
+ picker.PointerPressed += (_, e) =>
+ {
+ if (!e.GetCurrentPoint(picker).Properties.IsLeftButtonPressed) return;
+ var fly = new MenuFlyout();
+ void Add(int id, string name, IBrush swatch)
+ {
+ var mi = new MenuItem { Header = name, Icon = new Rectangle { Width = 7, Height = 7, Fill = swatch, RadiusX = 1, RadiusY = 1 } };
+ if (id == (HasTrack() ? Source() : -1)) mi.FontWeight = FontWeight.SemiBold;
+ mi.Click += (_, _) =>
+ {
+ engine.SetDeviceSidechainSource(track, di, id);
+ if (id >= 0 && CarrierI() != 2) SetP(Carrier, 1); // picking a track means using it
+ ctx.NotifyChanged(); RefreshAll();
+ };
+ fly.Items.Add(mi);
+ }
+ Add(-1, "None", NotaPalette.Rule);
+ fly.Items.Add(new Separator());
+ foreach (var (id, name, color) in Candidates()) Add(id, name, ArrangementView.TrackBrush(color));
+ fly.ShowAt(picker);
+ e.Handled = true;
+ };
+ ToolTip.SetTip(picker, "Carrier track — the track the voice shapes when Carrier is Track; this track and its groups are not offered");
+
+ var tap = Segments(new[] { "Pre", "Post" }, () => engine.DeviceSidechainTapPre(track, di) ? 0 : 1,
+ i => { engine.SetDeviceSidechainTapPre(track, di, i == 0); ctx.NotifyChanged(); }, out var tapSync, padX: 3, fontSize: 8,
+ dim: () => CarrierI() != 2 || !HasTrack());
+ readouts.Add(tapSync);
+ ToolTip.SetTip(tap, "Where the carrier track is tapped: before its effects and fader, or after. Pre keeps feeding while the track is muted");
+ var trackRow = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 4 };
+ trackRow.Children.Add(picker);
+ trackRow.Children.Add(Col(tap, 1));
+
+ var tilt = Slider("Tilt", Tilt, v => DbF((v - 0.5) * 24), "Tilt — brightens (or darkens) the saw or the carrier track around 1 kHz before the bands, ±12 dB",
+ dim: () => CarrierI() == 1, bipolar: true);
+ var pitch = Slider("Pitch", Pitch, v => NoteName(PitchOf(v) + 12), "Pitch — the internal saw's note, C0 … C7",
+ dim: () => CarrierI() != 0, steps: 85);
+
+ var modHead = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") };
+ modHead.Children.Add(Title("Modulator"));
+ modHead.Children.Add(Col(modWhat, 1));
+ var modBody = new Grid { RowDefinitions = new RowDefinitions("Auto,Auto,Auto"), RowSpacing = 5 };
+ modBody.Children.Add(modHead);
+ modBody.Children.Add(Row(modGain, 1));
+ modBody.Children.Add(Row(keyRow, 2));
+ var carBody = new Grid { RowDefinitions = new RowDefinitions("Auto,Auto,Auto,Auto,Auto"), RowSpacing = 5 };
+ carBody.Children.Add(Title("Carrier"));
+ carBody.Children.Add(Row(carSeg, 1));
+ carBody.Children.Add(Row(trackRow, 2));
+ carBody.Children.Add(Row(tilt, 3));
+ carBody.Children.Add(Row(pitch, 4));
+ var modSect = Section(new Border { Padding = new Thickness(8, 6), Child = modBody });
+ var carSect = Section(new Border { Padding = new Thickness(8, 6), Child = carBody });
+ var left = new Grid { RowDefinitions = new RowDefinitions("Auto,*"), Width = 152 };
+ left.Children.Add(modSect);
+ left.Children.Add(Row(carSect, 1));
+
+ // ======================================================================
+ // CENTRE — Bands: the envelope graph over the band knobs
+ // ======================================================================
+ var info = Mono("", 8, TextTertiary);
+ readouts.Add(() => info.Text = NotaNum.F($"{BandsOf(P(Bands))} · ") + HzF(LowHz(P(Low))) + " – " + HzF(HighHz(P(High))));
+ var head = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto") };
+ head.Children.Add(Title("Bands"));
+ head.Children.Add(Col(info, 1));
+
+ var graph = new VocoderGraph();
+ graph.GestureBegin += edge => Begin(edge == 0 ? Low : High);
+ graph.GestureEnd += edge => End(edge == 0 ? Low : High);
+ graph.EdgeChanged += (edge, hz) =>
+ {
+ if (edge == 0) Raw(Low, ExpNorm(Math.Min(hz, HighHz(P(High)) / 2), 20, 1000));
+ else Raw(High, ExpNorm(Math.Max(hz, LowHz(P(Low)) * 2), 2000, 20000));
+ RefreshAll();
+ };
+ graph.ResetRequested += edge => { Reset(edge == 0 ? Low : High); RefreshAll(); };
+ Learn(graph, Low);
+ ToolTip.SetTip(graph, "The modulator's level in each band (bars) and the carrier's (teal). Drag an edge to move Low or High; double-click an edge resets it.");
+
+ var knobs = new UniformGrid { Rows = 1, Columns = 7, Margin = new Thickness(0, 4, 0, 0) };
+ knobs.Children.Add(K(Bands, "Bands", v => BandsOf(v).ToString(NotaNum.Culture), "Bands — how many bands, 8 … 32: fewer is more robotic, more is clearer", steps: 25));
+ knobs.Children.Add(K(Low, "Low", v => HzF(LowHz(v)), "Low — the lowest band's edge, 20 Hz … 1 kHz"));
+ knobs.Children.Add(K(High, "High", v => HzF(HighHz(v)), "High — the highest band's edge, 2 … 20 kHz"));
+ knobs.Children.Add(K(Q, "Q", v => NotaNum.F($"{1 + v * 9:0.0}"), "Q — how narrow each band is, 1 … 10"));
+ knobs.Children.Add(K(Formant, "Formant", v => StF(SemisOf(v)), "Formant — moves the carrier's bands against the modulator's, ±12 st: up sounds smaller, down larger", steps: 25));
+ knobs.Children.Add(K(Attack, "Attack", v => MsF(ExpMap(v, 0.5, 100)), "Attack — how fast a band opens, 0.5 … 100 ms"));
+ knobs.Children.Add(K(Release, "Release", v => MsF(ExpMap(v, 5, 1000)), "Release — how fast a band closes, 5 … 1000 ms"));
+
+ var centreBody = new DockPanel { LastChildFill = true };
+ DockPanel.SetDock(head, Dock.Top);
+ DockPanel.SetDock(knobs, Dock.Bottom);
+ head.Margin = new Thickness(0, 0, 0, 5);
+ centreBody.Children.Add(head);
+ centreBody.Children.Add(knobs);
+ centreBody.Children.Add(graph);
+ var centre = Section(new Border { Padding = new Thickness(8, 6), Child = centreBody });
+
+ // ======================================================================
+ // RIGHT — Output: Unvoiced · Mix · Gain · Hold · the output meter
+ // ======================================================================
+ var unv = Slider("Unvoiced", Unvoiced, v => NotaNum.F($"{v * 100:0} %"), "Unvoiced — adds noise where the modulator hisses, so consonants stay clear");
+ var mix = Slider("Mix", Mix, v => NotaNum.F($"{v * 100:0} %"), "Mix — the carrier as it came in against the vocoded sound");
+ var gain = Slider("Gain", Gain, v => DbF((v - 0.5) * 24), "Gain — the output level, ±12 dB", bipolar: true);
+ var hold = Switch("Hold", () => P(Hold) >= 0.5f, () => { SetP(Hold, P(Hold) >= 0.5f ? 0 : 1); RefreshAll(); }, out var holdSync);
+ readouts.Add(holdSync);
+ Learn(hold, Hold);
+ ToolTip.SetTip(hold, "Hold — freezes every band where it is; the carrier keeps sounding through it");
+ var outMeter = Meter("Out", out var outRow, "The vocoder's output level");
+
+ var outBody = new Grid { RowDefinitions = new RowDefinitions("Auto,Auto,Auto,Auto,Auto,*,Auto"), RowSpacing = 6 };
+ outBody.Children.Add(Title("Output"));
+ outBody.Children.Add(Row(unv, 1));
+ outBody.Children.Add(Row(mix, 2));
+ outBody.Children.Add(Row(gain, 3));
+ outBody.Children.Add(Row(new Border { HorizontalAlignment = HorizontalAlignment.Left, Child = hold }, 4));
+ outBody.Children.Add(Row(outRow, 6));
+ var right = Section(new Border { Padding = new Thickness(8, 6), Child = outBody });
+ right.Width = 138;
+
+ // ---- assemble ---------------------------------------------------------------
+ var root = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*,Auto") };
+ root.Children.Add(left);
+ root.Children.Add(Col(centre, 1));
+ root.Children.Add(Col(right, 2));
+
+ void Refresh()
+ {
+ scN = engine.DeviceScope(track, di, scope, kTele);
+ bool on = On(), has = !Passing();
+ graph.Set(scope, scN, LowHz(P(Low)), HighHz(P(High)), on, has);
+ float key = (float)Sc(S_KeyPeak);
+ keyMeter.Push(new NotaMeter { PeakL = key, PeakR = key });
+ outMeter.Push(new NotaMeter { PeakL = (float)Sc(S_OutPeakL), PeakR = (float)Sc(S_OutPeakR) });
+ RefreshAll();
+ }
+ ctx.AddDeviceRefresher(Refresh);
+ Refresh();
+ return root;
+ }
+}
diff --git a/src/managed/Nota.App/DeviceCards/DeviceCardFactory.cs b/src/managed/Nota.App/DeviceCards/DeviceCardFactory.cs
index e11fbd82..b0787a29 100644
--- a/src/managed/Nota.App/DeviceCards/DeviceCardFactory.cs
+++ b/src/managed/Nota.App/DeviceCards/DeviceCardFactory.cs
@@ -43,6 +43,7 @@ internal sealed class DeviceCardFactory
[23] = new FlangerDeviceBody(),
[24] = new PhaserDeviceBody(),
[25] = new ChorusDeviceBody(),
+ [26] = new VocoderDeviceBody(),
};
/// <summary>Resolve the body for a built-in device: its mapped body, or the generic
diff --git a/src/managed/Nota.App/NotaDocs.cs b/src/managed/Nota.App/NotaDocs.cs
index 04a52e5e..6dfe172f 100644
--- a/src/managed/Nota.App/NotaDocs.cs
+++ b/src/managed/Nota.App/NotaDocs.cs
@@ -29,7 +29,7 @@ internal static class NotaDocs
{
"eq-8", "compressor", "reverb", "delay", "utility", "", "valve", "auto-filter", "vintage",
"orbit", "auto-shift", "beat-repeat", "crush", "dynamic-eq", "ceiling", "strata", "eq-3",
- "forge", "level", "shutter", "chamber", "prism", "lens", "flanger", "phaser", "chorus",
+ "forge", "level", "shutter", "chamber", "prism", "lens", "flanger", "phaser", "chorus", "vocoder",
};
private static readonly string[] MidiEffects = { "arp", "chord", "scale", "length", "velocity", "random" };
diff --git a/src/managed/Nota.Application/Palette/BuiltinDeviceCatalog.cs b/src/managed/Nota.Application/Palette/BuiltinDeviceCatalog.cs
index ae1e4552..11ebb06f 100644
--- a/src/managed/Nota.Application/Palette/BuiltinDeviceCatalog.cs
+++ b/src/managed/Nota.Application/Palette/BuiltinDeviceCatalog.cs
@@ -152,6 +152,9 @@ public static class BuiltinDeviceCatalog
new("Nota Chorus", A, 25, "chorus", D("chorus", "ensemble dimension",
"wide lush", "", "synth keys guitar vocals", "widen modulation", "",
"Chorus and ensemble for width and shimmer.")),
+ new("Nota Vocoder", A, 26, "vocoder", D("vocoder", "talkbox robot choir channel",
+ "metallic vintage", "", "vocals synth", "modulation", "synthwave",
+ "Shapes this track's sound with another track's voice.")),
new("Nota Auto Shift", A, 10, "pitch correction", D("pitch", "autotune melodyne tune",
"", "", "vocals", "tuning", "trap pop",
"Real-time pitch correction to a key and scale.")),
diff --git a/src/managed/Nota.Application/Palette/DeviceCategories.cs b/src/managed/Nota.Application/Palette/DeviceCategories.cs
index 2790cc37..80956dad 100644
--- a/src/managed/Nota.Application/Palette/DeviceCategories.cs
+++ b/src/managed/Nota.Application/Palette/DeviceCategories.cs
@@ -31,7 +31,7 @@ public static class DeviceCategories
new("EQ & filter", ["Nota EQ-3", "Nota EQ-8", "Nota Dynamic EQ-8", "Nota Auto Filter"]),
new("Dynamics", ["Nota Compressor", "Nota Prism", "Nota Ceiling", "Nota Shutter"]),
new("Reverb & delay", ["Nota Reverb", "Nota Chamber", "Nota Delay"]),
- new("Modulation", ["Nota Chorus", "Nota Flanger", "Nota Phaser", "Nota Orbit"]),
+ new("Modulation", ["Nota Chorus", "Nota Flanger", "Nota Phaser", "Nota Orbit", "Nota Vocoder"]),
new("Distortion", ["Nota Valve", "Nota Vintage", "Nota Forge", "Nota Crush"]),
new("Pitch & time", ["Nota Auto Shift", "Nota Beat Repeat", "Nota Strata"]),
new("Utility", ["Nota Utility", "Nota Level", "Nota Lens"]),
diff --git a/src/managed/Nota.Application/Palette/SemanticVocabulary.cs b/src/managed/Nota.Application/Palette/SemanticVocabulary.cs
index 76c6f561..78be3427 100644
--- a/src/managed/Nota.Application/Palette/SemanticVocabulary.cs
+++ b/src/managed/Nota.Application/Palette/SemanticVocabulary.cs
@@ -56,6 +56,7 @@ public static class SemanticVocabulary
T_("chorus", R, "chorus", "ensemble", "хорус");
T_("flanger", R, "flanger", "фленджер", "флэнджер");
T_("phaser", R, "phaser", "фэйзер", "фейзер", "фазер");
+ T_("vocoder", R, "vocoder", "talkbox", "robotvoice", "вокодер", "токбокс");
T_("autopan", R, "autopan", "panner", "tremolo", "автопан", "тремоло", "панорамирование");
T_("pitch", R, "pitch", "autotune", "tune", "tuning", "pitchshift", "автотюн", "тюн", "тон");
T_("glitch", R, "glitch", "stutter", "repeat", "beatrepeat", "глитч", "заикание");
diff --git a/src/managed/Nota.Infrastructure/Audition/PresetAudition.Tracks.cs b/src/managed/Nota.Infrastructure/Audition/PresetAudition.Tracks.cs
index 68e8bbe1..0dbb74bd 100644
--- a/src/managed/Nota.Infrastructure/Audition/PresetAudition.Tracks.cs
+++ b/src/managed/Nota.Infrastructure/Audition/PresetAudition.Tracks.cs
@@ -143,7 +143,7 @@ public sealed partial class PresetAudition
// Dynamics and rhythm effects want transients.
1 or 11 or 19 or 21 => "drums",
// Time, modulation and pitch effects want sustained, spaced notes (tails heard alone).
- 2 or 3 or 9 or 10 or 15 or 20 or 23 or 24 or 25 => "keys",
+ 2 or 3 or 9 or 10 or 15 or 20 or 23 or 24 or 25 or 26 => "keys",
// Tone shaping (EQ, drive, filters, limiting, level) wants a full mix.
_ => "pop",
};
diff --git a/src/managed/Nota.Infrastructure/Audition/PresetAudition.cs b/src/managed/Nota.Infrastructure/Audition/PresetAudition.cs
index b27e92fa..2a4573e0 100644
--- a/src/managed/Nota.Infrastructure/Audition/PresetAudition.cs
+++ b/src/managed/Nota.Infrastructure/Audition/PresetAudition.cs
@@ -194,7 +194,7 @@ public sealed partial class PresetAudition : IPresetAudition
[11] = "Nota Beat Repeat", [12] = "Nota Crush", [13] = "Nota Dynamic EQ-8", [14] = "Nota Ceiling",
[15] = "Nota Strata", [16] = "Nota EQ-3", [17] = "Nota Forge", [18] = "Nota Level", [19] = "Nota Shutter",
[20] = "Nota Chamber", [21] = "Nota Prism", [22] = "Nota Lens", [23] = "Nota Flanger", [24] = "Nota Phaser",
- [25] = "Nota Chorus",
+ [25] = "Nota Chorus", [26] = "Nota Vocoder",
};
private static string DeviceName(PresetDocument doc, int kind, bool instrument = false, bool midi = false)
diff --git a/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs b/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
index 88f17c57..aaf8f25a 100644
--- a/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
+++ b/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
@@ -1988,6 +1988,22 @@ public sealed class FactoryPresetCatalog : IFactoryPresets
Ch("Bar Swell", CEnsemble, 0.60f, 0.10f, 140, 0.55f, 180, div: "1/1");
Ch("Triplet Shiver", CClassic, 0.30f, 0.00f, 120, 0.45f, 180, div: "1/8T");
Ch("Four-Bar Drift", CClassic, 0.90f, 0.00f, 130, 0.50f, 180, div: "4/1");
+
+ // ---- Nota Vocoder (kind 26) — channel vocoder. Written in units through Vo(): bands
+ // 8..32, Low Hz 20..1000, High Hz 2000..20000, Q 1..10, Formant −12..+12 st, Attack
+ // ms 0.5..100, Release ms 5..1000, carrier (VSaw / VNoise / VTrack), Tilt dB ±12, Pitch
+ // (semitones above C0, 36 = C3), Unvoiced 0..1, Mix 0..1. The track the vocoder sits on is
+ // the voice; a VTrack preset takes its carrier from a track the project picks (until then
+ // the voice passes through), so presets never name one.
+ Section("Voice");
+ Vo("Init");
+ Vo("Robot choir", bands: 20, q: 6.0f, pitch: 36, release: 50, unvoiced: 0.40f);
+ Vo("Talk box", bands: 24, lowHz: 120, highHz: 6000, q: 7.0f, attack: 1.5f, release: 30, tilt: 6, unvoiced: 0.25f, carrier: VTrack);
+ Vo("Whisper", bands: 24, q: 4.0f, carrier: VNoise, release: 35, unvoiced: 0.70f);
+ Vo("Lo-fi robot", bands: 8, lowHz: 150, highHz: 4000, q: 3.0f, pitch: 31, release: 25, unvoiced: 0.10f);
+ Section("Pads");
+ Vo("Strings choir", bands: 32, q: 8.0f, attack: 12, release: 300, tilt: 4, unvoiced: 0.15f, mix: 0.85f, carrier: VTrack);
+ Vo("Deep giant", bands: 20, formant: -7, q: 5.0f, pitch: 24, release: 60, unvoiced: 0.20f);
Section("By Source");
Ch("Vocal Double", CClassic, 0.15f, 0.00f, 140, 0.35f, 180, hz: 0.40f, hpHz: 200);
Ch("Bass Chorus", CClassic, 0.45f, 0.00f, 110, 0.45f, 180, hz: 0.50f, hpHz: 250);
@@ -2694,6 +2710,22 @@ public sealed class FactoryPresetCatalog : IFactoryPresets
("Warmth", warmth), ("Mix", mix));
}
+ // Nota Vocoder carriers (Vocoder::CarrierInput / Saw / Noise) and its presets in units.
+ private const int VSaw = 0, VNoise = 1, VTrack = 2;
+
+ private void Vo(string name, int bands = 16, float lowHz = 80, float highHz = 8000, float q = 5f, int formant = 0,
+ float attack = 2f, float release = 40f, int carrier = VSaw, float tilt = 3f, int pitch = 36,
+ float unvoiced = 0.35f, float mix = 1f)
+ {
+ static float Exp(float v, double lo, double hi) => (float)(Math.Log(Math.Clamp(v, lo, hi) / lo) / Math.Log(hi / lo));
+ Fx("vocoder", 26, name,
+ ("Bands", (Math.Clamp(bands, 8, 32) - 8) / 24f), ("Low", Exp(lowHz, 20, 1000)), ("High", Exp(highHz, 2000, 20000)),
+ ("Q", (Math.Clamp(q, 1f, 10f) - 1f) / 9f), ("Formant", 0.5f + Math.Clamp(formant, -12, 12) / 24f),
+ ("Attack", Exp(attack, 0.5, 100)), ("Release", Exp(release, 5, 1000)), ("Mod gain", 0.5f),
+ ("Carrier", carrier / 2f), ("Tilt", 0.5f + Math.Clamp(tilt, -12f, 12f) / 24f), ("Pitch", Math.Clamp(pitch, 0, 84) / 84f),
+ ("Unvoiced", unvoiced), ("Mix", mix), ("Gain", 0.5f), ("Hold", 0f));
+ }
+
// Nota Forge stage types (the S* Type step, × 1/5).
private const int FTube = 0, FDiode = 1, FTape = 2, FFuzz = 3, FDigital = 4, FFold = 5;
diff --git a/src/managed/Nota.Mcp/Tools/DeviceTools.cs b/src/managed/Nota.Mcp/Tools/DeviceTools.cs
index b21a7ad7..a98b5164 100644
--- a/src/managed/Nota.Mcp/Tools/DeviceTools.cs
+++ b/src/managed/Nota.Mcp/Tools/DeviceTools.cs
@@ -76,12 +76,12 @@ public sealed class DeviceTools(IAudioEngine engine, IEngineDispatch dispatch, I
public sealed record Sidechain(bool Accepts, int SourceTrackId, bool TapPre, float GainDb, float Mix);
- [McpServerTool(Name = "get_device_sidechain"), Description("Read a device's sidechain routing: whether it can take a key at all (the Compressor, Ceiling, Nota Shutter, Nota Auto Shift — its MIDI source — and plugins with a sidechain bus), the source track id (-1 = the device keys off its own track), whether the source is tapped pre-FX (true) or post-fader (false), the detector gain in dB and the effect's sidechain dry/wet mix (0..1).")]
+ [McpServerTool(Name = "get_device_sidechain"), Description("Read a device's sidechain routing: whether it can take a key at all (the Compressor, Ceiling, Nota Shutter, Nota Auto Shift — its MIDI source —, Nota Vocoder — its carrier track — and plugins with a sidechain bus), the source track id (-1 = the device keys off its own track), whether the source is tapped pre-FX (true) or post-fader (false), the detector gain in dB and the effect's sidechain dry/wet mix (0..1).")]
public Task<Sidechain> GetDeviceSidechain(int trackId, int deviceIndex) => Read(() => new Sidechain(
E.DeviceAcceptsSidechain(trackId, deviceIndex), E.DeviceSidechainSource(trackId, deviceIndex),
E.DeviceSidechainTapPre(trackId, deviceIndex), E.DeviceSidechainGain(trackId, deviceIndex), E.DeviceSidechainMix(trackId, deviceIndex)));
- [McpServerTool(Name = "set_device_sidechain"), Description("Route a sidechain key into a device — e.g. duck a bass or pad under the kick with a Compressor (kind 1): pass the kick track as sourceTrackId, then shape the key with the Compressor's params (SC HP / SC LP / SC Q / SC Gain / Hold; External Key must be on, which is its default). Nota Shutter (kind 19) gates or ducks against a key the same way (Flip = 1 for Duck; Det HP / Det LP shape the key; External Key on, its default). Nota Auto Shift (kind 10) takes an instrument track here as its MIDI source: with Key Source = 1 (MIDI) the voice is pulled to that track's notes (its clips after its MIDI effects, even while muted). sourceTrackId -1 clears the source (the device keys off its own track). Optional: tapPre (true = the source before its effects and fader, false = after), gainDb (extra detector gain, ±24 dB). Leave an optional argument out to keep its current value. No effect on devices that take no sidechain.")]
+ [McpServerTool(Name = "set_device_sidechain"), Description("Route a sidechain key into a device — e.g. duck a bass or pad under the kick with a Compressor (kind 1), or make a pad speak with a vocal through Nota Vocoder (kind 26, on the vocal track, which is the modulator: set its Carrier param to Track (1.0) and pass the pad track here as the carrier; tapPre true takes the pad before its effects, gainDb trims it; with Carrier Saw or Noise it needs no source): pass the kick track as sourceTrackId, then shape the key with the Compressor's params (SC HP / SC LP / SC Q / SC Gain / Hold; External Key must be on, which is its default). Nota Shutter (kind 19) gates or ducks against a key the same way (Flip = 1 for Duck; Det HP / Det LP shape the key; External Key on, its default). Nota Auto Shift (kind 10) takes an instrument track here as its MIDI source: with Key Source = 1 (MIDI) the voice is pulled to that track's notes (its clips after its MIDI effects, even while muted). sourceTrackId -1 clears the source (the device keys off its own track). Optional: tapPre (true = the source before its effects and fader, false = after), gainDb (extra detector gain, ±24 dB). Leave an optional argument out to keep its current value. No effect on devices that take no sidechain.")]
public Task SetDeviceSidechain(int trackId, int deviceIndex, [Description("Key source track id, or -1 for none")] int sourceTrackId,
bool? tapPre = null, float? gainDb = null) => Mutate(() =>
{
diff --git a/src/native/nota.engine/include/nota/nota_engine.h b/src/native/nota.engine/include/nota/nota_engine.h
index d7b958c5..ac33451b 100644
--- a/src/native/nota.engine/include/nota/nota_engine.h
+++ b/src/native/nota.engine/include/nota/nota_engine.h
@@ -1467,8 +1467,9 @@ NOTA_API int32_t nota_device_text(const NotaEngine* engine, int32_t track_id
* source_track_id -1 clears it; get returns the current source (-1 = none). */
NOTA_API void nota_device_set_sidechain_source(NotaEngine* engine, int32_t track_id, int32_t device_index, int32_t source_track_id);
NOTA_API int32_t nota_device_sidechain_source(const NotaEngine* engine, int32_t track_id, int32_t device_index);
-/* Whether a device can key off a sidechain source: 1 for the built-in Compressor and
- * for hosted plugins that expose a sidechain input bus (Phase C); 0 otherwise. */
+/* Whether a device can key off a sidechain source: 1 for the built-in Compressor (and the
+ * other keyed built-ins, e.g. Nota Vocoder's modulator) and for hosted plugins that expose
+ * a sidechain input bus (Phase C); 0 otherwise. */
NOTA_API int32_t nota_device_accepts_sidechain(const NotaEngine* engine, int32_t track_id, int32_t device_index);
/* Instrument sidechain ("React", Nota Flux): route a listening instrument to a source
* track. source_track_id -1 clears it; get returns the current source (-1 = none);
diff --git a/src/native/nota.engine/src/Audition.cpp b/src/native/nota.engine/src/Audition.cpp
index 59257bf9..31d38cb2 100644
--- a/src/native/nota.engine/src/Audition.cpp
+++ b/src/native/nota.engine/src/Audition.cpp
@@ -195,7 +195,7 @@ int64_t AuditionRig::render(const AuditionNote* notes, int32_t count, double bpm
std::vector<float> out;
out.reserve(static_cast<size_t>(maxFrames * 2));
- float buf[kBlock * 2];
+ float buf[kBlock * 2], key[kBlock * 2];
MidiEv evA[kMaxEvents], evB[kMaxEvents];
size_t next = 0;
int64_t quiet = 0, lastLoud = 0;
@@ -259,7 +259,10 @@ int64_t AuditionRig::render(const AuditionNote* notes, int32_t count, double bpm
ti.timeInSeconds = pos / sr_;
ti.timeInSamples = pos;
ti.isPlaying = true;
+ // A preview has no other tracks: a device that is silent without a key hears the phrase itself.
+ std::memcpy(key, buf, sizeof(float) * static_cast<size_t>(n) * 2);
for (auto& d : devices_) {
+ d->setPreviewKey(key, n);
d->setTransport(beat, spb, true);
d->setTransportInfo(ti);
d->process(buf, n);
diff --git a/src/native/nota.engine/src/Device.h b/src/native/nota.engine/src/Device.h
index 062bfcf4..985a81c5 100644
--- a/src/native/nota.engine/src/Device.h
+++ b/src/native/nota.engine/src/Device.h
@@ -137,6 +137,12 @@ public:
virtual void setSidechainSourceTrackId(int32_t /*trackId*/) {}
virtual void setSidechain(const float* /*interleaved*/, int32_t /*frames*/) {}
+ // Preview key (the browser's preset audition): the audition rig has no other tracks, so it
+ // hands every device the phrase it is about to process, right before process(). A device
+ // that is silent without a key (Nota Vocoder's modulator) uses it for that one block when no
+ // sidechain source is routed; everything else ignores it. Never called by the engine.
+ virtual void setPreviewKey(const float* /*interleaved*/, int32_t /*frames*/) {}
+
// Whether this device can key off a sidechain source at all: true for the
// built-in Compressor and for hosted plugins that expose a sidechain input
// bus (Phase C). The UI only offers a source picker when this is true.
diff --git a/src/native/nota.engine/src/Engine_Devices.cpp b/src/native/nota.engine/src/Engine_Devices.cpp
index 9907d206..4f7451f9 100644
--- a/src/native/nota.engine/src/Engine_Devices.cpp
+++ b/src/native/nota.engine/src/Engine_Devices.cpp
@@ -26,6 +26,7 @@
#include "Flanger.h"
#include "Phaser.h"
#include "Chorus.h"
+#include "Vocoder.h"
#include "Prism.h"
#include "Ceiling.h"
#include "Strata.h"
@@ -531,6 +532,7 @@ int32_t Engine::addTrackBuiltinDevice(int32_t trackId, int32_t kind) {
else if (kind == 23) dev = std::make_shared<Flanger>();
else if (kind == 24) dev = std::make_shared<Phaser>();
else if (kind == 25) dev = std::make_shared<Chorus>();
+ else if (kind == 26) dev = std::make_shared<Vocoder>();
else return -1;
dev->setSampleRate(transport_.sampleRate() > 0 ? transport_.sampleRate() : 44100.0, kMaxBlock);
if (kind == 5) if (auto* rk = dynamic_cast<RackDevice*>(dev.get())) rk->addChain(-1); // one pass-through chain
@@ -600,6 +602,7 @@ std::shared_ptr<Device> Engine::cloneDevice(const Device& src) const {
case 23: d = std::make_shared<Flanger>(); break;
case 24: d = std::make_shared<Phaser>(); break;
case 25: d = std::make_shared<Chorus>(); break;
+ case 26: d = std::make_shared<Vocoder>(); break;
default: d = src.clone(); break; // hosted plugin
}
if (!d) return nullptr;
@@ -611,6 +614,10 @@ std::shared_ptr<Device> Engine::cloneDevice(const Device& src) const {
if (!st.empty()) d->setState(st.data(), (int32_t)st.size());
}
d->setBypassed(src.bypassed());
+ d->setSidechainSourceTrackId(src.sidechainSourceTrackId()); // a keyed device keeps its key
+ d->setSidechainTapPre(src.sidechainTapPre());
+ d->setSidechainGainDb(src.sidechainGainDb());
+ d->setSidechainMix(src.sidechainMix());
return d;
}
@@ -682,6 +689,7 @@ std::shared_ptr<Device> makeBuiltinDevice(int32_t kind) {
case 23: return std::make_shared<Flanger>();
case 24: return std::make_shared<Phaser>();
case 25: return std::make_shared<Chorus>();
+ case 26: return std::make_shared<Vocoder>();
default: return nullptr; // Rack / plugin: no simple per-param default
}
}
@@ -990,8 +998,14 @@ bool Engine::instrumentAcceptsSidechain(int32_t trackId) const {
void Engine::recomputeRouting() {
for (auto& s : routeSlotTrackId_) s.store(-1, std::memory_order_relaxed);
int32_t next = 0;
+ // A source that is not in the graph (its track was deleted; undo brings it back) gets no
+ // slot, so its consumers see no key at all rather than a silent one.
+ auto exists = [&](int32_t id) {
+ for (auto& t : authoring_->tracks) if (t->id() == id) return true;
+ return false;
+ };
auto claim = [&](int32_t src) {
- if (src < 0 || routeSlotForTrack(src) >= 0) return; // none / already assigned
+ if (src < 0 || routeSlotForTrack(src) >= 0 || !exists(src)) return; // none / already assigned / gone
if (next < kMaxRoutes) routeSlotTrackId_[next++].store(src, std::memory_order_relaxed);
};
for (auto& t : authoring_->tracks) {
diff --git a/src/native/nota.engine/src/Engine_Render.cpp b/src/native/nota.engine/src/Engine_Render.cpp
index c7dcd09e..37a8a47e 100644
--- a/src/native/nota.engine/src/Engine_Render.cpp
+++ b/src/native/nota.engine/src/Engine_Render.cpp
@@ -1848,7 +1848,13 @@ void Engine::mixGraph(Graph* g, float* out, int32_t frames, double blockStart, b
const bool audible = !leafMute(t) && (!anySolo || leafSolo(t));
// Soloing a monitoring (or recording) track must not silence what it listens to.
const bool feeding = !audible && !leafMute(t) && feedsMonitor(t.id());
- if (!audible && !capturing && !feeding) { t.setMeter(0, 0, 0, 0); t.stereoFold(0, 0, 0, frames, stereoA); continue; }
+ // A sidechain source keeps rendering for its taps when muted or solo-gated, the way a
+ // console's pre-fader send outlives the channel mute: a vocoder's voice track can be
+ // muted (or the pad soloed) and still drive the bands. Its post-fader tap is silent
+ // while it is muted.
+ const bool keying = !audible && routeSlotForTrack(t.id()) >= 0;
+ const bool postTapMuted = keying && leafMute(t);
+ if (!audible && !capturing && !feeding && !keying) { t.setMeter(0, 0, 0, 0); t.stereoFold(0, 0, 0, frames, stereoA); continue; }
const bool toMix = audible || capturing; // false: render only for the taps
// Destination: this leaf's parent group's submix bus, else the master mix.
const int destSlot = slotOf(t.groupId());
@@ -1963,7 +1969,7 @@ void Engine::mixGraph(Graph* g, float* out, int32_t frames, double blockStart, b
float l, r;
ps.apply(i, scratch_[i * 2], scratch_[i * 2 + 1], l, r);
if (tapRec && !inputQueue_.push(InputFrame{ l, r })) ++recDropped; // record this track's output
- if (route) { route[i * 2] += l; route[i * 2 + 1] += r; } // tap post-fader → route bus
+ if (route && !postTapMuted) { route[i * 2] += l; route[i * 2 + 1] += r; } // tap post-fader → route bus
if (!toMix) continue; // solo-gated feeder: taps only
dest[i * 2] += l;
dest[i * 2 + 1] += r;
diff --git a/src/native/nota.engine/src/Vocoder.h b/src/native/nota.engine/src/Vocoder.h
new file mode 100644
index 00000000..9d9cd9fe
--- /dev/null
+++ b/src/native/nota.engine/src/Vocoder.h
@@ -0,0 +1,441 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Built-in Nota Vocoder (device kind 26, nota-daw/nota#113, specs/028-vocoder-effect) — a
+// classic channel vocoder with two inputs:
+//
+// modulator this track's audio (the voice), summed to mono, trimmed by Mod gain
+// carrier an internal band-limited saw at Pitch (Saw, the default: a robot voice straight
+// away), white noise (Noise), or another track (Track) through the device sidechain
+// (the engine hands us its previous block, pre-FX or post-FX per the tap); Tilt
+// shelves Saw / Track around 1 kHz before the bands
+//
+// modulator → N analysis band-passes → envelope followers (Attack / Release, Hold freezes)
+// carrier → N synthesis band-passes (centres × 2^(Formant/12)) × envelopes → wet. With a
+// Track carrier the envelopes are divided by their slow energy (an AGC), so the
+// result sits at that track's level whatever the voice's; with Saw / Noise they
+// are not, so the result follows the voice's level
+// wet += high-passed noise gated by the modulator's sibilance (Unvoiced)
+// out = equal-power Mix of this track (dry) and wet, then Gain; a Track carrier with no
+// track picked passes this track through unchanged
+//
+// Bands: 8–32, log-spaced between Low and High; each is two cascaded TPT SVF band-pass
+// sections (constant peak gain, 4th order) of Q. The wet sum passes a soft knee above −6 dBFS. Coefficients follow smoothed params every
+// kCtrl samples, so Low / High / Q / Formant can be swept while playing. A Bands change ducks
+// the wet path out and back in (5 ms each way) around a state reset. A Carrier change
+// crossfades the two sources over 10 ms. Zero latency. In the browser's preset audition (no other
+// tracks) the rig's setPreviewKey hands it its own phrase, which a Track carrier then uses.
+//
+// All params are normalized 0..1 and APPEND ONLY (contracts/device-params.md). Persistence /
+// automation / clone flow generically through the base Device.
+// Telemetry (scopeRead): key peak, output peaks, the band count, then per band the envelope,
+// the carrier level (both 0..1 on a 54 dB scale) and the analysis centre in Hz.
+// deviceText: 0 = status line.
+// Header-only, allocation-free, JUCE-free.
+
+#pragma once
+
+#include "Device.h"
+
+#include <algorithm>
+#include <array>
+#include <atomic>
+#include <cmath>
+#include <cstdint>
+#include <cstdio>
+#include <string>
+
+namespace nota {
+
+class Vocoder : public Device {
+public:
+ // Param layout — order is the persisted/automation layout. APPEND ONLY.
+ enum { Bands = 0, Low, High, Q, Formant, Attack, Release, ModGain, Carrier, Tilt, Pitch,
+ Unvoiced, Mix, Gain, Hold, kNumParams };
+ enum { CarrierSaw = 0, CarrierNoise = 1, CarrierTrack = 2 };
+
+ static constexpr int kMaxBands = 32, kMinBands = 8;
+ // Telemetry layout (scopeRead).
+ enum { S_KeyPeak = 0, S_OutPeakL, S_OutPeakR, S_Bands, S_Env = 4, S_Carrier = S_Env + kMaxBands,
+ S_Centre = S_Carrier + kMaxBands, kTele = S_Centre + kMaxBands };
+
+ // Ranges (mirrored by the card, the presets and MCP).
+ static constexpr double kLowLo = 20.0, kLowHi = 1000.0; // Hz, exponential
+ static constexpr double kHighLo = 2000.0, kHighHi = 20000.0; // Hz, exponential
+ static constexpr double kQLo = 1.0, kQHi = 10.0;
+ static constexpr double kAttLo = 0.5, kAttHi = 100.0; // ms, exponential
+ static constexpr double kRelLo = 5.0, kRelHi = 1000.0; // ms, exponential
+ static constexpr double kModGainDb = 24.0, kTiltDb = 12.0, kGainDb = 12.0, kFormantSt = 12.0;
+ static constexpr int kPitchSteps = 84; // C0 … C7
+ static constexpr double kC0 = 16.351597831287414;
+
+ Vocoder() {
+ p_[Bands].store(8.0f / 24.0f); // 16
+ p_[Low].store(0.3544f); // 80 Hz
+ p_[High].store(0.6021f); // 8 kHz
+ p_[Q].store(4.0f / 9.0f); // 5.0
+ p_[Formant].store(0.5f); // 0 st
+ p_[Attack].store(0.2616f); // 2 ms
+ p_[Release].store(0.3925f); // 40 ms
+ p_[ModGain].store(0.5f); // 0 dB
+ p_[Carrier].store(0.0f); // Saw
+ p_[Tilt].store(0.625f); // +3 dB
+ p_[Pitch].store(36.0f / kPitchSteps);// C3
+ p_[Unvoiced].store(0.35f);
+ p_[Mix].store(1.0f);
+ p_[Gain].store(0.5f); // 0 dB
+ p_[Hold].store(0.0f);
+ setSidechainTapPre(1); // a carrier track is taken before its effects
+ setSampleRate(44100.0, 0);
+ }
+
+ void setSampleRate(double sr, int32_t /*maxBlock*/) override {
+ sr_ = sr > 0 ? sr : 44100.0;
+ reset();
+ }
+
+ // --- sidechain (the carrier track) ----------------------------------------------------
+ int32_t sidechainSourceTrackId() const override { return scTrackId_.load(std::memory_order_relaxed); }
+ void setSidechainSourceTrackId(int32_t id) override { scTrackId_.store(id, std::memory_order_relaxed); }
+ void setSidechain(const float* interleaved, int32_t frames) override { scBuf_ = interleaved; scFrames_ = frames; }
+ bool acceptsSidechain() const override { return true; }
+ void setPreviewKey(const float* interleaved, int32_t frames) override { pvBuf_ = interleaved; pvFrames_ = frames; }
+
+ void process(float* buf, int32_t frames) override {
+ const double sr = sr_;
+ // The engine only refreshes the key buffer while a source is set; drop a stale one.
+ const float* sc = (scTrackId_.load(std::memory_order_relaxed) >= 0 && scFrames_ >= frames) ? scBuf_ : nullptr;
+ if (!sc && pvBuf_ && pvFrames_ >= frames) sc = pvBuf_; // the preset audition: its own phrase
+ scBuf_ = nullptr; pvBuf_ = nullptr;
+
+ const double smP = 1.0 - std::exp(-(double)kCtrl / (0.020 * sr)); // control-rate glide, ~20 ms
+ const double smA = 1.0 - std::exp(-1.0 / (0.010 * sr)); // per-sample glide, ~10 ms
+ const double att = std::exp(-1.0 / (expMap(get(Attack), kAttLo, kAttHi) * 0.001 * sr));
+ const double rel = std::exp(-1.0 / (expMap(get(Release), kRelLo, kRelHi) * 0.001 * sr));
+ const double modG = dbToLin((get(ModGain) - 0.5) * 2.0 * kModGainDb);
+ const double scG = dbToLin(sidechainGainDb()); // the carrier track's trim
+ const double tiltT = (get(Tilt) - 0.5) * 2.0 * kTiltDb;
+ const double pitchT = std::log2(kC0) + std::round(get(Pitch) * kPitchSteps) / 12.0;
+ const double uvT = get(Unvoiced);
+ const double mixT = get(Mix);
+ const double gainT = dbToLin((get(Gain) - 0.5) * 2.0 * kGainDb);
+ const bool hold = get(Hold) >= 0.5f;
+ const int carT = std::clamp((int)std::lround(get(Carrier) * 2.0f), 0, 2);
+ const int nT = std::clamp(kMinBands + (int)std::lround(get(Bands) * 24.0f), kMinBands, kMaxBands);
+ const double duckStep = 1.0 / (0.005 * sr);
+ const double xfStep = 1.0 / (0.010 * sr);
+ const double uvAtt = std::exp(-1.0 / (0.001 * sr)), uvRel = std::exp(-1.0 / (0.030 * sr));
+ const double lvRel = std::exp(-1.0 / (0.100 * sr));
+ const double agcAtt = std::exp(-1.0 / (0.005 * sr)), agcRel = std::exp(-1.0 / (0.400 * sr));
+
+ if (snap_) { // first block: no glides from the defaults
+ lowS_ = get(Low); highS_ = get(High); qS_ = get(Q); fmtS_ = get(Formant);
+ tiltS_ = tiltT; pitchS_ = pitchT; uvS_ = uvT; mixS_ = mixT; gainS_ = gainT; modGS_ = modG;
+ carCur_ = carPrev_ = carT; xf_ = 1.0; n_ = nT; duck_ = 1.0;
+ passS_ = (carT == CarrierTrack && !sc) ? 1.0 : 0.0;
+ computeBands(); snap_ = false;
+ }
+ if (carT != carCur_ && xf_ >= 1.0) { carPrev_ = carCur_; carCur_ = carT; xf_ = 0.0; }
+
+ float keyPk = keyPk_, outPkL = outPkL_, outPkR = outPkR_;
+ const float pkFall = (float)std::exp(-(double)frames / (0.300 * sr));
+ keyPk *= pkFall; outPkL *= pkFall; outPkR *= pkFall;
+
+ for (int32_t i = 0; i < frames; ++i) {
+ if (--ctrl_ <= 0) { // control rate: params → band layout
+ ctrl_ = kCtrl;
+ lowS_ += (get(Low) - lowS_) * smP;
+ highS_ += (get(High) - highS_) * smP;
+ qS_ += (get(Q) - qS_) * smP;
+ fmtS_ += (get(Formant) - fmtS_) * smP;
+ if (nT != n_) { // Bands moved: duck out, reset, duck in
+ if (duck_ <= 0.0) { n_ = nT; clearBands(); }
+ else ducking_ = true;
+ } else ducking_ = false;
+ computeBands();
+ }
+ if (ducking_) duck_ = std::max(0.0, duck_ - duckStep);
+ else if (duck_ < 1.0) duck_ = std::min(1.0, duck_ + duckStep);
+
+ tiltS_ += (tiltT - tiltS_) * smA;
+ pitchS_ += (pitchT - pitchS_) * smA;
+ uvS_ += (uvT - uvS_) * smA;
+ mixS_ += (mixT - mixS_) * smA;
+ gainS_ += (gainT - gainS_) * smA;
+ modGS_ += (modG - modGS_) * smA;
+ if (xf_ < 1.0) xf_ = std::min(1.0, xf_ + xfStep);
+
+ // Modulator: this track, mono.
+ const double inL = buf[2 * i], inR = buf[2 * i + 1];
+ const double m = 0.5 * (inL + inR) * modGS_;
+ keyPk = std::max(keyPk, (float)std::fabs(m));
+
+ // Carrier: crossfade between the previous and the current source.
+ const double saw = sawTick(std::exp2(pitchS_));
+ const double nzL = noise(), nzR = noise();
+ const double tL = sc ? (double)sc[2 * i] * scG : 0.0, tR = sc ? (double)sc[2 * i + 1] * scG : 0.0;
+ double wTrk = 0.0, wSaw = 0.0, wNz = 0.0;
+ addWeight(carCur_, xf_, wTrk, wSaw, wNz);
+ addWeight(carPrev_, 1.0 - xf_, wTrk, wSaw, wNz);
+ double cL = wTrk * tL + wSaw * saw, cR = wTrk * tR + wSaw * saw;
+ tiltTick(cL, cR, tiltS_);
+ cL += wNz * nzL; cR += wNz * nzR;
+
+ // Bands. A Track carrier weighs each band by its envelope over the voice's recent
+ // energy (a slow AGC with a floor), so the result sits at that track's level whatever
+ // the voice's level; Saw / Noise weigh by the envelope itself, so the robot follows the
+ // voice's level. A pause in the voice closes the bands either way.
+ const double wInt = wSaw + wNz;
+ const double inv = wTrk / std::max(agc_, kAgcFloor) + wInt * kVoice;
+ double wetL = 0.0, wetR = 0.0, total = 0.0;
+ for (int b = 0; b < n_; ++b) {
+ Band& bd = band_[b];
+ const double a = bd.an.tick(bd.an2.tick(m, bd.ca), bd.ca);
+ if (!hold) {
+ const double x = std::fabs(a);
+ const double c = x > bd.env ? att : rel;
+ bd.env = std::min(kEnvMax, x + (bd.env - x) * c);
+ }
+ total += bd.env * bd.env;
+ if (!bd.live) continue;
+ const double sL = bd.sl.tick(bd.sl2.tick(cL, bd.cs), bd.cs);
+ const double sR = bd.sr.tick(bd.sr2.tick(cR, bd.cs), bd.cs);
+ const double lx = std::fabs(sL);
+ bd.lvl = lx > bd.lvl ? lx : lx + (bd.lvl - lx) * lvRel;
+ const double w = std::min(kWeightMax, bd.env * inv);
+ wetL += sL * w; wetR += sR * w;
+ }
+ total = std::sqrt(total); // the envelopes' energy, not their sum: the result keeps
+ if (!hold) agc_ = total + (agc_ - total) * (total > agc_ ? agcAtt : agcRel); // its level whether the voice is narrow or wide
+ wetL *= norm_; wetR *= norm_;
+
+ // Unvoiced: high-passed noise where the modulator is sibilant.
+ const double hf = hpM_.tick(hpM2_.tick(m, uvHpA_), uvHpA_);
+ const double hx = std::fabs(hf), fx = std::fabs(m);
+ uvHf_ = hx + (uvHf_ - hx) * (hx > uvHf_ ? uvAtt : uvRel);
+ uvAll_ = fx + (uvAll_ - fx) * (fx > uvAll_ ? uvAtt : uvRel);
+ const double cx = 0.5 * (std::fabs(cL) + std::fabs(cR)); // the carrier's level gates it too:
+ carEnv_ = cx + (carEnv_ - cx) * (cx > carEnv_ ? uvAtt : lvRel); // a silent carrier stays silent
+ if (uvS_ > 1e-4) {
+ double r = uvAll_ > 1e-9 ? std::min(1.0, uvHf_ / uvAll_) : 0.0;
+ r *= r;
+ const double lvl = wTrk + wInt * std::min(2.0, agc_ * kVoice); // at the wet path's level
+ const double g = uvS_ * r * std::min(1.0, uvAll_ / kUvFloor) * kUvGain * carEnv_ * lvl;
+ wetL += g * hpNL_.tick(hpNL2_.tick(nzL, uvHpA_), uvHpA_);
+ wetR += g * hpNR_.tick(hpNR2_.tick(nzR, uvHpA_), uvHpA_);
+ }
+ wetL = soft(wetL) * duck_; wetR = soft(wetR) * duck_;
+
+ // Equal-power Mix of this track (dry) and the wet path, then Gain. A Track carrier with
+ // no track picked passes this track unchanged (a 10 ms fade either way).
+ const double passT = (carCur_ == CarrierTrack && !sc) ? 1.0 : 0.0;
+ passS_ += (passT - passS_) * smA;
+ if (std::fabs(passT - passS_) < 1e-5) passS_ = passT;
+ const double dG = std::cos(mixS_ * 1.5707963267948966), wG = std::sin(mixS_ * 1.5707963267948966);
+ const double vL = (dG * inL + wG * wetL) * gainS_, vR = (dG * inR + wG * wetR) * gainS_;
+ const float oL = (float)(passS_ * inL + (1.0 - passS_) * vL);
+ const float oR = (float)(passS_ * inR + (1.0 - passS_) * vR);
+ buf[2 * i] = std::isfinite(oL) ? oL : 0.0f;
+ buf[2 * i + 1] = std::isfinite(oR) ? oR : 0.0f;
+ outPkL = std::max(outPkL, std::fabs(buf[2 * i]));
+ outPkR = std::max(outPkR, std::fabs(buf[2 * i + 1]));
+ }
+ flushDenormals();
+
+ keyPk_ = keyPk; outPkL_ = outPkL; outPkR_ = outPkR;
+ tele_[S_KeyPeak].store(keyPk, std::memory_order_relaxed);
+ tele_[S_OutPeakL].store(outPkL, std::memory_order_relaxed);
+ tele_[S_OutPeakR].store(outPkR, std::memory_order_relaxed);
+ tele_[S_Bands].store((float)n_, std::memory_order_relaxed);
+ for (int b = 0; b < kMaxBands; ++b) {
+ const bool on = b < n_;
+ tele_[S_Env + b].store(on ? disp(band_[b].env) : 0.0f, std::memory_order_relaxed);
+ tele_[S_Carrier + b].store(on && band_[b].live ? disp(band_[b].lvl) : 0.0f, std::memory_order_relaxed);
+ tele_[S_Centre + b].store(on ? (float)band_[b].fa : 0.0f, std::memory_order_relaxed);
+ }
+ }
+
+ int32_t scopeRead(float* out, int32_t maxSamples) const override {
+ if (!out || maxSamples <= 0) return 0;
+ int32_t n = 0;
+ for (int k = 0; k < kTele && n < maxSamples; ++k) out[n++] = tele_[k].load(std::memory_order_relaxed);
+ return n;
+ }
+
+ std::string deviceText(int32_t id) const override {
+ if (id != 0) return {};
+ static const char* car[] = { "saw", "noise", "track" };
+ char b[320];
+ const int c = std::clamp((int)std::lround(get(Carrier) * 2.0f), 0, 2);
+ std::snprintf(b, sizeof b, "%d bands %.0f-%.0f Hz - Q %.1f - formant %+d st - attack %.1f ms - release %.0f ms"
+ " - carrier %s - unvoiced %.0f %% - mix %.0f %%%s%s",
+ kMinBands + (int)std::lround(get(Bands) * 24.0f), lowHz(get(Low)), highHz(get(High)),
+ kQLo + get(Q) * (kQHi - kQLo), (int)std::lround((get(Formant) - 0.5) * 2.0 * kFormantSt),
+ expMap(get(Attack), kAttLo, kAttHi), expMap(get(Release), kRelLo, kRelHi), car[c],
+ get(Unvoiced) * 100.0, get(Mix) * 100.0, get(Hold) >= 0.5f ? " - hold" : "",
+ std::lround(get(Carrier) * 2.0f) == CarrierTrack && sidechainSourceTrackId() < 0 ? " - no carrier track (passes through)" : "");
+ return b;
+ }
+
+ const char* displayName() const override { return "Nota Vocoder"; }
+ int32_t builtinKind() const override { return 26; }
+
+ int32_t paramCount() const override { return kNumParams; }
+ const char* paramName(int32_t i) const override {
+ static const char* nm[kNumParams] = { "Bands", "Low", "High", "Q", "Formant", "Attack", "Release",
+ "Mod gain", "Carrier", "Tilt", "Pitch", "Unvoiced", "Mix", "Gain", "Hold" };
+ return (i >= 0 && i < kNumParams) ? nm[i] : "";
+ }
+ float paramMin(int32_t /*i*/) const override { return 0.0f; }
+ float paramMax(int32_t /*i*/) const override { return 1.0f; }
+ float getParam(int32_t i) const override {
+ return (i >= 0 && i < kNumParams) ? p_[i].load(std::memory_order_relaxed) : 0.0f;
+ }
+ void setParam(int32_t i, float v) override {
+ if (i >= 0 && i < kNumParams) p_[i].store(std::clamp(v, 0.0f, 1.0f), std::memory_order_relaxed);
+ }
+
+ // Unit mappings, shared with the smoke test.
+ static double expMap(double v, double lo, double hi) { return lo * std::pow(hi / lo, std::clamp(v, 0.0, 1.0)); }
+ static double lowHz(double v) { return expMap(v, kLowLo, kLowHi); }
+ static double highHz(double v) { return expMap(v, kHighLo, kHighHi); }
+
+private:
+ static constexpr int kCtrl = 32;
+ static constexpr double kEnvMax = 1.0; // a full-scale band: a loop through a return cannot run away
+ static constexpr double kNorm = 7.0; // wet make-up (calibrated in the smoke test: ≈ the carrier's level)
+ static constexpr double kVoice = 6.5; // Saw / Noise: envelope → weight (calibrated: a voice at −20 dBFS → ≈ the same out)
+ static constexpr double kAgcFloor = 0.003; // the AGC's floor: a band total this low counts as silence
+ static constexpr double kWeightMax = 1.5; // a band's weight cap while the AGC catches up with an onset
+ static constexpr double kUvFloor = 0.003; // modulator level under which Unvoiced stays shut
+ static constexpr double kUvGain = 3.0; // noise level against the carrier's
+
+ // TPT state-variable band-pass, constant peak gain (Cytomic).
+ struct Coef { double a1 = 0, a2 = 0, a3 = 0, k = 1; };
+ struct Svf {
+ double ic1 = 0, ic2 = 0;
+ double tick(double x, const Coef& c) {
+ const double v3 = x - ic2;
+ const double v1 = c.a1 * ic1 + c.a2 * v3;
+ const double v2 = ic2 + c.a2 * ic1 + c.a3 * v3;
+ ic1 = 2.0 * v1 - ic1; ic2 = 2.0 * v2 - ic2;
+ return c.k * v1;
+ }
+ void clear() { ic1 = ic2 = 0; }
+ };
+ struct Band {
+ Svf an, an2, sl, sl2, sr, sr2;
+ Coef ca, cs;
+ double fa = 1000.0, env = 0.0, lvl = 0.0;
+ bool live = true;
+ };
+ // One-pole high-pass (two in series make the 12 dB/oct unvoiced filters).
+ struct Hp1 {
+ double z = 0, x1 = 0;
+ double tick(double x, double a) { const double y = a * (z + x - x1); x1 = x; z = y; return y; }
+ void clear() { z = x1 = 0; }
+ };
+
+ float get(int i) const { return p_[i].load(std::memory_order_relaxed); }
+ static double dbToLin(double db) { return std::pow(10.0, db / 20.0); }
+ // Linear to ±0.5, then a tanh knee that never passes ±1 — a hot modulator cannot clip the wet path.
+ static double soft(double x) {
+ const double a = std::fabs(x);
+ if (a <= 0.5) return x;
+ return std::copysign(0.5 + 0.5 * std::tanh((a - 0.5) * 2.0), x);
+ }
+ static float disp(double v) { // 0..1 over −54 … 0 dB (rectified level)
+ if (v <= 1e-9) return 0.0f;
+ return (float)std::clamp((20.0 * std::log10(v) + 54.0) / 54.0, 0.0, 1.0);
+ }
+ static Coef bp(double f, double q, double sr) {
+ Coef c;
+ const double g = std::tan(3.141592653589793 * std::min(f, 0.49 * sr) / sr);
+ c.k = 1.0 / q;
+ c.a1 = 1.0 / (1.0 + g * (g + c.k));
+ c.a2 = g * c.a1;
+ c.a3 = g * c.a2;
+ return c;
+ }
+ static void addWeight(int src, double w, double& trk, double& saw, double& nz) {
+ if (src == CarrierTrack) trk += w; else if (src == CarrierNoise) nz += w; else saw += w;
+ }
+
+ void computeBands() {
+ double lo = lowHz(lowS_), hi = highHz(highS_);
+ lo = std::min(lo, hi * 0.5); // at least an octave
+ const double q = kQLo + qS_ * (kQHi - kQLo);
+ const double shift = std::exp2(std::round((fmtS_ - 0.5) * 2.0 * kFormantSt) / 12.0);
+ const double nyq = 0.45 * sr_;
+ for (int b = 0; b < n_; ++b) {
+ Band& bd = band_[b];
+ bd.fa = std::min(lo * std::pow(hi / lo, (b + 0.5) / n_), nyq);
+ const double fs = bd.fa * shift;
+ bd.live = fs <= nyq;
+ bd.ca = bp(bd.fa, q, sr_);
+ bd.cs = bp(std::min(fs, nyq), q, sr_);
+ }
+ norm_ = kNorm * std::sqrt(n_ / 16.0) * std::sqrt(q / 5.0); // L2 weights: √N brings a spread voice back to level
+ }
+ void clearBands() {
+ for (auto& bd : band_) { bd.an.clear(); bd.an2.clear(); bd.sl.clear(); bd.sl2.clear(); bd.sr.clear(); bd.sr2.clear(); bd.env = bd.lvl = 0.0; }
+ }
+ void reset() {
+ clearBands();
+ hpM_.clear(); hpM2_.clear(); hpNL_.clear(); hpNL2_.clear(); hpNR_.clear(); hpNR2_.clear();
+ tiltZL_ = tiltZR_ = 0.0; sawPh_ = 0.0; uvHf_ = uvAll_ = carEnv_ = agc_ = 0.0;
+ uvHpA_ = 1.0 / (1.0 + 2.0 * 3.141592653589793 * 4000.0 / sr_);
+ tiltA_ = std::exp(-2.0 * 3.141592653589793 * 1000.0 / sr_);
+ ctrl_ = 0; snap_ = true; ducking_ = false;
+ keyPk_ = outPkL_ = outPkR_ = 0.0f;
+ }
+
+ double sawTick(double hz) { // polyBLEP saw
+ const double dt = std::min(0.5, hz / sr_);
+ double t = sawPh_;
+ double y = 2.0 * t - 1.0;
+ if (t < dt) { const double x = t / dt; y -= x + x - x * x - 1.0; }
+ else if (t > 1.0 - dt) { const double x = (t - 1.0) / dt; y -= x * x + x + x + 1.0; }
+ sawPh_ += dt; if (sawPh_ >= 1.0) sawPh_ -= 1.0;
+ return 0.5 * y;
+ }
+ double noise() { // xorshift32 → [−1, 1)
+ rng_ ^= rng_ << 13; rng_ ^= rng_ >> 17; rng_ ^= rng_ << 5;
+ return (double)(int32_t)rng_ * (1.0 / 2147483648.0);
+ }
+ void tiltTick(double& l, double& r, double db) { // shelf pair around 1 kHz: lows −db/2, highs +db/2
+ const double gh = std::pow(10.0, db / 40.0), gl = 1.0 / gh;
+ tiltZL_ = l + (tiltZL_ - l) * tiltA_;
+ tiltZR_ = r + (tiltZR_ - r) * tiltA_;
+ l = tiltZL_ * gl + (l - tiltZL_) * gh;
+ r = tiltZR_ * gl + (r - tiltZR_) * gh;
+ }
+ void flushDenormals() {
+ auto f = [](double& v) { if (std::fabs(v) < 1e-20) v = 0.0; };
+ for (auto& bd : band_)
+ for (Svf* s : { &bd.an, &bd.an2, &bd.sl, &bd.sl2, &bd.sr, &bd.sr2 }) { f(s->ic1); f(s->ic2); }
+ for (auto& bd : band_) { f(bd.env); f(bd.lvl); }
+ f(uvHf_); f(uvAll_); f(carEnv_); f(agc_); f(tiltZL_); f(tiltZR_);
+ }
+
+ std::atomic<float> p_[kNumParams];
+ std::atomic<float> tele_[kTele] = {};
+ std::atomic<int32_t> scTrackId_{ -1 };
+ const float* scBuf_ = nullptr;
+ int32_t scFrames_ = 0;
+ const float* pvBuf_ = nullptr; // preview key (setPreviewKey), one block
+ int32_t pvFrames_ = 0;
+
+ double sr_ = 44100.0;
+ std::array<Band, kMaxBands> band_{};
+ int n_ = 16, ctrl_ = 0, carCur_ = 0, carPrev_ = 0;
+ bool snap_ = true, ducking_ = false;
+ double duck_ = 1.0, xf_ = 1.0, norm_ = 1.0, agc_ = 0.0, passS_ = 1.0;
+ double lowS_ = 0, highS_ = 0, qS_ = 0, fmtS_ = 0.5, tiltS_ = 0, pitchS_ = 0, uvS_ = 0, mixS_ = 1, gainS_ = 1, modGS_ = 1;
+ double carEnv_ = 0.0, sawPh_ = 0.0, tiltZL_ = 0.0, tiltZR_ = 0.0, tiltA_ = 0.0, uvHpA_ = 0.0, uvHf_ = 0.0, uvAll_ = 0.0;
+ Hp1 hpM_, hpM2_, hpNL_, hpNL2_, hpNR_, hpNR2_;
+ uint32_t rng_ = 0x9E3779B9u;
+ float keyPk_ = 0.0f, outPkL_ = 0.0f, outPkR_ = 0.0f;
+};
+
+} // namespace nota
diff --git a/tests/Nota.SmokeTest/BrowserCategoryTests.cs b/tests/Nota.SmokeTest/BrowserCategoryTests.cs
index e97aac2b..d2bb95df 100644
--- a/tests/Nota.SmokeTest/BrowserCategoryTests.cs
+++ b/tests/Nota.SmokeTest/BrowserCategoryTests.cs
@@ -114,7 +114,7 @@ internal static class BrowserCategoryTests
pvm.SetCategoryFilter(1, DeviceCategories.Other);
plugins.Set("Ambience | VST3 | fx | Smart | Fx/Reverb", "Ana | VST3 | inst | Sonic | Instrument/Synth");
pvm.Rebuild();
- yield return (pvm.CategoryFilter(1) == "" && !pvm.CategoriesOn(1).Contains(DeviceCategories.Other) && Devices(pvm.Effects).Count == 27
+ yield return (pvm.CategoryFilter(1) == "" && !pvm.CategoriesOn(1).Contains(DeviceCategories.Other) && Devices(pvm.Effects).Count == 28
&& pvm.CategoryFilter(0) == "Synths",
"a rescan that empties the picked category clears the pick; other picks stay");
diff --git a/tests/Nota.SmokeTest/DesignTokenCheck.Browser.cs b/tests/Nota.SmokeTest/DesignTokenCheck.Browser.cs
index 8292c639..e0d54d4b 100644
--- a/tests/Nota.SmokeTest/DesignTokenCheck.Browser.cs
+++ b/tests/Nota.SmokeTest/DesignTokenCheck.Browser.cs
@@ -16,7 +16,7 @@ internal static partial class DesignTokenCheck
var types = new[] { BuiltinDeviceType.Instrument, BuiltinDeviceType.AudioEffect, BuiltinDeviceType.MidiEffect };
var expected = new Dictionary<BuiltinDeviceType, int>
{
- [BuiltinDeviceType.Instrument] = 16, [BuiltinDeviceType.AudioEffect] = 26, [BuiltinDeviceType.MidiEffect] = 6,
+ [BuiltinDeviceType.Instrument] = 16, [BuiltinDeviceType.AudioEffect] = 27, [BuiltinDeviceType.MidiEffect] = 6,
};
foreach (var type in types)
{
diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.cs
index a465416d..7c319215 100644
--- a/tests/Nota.SmokeTest/Program.cs
+++ b/tests/Nota.SmokeTest/Program.cs
@@ -395,6 +395,14 @@ if (args.Length >= 1 && args[0] == "--keys")
Console.WriteLine(failures == 0 ? "KEYS PASSED" : $"KEYS FAILED ({failures})");
return failures == 0 ? 0 : 1;
}
+// Nota Vocoder alone (fast iteration): `--vocoder`. Also part of the full run.
+if (args.Length >= 1 && args[0] == "--vocoder")
+{
+ Console.WriteLine("-- nota vocoder --");
+ foreach (var (ok, label) in VocoderTests.Run()) Check(ok, label);
+ Console.WriteLine(failures == 0 ? "VOCODER PASSED" : $"VOCODER FAILED ({failures})");
+ return failures == 0 ? 0 : 1;
+}
// Live MIDI recording alone (fast iteration): `--live-record`. Also part of the full run.
if (args.Length >= 1 && args[0] == "--live-record")
{
@@ -14909,6 +14917,8 @@ Console.WriteLine("-- tempo follow --");
foreach (var (ok, label) in TempoFollowTests.Run()) Check(ok, label);
Console.WriteLine("-- nota keys --");
foreach (var (ok, label) in KeysTests.Run()) Check(ok, label);
+Console.WriteLine("-- nota vocoder --");
+foreach (var (ok, label) in VocoderTests.Run()) Check(ok, label);
Console.WriteLine("-- instrument on/off --");
foreach (var (ok, label) in InstrumentBypassTests.Run()) Check(ok, label);
Console.WriteLine("-- preset init --");
diff --git a/tests/Nota.SmokeTest/VocoderTests.cs b/tests/Nota.SmokeTest/VocoderTests.cs
new file mode 100644
index 00000000..e12ea2b8
--- /dev/null
+++ b/tests/Nota.SmokeTest/VocoderTests.cs
@@ -0,0 +1,421 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Nota Vocoder (effect kind 26, specs/028-vocoder-effect): the track is the voice (modulator),
+// the carrier a saw, noise or another track. Identity, the param contract
+// (names, defaults, round-trip), clone, the modulator through the device sidechain, the three
+// carriers, the band controls, Hold, Unvoiced, click-free sweeps, save / load, determinism, the
+// factory presets and the CPU budget against Nota Chamber.
+
+using System.Diagnostics;
+using Nota.Application;
+using Nota.Infrastructure;
+
+namespace Nota.SmokeTest;
+
+internal static class VocoderTests
+{
+ private const int Sr = 48000, Kind = 26, Block = 512;
+ private const int PBands = 0, PLow = 1, PHigh = 2, PQ = 3, PFormant = 4, PAttack = 5, PRelease = 6, PModGain = 7,
+ PCarrier = 8, PTilt = 9, PPitch = 10, PUnvoiced = 11, PMix = 12, PGain = 13, PHold = 14;
+ private static readonly string[] Names =
+ { "Bands", "Low", "High", "Q", "Formant", "Attack", "Release", "Mod gain", "Carrier", "Tilt", "Pitch", "Unvoiced", "Mix", "Gain", "Hold" };
+ private static readonly float[] Defaults =
+ { 8f / 24f, 0.3544f, 0.6021f, 4f / 9f, 0.5f, 0.2616f, 0.3925f, 0.5f, 0f, 0.625f, 36f / 84f, 0.35f, 1f, 0.5f, 0f };
+
+ private static string? _chord, _speech;
+
+ // A C-major triad of band-limited saws, −12 dBFS-ish; nothing above ~4 kHz.
+ private static string Chord()
+ {
+ if (_chord != null) return _chord;
+ _chord = Path.Combine(Path.GetTempPath(), "nota-smoke-vocoder-chord.wav");
+ double[] f0 = { 130.81, 164.81, 196.0 };
+ WavWriter.WriteStereo(_chord, 4.0, Sr, i =>
+ {
+ double s = 0;
+ foreach (double f in f0)
+ for (int k = 1; k * f < 4000; k++) s += Math.Sin(2 * Math.PI * f * k * i / Sr) / k;
+ s *= 0.08;
+ return (s, s);
+ });
+ return _chord;
+ }
+
+ // A speech-like modulator: a 150 Hz buzz through two moving formants, syllables at 3 Hz, and a
+ // sibilant noise burst (above 4 kHz) every 1.5 s. Deterministic.
+ private static string Speech()
+ {
+ if (_speech != null) return _speech;
+ _speech = Path.Combine(Path.GetTempPath(), "nota-smoke-vocoder-speech.wav");
+ uint seed = 777; double prev = 0;
+ double Next() { seed = seed * 1664525u + 1013904223u; return (seed >> 8) / 8388608.0 - 1.0; }
+ WavWriter.WriteStereo(_speech, 4.0, Sr, i =>
+ {
+ double t = (double)i / Sr;
+ double f1 = 500 + 250 * Math.Sin(2 * Math.PI * 1.7 * t), f2 = 1500 + 700 * Math.Sin(2 * Math.PI * 1.1 * t + 1);
+ double v = 0;
+ for (int k = 1; k * 150.0 < 5000; k++)
+ {
+ double f = 150.0 * k;
+ double g = Math.Exp(-Math.Pow(Math.Log(f / f1), 2) * 4) + 0.8 * Math.Exp(-Math.Pow(Math.Log(f / f2), 2) * 5);
+ v += g * Math.Sin(2 * Math.PI * f * t) / Math.Sqrt(k);
+ }
+ v *= 0.12 * Math.Abs(Math.Sin(2 * Math.PI * 1.5 * t));
+ double ph = t % 1.5;
+ if (ph > 1.1 && ph < 1.3) { double n = Next(); v += (n - prev) * 0.25; prev = n; } // differentiated noise ≈ HF
+ return (v, v);
+ });
+ return _speech;
+ }
+
+ // The voice track (speech unless empty) with the vocoder — the modulator — and, when asked, a
+ // carrier track (chord unless empty) routed in as Carrier = Track.
+ private static (NotaEngine E, int Voice, int Car, int Di) Rig(bool voiceClip = true, bool carrierTrack = false, bool carrierClip = true)
+ {
+ var e = new NotaEngine();
+ e.SetBpm(120);
+ int voice = e.AddAudioTrack();
+ if (voiceClip) e.AddAudioClip(voice, Speech(), 0.0);
+ int car = -1;
+ if (carrierTrack) { car = e.AddAudioTrack(); if (carrierClip) e.AddAudioClip(car, Chord(), 0.0); }
+ int di = e.AddBuiltinDevice(voice, Kind);
+ if (carrierTrack)
+ {
+ e.DeviceSetParam(voice, di, PCarrier, 1f);
+ e.SetDeviceSidechainSource(voice, di, car);
+ e.SetTrackVolume(car, 0f); // hear the vocoder alone (the Pre tap is before the fader)
+ }
+ return (e, voice, car, di);
+ }
+
+ private static float[] Play(NotaEngine e, int frames, int block = Block, Action<int>? perBlock = null)
+ {
+ var all = new float[frames * 2]; var b = new float[block * 2];
+ e.Seek(0); e.Play();
+ int n = 0;
+ for (int done = 0; done < frames; n++)
+ {
+ perBlock?.Invoke(n);
+ int m = Math.Min(block, frames - done);
+ e.RenderOffline(b, m, Sr);
+ Array.Copy(b, 0, all, done * 2, m * 2);
+ done += m;
+ }
+ e.StopTransport();
+ return all;
+ }
+
+ private static double Rms(float[] st, int from = 0)
+ {
+ double s = 0; int n = 0;
+ for (int i = from * 2; i < st.Length; i++) { s += st[i] * (double)st[i]; n++; }
+ return Math.Sqrt(s / Math.Max(1, n));
+ }
+ private static double Peak(float[] st) { double p = 0; foreach (var v in st) p = Math.Max(p, Math.Abs(v)); return p; }
+ private static bool Finite(float[] st) { foreach (var v in st) if (!float.IsFinite(v) || Math.Abs(v) > 8f) return false; return true; }
+ private static double MaxStep(float[] st, int from = 0)
+ {
+ double d = 0;
+ for (int i = (from + 1) * 2; i < st.Length; i++) d = Math.Max(d, Math.Abs(st[i] - st[i - 2]));
+ return d;
+ }
+ private static double MaxDiff(float[] a, float[] b) { double d = 0; for (int i = 0; i < Math.Min(a.Length, b.Length); i++) d = Math.Max(d, Math.Abs(a[i] - b[i])); return d; }
+ // Energy at one frequency (Goertzel), mono sum.
+ private static double At(float[] st, double hz, int from = 0)
+ {
+ double w = 2 * Math.PI * hz / Sr, c = 2 * Math.Cos(w), s1 = 0, s2 = 0;
+ for (int i = from * 2; i < st.Length; i += 2) { double s0 = (st[i] + st[i + 1]) * 0.5 + c * s1 - s2; s2 = s1; s1 = s0; }
+ return s1 * s1 + s2 * s2 - c * s1 * s2;
+ }
+ // Energy above `hz` (first difference of the mono sum, a crude high-pass).
+ private static double HighEnergy(float[] st, int from = 0)
+ {
+ double s = 0, prev = 0;
+ for (int i = from * 2; i < st.Length; i += 2) { double m = (st[i] + st[i + 1]) * 0.5; s += (m - prev) * (m - prev); prev = m; }
+ return s;
+ }
+
+ private static double Db(float[] st, int from) => 20 * Math.Log10(Rms(st, from) + 1e-12);
+
+ public static IEnumerable<(bool, string)> Run()
+ {
+ // ---- identity and the param contract ------------------------------------------------
+ {
+ var (e, voice, car, di) = Rig(carrierTrack: true);
+ using var _ = e;
+ yield return (di >= 0 && e.DeviceName(voice, di) == "Nota Vocoder" && e.TrackDeviceBuiltinKind(voice, di) == Kind,
+ $"Nota Vocoder adds as builtin kind 26 ('{e.DeviceName(voice, di)}')");
+ int pc = e.DeviceParamCount(voice, di);
+ var names = Enumerable.Range(0, pc).Select(i => e.DeviceParamName(voice, di, i)).ToArray();
+ yield return (pc == 15 && names.SequenceEqual(Names), $"15 params in the contract order ({string.Join(",", names)})");
+ var bad = Enumerable.Range(0, Math.Min(pc, 15)).Where(i => Math.Abs(e.DeviceParamDefault(voice, di, i) - Defaults[i]) > 1e-3f).ToArray();
+ yield return (bad.Length == 0, $"defaults match the contract — Carrier Saw ({(bad.Length == 0 ? "all" : "off: " + string.Join(",", bad.Select(i => Names[i])))})");
+ var snap = Enumerable.Range(0, pc).Select(i => e.DeviceGetParam(voice, di, i)).ToArray();
+ bool rt = true;
+ for (int i = 0; i < pc; i++) { float v = (i * 7 % 10) / 10f; e.DeviceSetParam(voice, di, i, v); rt &= Math.Abs(e.DeviceGetParam(voice, di, i) - v) < 1e-5f; }
+ yield return (rt, "every param round-trips");
+ for (int i = 0; i < pc; i++) e.DeviceSetParam(voice, di, i, snap[i]);
+ yield return (e.DeviceAcceptsSidechain(voice, di) && e.DeviceSidechainSource(voice, di) == car, "takes a sidechain (the carrier track)");
+ yield return (e.DeviceSidechainTapPre(voice, di), "a new vocoder taps its carrier track pre-FX");
+
+ int dup = e.DuplicateTrack(voice);
+ bool same = dup > 0 && Enumerable.Range(0, pc).All(i => Math.Abs(e.DeviceGetParam(dup, di, i) - e.DeviceGetParam(voice, di, i)) < 1e-6f);
+ yield return (same, "duplicating the track clones every param");
+ yield return (dup > 0 && e.DeviceSidechainSource(dup, di) == car && e.DeviceSidechainTapPre(dup, di),
+ $"the clone keeps its carrier track and tap ({e.DeviceSidechainSource(dup, di)})");
+ }
+
+ // ---- the default: the track's own voice through the internal saw -----------------
+ {
+ var (e, voice, _, di) = Rig();
+ using var _e = e;
+ var robot = Play(e, Sr * 2);
+ double rms = Rms(robot, Sr / 2), pk = Peak(robot);
+ yield return (Finite(robot) && rms > 1e-3, $"added with its defaults, the voice comes out as a robot (Saw) — audible + finite (RMS {rms:0.0000}, peak {pk:0.000})");
+ yield return (pk < 1.0, $"default settings stay below 0 dBFS (peak {pk:0.000})");
+ e.SetDeviceBypassed(voice, di, true);
+ double voiceDb = Db(Play(e, Sr * 2), Sr / 2);
+ e.SetDeviceBypassed(voice, di, false);
+ double robotDb = 20 * Math.Log10(rms);
+ yield return (Math.Abs(robotDb - voiceDb) < 6, $"the robot sits near the voice's level ({robotDb:0.0} vs {voiceDb:0.0} dB)");
+
+ // The robot follows the syllables: 50 ms windows over the first second swing.
+ var win = Enumerable.Range(2, 18).Select(w => { double s = 0; for (int i = w * 2400; i < (w + 1) * 2400; i++) s += robot[2 * i] * (double)robot[2 * i]; return 10 * Math.Log10(s / 2400 + 1e-20); }).ToArray();
+ yield return (win.Max() - win.Min() > 8, $"the output follows the syllables ({win.Max() - win.Min():0.0} dB swing)");
+ // ...and the voice's level: Mod gain −20 dB brings the robot down with it.
+ e.DeviceSetParam(voice, di, PModGain, 0.5f - 20f / 48f);
+ double quietDb = Db(Play(e, Sr * 2), Sr / 2);
+ e.DeviceSetParam(voice, di, PModGain, 0.5f);
+ yield return (robotDb - quietDb is > 12 and < 28, $"with Saw the robot follows the voice's level (−20 dB → {quietDb - robotDb:0.0} dB)");
+
+ var sc = new float[100];
+ Play(e, Sr / 6); // end on a syllable's peak (the speech's gaps fall on every 1/3 s)
+ int n = e.DeviceScope(voice, di, sc, sc.Length);
+ yield return (n == 100 && (int)sc[3] == 16 && sc.Skip(4).Take(16).Max() > 0 && sc[68] > 79 && sc[68 + 15] < 8001,
+ $"scope: 100 values ({n}), 16 bands ({sc[3]}), env max {sc.Skip(4).Take(16).Max():0.00}, centres {sc[68]:0} … {sc[68 + 15]:0} Hz");
+
+ e.DeviceSetParam(voice, di, PMix, 0f);
+ var dry = Play(e, Sr);
+ e.SetDeviceBypassed(voice, di, true);
+ var byp = Play(e, Sr);
+ e.SetDeviceBypassed(voice, di, false);
+ double dd = MaxDiff(dry.Skip(Sr / 5).ToArray(), byp.Skip(Sr / 5).ToArray()); // after the Mix glide
+ yield return (dd < 1e-4, $"Mix 0 % = the track as it came in (Δ {dd:0.000000})");
+ }
+ {
+ var (e, _, _, _) = Rig(voiceClip: false); // an empty track: no voice
+ using var _e = e;
+ var outv = Play(e, Sr);
+ yield return (Finite(outv) && Rms(outv, Sr / 4) < 1e-4, "no voice on the track → silence (the saw only speaks through it)");
+ }
+
+ // ---- carriers: Saw at Pitch, Noise, another track --------------------------------------
+ {
+ var (e, voice, _, di) = Rig();
+ using var _e = e;
+ e.DeviceSetParam(voice, di, PUnvoiced, 0f); // the pitch check wants the saw alone
+ var saw = Play(e, Sr * 2);
+ // Odd harmonics of C3 (3, 5, 7 × 130.8 Hz) are not harmonics of C4: they vanish when Pitch is C4.
+ double Odd(float[] o) => At(o, 392.44, Sr / 2) + At(o, 654.06, Sr / 2) + At(o, 915.67, Sr / 2);
+ double Even(float[] o) => At(o, 523.25, Sr / 2) + At(o, 784.88, Sr / 2) + At(o, 1046.5, Sr / 2);
+ double c3 = Odd(saw) / Even(saw);
+ e.DeviceSetParam(voice, di, PPitch, 48f / 84f); // C4
+ var saw4 = Play(e, Sr * 2);
+ double c4 = Odd(saw4) / Even(saw4);
+ yield return (c3 > 10 * c4, $"Pitch sets the saw's note (odd / even C3 harmonics {c3:0.00} at C3 → {c4:0.000} at C4)");
+ e.DeviceSetParam(voice, di, PPitch, Defaults[PPitch]);
+ e.DeviceSetParam(voice, di, PUnvoiced, Defaults[PUnvoiced]);
+ e.DeviceSetParam(voice, di, PCarrier, 0.5f);
+ var nz = Play(e, Sr * 2);
+ yield return (Finite(nz) && Rms(nz, Sr / 2) > 1e-3 && Peak(nz) < 1.0, $"Noise carrier whispers (RMS {Rms(nz, Sr / 2):0.0000})");
+
+ // Switching carriers mid-play crossfades: no jump bigger than the signal's own steps.
+ e.DeviceSetParam(voice, di, PCarrier, 0f);
+ var sw = Play(e, Sr, perBlock: b => { if (b == 40) e.DeviceSetParam(voice, di, PCarrier, 0.5f); if (b == 70) e.DeviceSetParam(voice, di, PCarrier, 0f); });
+ double steady = Math.Max(MaxStep(saw, Sr / 2), MaxStep(nz, Sr / 2));
+ yield return (Finite(sw) && MaxStep(sw, Sr / 4) < steady * 1.5 + 0.02, $"carrier switch is click-free (max step {MaxStep(sw, Sr / 4):0.000} vs steady {steady:0.000})");
+
+ // Track carrier with no track picked: the track passes through unchanged.
+ e.DeviceSetParam(voice, di, PCarrier, 1f);
+ var none = Play(e, Sr);
+ e.SetDeviceBypassed(voice, di, true);
+ var noneByp = Play(e, Sr);
+ e.SetDeviceBypassed(voice, di, false);
+ double nd = MaxDiff(none.Skip(Sr).ToArray(), noneByp.Skip(Sr).ToArray()); // after the 10 ms fade (0.5 s in)
+ yield return (nd < 1e-4, $"Track carrier, no track picked → the track passes unchanged (Δ {nd:0.000000} against bypass)");
+ }
+ {
+ var (e, voice, car, di) = Rig(carrierTrack: true);
+ using var _e = e;
+ var talk = Play(e, Sr * 2);
+ double talkDb = Db(talk, Sr / 2);
+ yield return (Finite(talk) && Rms(talk, Sr / 2) > 1e-3 && Peak(talk) < 1.0, $"Track carrier: the chord track speaks the voice ({talkDb:0.0} dB, peak {Peak(talk):0.000})");
+ // The level follows the carrier track, not the voice: a voice 20 dB quieter vocodes as loud.
+ e.DeviceSetParam(voice, di, PModGain, 0.5f - 20f / 48f);
+ double quietDb = Db(Play(e, Sr * 2), Sr / 2);
+ e.DeviceSetParam(voice, di, PModGain, 0.5f);
+ yield return (Math.Abs(quietDb - talkDb) < 3, $"with a Track carrier a voice 20 dB quieter vocodes as loud ({talkDb:0.0} → {quietDb:0.0} dB)");
+ e.SetTrackVolume(car, 1f); e.SetTrackVolume(voice, 0f);
+ double carDb = Db(Play(e, Sr * 2), Sr / 2);
+ e.SetTrackVolume(car, 0f); e.SetTrackVolume(voice, 1f);
+ yield return (Math.Abs(talkDb - carDb) < 6, $"…and sits near the carrier track's level ({talkDb:0.0} vs {carDb:0.0} dB)");
+ // Muting the carrier track (to hear only the vocoder) keeps its Pre tap feeding the bands.
+ e.SetTrackVolume(car, 1f); e.SetTrackMute(car, true);
+ double mutedDb = Db(Play(e, Sr * 2), Sr / 2);
+ e.SetTrackMute(car, false); e.SetTrackVolume(car, 0f);
+ yield return (Math.Abs(mutedDb - talkDb) < 1.5, $"a muted carrier track still feeds the bands through the Pre tap ({mutedDb:0.0} vs {talkDb:0.0} dB)");
+
+ // Unvoiced adds energy above the chord (which has none past ~4 kHz) where the speech hisses.
+ e.DeviceSetParam(voice, di, PUnvoiced, 0f);
+ var uv0 = Play(e, Sr * 2);
+ e.DeviceSetParam(voice, di, PUnvoiced, 1f);
+ var uv1 = Play(e, Sr * 2);
+ double hRatio = HighEnergy(uv1, Sr / 4) / Math.Max(1e-12, HighEnergy(uv0, Sr / 4));
+ yield return (Finite(uv1) && hRatio > 2, $"Unvoiced brings out sibilants (high-band energy × {hRatio:0.0})");
+ e.DeviceSetParam(voice, di, PUnvoiced, Defaults[PUnvoiced]);
+
+ // The carrier track is deleted: the voice passes through unchanged.
+ e.SetDeviceBypassed(voice, di, true);
+ var byp = Play(e, Sr);
+ e.SetDeviceBypassed(voice, di, false);
+ e.RemoveTrack(car);
+ var o = Play(e, Sr);
+ double rd = MaxDiff(o.Skip(Sr).ToArray(), byp.Skip(Sr).ToArray());
+ yield return (Finite(o) && rd < 1e-4, $"deleting the carrier track lets the voice pass unchanged, no crash (Δ {rd:0.000000})");
+ }
+ {
+ var (e, _, _, _) = Rig(carrierTrack: true, carrierClip: false); // the carrier track is silent
+ using var _e = e;
+ var outv = Play(e, Sr);
+ yield return (Finite(outv) && Rms(outv, Sr / 4) < 1e-4, "a silent carrier track → silent wet");
+ }
+
+ // ---- shaping -------------------------------------------------------------------------
+ {
+ var (e, voice, _, di) = Rig();
+ using var _e = e;
+ var sc = new float[100];
+ var basev = Play(e, Sr);
+ foreach (var (bn, nb) in new[] { (0f, 8), (1f, 32) })
+ {
+ e.DeviceSetParam(voice, di, PBands, bn);
+ var o = Play(e, Sr);
+ e.DeviceScope(voice, di, sc, sc.Length);
+ yield return (Finite(o) && Rms(o, Sr / 4) > 1e-3 && (int)sc[3] == nb, $"{nb} bands: audible, finite, scope reports {(int)sc[3]}");
+ }
+ e.DeviceSetParam(voice, di, PBands, Defaults[PBands]);
+ foreach (float fm in new[] { 0f, 1f })
+ {
+ e.DeviceSetParam(voice, di, PFormant, fm);
+ var o = Play(e, Sr);
+ yield return (Finite(o) && Rms(o, Sr / 4) > 1e-4 && MaxDiff(o, basev) > 1e-3, $"Formant {(fm - 0.5f) * 24:+0;−0} st is finite and changes the sound");
+ }
+ e.DeviceSetParam(voice, di, PFormant, 0.5f);
+
+ // Hold freezes the envelopes while the voice keeps moving.
+ Play(e, Sr / 2, perBlock: b => { if (b == 20) e.DeviceSetParam(voice, di, PHold, 1f); });
+ e.DeviceScope(voice, di, sc, sc.Length); var h1 = sc.Skip(4).Take(16).ToArray();
+ var held = new float[4096 * 2]; e.Play(); e.RenderOffline(held, 4096, Sr); e.StopTransport();
+ e.DeviceScope(voice, di, sc, sc.Length); var h2 = sc.Skip(4).Take(16).ToArray();
+ yield return (h1.Zip(h2).All(p => Math.Abs(p.First - p.Second) < 1e-5f) && h1.Max() > 0, "Hold freezes the band envelopes");
+ e.DeviceSetParam(voice, di, PHold, 0f);
+
+ // Sweeping every band control each block stays finite and click-free (SC-003).
+ // The reference: the largest sample step of static renders at the corners the sweep visits.
+ double ref0 = 0;
+ foreach (var (lo, hi, q, fm, bn) in new[] { (0f, 0f, 0f, 0f, 0f), (1f, 1f, 1f, 1f, 1f), (0f, 1f, 1f, 1f, 0f), (1f, 0f, 0f, 0f, 1f), (0.5f, 0.5f, 0.5f, 0.5f, 0f) })
+ {
+ e.DeviceSetParam(voice, di, PLow, lo); e.DeviceSetParam(voice, di, PHigh, hi); e.DeviceSetParam(voice, di, PQ, q);
+ e.DeviceSetParam(voice, di, PFormant, fm); e.DeviceSetParam(voice, di, PBands, bn);
+ ref0 = Math.Max(ref0, MaxStep(Play(e, Sr), Sr / 4));
+ }
+ var sweep = Play(e, Sr * 2, 128, b =>
+ {
+ double ph = b * 0.05;
+ e.DeviceSetParam(voice, di, PLow, (float)(0.5 + 0.5 * Math.Sin(ph)));
+ e.DeviceSetParam(voice, di, PHigh, (float)(0.5 + 0.5 * Math.Cos(ph * 0.7)));
+ e.DeviceSetParam(voice, di, PQ, (float)(0.5 + 0.5 * Math.Sin(ph * 1.3)));
+ e.DeviceSetParam(voice, di, PFormant, (float)(0.5 + 0.5 * Math.Sin(ph * 0.4)));
+ if (b % 150 == 0) e.DeviceSetParam(voice, di, PBands, (b / 150) % 2 == 0 ? 1f : 0f);
+ });
+ double ms = MaxStep(sweep, Sr / 4);
+ yield return (Finite(sweep) && ms < ref0 * 1.5 + 0.02, $"sweeping Low / High / Q / Formant / Bands is click-free (max step {ms:0.000} vs static corners {ref0:0.000})");
+ }
+
+ // ---- recall, determinism, presets ---------------------------------------------------
+ {
+ float[] Render()
+ {
+ var (e, voice, _, di) = Rig(carrierTrack: true);
+ using var _e = e;
+ e.DeviceSetParam(voice, di, PBands, 0.75f);
+ e.DeviceSetParam(voice, di, PUnvoiced, 0.6f);
+ return Play(e, Sr);
+ }
+ var a = Render(); var b = Render();
+ yield return (MaxDiff(a, b) == 0, $"two offline renders are identical (Δ {MaxDiff(a, b)})");
+ }
+ {
+ string dir = Path.Combine(Path.GetTempPath(), "nota-smoke-vocoder-" + Guid.NewGuid().ToString("N") + ".nota");
+ var transport = new TransportState(120.0, 1.0, false, false);
+ var (e, voice, car, di) = Rig(carrierTrack: true);
+ using (e)
+ {
+ e.DeviceSetParam(voice, di, PFormant, 0.75f);
+ e.SetDeviceSidechainTapPre(voice, di, false);
+ ProjectService.Save(ProjectService.Capture(e, transport, new List<string>()), dir, e);
+ }
+ using var d = new NotaEngine();
+ var warn = ProjectService.Apply(ProjectService.Load(dir), d, dir);
+ int dVoice = -1, dCar = -1;
+ for (int i = 0; i < d.TrackCount; i++)
+ if (d.TryGetTrackInfo(i, out var ti)) { if (i == 0) dVoice = ti.Id; else if (i == 1) dCar = ti.Id; }
+ bool ok = dVoice > 0 && d.TrackDeviceBuiltinKind(dVoice, di) == Kind
+ && Math.Abs(d.DeviceGetParam(dVoice, di, PFormant) - 0.75f) < 1e-5f && Math.Abs(d.DeviceGetParam(dVoice, di, PCarrier) - 1f) < 1e-5f;
+ yield return (warn.Count == 0 && ok, $"save / load restores the vocoder's params ({warn.Count} warnings)");
+ yield return (d.DeviceSidechainSource(dVoice, di) == dCar && !d.DeviceSidechainTapPre(dVoice, di),
+ $"save / load restores the carrier track and its tap ({d.DeviceSidechainSource(dVoice, di)} vs {dCar})");
+ try { Directory.Delete(dir, true); } catch { }
+ }
+ {
+ var cat = new FactoryPresetCatalog();
+ var mine = cat.All().Where(p => p.Id.StartsWith("vocoder/", StringComparison.Ordinal)).ToList();
+ yield return (mine.Count >= 5, $"{mine.Count} factory presets (≥ 5)");
+ var (e, voice, _, di) = Rig();
+ using var _e = e;
+ var loud = new List<string>(); var fail = new List<string>(); var silent = new List<string>();
+ foreach (var p in mine)
+ {
+ string err = cat.ApplyInPlace(e, p.Id, voice, di);
+ if (err.Length != 0) { fail.Add(p.Id + ": " + err); continue; }
+ var o = Play(e, Sr * 2);
+ if (!Finite(o) || Peak(o) >= 1.0) loud.Add($"{p.Id} {Peak(o):0.00}");
+ if (Rms(o, Sr / 2) < 1e-3) silent.Add(p.Id);
+ }
+ yield return (fail.Count == 0, $"every vocoder preset applies ({string.Join("; ", fail)})");
+ yield return (loud.Count == 0 && silent.Count == 0, $"every preset dropped on a voice track is audible and peaks below 0 dBFS (loud: {string.Join(", ", loud)}; silent: {string.Join(", ", silent)})");
+ }
+
+ // ---- CPU: 32 bands at 48 kHz within Nota Chamber's budget (SC-004) ------------------
+ {
+ double Cost(int kind, bool vocoder)
+ {
+ using var e = new NotaEngine();
+ e.SetBpm(120);
+ int t = e.AddAudioTrack(); e.AddAudioClip(t, Speech(), 0.0);
+ int m = e.AddAudioTrack(); e.AddAudioClip(m, Chord(), 0.0);
+ int d = e.AddBuiltinDevice(t, kind);
+ if (vocoder) { e.DeviceSetParam(t, d, PBands, 1f); e.DeviceSetParam(t, d, PCarrier, 1f); e.SetDeviceSidechainSource(t, d, m); }
+ Play(e, Sr / 2);
+ var sw = Stopwatch.StartNew();
+ Play(e, Sr * 3);
+ return sw.Elapsed.TotalMilliseconds;
+ }
+ double baseMs = Cost(-1, false);
+ double chamber = Cost(20, false) - baseMs;
+ double voc = Cost(Kind, true) - baseMs;
+ yield return (voc <= Math.Max(chamber, 1.0) * 1.1, $"32-band vocoder costs ≤ Nota Chamber ({voc:0.0} ms vs {chamber:0.0} ms per 3 s)");
+ }
+ }
+}