From 5069f042fa8478648214a7038d87ae976a041751 Mon Sep 17 00:00:00 2001 From: Chris Robinson <chris.kcat@gmail.com> Date: Thu, 19 Jan 2023 13:03:09 -0800 Subject: Improve the output scaling of the pitch shifter For tones than land exactly on a frequency bin, which are subject to the least amount of error when not adjusted, this produces a level that more closely matches the original input. --- alc/effects/pshifter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'alc/effects/pshifter.cpp') diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp index 8d4aa630..121cdcd3 100644 --- a/alc/effects/pshifter.cpp +++ b/alc/effects/pshifter.cpp @@ -277,7 +277,7 @@ void PshifterState::process(const size_t samplesToDo, */ inverse_fft(al::as_span(mFftBuffer)); - static constexpr double scale{4.0 / OversampleFactor / StftSize}; + static constexpr double scale{3.0 / OversampleFactor / StftSize}; for(size_t dst{mPos}, k{0u};dst < StftSize;++dst,++k) mOutputAccum[dst] += gWindow.mData[k]*mFftBuffer[k].real() * scale; for(size_t dst{0u}, k{StftSize-mPos};dst < mPos;++dst,++k) -- cgit v1.2.3