From 7febc09dbcf723f11663d232b18166a942de5816 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Fri, 27 May 2022 15:03:40 +0100 Subject: [PATCH] Fix accidental time stretch coming along with pitch shift --- src/finer/R3StretcherImpl.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/finer/R3StretcherImpl.cpp b/src/finer/R3StretcherImpl.cpp index 6c3839a..c7a29d1 100644 --- a/src/finer/R3StretcherImpl.cpp +++ b/src/finer/R3StretcherImpl.cpp @@ -315,16 +315,20 @@ R3StretcherImpl::retrieve(float *const *output, size_t samples) const void R3StretcherImpl::consume() { - double ratio = getEffectiveRatio(); - int inhop = m_inhop; - int longest = m_guideConfiguration.longestFftSize; int channels = m_parameters.channels; // m_calculator->setDebugLevel(3); + + int inhop = m_inhop; + + double effectivePitchRatio = 1.0 / m_pitchScale; + if (m_resampler) { + effectivePitchRatio = m_resampler->getEffectiveRatio(effectivePitchRatio); + } - int outhop = m_calculator->calculateSingle(ratio, - 1.0 / m_pitchScale, + int outhop = m_calculator->calculateSingle(m_timeRatio, + effectivePitchRatio, 1.f, inhop, longest,