Hybrid pipeline: RPPBuilder writes VST3/MIDI/audio skeleton, ReaScript handles built-in plugins (ReaEQ, ReaComp) via TrackFX_AddByName + TrackFX_SetParam with multi-action dispatch, adaptive API check, and builtin plugin auto-detection from PLUGIN_REGISTRY. 326 tests (298 existing + 28 new), 12/12 spec scenarios compliant.
4.3 KiB
Proposal: ReaScript-First Built-in Plugin Configuration
Intent
RPPBuilder writes .rpp text that REAPER loads, but built-in plugins (ReaEQ, ReaComp, ReaVerb, etc.) need the REAPER API (TrackFX_AddByName, TrackFX_SetParam) to configure parameters correctly. Text-mode VST "ReaEQ" "reaeq.dll" loads the plugin but leaves all 19 param slots at zero — no EQ curve, no compression threshold. ReaScript already handles verify/render; it must also handle built-in plugin insertion and parameter configuration while RPPBuilder keeps generating VST3/MIDI/audio structure.
Scope
In Scope
- New ReaScript actions:
add_track,add_fx,add_midi_item,configure_fx_params ReaScriptCommanddataclass extended withplugins_to_add: list[PluginDef],fx_params: list[dict]ReaScriptGeneratorgenerates script blocks forInsertTrackAtIndex,TrackFX_AddByName,CreateNewMIDIItemInProj,MIDI_InsertNote,TrackFX_SetParamscripts/run_in_reaper.pysupports multi-action pipeline: skeleton → inject plugins → verify → rendercommands.pydecoupled: action dispatch mapping,ReaScriptResultgainsadded_plugins: list[tuple[str, int]]- RPPBuilder marks built-in plugins with
paramsfield; ReaScript reads these and applies via API
Out of Scope
- VST3 plugin insertion via ReaScript (RPPBuilder handles these)
- ReaScript-based arrangement/track ordering (RPPBuilder remains source of truth)
- OSC/HTTP-based REAPER control
- Multi-DAW support
Capabilities
New Capabilities
reascript-builtin-fx: ReaScript generates code to insert built-in REAPER plugins with configured parameters via the native API, reading aplugins_to_addsection from the command JSON.
Modified Capabilities
reascript-generator: (existing) expands beyond verify/calibrate/render to support add_track, add_fx, add_midi_item, configure_fx_params actions with action dispatch.
Approach
Hybrid pipeline: RPPBuilder writes a skeleton .rpp with VST3 plugs + MIDI + audio. ReaScript then executes:
- Open skeleton
.rpp - Add tracks reserved for built-in plugins (
InsertTrackAtIndex) - Insert FX by name (
TrackFX_AddByName("ReaEQ")) - Configure params (
TrackFX_SetParam(track, fx_idx, param_idx, value)) - Add MIDI items/notes for ReaScript-generated MIDI (if needed)
- Verify all FX → calibrate volumes → render → measure LUFS
ReaScriptCommand.action becomes an ordered list: ["add_plugins", "verify_fx", "calibrate", "render"]. ReaScriptGenerator._build_script() dispatches per-action code blocks.
Affected Areas
| Area | Impact | Description |
|---|---|---|
src/reaper_scripting/commands.py |
Modified | New action types + plugins_to_add field |
src/reaper_scripting/__init__.py |
Modified | New script generation blocks for built-in FX |
scripts/run_in_reaper.py |
Modified | Multi-action pipeline orchestration |
src/reaper_builder/__init__.py |
Modified | Mark built-in plugins in RPP with params dict |
tests/test_reaper_scripting.py |
Modified | New tests for add_fx/configure_fx_params |
Risks
| Risk | Likelihood | Mitigation |
|---|---|---|
| Built-in plugin API missing in REAPER version | Low | API check in generated script; fallback to text-only |
| Param indices differ across REAPER versions | Medium | Pin known indices; version-detect at script startup |
| Multi-action execution breaks existing tests | Medium | Extensible action dispatch; existing "calibrate" action preserved |
Rollback Plan
- Revert
commands.pyto single-action model (backward compat:action: "calibrate"still works) - Revert
_build_script()to single-block generation - RPPBuilder changes are additive (new
paramsfield); no rollback needed - Existing 298 tests must remain green throughout
Dependencies
- REAPER v7+ with Python ReaScript
- No new Python packages
Success Criteria
ReaScriptCommand(action="add_plugins")generates valid Python that callsTrackFX_AddByNameandTrackFX_SetParam- Built-in plugin (ReaEQ) loaded with correct params in generated
.rppverified by REAPER - Existing 298 tests pass unchanged
scripts/run_in_reaper.pyruns multi-action pipeline end-to-end- Generated ReaScript handles missing API gracefully with
check_api()guard