@mthines/reaper-mcp 0.82.1-beta.111.1 → 0.82.1-beta.113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  <div align="center">
2
2
 
3
3
  <picture>
4
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/logo-dark.svg">
5
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/logo.svg" alt="reaper-mcp" width="360">
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/logo-dark.svg">
5
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/logo.svg" alt="reaper-mcp" width="360">
6
6
  </picture>
7
7
 
8
8
  <br><br>
9
9
 
10
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/hero.svg" alt="reaper-mcp — Mix by asking. Type what you hear and an AI mix engineer inside your REAPER session does it." width="100%">
10
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/hero.svg" alt="reaper-mcp — Mix by asking. Type what you hear and an AI mix engineer inside your REAPER session does it." width="100%">
11
11
 
12
12
  <br>
13
13
 
@@ -21,7 +21,7 @@ You chat in plain English in Claude Code, by keyboard (or dictation, if you like
21
21
  [![Claude Code](https://img.shields.io/badge/Claude_Code-ready-a78bfa?style=for-the-badge)](https://claude.com/claude-code)
22
22
  [![LoreKit](https://img.shields.io/badge/Memory-LoreKit-7c3aed?style=for-the-badge)](https://lorekit.io)
23
23
  [![macOS · Windows · Linux](https://img.shields.io/badge/macOS_·_Windows_·_Linux-1a1240?style=for-the-badge)](#-install-in-3-steps)
24
- [![MIT](https://img.shields.io/badge/license-MIT-ff7a45?style=for-the-badge)](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/LICENSE)
24
+ [![MIT](https://img.shields.io/badge/license-MIT-ff7a45?style=for-the-badge)](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/LICENSE)
25
25
 
26
26
  [**Install in 3 steps**](#-install-in-3-steps) · [See it work](#-just-type-what-you-hear) · [What you get](#-why-producers-use-it) · [Watch it work](#-see-what-your-agent-is-doing) · [Extensions](#-extensions-teach-it-your-plugin) · [Clients & models](#-clients-and-models) · [FAQ](#-faq)
27
27
 
@@ -48,7 +48,7 @@ with your OS if you prefer, it's the same thing to the agent):
48
48
 
49
49
  Here's what happens next:
50
50
 
51
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/session-demo.svg" alt="Illustrative session: the mixer saves a snapshot, measures, cuts the guitars where they mask the vocal, compresses the vocal, re-measures and saves an after snapshot." width="100%">
51
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/session-demo.svg" alt="Illustrative session: the mixer saves a snapshot, measures, cuts the guitars where they mask the vocal, compresses the vocal, re-measures and saves an after snapshot." width="100%">
52
52
 
53
53
  It isn't a preset and it isn't a guess. Before it touches anything it **measures your
54
54
  actual tracks** (loudness, spectrum, stereo width, dynamics). It makes the change with
@@ -96,7 +96,7 @@ handling and dynamics to the style. Just tell it what you're making.
96
96
  With **[LoreKit](#-lorekit-the-knowledge-core)** as its memory, it keeps what it learns
97
97
  about your plugins and your taste, so a correction sticks. It also draws on a shared
98
98
  plugin library that grows every time someone
99
- **[contributes](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/knowledge/contributions/README.md)**, you included.
99
+ **[contributes](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/knowledge/contributions/README.md)**, you included.
100
100
 
101
101
  </td>
102
102
  <td valign="top">
@@ -113,7 +113,7 @@ or upload anything, and you hear each change as it happens.
113
113
 
114
114
  ## 🔍 How it works
115
115
 
116
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/how-it-works.svg" alt="You describe what you hear, Claude measures and decides, REAPER changes live. Every change: snapshot, measure, decide, change, re-measure." width="100%">
116
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/how-it-works.svg" alt="You describe what you hear, Claude measures and decides, REAPER changes live. Every change: snapshot, measure, decide, change, re-measure." width="100%">
117
117
 
118
118
  **You stay in charge.** Ask it to explain before it acts, undo anything, or use
119
119
  `/critique` for advice without a single change to your project.
@@ -126,7 +126,7 @@ A mix engineer's value is what they've learned. reaper-mcp keeps all of that in
126
126
  **[LoreKit](https://lorekit.io)**, a free, open-source memory store for AI agents. It's
127
127
  what turns a remote control into an engineer that gets better every session.
128
128
 
129
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/knowledge-core.svg" alt="LoreKit at the center: the mix skills read plugin records and lessons before acting and write back what they learned." width="100%">
129
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/knowledge-core.svg" alt="LoreKit at the center: the mix skills read plugin records and lessons before acting and write back what they learned." width="100%">
130
130
 
131
131
  - 🎛️ **One record per plugin.** What it is, what each knob does, the settings that
132
132
  worked and the gotchas. Ask for a plugin it has never seen and it **researches it,
@@ -141,12 +141,12 @@ what turns a remote control into an engineer that gets better every session.
141
141
  overwritten. The built-in set comes with the server, read-only, and needs no
142
142
  LoreKit account. Connect your own LoreKit to start your layer.
143
143
  - 📚 **A built-in plugin library.** FabFilter, Soundtoys, Valhalla, iZotope, Melodyne, the
144
- REAPER stock plugins and more: see the **[built-in plugin list](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/PLUGINS.md)**, and how
144
+ REAPER stock plugins and more: see the **[built-in plugin list](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/PLUGINS.md)**, and how
145
145
  to add yours.
146
146
  - 🤝 **Share what you taught it.** Press **Contribute** in the bridge page's Plugins tab
147
147
  and your plugin records become a pull request. Once the maintainer approves it, they're
148
148
  built in for every reaper-mcp user and added to the
149
- [plugin list](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/PLUGINS.md) ([how it works](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/knowledge/contributions/README.md)).
149
+ [plugin list](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/PLUGINS.md) ([how it works](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/knowledge/contributions/README.md)).
150
150
  Regular contributors can publish straight to built-in, no pull request: ask on
151
151
  [Discord](https://discord.gg/Eg8tznuXp4).
152
152
  - 🌍 **It follows you.** The memory isn't tied to one project folder. Whatever song
@@ -161,7 +161,7 @@ what turns a remote control into an engineer that gets better every session.
161
161
 
162
162
  ## 🚀 Install in 3 steps
163
163
 
164
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/install-steps.svg" alt="1. Get REAPER, Claude Code and Node.js. 2. Paste one command. 3. Click Run on mcp_bridge.lua in REAPER." width="100%">
164
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/install-steps.svg" alt="1. Get REAPER, Claude Code and Node.js. 2. Paste one command. 3. Click Run on mcp_bridge.lua in REAPER." width="100%">
165
165
 
166
166
  ### 1 · Get the apps
167
167
 
@@ -259,7 +259,7 @@ instead of just giving advice:
259
259
  | 🔀 **Routing**: sends, buses, sidechains, hardware outputs | 🎹 **MIDI**: write, edit and analyze notes & CC, live MIDI out | ✂️ **Editing**: split, trim, move, fades, takes, stretch markers |
260
260
  | 📍 **Arrangement**: markers, regions, tempo map | 〰️ **Automation**: envelopes, points and pooled automation items | 💾 **Project**: save, render, undo/redo, snapshots, REAPER actions |
261
261
 
262
- 👉 The main tools by area: **[docs/TOOLS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/TOOLS.md)**
262
+ 👉 The main tools by area: **[docs/TOOLS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/TOOLS.md)**
263
263
 
264
264
  ### 🎸 Genre-aware out of the box
265
265
 
@@ -287,8 +287,8 @@ it's **just a plugin**: it keeps working with no bridge, no server and no Claude
287
287
  > ↔️ *"/make-plugin keep everything under 120 Hz in mono and widen the rest"*
288
288
 
289
289
  <p>
290
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/make-plugin-core.png" alt="A generated plugin, Mutate Verb: four large knobs in the core view and a collapsed Advanced header." width="49%">
291
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/make-plugin-advanced.png" alt="The same plugin with the Advanced drawer open over the core view, showing six more knobs." width="49%">
290
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/make-plugin-core.png" alt="A generated plugin, Mutate Verb: four large knobs in the core view and a collapsed Advanced header." width="49%">
291
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/make-plugin-advanced.png" alt="The same plugin with the Advanced drawer open over the core view, showing six more knobs." width="49%">
292
292
  </p>
293
293
 
294
294
  - 🎛️ **A simple core, the rest on demand.** A few big knobs up front; everything else lives in an **Advanced** drawer that overlays the view instead of squeezing it.
@@ -298,7 +298,7 @@ it's **just a plugin**: it keeps working with no bridge, no server and no Claude
298
298
  - 📏 **Proven by measurement.** It renders with the plugin on and off and checks the audio changed, because a plugin that fails to compile still loads in REAPER.
299
299
  - 🗂️ **Easy to find.** Plugins land in your FX list as `… (reaper-mcp)`, and old versions are kept.
300
300
 
301
- 📖 How it works, the toolkit, the examples and the limits: **[docs/PLUGIN-AUTHORING.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/PLUGIN-AUTHORING.md)**
301
+ 📖 How it works, the toolkit, the examples and the limits: **[docs/PLUGIN-AUTHORING.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/PLUGIN-AUTHORING.md)**
302
302
 
303
303
  > 🚧 **Coming next:** graphs. Frequency displays with band selection (for an EQ or a multiband
304
304
  > compressor), spectrum and gain-reduction meters, and a MIDI keyboard.
@@ -312,7 +312,7 @@ isn't a knob: a synth's **wavetables**, its **modulation matrix**, a guitar rig'
312
312
  file**. **Extensions** reach that. They're small add-ons you switch on, and you can have
313
313
  Claude build one for the plugin *you* use.
314
314
 
315
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/extensions.svg" alt="Extensions plug into reaper-mcp through a small versioned API: the core on the left, and the Vital, Helix and your-own extensions on the right." width="100%">
315
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/extensions.svg" alt="Extensions plug into reaper-mcp through a small versioned API: the core on the left, and the Vital, Helix and your-own extensions on the right." width="100%">
316
316
 
317
317
  > 🎹 *"On the Vital on track 2, route LFO 2 to the filter cutoff at 40% and make it a slow triangle."*
318
318
  >
@@ -339,7 +339,7 @@ reaper-mcp extension list # what's installed, and why one can't load
339
339
  - 🛡️ **A broken extension is skipped**, never a crash, and `reaper-mcp doctor` tells you why.
340
340
  - 🧪 **Proven live.** `/new-extension` doesn't finish until the edit shows up in the plugin *and* in the audio.
341
341
 
342
- 📖 Full guide (the API, Lua handlers, testing, sharing, troubleshooting): **[docs/EXTENSIONS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/EXTENSIONS.md)**
342
+ 📖 Full guide (the API, Lua handlers, testing, sharing, troubleshooting): **[docs/EXTENSIONS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/EXTENSIONS.md)**
343
343
 
344
344
  ---
345
345
 
@@ -355,7 +355,7 @@ reaper-mcp extension list # what's installed, and why one can't load
355
355
  - 📊 **Bridge status window.** See every action as it happens, with timing and errors,
356
356
  in a small window next to REAPER ([see what it shows](#-see-what-your-agent-is-doing)).
357
357
 
358
- 📖 What it can and can't do to a session, and what isn't covered: **[docs/SAFETY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/SAFETY.md)**.
358
+ 📖 What it can and can't do to a session, and what isn't covered: **[docs/SAFETY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/SAFETY.md)**.
359
359
 
360
360
  ---
361
361
 
@@ -365,7 +365,7 @@ You shouldn't have to take its word for it. The **bridge window** opens next to
365
365
  logs every move the agent makes, as it happens: what it did, how long it took and anything
366
366
  that went wrong. With several Claude sessions connected, you can see which one did what.
367
367
 
368
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/bridge-status.png" alt="The MCP Bridge status window: uptime, command count, errors, latency, a commands-per-minute timeline, and a live log of tool calls such as read_track_spectrum, set_track_property and snapshot_save, tagged by session." width="100%">
368
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/bridge-status.png" alt="The MCP Bridge status window: uptime, command count, errors, latency, a commands-per-minute timeline, and a live log of tool calls such as read_track_spectrum, set_track_property and snapshot_save, tagged by session." width="100%">
369
369
 
370
370
  <sub>Demo data. Add <code>?demo</code> to the window's address to explore it without REAPER.</sub>
371
371
 
@@ -375,7 +375,7 @@ Every call opens a drawer in plain words (*"midnight-drive wrote new points into
375
375
  automation on track 5"*) with a picture of the change: **before → after** for edits, a
376
376
  readout against your target for measurements.
377
377
 
378
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/bridge-drawer.png" alt="The bridge window with a call open in the drawer: Write automation, with a volume envelope drawn before and after, and the params the agent sent." width="100%">
378
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/bridge-drawer.png" alt="The bridge window with a call open in the drawer: Write automation, with a volume envelope drawn before and after, and the params the agent sent." width="100%">
379
379
 
380
380
  ### 📈 What it measured
381
381
 
@@ -383,14 +383,14 @@ readout against your target for measurements.
383
383
  <tr>
384
384
  <td width="50%" valign="top">
385
385
 
386
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/spectrum.png" alt="The spectrum view: third-octave bands from 25 Hz to 16 kHz as bars, hot bands in amber." width="100%">
386
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/spectrum.png" alt="The spectrum view: third-octave bands from 25 Hz to 16 kHz as bars, hot bands in amber." width="100%">
387
387
 
388
388
  **Spectrum**<br><sub>Where the energy sits, band by band, judged by perceived loudness. Hot bands turn amber.</sub>
389
389
 
390
390
  </td>
391
391
  <td width="50%" valign="top">
392
392
 
393
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/loudness.png" alt="The loudness view: integrated LUFS against a target range on a scale, with short-term, momentary and true peak readouts and the change since the previous call." width="100%">
393
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/loudness.png" alt="The loudness view: integrated LUFS against a target range on a scale, with short-term, momentary and true peak readouts and the change since the previous call." width="100%">
394
394
 
395
395
  **Loudness**<br><sub>LUFS against your target, true peak, and how it moved since the last measurement.</sub>
396
396
 
@@ -399,14 +399,14 @@ readout against your target for measurements.
399
399
  <tr>
400
400
  <td width="50%" valign="top">
401
401
 
402
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/loudness-curve.png" alt="The loudness curve view: short-term loudness over the length of a song against a target line, with the spans over target shaded." width="100%">
402
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/loudness-curve.png" alt="The loudness curve view: short-term loudness over the length of a song against a target line, with the spans over target shaded." width="100%">
403
403
 
404
404
  **Loudness over time**<br><sub>The whole song's loudness, with the stretches that run over target shaded.</sub>
405
405
 
406
406
  </td>
407
407
  <td width="50%" valign="top">
408
408
 
409
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/masking.png" alt="The masking view: a heat map of track pairs against frequency bands, with the worst conflicts and which track to cut." width="100%">
409
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/masking.png" alt="The masking view: a heat map of track pairs against frequency bands, with the worst conflicts and which track to cut." width="100%">
410
410
 
411
411
  **Masking**<br><sub>Which tracks fight, at which frequency, and which one should give way.</sub>
412
412
 
@@ -415,14 +415,14 @@ readout against your target for measurements.
415
415
  <tr>
416
416
  <td width="50%" valign="top">
417
417
 
418
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/stereo-bands.png" alt="The stereo view: correlation per frequency band on a minus one to plus one scale." width="100%">
418
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/stereo-bands.png" alt="The stereo view: correlation per frequency band on a minus one to plus one scale." width="100%">
419
419
 
420
420
  **Stereo, per band**<br><sub>Phase correlation per band. Catches a wide or out-of-phase low end before it hurts.</sub>
421
421
 
422
422
  </td>
423
423
  <td width="50%" valign="top">
424
424
 
425
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/waveform.png" alt="The waveform view: a rendered track drawn on a decibel scale with its peak, RMS and clipped sample count." width="100%">
425
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/waveform.png" alt="The waveform view: a rendered track drawn on a decibel scale with its peak, RMS and clipped sample count." width="100%">
426
426
 
427
427
  **Waveform**<br><sub>What a rendered track really looks like, with clipping counted.</sub>
428
428
 
@@ -438,14 +438,14 @@ Every edit is drawn **before → after**: new in blue, old dashed or ghosted, re
438
438
  <tr>
439
439
  <td width="50%" valign="top">
440
440
 
441
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/mixer.png" alt="The mixer view: every track as a fader with its level in dB, pan, and mute, solo and arm badges, grouped by folder." width="100%">
441
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/mixer.png" alt="The mixer view: every track as a fader with its level in dB, pan, and mute, solo and arm badges, grouped by folder." width="100%">
442
442
 
443
443
  **Mixer**<br><sub>The session as a mixer: folders, levels, pans, mute, solo and arm.</sub>
444
444
 
445
445
  </td>
446
446
  <td width="50%" valign="top">
447
447
 
448
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/routing.png" alt="The routing view: a signal-flow diagram of a track's sends, receives and hardware outputs, with added, changed and removed routes marked." width="100%">
448
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/routing.png" alt="The routing view: a signal-flow diagram of a track's sends, receives and hardware outputs, with added, changed and removed routes marked." width="100%">
449
449
 
450
450
  **Routing**<br><sub>Sends, receives and outputs as signal flow. Thicker wire means louder.</sub>
451
451
 
@@ -454,14 +454,14 @@ Every edit is drawn **before → after**: new in blue, old dashed or ghosted, re
454
454
  <tr>
455
455
  <td width="50%" valign="top">
456
456
 
457
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/automation.png" alt="The automation view: a volume envelope with pooled automation items drawn as blocks tinted by pool." width="100%">
457
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/automation.png" alt="The automation view: a volume envelope with pooled automation items drawn as blocks tinted by pool." width="100%">
458
458
 
459
459
  **Automation**<br><sub>Envelope points and pooled automation items, before and after.</sub>
460
460
 
461
461
  </td>
462
462
  <td width="50%" valign="top">
463
463
 
464
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/piano-roll.png" alt="The piano roll view: added notes in blue, unchanged notes in grey, removed notes dashed, and a velocity lane." width="100%">
464
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/piano-roll.png" alt="The piano roll view: added notes in blue, unchanged notes in grey, removed notes dashed, and a velocity lane." width="100%">
465
465
 
466
466
  **Piano roll**<br><sub>MIDI edits as a piano roll: added, kept and removed notes, with velocity.</sub>
467
467
 
@@ -470,14 +470,14 @@ Every edit is drawn **before → after**: new in blue, old dashed or ghosted, re
470
470
  <tr>
471
471
  <td width="50%" valign="top">
472
472
 
473
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/pins.png" alt="The plugin pins view: track channels wired into a compressor's input pins, with a newly connected sidechain highlighted." width="100%">
473
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/pins.png" alt="The plugin pins view: track channels wired into a compressor's input pins, with a newly connected sidechain highlighted." width="100%">
474
474
 
475
475
  **Plugin pins**<br><sub>Which track channels feed which plugin pins. Here, a sidechain just got wired in.</sub>
476
476
 
477
477
  </td>
478
478
  <td width="50%" valign="top">
479
479
 
480
- <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.111.1/docs/assets/views/render.png" alt="The render view: three rendered versions of a song with a waveform, LUFS, peak and length for each, against a loudness target." width="100%">
480
+ <img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.1/docs/assets/views/render.png" alt="The render view: three rendered versions of a song with a waveform, LUFS, peak and length for each, against a loudness target." width="100%">
481
481
 
482
482
  **Renders**<br><sub>Every rendered file with its LUFS, peak and length against your target.</sub>
483
483
 
@@ -500,7 +500,7 @@ It has no model of its own, so the AI is whichever one your client runs.
500
500
  | Client | Status |
501
501
  |---|---|
502
502
  | **Claude Code** | Tested daily. The installer sets it up, and the `/mixer`, `/critique`, `/mastering` and `/editing` skills are written for it. |
503
- | **Other MCP clients** (Claude Desktop, Cursor, VS Code, …) | Not tested. The tools work from any client that runs a local stdio server: [config](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/REFERENCE.md#other-mcp-clients). The skills only load where the client reads `SKILL.md` files. |
503
+ | **Other MCP clients** (Claude Desktop, Cursor, VS Code, …) | Not tested. The tools work from any client that runs a local stdio server: [config](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/REFERENCE.md#other-mcp-clients). The skills only load where the client reads `SKILL.md` files. |
504
504
 
505
505
  **Typed or voice?**
506
506
  Typed. reaper-mcp never listens to a microphone for instructions: it gets text from your client.
@@ -525,17 +525,17 @@ Tried one? [Tell us how it went](https://github.com/mthines/reaper-mcp/issues/72
525
525
 
526
526
  **What is it trained on?**
527
527
  Nothing. There is no reaper-mcp model and nothing is trained on your sessions.
528
- The skills and [`knowledge/`](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/knowledge/) are plain text: opinions and checklists your model reads, which you can edit or skip.
528
+ The skills and [`knowledge/`](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/knowledge/) are plain text: opinions and checklists your model reads, which you can edit or skip.
529
529
  Where your data goes:
530
530
 
531
531
  - **Your model** sees what the tools return: track names, FX settings, meter readings, file paths,
532
532
  and MIDI notes when a tool reads them.
533
- Audio stays on your machine; analysis that needs audio runs in the optional local Python sidecar ([`reaper-mcp setup-sidecar`](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/REFERENCE.md#cli-commands)).
533
+ Audio stays on your machine; analysis that needs audio runs in the optional local Python sidecar ([`reaper-mcp setup-sidecar`](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/REFERENCE.md#cli-commands)).
534
534
  - **LoreKit, built-in layer:** the skills look up shared plugin knowledge with a public read-only key,
535
535
  so search terms such as plugin names reach LoreKit even if you never connect it.
536
536
  - **LoreKit, your layer** (only if you connect it) stores what the skills learn about plugins and your preferences.
537
537
  - **Usage telemetry** (on by default, [easy to turn off](#-privacy--telemetry)) sends tool names, the kind of
538
- error and timings, never content. The bridge page has its own switch: [TELEMETRY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/TELEMETRY.md#the-bridge-page).
538
+ error and timings, never content. The bridge page has its own switch: [TELEMETRY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/TELEMETRY.md#the-bridge-page).
539
539
 
540
540
  ---
541
541
 
@@ -555,7 +555,7 @@ messages, audio or MIDI. I respect your privacy 🙏
555
555
 
556
556
  You're in control: setup asks before anything is sent, and `reaper-mcp telemetry off`
557
557
  turns it off for good — no hard feelings. Everything that's collected, and where it
558
- goes, is in [TELEMETRY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/TELEMETRY.md).
558
+ goes, is in [TELEMETRY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/TELEMETRY.md).
559
559
 
560
560
  ---
561
561
 
@@ -603,7 +603,7 @@ explains its reasoning so you can push back.
603
603
  <br>
604
604
  Every edit is a single undo step, and the mix skills snapshot before and after a task. Use
605
605
  <code>/critique</code> or read-only mode if you only want advice. Saving a copy of your project
606
- before a big session never hurts. <a href="https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/SAFETY.md">What is and isn't guarded</a>.
606
+ before a big session never hurts. <a href="https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/SAFETY.md">What is and isn't guarded</a>.
607
607
  </details>
608
608
 
609
609
  <details>
@@ -611,7 +611,7 @@ before a big session never hurts. <a href="https://github.com/mthines/reaper-mcp
611
611
  <br>
612
612
  Any plugin REAPER can load (VST, VST3, AU, CLAP, JS). It finds what you have installed
613
613
  and reaches for the best tool for each job. The ones it already knows are in the
614
- <a href="https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/PLUGINS.md">built-in plugin list</a>. When it meets a plugin it doesn't know, it
614
+ <a href="https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/PLUGINS.md">built-in plugin list</a>. When it meets a plugin it doesn't know, it
615
615
  researches it, inspects its controls live and saves what it learns to LoreKit. You can
616
616
  also teach it one up front with <code>/learn-plugin</code>.
617
617
  </details>
@@ -642,12 +642,12 @@ No. It reads meter values and settings from your running session, not your audio
642
642
 
643
643
  ## 🛠️ For developers
644
644
 
645
- - 📖 **[docs/REFERENCE.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/REFERENCE.md)**: architecture, install internals, CLI,
645
+ - 📖 **[docs/REFERENCE.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/REFERENCE.md)**: architecture, install internals, CLI,
646
646
  environment variables, telemetry, project structure
647
- - 🧰 **[docs/TOOLS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/TOOLS.md)**: the main tools by area
648
- - 🧩 **[docs/EXTENSIONS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/EXTENSIONS.md)**: write, test and share an extension (the API, Lua handlers, Vital and Helix)
649
- - 🧑‍💻 **[DEVELOPMENT.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/DEVELOPMENT.md)**: build, test, run from source, MCP Inspector
650
- - 🧪 **[docs/TESTING.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.111.1/docs/TESTING.md)**: end-to-end testing guide
647
+ - 🧰 **[docs/TOOLS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/TOOLS.md)**: the main tools by area
648
+ - 🧩 **[docs/EXTENSIONS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/EXTENSIONS.md)**: write, test and share an extension (the API, Lua handlers, Vital and Helix)
649
+ - 🧑‍💻 **[DEVELOPMENT.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/DEVELOPMENT.md)**: build, test, run from source, MCP Inspector
650
+ - 🧪 **[docs/TESTING.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.1/docs/TESTING.md)**: end-to-end testing guide
651
651
 
652
652
  ```
653
653
  Claude Code ⇄ MCP server (TypeScript) ⇄ file IPC ⇄ Lua bridge in REAPER ⇄ ReaScript API + JSFX meters
@@ -80,7 +80,7 @@ Cut before you add. If a control could be a sensible fixed value, make it one. P
80
80
  example in `examples/` (`mutate-verb.jsfx` random and granular plus reverb, `tape-sat.jsfx`
81
81
  nonlinear plus tilt EQ, `width-bass-mono.jsfx` linear stereo plus meter, `multiband-compressor.jsfx` frequency graph with
82
82
  crossover handles in Hz, per-band gain reduction and a transfer curve via `ui_freqgraph`,
83
- `ui_fhandle`, `ui_grmeter`, `ui_transfer`; `ui_keyboard` shows MIDI notes) and read it. Each has its
83
+ `ui_fhandle`, `ui_fthresh`, `ui_grmeter`, `ui_transfer`; `ui_fband` gives bands one level each and `ui_keyboard` shows and plays MIDI notes; no shipped example uses those two, see `reference/toolkit.md`) and read it. Each has its
84
84
  suggested presets beside it (`<name>.presets.json`): the shape `write_jsfx` takes.
85
85
 
86
86
  ### Step 2: Write the source
@@ -94,6 +94,22 @@ example and change what the spec changes. The shape is always:
94
94
  `ui_mem`; compute coefficients in `update()`, called from `@init`, `@slider` and
95
95
  `@block: ui_changed() ? update();`.
96
96
  - `@gfx` draws the core row(s), then `ui_section("Advanced") ? ( ... )` for the rest.
97
+ - **Bands on a frequency graph are always directly editable, unless the user says otherwise.** A plugin
98
+ with bands (a crossover, a multiband or split, an EQ) draws `ui_freqgraph` with a `ui_fhandle` per
99
+ band edge, and then **a per-band control on the graph itself**: `ui_fthresh(thr, ratio, gain, n)` for
100
+ dynamics (hover a band and drag up or down for its threshold, Shift-drag for its gain, wheel for its
101
+ ratio) or `ui_fband(first, n, fmt)` for one level per band (drag up or down, Shift = fine). Both
102
+ select the band on a click, and one `ui_bandknob(first, n, "Label", fmt)` per band parameter edits
103
+ the selected band. Never ship bands whose only controls are plain knobs: the multiband example is
104
+ the model.
105
+ - **A keyboard is for playing as well as showing, and it sits along the bottom.** `ui_keyboard(21, 108,
106
+ "Keys")` (the full range, or 36-96 for a small window; make the window wide enough, about 700 px for
107
+ 88 keys) as the **last** core row, below the knobs, short and full width like Vital's and Odin's. A
108
+ click or a drag across the keys plays. The keys fill the bottom of their cell, so the keyboard row must be the
109
+ last of the `ui_begin` core rows and the count must match the rows you draw (`ui_tall(2)` on the knob row
110
+ above it makes the keys a short strip right above the Advanced bar): read it in `@block` with `while (ui_kpoll()) ( ui_kv > 0 ?
111
+ <note on ui_kn, ui_kv> : <note off ui_kn> );` next to the MIDI-in loop (a synth turns them into
112
+ voices, a MIDI effect `midisend`s them). Notes from MIDI light the keys with `ui_kkey(note, vel)`.
97
113
  - Do not write the toolkit: `write_jsfx` inlines it.
98
114
  - Never assign `ui_adv_open` (or any `ui_` state) in plugin code: REAPER re-runs `@init` when
99
115
  playback starts, so the Advanced drawer would snap shut on Play (lint `ui-state-reset`).
@@ -1,5 +1,5 @@
1
1
  desc:Multiband Compressor
2
- // accent: orange
2
+ // accent: blue
3
3
  import mcp_ui.jsfx-inc
4
4
 
5
5
  // Three bands with Linkwitz-Riley 4th-order crossovers (the bands sum flat), one compressor per band.
@@ -44,17 +44,18 @@ Every widget is one block, label above, control, value below, sized the same acr
44
44
  | `ui_gshow(on)` / `ui_gfeed2(buf, n)` | before / after: with `ui_gshow(slider)` on, the graph also draws the input as a second, lighter line labelled Input / Output; feed it with `ui_gfeed2` only while shown (a second FFT costs). Put a `ui_toggle` for it in Advanced | a `<0,1,1{Off,On}>` slider |
45
45
  | `ui_fhandle(idx, "Label")` | a draggable band edge on the graph, bound to slider `idx` in Hz; drag, wheel, double-click for a value box, modifier-click resets; stays between its neighbours; automates like a knob | a Hz slider, e.g. `<40,800,1>`; call it after `ui_freqgraph`, in left-to-right order |
46
46
  | `ui_fthresh(thr_first, ratio_first, gain_first, n)` | a threshold line across each of `n` bands (the handles + 1) on the graph; hover a band and drag up/down to move its threshold, **Shift**-drag its gain, wheel = its ratio, click selects it | `n` threshold sliders from `thr_first` (dB, -60..0), `n` ratio sliders from `ratio_first`, `n` gain sliders from `gain_first`; call it after the handles |
47
+ | `ui_fband(first_idx, n, fmt)` | one level line per band on the graph, for bands with a single amount (an EQ's gain, a split's level): hover a band and drag up or down (the slider's full range across the graph height), **Shift**-drag for fine steps, wheel = a small step, click selects it, double-click types a value, modifier-click resets; `fmt` as for knobs (1 = dB) | `n` sliders from `first_idx`; call it after the handles; pair it with `ui_bandknob` |
47
48
  | `ui_bandknob(first_idx, n, "Label", fmt)` | a knob on the selected band's slider (`first_idx + ui_fsel`), labelled with the band (Low / Mid / High, else Band N) | `n` sliders from `first_idx`; counts as one widget |
48
49
  | `ui_grmeter(n, "Label")` | `n` (1-8) gain-reduction bars hanging from the top, amber from 6 dB, red from 12; a click selects the band | `ui_gr(k, db)` per band from `@block` (db 0 or more) |
49
50
  | `ui_transfer(thr_idx, ratio_idx, knee_db)` | a compressor transfer curve that follows the threshold and ratio sliders (the selected band's, `thr_idx + ui_fsel`, with a graph), with a live level dot | `ui_glevel(db)` from `@block` |
50
- | `ui_keyboard(lo, hi, "Label")` | piano keys `lo`..`hi` (MIDI notes), lit while held | `ui_kkey(note, vel)` on note on, `ui_kkey(note, 0)` on note off |
51
+ | `ui_keyboard(lo, hi, "Label")` | piano keys `lo`..`hi` (MIDI notes, 21-108 is the full 88), short and full width: put it as the last core row, below the knobs. **Playable**: press a key to play it (higher up the key = softer), drag across keys for a glissando, release to stop | `ui_kkey(note, vel)` on note on, `ui_kkey(note, 0)` on note off, for notes the plugin hears; the notes the user plays arrive in `@block` through `while (ui_kpoll()) ( ... )`: each 1 means `ui_kn` is a note and `ui_kv` its velocity (0 = off) |
51
52
  | `ui_tall(span)` | the next `ui_row` is `span` times as tall (a graph needs height); knobs in it keep their size | none |
52
53
 
53
54
  Use `ui_boot(2)` in a plugin with these feeds: it redraws only when a feed, a control or the window
54
55
  changed, so silence costs nothing (`ui_boot(1)` redraws every frame, `ui_boot(0)` only on change).
55
56
  Feeds are rounded to a visible step before they count as change. A graph widget counts as one
56
57
  widget for the core limit. The selected band is `ui_fsel` (0-based), which the plugin may read.
57
- Memory map: 0..1023 core, 1024+ graph data (`ui_fg` trace, `ui_ge` band edges, `ui_grm`, `ui_kb`),
58
+ Memory map: 0..1023 core, 1024+ graph data (`ui_fg` trace, `ui_ge` band edges, `ui_grm`, `ui_kb`, `ui_kq` the played-key queue),
58
59
  `ui_mem` (2048) is where your buffers start. `examples/multiband-compressor.jsfx` uses them all.
59
60
 
60
61
  `fmt` for knobs: `0` number (`0.00`), `1` dB, `2` percent of 0..1, `3` Hz or kHz, `4` ms, `5` integer.
@@ -72,7 +73,7 @@ when the user turns on the FX window's **+ > Send all keyboard input to plug-in*
72
73
  the plugin; then it closes the value box, the About dialog, then the drawer (and the window
73
74
  closes with its close button, as every key now goes to the plugin).
74
75
 
75
- **Header knobs.** A plugin with a Mix and/or an Output slider calls `ui_header(mix_idx, out_idx)` in `@gfx` before `ui_begin` (0 for one it does not have): two small knobs in the top right, Output rightmost, with the usual gestures, the value shown while hovered. Do not draw those sliders as widgets too (they leave the core view and its widget count). The plugin name and the first row get a clear gap below the name, a little more with header knobs.
76
+ **Header bars.** A plugin with a Mix and/or an Output slider calls `ui_header(mix_idx, out_idx)` in `@gfx` before `ui_begin` (0 for one it does not have): two slim horizontal bars in the top right (like Vital's), Output rightmost, dragged left/right with the usual gestures, the value shown while hovered. Do not draw those sliders as widgets too (they leave the core view and its widget count). The header band is one line: the plugin name and the bars are vertically centred on it, with an equal gap above and below, and the first row starts after it (the same with or without Mix / Output).
76
77
 
77
78
  Every plugin also gets, with no code of its own: its name in small spaced capitals at the top-left
78
79
  (hidden in a very narrow window), and a small "reaper-mcp" credit at the bottom right
package/main.js CHANGED
@@ -660,6 +660,20 @@ function withPageLink(result, links) {
660
660
  return { ...reply5, content: [...reply5.content, { type: "text", text: `Bridge page (before/after view): ${last}` }] };
661
661
  }
662
662
 
663
+ // apps/reaper-mcp-server/src/call-outcome.ts
664
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
665
+ var store2 = new AsyncLocalStorage2();
666
+ function trackCallOutcome(fn) {
667
+ const outcome = { logged: false, regression: false };
668
+ return store2.run(outcome, async () => ({ result: await fn(), outcome }));
669
+ }
670
+ function noteLoggedFailure(regression) {
671
+ const outcome = store2.getStore();
672
+ if (!outcome) return;
673
+ outcome.logged = true;
674
+ if (regression) outcome.regression = true;
675
+ }
676
+
663
677
  // apps/reaper-mcp-server/src/bridge.ts
664
678
  var POLL_INTERVAL_MS = 10;
665
679
  var BRIDGE_RPC_SYSTEM = "reaper_bridge";
@@ -825,6 +839,7 @@ async function sendCommand(type, params = {}, timeoutMs = DEFAULT_TIMEOUT_MS) {
825
839
  { "rpc.method": type, "error.type": "bridge_not_running", "reaper.bridge.state": down.state },
826
840
  { eventName: "reaper.bridge.command.not_sent" }
827
841
  );
842
+ noteLoggedFailure(false);
828
843
  }
829
844
  finish("bridge_not_running");
830
845
  return { id: randomUUID2(), success: false, error: message, timestamp: Date.now() };
@@ -908,6 +923,7 @@ async function sendCommand(type, params = {}, timeoutMs = DEFAULT_TIMEOUT_MS) {
908
923
  },
909
924
  { eventName: "reaper.bridge.command.failed" }
910
925
  );
926
+ noteLoggedFailure(systemError);
911
927
  }
912
928
  const tMetrics = now();
913
929
  finish(errorType);
@@ -941,6 +957,7 @@ async function sendCommand(type, params = {}, timeoutMs = DEFAULT_TIMEOUT_MS) {
941
957
  { "rpc.method": type, "reaper.bridge.command.id": id, "error.type": "timeout", "reaper.bridge.timeout_ms": timeoutMs },
942
958
  { eventName: "reaper.bridge.command.timeout" }
943
959
  );
960
+ noteLoggedFailure(true);
944
961
  finish("timeout");
945
962
  return {
946
963
  id,
@@ -956,6 +973,7 @@ async function sendCommand(type, params = {}, timeoutMs = DEFAULT_TIMEOUT_MS) {
956
973
  "error.type": errorType,
957
974
  ...exceptionAttributes(err)
958
975
  });
976
+ noteLoggedFailure(true);
959
977
  finish(errorType);
960
978
  throw err;
961
979
  } finally {
@@ -5317,6 +5335,27 @@ var VENV_PYTHON = join6(SIDECAR_VENV_PATH2, VENV_BIN2, VENV_PYTHON_NAME2);
5317
5335
  var _rawTimeout = Number(process.env["REAPER_MCP_SIDECAR_TIMEOUT_MS"]);
5318
5336
  var ANALYZE_TIMEOUT_MS = Number.isFinite(_rawTimeout) && _rawTimeout > 0 ? _rawTimeout : 6e4;
5319
5337
  var QUEUE_WAIT_MS = 5 * 6e4;
5338
+ var SidecarRpcError = class extends Error {
5339
+ // No `name` override: a tool that lets this escape reports `error.type` from the name, which stays `Error`.
5340
+ constructor(message, code) {
5341
+ super(message);
5342
+ this.code = code;
5343
+ }
5344
+ };
5345
+ var INVALID_PARAMS = -32602;
5346
+ var REJECTED_INPUT = /^(Audio file not found|Audio too short|Sample rates differ)\b/;
5347
+ var NOT_INSTALLED = /^Audio understanding sidecar not installed|\b(audiobox-aesthetics not installed|Stem separation is not installed|FluidSynth native library is not installed)\b/;
5348
+ function classifySidecarError(err) {
5349
+ const message = err instanceof Error ? err.message : String(err);
5350
+ if (message.startsWith("Sidecar timeout")) return "timeout";
5351
+ if (message.startsWith("Sidecar busy")) return "busy";
5352
+ if (NOT_INSTALLED.test(message)) return "not_installed";
5353
+ if (err instanceof SidecarRpcError && err.code === INVALID_PARAMS || REJECTED_INPUT.test(message)) return "sidecar_rejected";
5354
+ return "sidecar_error";
5355
+ }
5356
+ function isSidecarRegression(type) {
5357
+ return type === "timeout" || type === "sidecar_error";
5358
+ }
5320
5359
  var SidecarClientImpl = class {
5321
5360
  process = null;
5322
5361
  pending = /* @__PURE__ */ new Map();
@@ -5404,14 +5443,16 @@ var SidecarClientImpl = class {
5404
5443
  return result;
5405
5444
  } catch (err) {
5406
5445
  const message = err instanceof Error ? err.message : String(err);
5407
- const errorType = message.startsWith("Sidecar timeout") ? "timeout" : message.startsWith("Sidecar busy") ? "busy" : message.startsWith("Audio understanding sidecar not installed") ? "not_installed" : "sidecar_error";
5446
+ const errorType = classifySidecarError(err);
5447
+ const regression = isSidecarRegression(errorType);
5408
5448
  metricAttrs["error.type"] = errorType;
5409
5449
  span.setAttribute("error.type", errorType);
5410
- span.setStatus({ code: SpanStatusCode2.ERROR, message: redactHome(message) });
5411
- emitLog(errorType === "not_installed" || errorType === "busy" ? "warn" : "error", `Sidecar ${method} failed: ${message}`, {
5450
+ if (regression) span.setStatus({ code: SpanStatusCode2.ERROR, message: redactHome(message) });
5451
+ emitLog(regression ? "error" : "warn", `Sidecar ${method} failed: ${message}`, {
5412
5452
  "rpc.method": method,
5413
5453
  "error.type": errorType
5414
- });
5454
+ }, { eventName: "reaper.sidecar.request.failed" });
5455
+ noteLoggedFailure(regression);
5415
5456
  throw err;
5416
5457
  } finally {
5417
5458
  span.end();
@@ -5576,7 +5617,7 @@ var SidecarClientImpl = class {
5576
5617
  }
5577
5618
  this.pending.delete(response.id);
5578
5619
  if (response.error) {
5579
- pending.reject(new Error(response.error.message));
5620
+ pending.reject(new SidecarRpcError(response.error.message, response.error.code));
5580
5621
  } else if (response.result) {
5581
5622
  pending.resolve(response.result);
5582
5623
  } else {
@@ -8827,10 +8868,14 @@ var UI_API = {
8827
8868
  ui_keyboard: 3,
8828
8869
  ui_fthresh: 4,
8829
8870
  ui_header: 2,
8830
- ui_hknob: 4,
8871
+ ui_hbar: 4,
8872
+ ui_pill: 4,
8831
8873
  ui_gfeed2: 2,
8832
8874
  ui_gshow: 1,
8833
- ui_bandknob: 4
8875
+ ui_bandknob: 4,
8876
+ ui_fband: 3,
8877
+ ui_kput: 2,
8878
+ ui_kpoll: 0
8834
8879
  };
8835
8880
  var MAX_CORE_WIDGETS = 5;
8836
8881
  var MAX_ADVANCED_WIDGETS = 8;
@@ -8872,6 +8917,7 @@ function sections2(code) {
8872
8917
  }
8873
8918
  var WIDGET = /\bui_(knob|toggle|choice|fhandle)\s*\(\s*(\d+)/g;
8874
8919
  var BANDKNOB = /\bui_bandknob\s*\(\s*(\d+)\s*,\s*(\d+)/g;
8920
+ var FBAND = /\bui_fband\s*\(\s*(\d+)\s*,\s*(\d+)/g;
8875
8921
  var FTHRESH = /\bui_fthresh\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/g;
8876
8922
  var HEADER = /\bui_header\s*\(\s*(\d+)\s*,\s*(\d+)/g;
8877
8923
  var TRANSFER = /\bui_transfer\s*\(\s*(\d+)\s*,\s*(\d+)/g;
@@ -8961,6 +9007,7 @@ function lintJsfx(source) {
8961
9007
  const ranges = [];
8962
9008
  for (const m of gfx.text.matchAll(HEADER)) for (const v of [m[1], m[2]]) if (Number(v) > 0) ranges.push(["ui_header", Number(v), 1]);
8963
9009
  for (const m of gfx.text.matchAll(BANDKNOB)) ranges.push(["ui_bandknob", Number(m[1]), Number(m[2])]);
9010
+ for (const m of gfx.text.matchAll(FBAND)) ranges.push(["ui_fband", Number(m[1]), Number(m[2])]);
8964
9011
  for (const m of gfx.text.matchAll(FTHRESH)) ranges.push(["ui_fthresh", Number(m[1]), Number(m[4])], ["ui_fthresh", Number(m[2]), Number(m[4])], ["ui_fthresh", Number(m[3]), Number(m[4])]);
8965
9012
  for (const [fn, first, count] of ranges) {
8966
9013
  for (let idx = first; idx < first + count; idx++) {
@@ -9404,17 +9451,24 @@ function instrumentToolHandlers(server) {
9404
9451
  },
9405
9452
  async (span) => {
9406
9453
  try {
9407
- const collected = await collectPageLinks(() => originalCb(...cbArgs));
9454
+ const { result: collected, outcome } = await trackCallOutcome(() => collectPageLinks(() => originalCb(...cbArgs)));
9408
9455
  const result = withPageLink(collected.result, collected.links);
9409
9456
  const res = result;
9410
9457
  if (res?.isError) {
9411
9458
  const errorText = res.content?.[0]?.text ?? "Tool error";
9412
9459
  const message = redactHome(errorText).slice(0, MAX_STATUS_MESSAGE);
9460
+ const regression = outcome.regression || isSystemError(classifyBridgeError(errorText.replace(/^Error:\s*/, "")));
9413
9461
  metricAttrs["error.type"] = "tool_error";
9414
9462
  span.setAttribute("error.type", "tool_error");
9415
9463
  span.setAttribute(TOOL_ERROR_MESSAGE, message);
9416
- if (isSystemError(classifyBridgeError(errorText.replace(/^Error:\s*/, "")))) {
9417
- span.setStatus({ code: SpanStatusCode3.ERROR, message });
9464
+ if (regression) span.setStatus({ code: SpanStatusCode3.ERROR, message });
9465
+ if (!outcome.logged) {
9466
+ emitLog(
9467
+ regression ? "error" : "warn",
9468
+ `Tool ${toolName} failed: ${message}`,
9469
+ { "gen_ai.tool.name": toolName, "error.type": "tool_error" },
9470
+ { eventName: "reaper.tool.failed" }
9471
+ );
9418
9472
  }
9419
9473
  }
9420
9474
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mthines/reaper-mcp",
3
- "version": "0.82.1-beta.111.1",
3
+ "version": "0.82.1-beta.113.1",
4
4
  "type": "module",
5
5
  "description": "MCP server for controlling REAPER DAW — real-time mixing, FX control, and frequency analysis for AI agents",
6
6
  "license": "MIT",
@@ -23,7 +23,8 @@
23
23
  // 1168..1199 ui_grm gain reduction per band in dB (8) -- slots 8..31 spare
24
24
  // 1200..1327 ui_kb MIDI keyboard: velocity per note 0..127 (0 = off)
25
25
  // 1328..1455 ui_fi the input trace for the before/after view (same 96 points as ui_fg)
26
- // 1456..2047 spare for the toolkit
26
+ // 1456..1489 ui_kq the keys played with the mouse: 16 note/velocity slots, then head and tail (ui_kpoll)
27
+ // 1490..2047 spare for the toolkit
27
28
  // 2048.. ui_mem the plugin
28
29
  // Every global starts with ui_. Sliders must be UNNAMED (slider1:0.5<0,1,0.01>Label): named
29
30
  // sliders do not keep their value in sliderN, which the toolkit reads through slider(idx).
@@ -46,7 +47,7 @@
46
47
  // @serialize file_var(0, ui_adv_open); // added for you when the plugin has none
47
48
 
48
49
  ui_ver = 1.3;
49
- ui_hm = 0; ui_ho = 0; // the header knobs' sliders (ui_header), 0 = none
50
+ ui_hm = 0; ui_ho = 0; // the header bars' sliders (ui_header), 0 = none
50
51
 
51
52
  // Design tokens: the bridge status page's palette (apps/bridge-ui/src/styles.css). The accent is
52
53
  // the plugin's own: write_jsfx emits ui_theme($xRRGGBB) after this block (from the plugin's name,
@@ -75,7 +76,7 @@ ui_pver = 0; ui_nctl = 0; ui_akind = 0; ui_example = 0;
75
76
  ui_min = 0; ui_max = 65; ui_def = 130; ui_stp = 195;
76
77
  ui_mtr = 400; // meter state: 2 slots per meter (level in dB, last time)
77
78
  ui_gn = 96; // frequency graph trace points (log-spaced); at most 128
78
- ui_fg = 1024; ui_ge = 1152; ui_grm = 1168; ui_kb = 1200; ui_fi = 1328; ui_gt = ui_fg; // graph widgets' memory, see the map above
79
+ ui_fg = 1024; ui_ge = 1152; ui_grm = 1168; ui_kb = 1200; ui_fi = 1328; ui_kq = 1456; ui_gt = ui_fg; // graph widgets' memory, see the map above
79
80
  ui_mem = 2048; // first free memory index for the plugin's own buffers
80
81
  // REAPER re-runs @init when playback starts (and on sample-rate changes): the UI state below
81
82
  // is set once, so pressing Play never closes the drawer or drops a drag. Plugin code must not
@@ -304,8 +305,9 @@ function ui_namedraw() local(x, y, i, c, n) (
304
305
  gfx_w >= 150 * ui_s ? (
305
306
  gfx_setfont(5);
306
307
  ui_caps(#ui_name);
307
- x = ui_pad; y = 4 * ui_s;
308
- ui_c(ui_cAccent, 0.9); gfx_circle(x + 1.5 * ui_s, y + 4.5 * ui_s, 1.5 * ui_s, 1, 1);
308
+ gfx_measurestr("A", ui_tw, ui_th);
309
+ x = ui_pad; y = 15 * ui_s - ui_th / 2; // centred on the header band, level with the Mix / Output bars
310
+ ui_c(ui_cAccent, 0.9); gfx_circle(x + 1.5 * ui_s, 15 * ui_s, 1.5 * ui_s, 1, 1);
309
311
  x += 8 * ui_s;
310
312
  ui_c(ui_cMuted, 0.85);
311
313
  i = 0; n = strlen(#ui_txt);
@@ -384,14 +386,18 @@ function ui_arow(x, y, w, label, val) (
384
386
  ui_c(ui_cText, 1); gfx_x = x + 70 * ui_s; gfx_y = y; gfx_drawstr(val);
385
387
  );
386
388
 
387
- // The About dialog: what reaper-mcp is, where to find it, and this plugin's facts. Closes on a
388
- // click outside it or on its x. In a short window the description lines go first.
389
- function ui_aboutdraw() local(w, h, x, y, lh, nd, rows, bx, cy, hitx) (
389
+ // The About dialog: what reaper-mcp is, where to find it, this plugin's facts and how the controls are
390
+ // used (the gestures every knob, bar and handle shares). Closes on a click outside it or on its x. In a
391
+ // short window the description lines go first, then the plugin's facts; the gestures stay while they fit.
392
+ function ui_aboutdraw() local(w, h, x, y, lh, nd, rows, bx, cy, hitx, kb, av) (
390
393
  lh = 13 * ui_s;
391
- nd = max(0, min(3, floor((gfx_h - 16 * ui_s - 186 * ui_s) / lh)));
392
- rows = nd > 0 ? 6 : max(2, min(6, floor((gfx_h - 16 * ui_s - 108 * ui_s) / lh)));
394
+ av = gfx_h - 16 * ui_s;
395
+ kb = av >= 225 * ui_s + 2 * lh; // the gesture block: a heading and five lines
396
+ av -= kb * 91 * ui_s;
397
+ nd = av - 186 * ui_s >= 3 * lh ? 3 : 0; // the description is all three lines or none, never cut mid-sentence
398
+ rows = nd > 0 ? 6 : max(2, min(6, floor((av - 108 * ui_s) / lh)));
393
399
  w = min(gfx_w - 16 * ui_s, 300 * ui_s);
394
- h = (12 + 22 + 6 + 4 + 28 + 10 + 16 + 10) * ui_s + nd * lh + rows * lh;
400
+ h = (12 + 22 + 6 + 4 + 28 + 10 + 16 + 10) * ui_s + nd * lh + rows * lh + kb * 91 * ui_s;
395
401
  x = (gfx_w - w) / 2; y = max(8 * ui_s, (gfx_h - h) / 2);
396
402
  bx = x + w - 26 * ui_s;
397
403
  hitx = mouse_x >= bx && mouse_x < bx + 20 * ui_s && mouse_y >= y + 8 * ui_s && mouse_y < y + 28 * ui_s;
@@ -432,6 +438,16 @@ function ui_aboutdraw() local(w, h, x, y, lh, nd, rows, bx, cy, hitx) (
432
438
  );
433
439
  rows > 4 ? ( sprintf(#ui_txt, "%d", ui_nctl); ui_arow(x, y, w, "Controls", #ui_txt); y += lh; );
434
440
  rows > 5 ? ( ui_arow(x, y, w, "Written", strlen(#ui_date) ? #ui_date : "-"); y += lh; );
441
+ kb ? (
442
+ y += 10 * ui_s;
443
+ ui_c(ui_cLine, 1); gfx_rect(x, y - 6 * ui_s, w - 28 * ui_s, max(1, ui_s));
444
+ gfx_setfont(2); ui_c(ui_cMuted, 1); gfx_x = x; gfx_y = y; gfx_drawstr("CONTROLS"); y += 16 * ui_s;
445
+ ui_arow(x, y, w, "Drag", "change the value"); y += lh;
446
+ ui_arow(x, y, w, "Shift-drag", "fine adjust (10x finer)"); y += lh;
447
+ ui_arow(x, y, w, "Wheel", "step the value"); y += lh;
448
+ ui_arow(x, y, w, "Dbl-click", "type an exact value"); y += lh;
449
+ ui_arow(x, y, w, "Cmd-click", "reset to default (Ctrl, Alt too)"); y += lh;
450
+ );
435
451
  gfx_setfont(1);
436
452
  );
437
453
  );
@@ -511,32 +527,60 @@ function ui_ctl(idx, fmt, label, x, y) local(lo, hi, st, t, fine) (
511
527
  );
512
528
 
513
529
  // Mix and Output in the top right of every plugin that has them: call ui_header(mix_idx, out_idx) in @gfx
514
- // before ui_begin (0 = this plugin has no such slider). Two small knobs with the usual gestures; the
530
+ // before ui_begin (0 = this plugin has no such slider). Two slim horizontal bars with the usual gestures; the
515
531
  // label shows the value while you hover or drag. Do not draw those two sliders as widgets as well.
516
532
  function ui_header(m, o) ( ui_hm = max(0, floor(m)); ui_ho = max(0, floor(o)); );
517
533
 
518
- // One small header knob whose right edge is xr; returns the x of the next one to its left.
519
- function ui_hknob(idx, label, fmt, xr) local(r, cx, cy, lo, hi, t, t0, a0, a1, av, aa, th, hot, tw0) (
520
- r = 8 * ui_s; cx = xr - r - 2 * ui_s; cy = 15 * ui_s;
521
- ui_hit = !(ui_core && ui_blocked) && !ui_modal && mouse_x >= xr - 62 * ui_s && mouse_x < xr && mouse_y >= 4 * ui_s && mouse_y < 26 * ui_s;
522
- ui_ctl(idx, fmt, label, cx, cy + 12 * ui_s);
523
- lo = ui_min[idx]; hi = ui_max[idx];
534
+ // A pill exactly h pixels tall: the end caps are circles of diameter h, so they never stick out past the bar.
535
+ function ui_pill(x, y, w, h) local(r) (
536
+ r = h / 2;
537
+ w <= h ? gfx_rect(x, y, w, h) : (
538
+ gfx_rect(x + r, y, w - h, h);
539
+ gfx_circle(x + r - 0.5, y + r - 0.5, r - 0.5, 1, 1);
540
+ gfx_circle(x + w - r - 0.5, y + r - 0.5, r - 0.5, 1, 1);
541
+ );
542
+ );
543
+
544
+ // One slim horizontal bar (like the level bar in Vital's header) whose right edge is xr; returns the x of the
545
+ // next one to its left. Drag left or right (Shift = fine), wheel, double-click to type, modifier-click resets.
546
+ // The header band is centred on y = 15 px, the same line the plugin name sits on.
547
+ function ui_hbar(idx, label, fmt, xr) local(bw, bh, bx, cy, by, lo, hi, st, t, t0, hot, tt, x0, x1) (
548
+ bw = 58 * ui_s; bh = 6 * ui_s; bx = xr - bw; cy = 15 * ui_s;
549
+ by = cy - 0.5 * ui_s; // the caps' ink sits half a pixel above the line box's middle: the bar follows the ink
550
+ lo = ui_min[idx]; hi = ui_max[idx]; st = ui_stp[idx];
551
+ ui_hit = !(ui_core && ui_blocked) && !ui_modal && mouse_x >= xr - 112 * ui_s && mouse_x < xr && mouse_y >= cy - 10 * ui_s && mouse_y < cy + 10 * ui_s;
552
+ ui_hit && ui_press ? (
553
+ tt = time_precise();
554
+ (mouse_cap & 52) ? ui_reset(idx) :
555
+ (ui_lci == idx && tt - ui_lct < 0.45) ? ui_edopen(idx, fmt, label, bx, cy + 12 * ui_s) :
556
+ ( ui_active = idx; ui_lx = mouse_x; ui_acc = slider(idx); ui_lci = idx; ui_lct = tt; );
557
+ );
558
+ ui_active == idx && ui_down ? (
559
+ ui_acc = min(hi, max(lo, ui_acc + (mouse_x - ui_lx) / (bw * ((mouse_cap & 8) ? 10 : 1)) * (hi - lo)));
560
+ ui_lx = mouse_x;
561
+ ui_set(idx, ui_q(idx, ui_acc));
562
+ );
563
+ ui_hit && mouse_wheel != 0 ? (
564
+ ui_set(idx, ui_q(idx, slider(idx) + sign(mouse_wheel) * (st > 0 ? st : (hi - lo) / ((mouse_cap & 8) ? 200 : 40))));
565
+ );
566
+ ui_active == idx && ui_rel ? ( slider_automate(2 ^ (idx - 1), 1); ui_active = 0; );
524
567
  t = min(1, max(0, (slider(idx) - lo) / (hi - lo)));
525
568
  t0 = (lo < 0 && hi > 0) ? -lo / (hi - lo) : 0;
526
569
  hot = ui_active == idx || ui_hit;
527
- th = max(2 * ui_s, r * 0.22);
528
- a0 = -2.35; a1 = 2.35; av = a0 + (a1 - a0) * t; aa = a0 + (a1 - a0) * t0;
529
- ui_c(hot ? ui_cTrackHot : ui_cTrack, 1); ui_ring(cx, cy, r - th, r, a0, a1);
530
- abs(t - t0) > 0.002 ? ( ui_c(ui_active == idx ? ui_cAccentAct : (hot ? ui_cAccentHi : ui_cAccent), 1); ui_ring(cx, cy, r - th, r, min(aa, av), max(aa, av)); );
531
- ui_cm(ui_cPanel2, ui_cLine, hot ? 0.9 : 0.4); gfx_circle(cx, cy, r - th - ui_s, 1, 1);
532
- ui_c(hot ? ui_cAccent : ui_cText, 1); gfx_circle(cx + sin(av) * (r - th - 3 * ui_s), cy - cos(av) * (r - th - 3 * ui_s), max(1, ui_s), 1, 1);
570
+ ui_c(hot ? ui_cTrackHot : ui_cTrack, 1); ui_pill(bx, by - bh / 2, bw, bh);
571
+ abs(t - t0) > 0.002 ? (
572
+ x0 = bx + bw * min(t, t0); x1 = bx + bw * max(t, t0);
573
+ ui_c(ui_active == idx ? ui_cAccentAct : (hot ? ui_cAccentHi : ui_cAccent), 1);
574
+ ui_pill(x0, by - bh / 2, max(1, x1 - x0), bh);
575
+ );
576
+ ui_c(hot ? ui_cText : ui_cMuted, 1); gfx_rect(bx + bw * t - ui_s / 2, by - bh, max(1, ui_s), bh * 2);
533
577
  gfx_setfont(2);
534
578
  hot ? ui_fmtv(fmt, slider(idx)) : ui_caps(label);
535
579
  gfx_measurestr(#ui_txt, ui_tw, ui_th);
536
580
  ui_c(ui_active == idx ? ui_cAccent : (hot ? ui_cText : ui_cMuted), 1);
537
- gfx_x = cx - r - 5 * ui_s - ui_tw; gfx_y = cy - ui_th / 2; gfx_drawstr(#ui_txt);
581
+ gfx_x = bx - 6 * ui_s - ui_tw; gfx_y = cy - ui_th / 2; gfx_drawstr(#ui_txt);
538
582
  gfx_setfont(1);
539
- xr - 66 * ui_s;
583
+ xr - 118 * ui_s;
540
584
  );
541
585
 
542
586
  // Returns 1 when the frame needs drawing. Nothing changed = nothing drawn, the old frame stays.
@@ -574,15 +618,15 @@ function ui_begin(core_rows, adv_rows) local(h, i, now, e, top) (
574
618
  gfx_setfont(4, "Arial", 15 * ui_s, 'b');
575
619
  gfx_setfont(5, "Arial", 8.5 * ui_s, 'b');
576
620
  gfx_setfont(1);
577
- ui_ytop = ui_pad + ((ui_hm || ui_ho) ? 20 : 8) * ui_s; // below the name (and the header knobs)
578
- ui_nlim = gfx_w - ui_pad - ((ui_hm > 0) + (ui_ho > 0)) * 66 * ui_s;
621
+ ui_ytop = 25 * ui_s; // name and bars are centred on y = 15; the first row's own padding makes the gap below match the 11 px above
622
+ ui_nlim = gfx_w - ui_pad - ((ui_hm > 0) + (ui_ho > 0)) * 118 * ui_s;
579
623
  ui_namedraw();
580
624
  ui_core = 1;
581
625
  ui_blocked = adv_rows > 0 && (ui_adv_open || ui_p > 0);
582
- (ui_hm || ui_ho) && gfx_w >= 240 * ui_s ? (
626
+ (ui_hm || ui_ho) && gfx_w >= 280 * ui_s ? (
583
627
  i = gfx_w - ui_pad;
584
- ui_ho ? i = ui_hknob(ui_ho, "Output", 1, i);
585
- ui_hm ? i = ui_hknob(ui_hm, "Mix", 2, i);
628
+ ui_ho ? i = ui_hbar(ui_ho, "Output", 1, i);
629
+ ui_hm ? i = ui_hbar(ui_hm, "Mix", 2, i);
586
630
  );
587
631
  // core: the window minus the drawer's closed bar (or the footer line when there is no drawer)
588
632
  ui_rowh = (gfx_h - ui_ytop - (adv_rows > 0 ? ui_bar + 4 * ui_s : ui_pad + (ui_credit ? 6 * ui_s : 0))) / max(1, core_rows);
@@ -783,6 +827,24 @@ function ui_kkey(note, vel) local(n, q0, q1) (
783
827
  ui_kb[n] = q1 ? min(127, max(1, vel)) : 0;
784
828
  );
785
829
 
830
+ // The keys the user plays with the mouse reach @block through a small queue (ui_kq: 16 slots of note and
831
+ // velocity, then a head and a tail). ui_kput is called by the keyboard widget; the plugin calls ui_kpoll() in
832
+ // @block until it returns 0: each 1 means ui_kn is a note and ui_kv its velocity (0 = note off).
833
+ // A note-on is queued only while two slots are free, so every queued note-on keeps room for its note-off
834
+ // (a full queue drops the newest event; a lost note-off would leave the note stuck when @block resumes).
835
+ function ui_kput(note, vel) local(t, f) (
836
+ t = (ui_kq[33] + 1) % 16;
837
+ f = (ui_kq[32] - ui_kq[33] + 15) % 16; // free slots
838
+ f >= (vel > 0 ? 2 : 1) ? ( ui_kq[ui_kq[33] * 2] = note; ui_kq[ui_kq[33] * 2 + 1] = vel; ui_kq[33] = t; );
839
+ );
840
+ function ui_kpoll() (
841
+ ui_kq[32] != ui_kq[33] ? (
842
+ ui_kn = ui_kq[ui_kq[32] * 2]; ui_kv = ui_kq[ui_kq[32] * 2 + 1];
843
+ ui_kq[32] = (ui_kq[32] + 1) % 16;
844
+ 1;
845
+ ) : 0;
846
+ );
847
+
786
848
  // ---- frequency graph ----------------------------------------------------------------------------
787
849
 
788
850
  // x of a frequency and the frequency of an x on the current graph (log axis, 20 Hz to 20 kHz).
@@ -984,6 +1046,58 @@ function ui_fthresh(thr_first, ratio_first, gain_first, n) local(k, a, b, x, y,
984
1046
  );
985
1047
  );
986
1048
 
1049
+ // ---- per-band levels --------------------------------------------------------------------------------
1050
+
1051
+ // A level line across each band of the frequency graph, one slider per band (first_idx .. first_idx + n - 1, any
1052
+ // range, drawn across the graph's height), for a plugin whose bands each have one amount (an EQ's gain, a split's
1053
+ // level). Hover a band and drag up or down to change its level, Shift-drag for fine steps, wheel for small steps,
1054
+ // a click selects the band (ui_fsel, which ui_bandknob follows), double-click types a value, Cmd/Ctrl/Alt-click
1055
+ // resets it. fmt is the knob formats (1 = dB). n is the number of bands (the handles + 1). Call it after the handles.
1056
+ function ui_fband(first_idx, n, fmt) local(k, a, b, y, idx, lo, hi, hot, drag, near, i, sel, t, mn, mx) (
1057
+ n = max(1, min(8, floor(n)));
1058
+ k = 0;
1059
+ loop(n,
1060
+ idx = first_idx + k; mn = ui_min[idx]; mx = ui_max[idx];
1061
+ lo = k == 0 ? 20 : slider(ui_ge[k - 1]); hi = k == n - 1 ? 20000 : slider(ui_ge[k]);
1062
+ a = ui_fxof(lo); b = ui_fxof(hi);
1063
+ y = ui_gy + ui_gh * (1 - (slider(idx) - mn) / (mx - mn));
1064
+ near = 0; i = 0;
1065
+ loop(n - 1, abs(mouse_x - ui_fxof(slider(ui_ge[i]))) < 9 * ui_s ? near = 1; i += 1;);
1066
+ hot = !near && !(ui_core && ui_blocked) && !ui_modal && ui_active == 0 && mouse_x >= a && mouse_x < b
1067
+ && mouse_y >= ui_gy && mouse_y < ui_gy + ui_gh;
1068
+ hot && ui_press ? (
1069
+ ui_fsel = k; t = time_precise();
1070
+ (mouse_cap & 52) ? ui_reset(idx) :
1071
+ (ui_lci == idx && t - ui_lct < 0.45) ? ui_edopen(idx, fmt, "Level", (a + b) / 2, y) :
1072
+ ( ui_active = idx; ui_ftd = 1; ui_ly = mouse_y; ui_acc = slider(idx); ui_lci = idx; ui_lct = t; );
1073
+ ui_press = 0;
1074
+ );
1075
+ ui_ftd && ui_active == idx && ui_down ? ( // only a drag this widget started
1076
+ ui_acc = min(mx, max(mn, ui_acc - (mouse_y - ui_ly) * (mx - mn) / ui_gh * ((mouse_cap & 8) ? 0.2 : 1)));
1077
+ ui_ly = mouse_y;
1078
+ ui_set(idx, ui_q(idx, ui_acc));
1079
+ );
1080
+ hot && mouse_wheel != 0 ? ui_set(idx, ui_q(idx, slider(idx) + sign(mouse_wheel) * (ui_stp[idx] > 0 ? ui_stp[idx] : (mx - mn) / 48))); // a stepped slider moves one step, or ui_q would round the nudge away
1081
+ ui_active == idx && ui_rel ? ( slider_automate(2 ^ (idx - 1), 1); ui_active = 0; ui_ftd = 0; );
1082
+ drag = ui_active == idx;
1083
+ (hot || drag) ? ui_gany = 2;
1084
+ sel = k == ui_fsel;
1085
+ y = ui_gy + ui_gh * (1 - (slider(idx) - mn) / (mx - mn));
1086
+ (hot || drag) ? ( ui_c(ui_cAccent, 0.07); gfx_rect(a, ui_gy, max(1, b - a), ui_gh); );
1087
+ ui_c(drag ? ui_cAccentAct : (sel || hot ? ui_cAccentHi : ui_cAccent), drag ? 1 : (sel ? 0.95 : (hot ? 0.8 : 0.4)));
1088
+ gfx_rect(a + 2 * ui_s, y, max(1, b - a - 4 * ui_s), max(1, sel ? 2 * ui_s : ui_s));
1089
+ (sel || hot || drag) && b - a > 50 * ui_s ? (
1090
+ gfx_setfont(2);
1091
+ fmt == 1 ? sprintf(#ui_txt, "%+.1f dB", slider(idx)) : ui_fmtv(fmt, slider(idx));
1092
+ gfx_measurestr(#ui_txt, ui_tw, ui_th);
1093
+ ui_c(drag || sel ? ui_cAccent : ui_cText, 1);
1094
+ gfx_x = a + 6 * ui_s; gfx_y = max(ui_gy + 2 * ui_s, y - ui_th - 3 * ui_s); gfx_drawstr(#ui_txt);
1095
+ gfx_setfont(1);
1096
+ );
1097
+ k += 1;
1098
+ );
1099
+ );
1100
+
987
1101
  // A knob for the selected band's slider: slider first_idx + ui_fsel of n, its label prefixed with the
988
1102
  // band's name (Low / Mid / High for 3 bands, Low / High for 2, else Band N).
989
1103
  function ui_bandknob(first_idx, n, label, fmt) local(k) (
@@ -1076,23 +1190,27 @@ function ui_transfer(thr_idx, ratio_idx, knee_db) local(k, t, r, bs, bx, by, i,
1076
1190
  // ---- MIDI keyboard ------------------------------------------------------------------------------
1077
1191
 
1078
1192
  // Piano keys lo..hi (MIDI notes; start and end on white keys: C, D, E, F, G, A, B), the notes fed with
1079
- // ui_kkey lit in the accent. Display only: a JSFX cannot send MIDI from @gfx.
1080
- function ui_keyboard(lo, hi, label) local(nw, n, pc, wi, ww, kx, ky, kw, kh, bk, x, v, k) (
1193
+ // ui_kkey lit in the accent. Playable: a click or drag queues notes the plugin reads with ui_kpoll() in @block
1194
+ // (a JSFX cannot send MIDI from @gfx, so the plugin sounds them itself).
1195
+ function ui_keyboard(lo, hi, label) local(nw, n, pc, wi, ww, kx, ky, kw, kh, bk, x, v, k, hn, hw, vel) (
1081
1196
  ui_cell();
1082
1197
  nw = 0; n = lo;
1083
1198
  loop(hi - lo + 1, ((2 ^ (n % 12)) & 1354) ? 0 : nw += 1; n += 1;);
1084
1199
  kw = ui_rw - 8 * ui_s; kx = ui_rx + 4 * ui_s; ky = ui_ry + 16 * ui_s;
1085
- kh = min(ui_rh - 20 * ui_s, 90 * ui_s);
1200
+ kh = min(ui_rh - 20 * ui_s, 52 * ui_s);
1201
+ ky = ui_ry + ui_rh - kh - 4 * ui_s; // along the bottom of its cell
1086
1202
  nw > 0 && kh > 16 * ui_s ? (
1087
1203
  ww = kw / nw;
1088
1204
  gfx_setfont(2); ui_caps(label);
1089
- ui_c(ui_cMuted, 1); gfx_x = kx; gfx_y = ui_ry + 2 * ui_s; gfx_drawstr(#ui_txt);
1205
+ ui_c(ui_cMuted, 1); gfx_x = kx; gfx_y = ky - 14 * ui_s; gfx_drawstr(#ui_txt);
1090
1206
  gfx_setfont(1);
1207
+ hn = -1; hw = -1;
1091
1208
  // white keys
1092
1209
  wi = 0; n = lo;
1093
1210
  loop(hi - lo + 1,
1094
1211
  ((2 ^ (n % 12)) & 1354) ? 0 : (
1095
1212
  x = kx + wi * ww; v = ui_kb[n] > 0;
1213
+ mouse_x >= x && mouse_x < x + ww && mouse_y >= ky && mouse_y < ky + kh ? hw = n;
1096
1214
  v ? ui_c(ui_cAccent, 1) : ui_cm(ui_cPanel2, ui_cText, 0.82);
1097
1215
  ui_rrect(x + 0.5 * ui_s, ky, ww - ui_s, kh, 3 * ui_s);
1098
1216
  wi += 1;
@@ -1105,6 +1223,7 @@ function ui_keyboard(lo, hi, label) local(nw, n, pc, wi, ww, kx, ky, kw, kh, bk,
1105
1223
  ((2 ^ (n % 12)) & 1354) ? (
1106
1224
  wi > 0 ? (
1107
1225
  bk = ww * 0.6; x = kx + wi * ww - bk / 2; v = ui_kb[n] > 0;
1226
+ mouse_x >= x && mouse_x < x + bk && mouse_y >= ky && mouse_y < ky + kh * 0.62 ? hn = n;
1108
1227
  ui_c(ui_cLine, 1); ui_rrect(x - ui_s, ky, bk + 2 * ui_s, kh * 0.62 + ui_s, 3 * ui_s);
1109
1228
  v ? ui_cm(ui_cAccent, ui_cBg, 0.35) : ui_cm(ui_cBg, ui_cPanel2, 0.5);
1110
1229
  ui_rrect(x, ky, bk, kh * 0.62, 3 * ui_s);
@@ -1112,5 +1231,18 @@ function ui_keyboard(lo, hi, label) local(nw, n, pc, wi, ww, kx, ky, kw, kh, bk,
1112
1231
  ) : wi += 1;
1113
1232
  n += 1;
1114
1233
  );
1234
+ // play the keys: press = note on (higher up the key = softer), drag across keys = glissando, release = note off
1235
+ hn < 0 ? hn = hw;
1236
+ vel = floor(35 + 92 * min(1, max(0, (mouse_y - ky) / kh)));
1237
+ hn >= 0 && ui_active == 0 && ui_press && !(ui_core && ui_blocked) && !ui_modal ? (
1238
+ ui_active = 64; ui_kheld = hn + 1; ui_kput(hn, vel); ui_kkey(hn, vel); ui_press = 0;
1239
+ );
1240
+ ui_active == 64 && ui_down && hn >= 0 && hn + 1 != ui_kheld ? (
1241
+ ui_kput(ui_kheld - 1, 0); ui_kkey(ui_kheld - 1, 0);
1242
+ ui_kheld = hn + 1; ui_kput(hn, vel); ui_kkey(hn, vel);
1243
+ );
1244
+ ui_active == 64 && !ui_down ? (
1245
+ ui_kput(ui_kheld - 1, 0); ui_kkey(ui_kheld - 1, 0); ui_kheld = 0; ui_active = 0;
1246
+ );
1115
1247
  );
1116
1248
  );