From ba9fe26dcd802322e03659f3faf578cbdaf1a273 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Fri, 24 Mar 2023 17:51:44 +0000 Subject: [PATCH] Never phase reset on silence in side channel, now that such resets are carried across --- src/finer/Guide.h | 3 ++- src/finer/R3Stretcher.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/finer/Guide.h b/src/finer/Guide.h index 8f01c95..bfc5788 100644 --- a/src/finer/Guide.h +++ b/src/finer/Guide.h @@ -208,6 +208,7 @@ public: int unityCount, bool realtime, bool tighterChannelLock, + bool resetOnSilence, Guidance &guidance) const { Profiler profiler("Guide::updateGuidance"); @@ -282,7 +283,7 @@ public: // the band ranges as well - in normal multi-window mode we // still have to do that, but we should do these first - if (meanMagnitude < 1.0e-6) { + if (resetOnSilence && meanMagnitude < 1.0e-6) { updateForSilence(guidance); return; } diff --git a/src/finer/R3Stretcher.cpp b/src/finer/R3Stretcher.cpp index 2608585..9055bb2 100644 --- a/src/finer/R3Stretcher.cpp +++ b/src/finer/R3Stretcher.cpp @@ -1303,6 +1303,15 @@ R3Stretcher::analyseChannel(int c, int inhop, int prevInhop, int prevOuthop) m_parameters.options & RubberBandStretcher::OptionChannelsTogether; double magMean = v_mean(classifyScale->mag.data() + 1, classify/2); + + bool resetOnSilence = true; + if (useMidSide() && c == 1) { + // Do not phase reset on silence in the side channel - the + // reset is propagated across to the mid channel, giving + // constant resets for e.g. mono material in a stereo + // configuration + resetOnSilence = false; + } if (m_useReadahead) { m_guide.updateGuidance(ratio, @@ -1317,6 +1326,7 @@ R3Stretcher::analyseChannel(int c, int inhop, int prevInhop, int prevOuthop) m_unityCount, isRealTime(), tighterChannelLock, + resetOnSilence, cd->guidance); } else { m_guide.updateGuidance(ratio, @@ -1331,6 +1341,7 @@ R3Stretcher::analyseChannel(int c, int inhop, int prevInhop, int prevOuthop) m_unityCount, isRealTime(), tighterChannelLock, + resetOnSilence, cd->guidance); }