diff --git a/cpp/StftPitchShift/StftPitchShiftCore.h b/cpp/StftPitchShift/StftPitchShiftCore.h index 2105775..144ac5f 100755 --- a/cpp/StftPitchShift/StftPitchShiftCore.h +++ b/cpp/StftPitchShift/StftPitchShiftCore.h @@ -78,6 +78,7 @@ namespace stftpitchshift void factors(const std::vector& factors) { pitcher.factors(factors); + vocoder.reset(); // #45 } double quefrency() const diff --git a/cpp/StftPitchShift/Vocoder.h b/cpp/StftPitchShift/Vocoder.h index 438bff9..b0e2871 100755 --- a/cpp/StftPitchShift/Vocoder.h +++ b/cpp/StftPitchShift/Vocoder.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -45,6 +46,12 @@ namespace stftpitchshift } } + void reset() + { + // zero decode phase buffer according to #45 + std::fill(decode_phase_buffer.begin(), decode_phase_buffer.end(), 0); + } + void encode(const std::span> dft) { assert(dft.size() == encode_phase_buffer.size());