c2f7cb6 (branch chore/update-stack). No code was changed as part of this review.
Method
- Ran the same gates as CI.
- Ran three parallel read-only reviews, each over its own part of the code:
- realtime DSP and plugins
- offline DSP and core crates
- CLI, MCP, worker, REAPER and tooling
- Confirmed the highest-severity findings by hand against the source. These are marked ✅ confirmed. All other findings come from reading the code and have not been reproduced by running it.
Automated checks
Test coverage distribution
Nothing tests the limiter on transients, the latency the plugins report, allocation on the audio thread, or the MCP tool dispatch. That is why the defects below pass CI.
High severity
H1. FFT allocates on the audio thread ✅ confirmed
- Where:
crates/forge-dsp/src/realtime.rs:250, 257, 326, 515-517, 553-554(RealtimeOpenSoothe::process_stft_hop,RealtimeOpenSpacer::process_unmask_hop) - Defect: The code calls
Fft::process(), and in rustfft 6.4 that allocatesvec![..; get_inplace_scratch_len()]on every call (rustfftsrc/lib.rs:195-198). - Impact: OpenSoothe makes 4 heap allocations per hop and OpenSpacer makes 5. This contradicts the “zero allocation” docs and the
assert_process_allocsintent, and it risks dropouts on the audio thread. - Fix: Allocate a scratch
Veconce innew()and callprocess_with_scratch.
H2. Master limiter lookahead does not look ahead ✅ confirmed
- Where:
crates/forge-dsp/src/realtime.rs:927-954(RealtimeMasterLimiter) - Defect:
required_gainis computed per sample, with no hold and no minimum over the lookahead window. A short over-peak such as a drum hit is over the ceiling for only about 4 samples. The 0.5 ms attack moves the gain only about 15% of the way in that time, and the gain releases on the next sample. - Impact: The peak leaves the delay line almost unattenuated and is hard-clipped by the final
clamp(-ceiling, ceiling)(line 954). Transients get clipped instead of limited, and true-peak compliance is lost. Only sustained overs are handled correctly. - Fix: Take a sliding-window minimum of
required_gainover the lookahead length, or ramp the gain so it reaches the target by the time the peak exits the delay line.
H3. STFT plugins report the wrong latency
- Where:
crates/forge-dsp/src/realtime.rs:132-134, 432-434; passed to the host atcrates/forge-plug/src/lib.rs:434, 693 - Defect: The plugins report
fft_size - hop= 1536 samples. A frame computed at ring position P writes into slot P+i, so input at time t comes out at t+2048. - Impact: Plugin delay compensation is off by 512 samples (about 10.7 ms at 48 kHz) for OpenSoothe and OpenSpacer.
- Fix: Report 2048, or change the output read position to match 1536. Add a test that feeds an impulse and measures the actual delay.
H4. reset() hardcodes 48 kHz and allocates ✅ confirmed (hardcode)
- Where:
crates/forge-plug/src/lib.rs:444-447(ForgeOpenSoothePlug::reset);crates/forge-dsp/src/realtime.rs:883 - Defect:
reset()callsself.dsp.reset(48_000.0)andself.limiter_dsp.reset(48_000.0), whatever the session rate is. The limiter’sresetis*self = new(), which allocates twoVecs.sub_tape_dspis not cleared at all. - Impact:
- At 44.1 or 96 kHz, every coefficient and the limiter lookahead are wrong after a reset.
- The lookahead stops matching the latency reported in
initialize. - nih-plug documents
reset()as callable on the audio thread, so the allocation also counts as a real-time violation.
- Fix: Store the sample rate in
initialize. Makeresetclear state only, with no reallocation.
H5. Sub & Tape side high-pass rebuilt every block
- Where:
crates/forge-plug/src/lib.rs:1138-1139withcrates/forge-dsp/src/realtime.rs:751-755 - Defect:
set_mono_cutoffruns unconditionally every block and rebuildsside_hp1andside_hp2withBiquad::highpass, which zeroesz1andz2. - Impact: The side channel glitches at buffer rate whenever it has content.
- Fix: Update coefficients only when the cutoff changes, and keep the filter state.
H6. DTW alignment allocates full N×N matrices ✅ confirmed
-
Where:
crates/forge-dsp/src/phase_align.rs:191-192(align_vocal_double_dtw) -
Defect:
cost(Vec<Vec<f64>>) andback(Vec<Vec<(usize, usize)>>) are allocated atnum_steps × num_steps, but only a band of width2*band+1is ever used. -
Impact: At a 10 ms hop, memory grows with the square of the length:
On ordinary user audio the result is an allocation abort or heavy swapping.
- Fix: Store only the band diagonal for each row.
H7. De-plosive split carves a permanent notch ✅ confirmed (offline)
- Where:
- offline:
crates/forge-dsp/src/restoration.rs:289-309 - realtime:
crates/forge-dsp/src/realtime.rs:660-678
- offline:
- Defect: The output is
hi + lo * plosive_gain, built from a 2nd-order low-pass and high-pass at the same cutoff frequency. With gain 1.0, which is almost always the case, the sum has the numerator(1, -2cos w0, 1), which is a notch at the cutoff. - Impact:
- Offline:
deliver(..., vocal=true)always cuts a full-depth notch at 110 Hz into the vocal, even when there are no plosives. - Realtime: about -10 dB near 90-115 Hz and about -3 dB from 63 to 200 Hz, which removes the vocal fundamental.
- Offline:
- Fix: Derive the high band as
x - lp, or use a Linkwitz-Riley crossover so the bands sum flat.
H8. MCP tools accept arbitrary filesystem paths ✅ confirmed
- Where:
crates/forge-mcp/src/main.rs:346-784(dispatch_tool) - Defect: None of the path arguments are validated or confined:
input,output,output_midi,output_dir,reference,sidechain,target. They go straight toAudioBuffer::load,save_wav,write_midi_fileandcreate_dir_all. - Impact: A prompt-injected agent could do any of the following:
- overwrite any file the user can write, for example with
forge_restore_and_defizzandoutput=<any path>, orforge_deliverplus its.delivery.jsonwrite - read any file that decodes as audio
- create arbitrary directory trees through
forge_ingest_to_reaperandforge_vocal_suite
- overwrite any file the user can write, for example with
- Fix:
- Define an allowed root, set by an environment variable or a flag.
- Canonicalize every path.
- Reject
..and any absolute path outside the allowed root.
Medium severity
Realtime DSP and plugins
M1. De-esser over-subtracts (realtime.rs:681-690)
sib_lis the residual of a +12 dB peaking EQ, about 2.98× the band.- Subtracting
sib_l*(1-cut)therefore removes too much. Belowcut≈ 0.66 the band is polarity-inverted instead of attenuated. - The
sib_envthreshold is also measured on the boosted residual. - Fix: scale by
(1-cut)/(A²-1), or use a true band-pass.
realtime.rs:1016-1019)
RealtimeMasteringEq18::set_gainsreplaces eachBiquad, which zeroes its state. Automating the EQ amount or switching genre clicks.- Fix: keep
z1andz2when updating the coefficients.
forge-plug/src/lib.rs:1565-1587, 1535-1541)
- NoteOns triggered by audio on notes 36, 38 and 42 never get a NoteOff, so sustaining instruments hang.
- Chord expansion copies the incoming event, so all 5 notes share one
voice_id, and NoteOff matching becomes ambiguous. - Toggling
expand_chordsbetween a NoteOn and its NoteOff leaves the harmony notes stuck.
realtime.rs:1148)
snare_bp(...) - mono*0.5leaves half of the broadband signal in the snare band.- Kick and hat transients can then pass the snare ratio test and fire spurious D1 notes.
- Fix: subtract
monoin full.
forge-plug/src/lib.rs:434-440)
- Latency is reported once, in
initialize, based onenable_limiterat that moment. - Toggling the limiter later changes the real delay by the lookahead (144 samples at 48 kHz) without calling
set_latency_samples.
elite_dsp.rs:1170-1186)
- It processes every 4th sample with SVF coefficients designed for the full sample rate, and does no anti-alias filtering before decimating.
- Every band displays 4× too low (25 Hz-18.5 kHz shows as 6 Hz-4.6 kHz), and high-frequency content aliases in. This affects the GUI only.
forge-plug/src/lib.rs:2472, elite_dsp.rs:526)
reverb_decay(0.05-0.98) is passed asdecay_rt60_secs, which is clamped to 0.2-20 s.- RT60 therefore never exceeds 1 s, and the lower third of the knob does nothing.
- Fix: map the normalized value to seconds.
loudness_limiter.rs:877-888, normalize_and_limit)
- Attack is an instantaneous gain step (
current_gain = target_g) taken L samples before the peak. - Large reductions create a discontinuity, heard as a click.
- Fix: ramp the gain.
Offline DSP, vocal, theory
M9. Chord parser falls back to the wrong quality (forge-theory/src/lib.rs:111-117)
- The catch-all maps any unknown quality that starts with
mto a minor 7th, and anything else to a major 7th. Cmaj7#11andCmaj11become C-Eb-G-Bb.G7#11,G7b5,G7#5,G9sus4andG13b9become G-B-D-F#.
"11" is voiced as minor 11 (forge-theory/src/lib.rs:104)
"11"shares an arm withm11([0,3,7,10,14,17]), soG11is voiced asGm11.
phase_align.rs:257-275)
- When the guide is longer than the dub,
step_fruns pastnum_steps-1and the mapped position stops moving. - Example: a 5 s guide against a 3 s dub gives about 2 s of one repeated sample (a DC offset) instead of silence.
phase_align.rs:60-63)
- Analysis uses only the first
min(n, fft_len/2)samples, at most 32768 (0.68 s at 48 kHz). The comment claims it picks the “highest-energy window”. - A silent or count-in intro longer than that gives lag 0 and no polarity decision.
phase_align.rs:93, 121)
correlation_peakis not normalized by signal energy. For ordinary audio it exceeds 1 and is clamped to 1.0, so the 0-1 confidence carries no information.
forge-vocal/src/lib.rs:36-47)
VocalScale::parsediscards the remainder returned byparse_pitch_class, so"Am"and"F#m"parse as major."A minor pentatonic"reads only one token and returns full natural minor.- Mixolydian, lydian, phrygian and locrian silently become major.
forge-vocal/src/lib.rs:154, 194-198)
- YIN stops at the first tau below 0.15 instead of the local minimum, and it has no parabolic interpolation.
- Pitch is quantized to whole-sample lag, about 16 cents at 445 Hz and 48 kHz.
time_secsis the window start rather than its center, so the pitch curves and the REAPER PITCHENV are about 20 ms early.
CLI, MCP, worker, REAPER
M16. GPU and Colab backends never run ✅ confirmed (forge-worker/src/lib.rs:40-44)
- Only
LocalGpuever tries the Python worker.AutoandRemoteColab{base_url}always use the Rust DSP splitter. - The MCP and CLI both pass
Auto, so neural separation never runs, andFORGE_COLAB_WORKER_URLis never read. - When
LocalGpufails, the error is discarded and the code silently falls back to the DSP splitter.
forge-worker/src/lib.rs:124-135)
Command::new("uv").output()has no timeout. A hung model download or CUDA stall blocks the single-threaded stdio MCP loop forever.- The script path is relative to the process working directory. If the MCP host launches the server elsewhere, the worker fails and the failure is swallowed (see M16).
forge-mcp/src/main.rs:63)
let Ok(raw) = line else { break };exits the server on one invalid-UTF-8 line from stdin.- A panic in any DSP call is not caught (no
catch_unwind), so it also kills the server.
forge-mcp/src/main.rs:374-385, 723-778)
forge_deliverandforge_ingest_to_reaperreturnisError:falseeven whenreport.ready == false.- The CLI exits 2 in the same case (
forge-cli/src/main.rs:593), so an agent that only checksisErrortreats a failed delivery as success.
forge-mcp/src/main.rs:729-740, forge-reaper/src/lib.rs:285, 317)
- The JSFX files are installed into
<output_dir>/Effects. - The
.rppreferencesForgeAudio/Forge_*.jsfx, which REAPER looks for under its ownEffects/ForgeAudio.
forge-reaper/src/lib.rs:322-323)
- Track
FILEpaths are written exactly as given, and REAPER resolves relative paths against the.rpp’s directory, soout/stems/x.wavbecomesout/out/stems/x.wav. sanitize_rpp_stringalso strips"from paths, which breaks the reference.- Fix: make the paths absolute.
python-worker/forge_gpu_worker.py:40-46, 51-57, 82)
- Stems are matched by substring on the output filename, and that filename includes the input name.
Lead_Vocal_mix.wavmatches"Vocal"for both stems, so the instrumental can be returned as the vocal. An input name containingdrytriggers the de-reverb check.Client.predicthas no timeout.
.github/workflows/codspeed.yml:12-14)
id-token: writeis set for the whole workflow, so PR-controlledbuild.rsand benches can mint OIDC tokens on same-repo PRs.- Fix: limit the permission to the step that needs it.
.github/workflows/ci.yml:169-176)
- The pluginval and clap-validator release zips are downloaded and run with no SHA256 check. Only the version tag pins them.
Low severity
- True-peak estimate reads low (
realtime.rs:897-901)- The estimator checks only t=0.5 and t≈0.75 within each sample interval, never t=0.25.
- It under-reads some inter-sample peaks.
- Spectrum slot 0 problems (
forge-plug/src/lib.rs:198-207,elite_dsp.rs:870)- The docs say slot 0 means “Off”, but the code treats it as a real slot and every instance defaults to it.
- Unpublished slots read 0.0 dB, so the bars pin at full height until the first publish.
- Stale data persists after an instance is removed.
- Bypassed effects click on re-entry (
realtime.rs:803-826,elite_dsp.rs:1051)- The tape and disperser buffers go stale while bypassed.
- Vocal Surgical automation steps (
forge-plug/src/lib.rs:1844-1853)- Its parameters are unsmoothed, so automation steps are audible.
- Delivery checks are looser than the standards (
delivery.rs:24, 262, 79-84)- A ±1.0 LU tolerance applies to every target, but EBU R128 allows ±0.5 LU, so -23.9 LUFS passes as “ready”.
- The Amazon ceiling is -1 dBTP. Amazon may recommend -2 dBTP; this has not been checked against their current documentation.
remove_dc=falsestill removes DC (restoration.rs:347-349)- With
declip=true, DC is still removed, becauseremove_dc_and_declipalways subtracts the mean.
- With
- NaN spreads through spectral unmasking (
spectral_unmask.rs:74, 108, 127)max_reduction_dbandsensitivityare clamped, butclamppasses NaN through.- Target samples are not sanitized, unlike in
spectral_defizz.rs, so one NaN spreads across every frame it touches.
- ABC parser gaps (
forge-theory/src/lib.rs:359, 392+)K:andL:are ignored, so the key signature never applies and the unit length is fixed at 1/8.- Fractional durations (
A/2), multi-digit durations (A12) andxrests are not handled. - Header lines such as
w:andV:, and decorations such as!f!, are scanned as notes.
- Ragged channels from odd WAV files (
forge-core/src/lib.rs:227-249)load_wavbuilds ragged channels if the total sample count is not divisible by the channel count, andapply_spectral_unmaskwould then panic incopy_from_slice.- Not yet checked whether
houndrejects such files first.
- JSFX install falls back silently (
forge-reaper/src/lib.rs:25-32)- With
APPDATAunset (macOS/Linux),install_jsfx_pluginswrites to./reaper-effects-installedand reports “Installed”.
- With
- ffmpeg leftovers and argument injection (
forge-reaper/src/lib.rs:115-157,forge-mcp/src/main.rs:621-641)- When ffmpeg fails,
*.pre_tag.wavis left behind. - An
outputthat starts with-can be parsed as an ffmpeg option.
- When ffmpeg fails,
- OSC send reports success regardless (
forge-reaper/src/lib.rs:374-391)send_reaper_oscreports success for fire-and-forget UDP, accepts addresses without a leading/, and binds to 127.0.0.1, so non-loopback hosts fail. CLI only.
- xtask exits 0 on usage errors (
xtask/src/main.rs:95-107)- Install usage errors return exit code 0, and
--destwith no value is silently ignored.
- Install usage errors return exit code 0, and
- xtask install fails on macOS (
xtask/src/main.rs:124-127)std::fs::copyfails on directory-bundle.clapfiles.
Areas that looked clean
- STFT overlap-add in
spectral_defizz.rsandspectral_unmask.rs: Hann analysis and synthesis windows, normalization by Σw², 75% overlap. - GCC-PHAT phase alignment: the lag sign and shift direction are correct, and so is the polarity decision.
AudioBuffer(forge-core): constructors,to_mono,to_stereo, the WAV round trip and dithering.- Delivery loudness targets: correct for Spotify, YouTube, Tidal, Deezer, Apple, Podcast, EBU and ATSC.
- MIDI and theory helpers:
- the pitch-shifter crossfade
snap_midianddiatonic_shift_semitones- MIDI writer event ordering and its u28 bounds
- Realtime indexing and math:
- ring masks, the FDN, flutter and preamp ring indexing
- NaN, Inf and denormal flushing
- Biquad, Cytomic SVF and K-weighting coefficients
- allpass stability
- nih-plug smoother usage
- Lyria HTTP client: has a 180 s timeout, and the key is sent in a header.
- CLI exit codes, and MCP JSON-RPC argument extraction (no unwraps on user input).
- RPP string and numeric sanitizing, and ISRC validation.
- CI workflows:
- actions are pinned by SHA
inputs.tagis passed viaenv- permissions are
contents: readby default - no
pull_request_target
Suggested fix order
- H8: confine MCP paths. This is a security issue and the smallest change.
- H1, H4, H5: real-time safety in the plugins.
- H2, H3: limiter transients and latency reporting, which together decide whether the master limiter can be trusted.
- H6, H7: DTW memory, and the de-plosive notch in both the offline and realtime paths.
- M16-M19: worker routing, timeouts and MCP robustness.
- Add regression tests alongside each fix:
- an impulse-delay test for the reported latency
- a single-transient test for the limiter’s true peak
- an allocation guard for the plugin
process()calls - an MCP
dispatch_tooltest for path rejection