Skip to content

hasValidPitch never resets -- ring mod stays active during silence #20

@user1303836

Description

@user1303836

Problem

hasValidPitch (source/PluginProcessor.h:52) is set to true when a valid pitch is first detected (PluginProcessor.cpp:138) and never set back to false during processing (only reset in prepareToPlay).

Once pitch tracking succeeds once, ring modulation continues forever, even during silence or when the player stops. The oscillator keeps running at the last detected frequency. This may produce unexpected artifacts -- the ring mod stays active with a stale frequency instead of bypassing.

Corroborated by: 4/8 audit agents (dsp-algorithm, pitch-detection, realtime-safety, stability-edge)

Suggested Fix

Consider one of these approaches:

  1. Timeout reset: Reset hasValidPitch = false after N consecutive low-confidence frames
  2. Confidence gating: Scale the wet signal by confidence so the effect fades naturally during silence
  3. Hold with decay: Keep the last frequency but fade out the wet signal over time when confidence drops

Option 2 is the most musical -- wet * confidence provides a natural gating behavior.

Also consider resetting PitchSmoother::hasValue after extended silence so the next valid pitch snaps immediately rather than sliding from a stale value.

Impact

  • Audio quality: Unwanted ring modulation artifacts during silence/pauses
  • Severity: Medium -- behavioral issue that affects musical usability

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions