@mthines/reaper-mcp 0.93.1 → 0.94.0
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 +48 -48
- package/bridge-ui/mcp_bridge.html +94 -54
- package/claude/knowledge/workflows/vocal-alignment.md +23 -2
- package/claude/skills/editing/SKILL.md +21 -5
- package/main.js +570 -142
- package/package.json +2 -1
- package/reaper/mcp_actions_lib.lua +29 -0
- package/reaper/mcp_bridge.lua +42 -1
- package/reaper/mcp_mixing_lib.lua +129 -0
|
@@ -25,8 +25,29 @@ The ear decides in the end. These steps find the problems the agent can measure
|
|
|
25
25
|
1. **Keep the originals.** Copy the guide and each double to new tracks (`T ref`, `T edit` are fine as temporary names, delete them when done) and edit the copies. Never touch the user's items or solo state. Tracks created without a master send are silent in playback but still render, so turn the master send on for tracks the user will audition.
|
|
26
26
|
2. **Pick the guide.** The louder, tighter take. A quiet backing vocal against a loud lead is a good test: onsets are found per source file, so level does not matter.
|
|
27
27
|
3. **Dry run.** `align_audio_to_guide` with `dryRun: true`: read the offset before and after (avg and max ms) per double. Start with `strength` around 0.8 and a `maxShiftMs` under the typical phrase gap; raise it only when hits are missed.
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
A dry run that reports `replacedMarkers` above 1 means the double already had stretch markers (an earlier alignment or edit by the user): say so before applying, and keep the original on the copy.
|
|
29
|
+
4. **Apply** (same call without `dryRun`), then run **Verify and iterate** below. Do not tell the user the alignment is done before that loop has finished; the align call's own after-offsets are what the tool planned, not what plays.
|
|
30
|
+
5. **Listen** before accepting: play the aligned range with the guide. The tool checks for damage, not for taste. Name the spots that are still uncertain.
|
|
31
|
+
|
|
32
|
+
## Verify and iterate (always, without being asked)
|
|
33
|
+
|
|
34
|
+
The align call plans from the items' source files. What the user hears is the rendered track, so measure that.
|
|
35
|
+
|
|
36
|
+
1. **Damage check.** `verify_edit` against the kept copy: `timeScale: 1`, `expect: "changed"`. The `discontinuity` check must be ok (no click or hard splice).
|
|
37
|
+
2. **Timing check on the render.** `detect_transients` on the guide track and the double track over the aligned range (`limit` high enough for the range, `minGapMs` 60). Pair hits within about 100 ms, using the strong ones first (strength above about 0.4 on either side, or both). Write down each pair's offset (double minus guide, ms).
|
|
38
|
+
3. **Judge.** Most pairs should sit within about ±15 ms (the tool's own after-average is 5-7 ms). Pairs beyond about 20 ms are outliers. List them with time, offset and strength.
|
|
39
|
+
4. **Do not use `measure_track_alignment` to judge a lead against a backing.** The two differ in texture (a scream against a sung line was measured at correlation 0.07-0.11, under the 0.3 it needs), so its delay is not to be trusted. Use onset pairing.
|
|
40
|
+
5. **Detectors can disagree.** `align_audio_to_guide` reads source files; `detect_transients` on a track reads the render. On low-band hits of a loud lead the two once placed the same hit about 100 ms apart. Before moving a marker for an outlier, check that both sides really have that hit (strength, band, a neighbouring pair that agrees). When the detectors disagree and nothing nearby confirms the outlier, do not move it: hand it to the user's ear.
|
|
41
|
+
A wrong pairing is the usual cause of a real outlier. Look at both source files with `detect_transients` (`path`, `filePosition` = item position minus start offset, `startTime` at or after `filePosition`): a guide hit with a very low `peakDb` (about -40 dB or lower) is a false hit, and the pairing can put the double's real hit on it and shift every hit after it by one (seen: a -53 dB blip took a real hit 80 ms early and stretched the audio after it by 1.4x). The fix is the markers: pin the double's real hit (marker `sourcePosition` = start offset + the hit's item time) on the guide's real hit, and keep the next marker at its natural spacing.
|
|
42
|
+
Two strong hits of the double close together (about 50 ms) against one guide hit are ambiguous (which one is the onset?). Do not guess: report the spot to the user.
|
|
43
|
+
6. **Fix and re-measure.** For a confirmed outlier, move that one hit: `get_stretch_markers`, then `edit_stretch_markers` (position in item seconds; all edits are checked against the whole list first). Re-render and repeat from step 2 on the touched range. At most 3 rounds, then stop and report what is left; never loop on an outlier the markers cannot fix (a hit with no partner, a marker that would cross its neighbour).
|
|
44
|
+
7. **Report** the before and after (average and worst offset on the render, number of outliers), what was fixed, and what is still loose or unconfirmed, with times. Say plainly which numbers come from onset detection rather than a waveform measurement.
|
|
45
|
+
|
|
46
|
+
## Undoing an alignment
|
|
47
|
+
|
|
48
|
+
- **Before aligning, save the markers:** `snapshot_save { name: "before-align", trackIndices: [<guide track>, <double track>], stretchMarkers: true }`. It keeps the stretch markers of every audio item on those tracks, apart from the track chunk, and `snapshot_restore` puts them back on the same items (found by GUID, else by track, position and length). The reply says how many items it restored, left alone or could not find. Scope it with `trackIndices` in a big project.
|
|
49
|
+
- A scoped snapshot (`trackIndices`, which turns on `fullChunk`) stores each track's whole state chunk, items included, so restoring it also reverts every item edit made since, on tracks REAPER accepts the chunk for. Pass `fullChunk: false` with `stretchMarkers: true` to bring back only the markers. A snapshot without either holds no items, so it cannot undo an alignment. `undo_project` does, one undo point per `align_audio_to_guide` call, as long as nothing was written after it.
|
|
50
|
+
- A `fullChunk` snapshot of the tracks was refused (`SetTrackStateChunk failed`) on tracks whose items carry Melodyne (ARA) take FX; the cause is not confirmed. The restore warns, leaves that track unchanged and still restores the saved stretch markers. For such tracks pass `fullChunk: false` when only the markers matter.
|
|
30
51
|
|
|
31
52
|
## Stretching a vocal: what the checks mean
|
|
32
53
|
|
|
@@ -52,8 +52,12 @@ decide what to do. Explain mode is never on otherwise.
|
|
|
52
52
|
an EQ on the wrong tracks). `list_tracks` (filtered by `parent`) or
|
|
53
53
|
`get_track_lanes` right before each batch, and target by name where it is
|
|
54
54
|
unique. Item indexes also change after every move, import or delete.
|
|
55
|
-
2. **
|
|
56
|
-
parameters
|
|
55
|
+
2. **Do not count on a snapshot to undo item edits.** A plain snapshot keeps faders and FX
|
|
56
|
+
parameters only. A scoped one (`trackIndices`) also stores each track's whole chunk, items
|
|
57
|
+
included, but REAPER refuses some chunks (tracks whose items carry Melodyne), and a restore
|
|
58
|
+
then reverts every item edit since. For stretch markers alone use `snapshot_save` with
|
|
59
|
+
`stretchMarkers: true` (and `fullChunk: false` to bring back only those). It cannot undo
|
|
60
|
+
a MIDI or arrangement edit. Before changing
|
|
57
61
|
items, keep the original as a **take** of the item it replaces (see "Keeping
|
|
58
62
|
the original" below), or as the A lane of a lane pair. **Never mute an
|
|
59
63
|
original and leave it under or beside the new item**: overlapping muted items
|
|
@@ -277,13 +281,25 @@ use `knowledge/workflows/vocal-alignment.md`; load it first. In short:
|
|
|
277
281
|
untouched) and delete them when the user is done.
|
|
278
282
|
2. `align_audio_to_guide` with `dryRun` first, then apply; it reads the items'
|
|
279
283
|
source files, so take FX such as Melodyne are not heard.
|
|
280
|
-
3.
|
|
281
|
-
|
|
282
|
-
|
|
284
|
+
3. **Verify and iterate before you say it is done; the user should never have to
|
|
285
|
+
ask.** Run the loop in the workflow's "Verify and iterate": `verify_edit`
|
|
286
|
+
against the kept copy (`timeScale` = the playback rate, `expect: "changed"`
|
|
287
|
+
for a stretch), then pair the hits of the rendered guide and double
|
|
288
|
+
(`detect_transients` on both tracks) and list every pair beyond about 20 ms.
|
|
289
|
+
Fix confirmed outliers one hit at a time with `edit_stretch_markers`,
|
|
290
|
+
re-measure, at most 3 rounds. Do not judge a lead against a backing with
|
|
291
|
+
`measure_track_alignment` (too little correlation). Then **tell the user
|
|
292
|
+
which edits to listen to**. A plain speed change (rates outside about 0.97x-1.03x) is reported as info (pitch follows speed);
|
|
283
293
|
a pitch-kept slow-down below 0.9x gets stretch artifacts that only the
|
|
284
294
|
dropout check and the user's ear catch. A pass is evidence, not a verdict.
|
|
285
295
|
4. Put each copied item straight at its final position; batch-moving items on a
|
|
286
296
|
track re-sorts their indexes.
|
|
297
|
+
5. A dry run that reports `replacedMarkers` above 1 means the double already has
|
|
298
|
+
stretch markers: say so before applying. Before applying, `snapshot_save` with
|
|
299
|
+
`stretchMarkers: true` and `trackIndices` of the guide and double tracks: it keeps
|
|
300
|
+
their stretch markers, which `snapshot_restore` puts back (a track-chunk restore
|
|
301
|
+
fails on tracks with Melodyne take FX; the markers still come back). `undo_project`
|
|
302
|
+
works only while nothing was written after.
|
|
287
303
|
|
|
288
304
|
## Workflow
|
|
289
305
|
|