From 81b0d747277240da93826a30b0ddae028454d581 Mon Sep 17 00:00:00 2001 From: Olli Date: Thu, 28 Jan 2021 21:28:43 +0200 Subject: [PATCH] Correct initial skip value ... so that with nominal tempo the expected best sequence overlapping location lays in middle of the correlation window. This will ensure that with output should be similar to input when tempo adjustment is zero. --- source/SoundTouch/TDStretch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/SoundTouch/TDStretch.cpp b/source/SoundTouch/TDStretch.cpp index eed93ae..f5fcb55 100644 --- a/source/SoundTouch/TDStretch.cpp +++ b/source/SoundTouch/TDStretch.cpp @@ -675,7 +675,7 @@ void TDStretch::processSamples() // Adjust processing offset at beginning of track by not perform initial overlapping // and compensating that in the 'input buffer skip' calculation isBeginning = false; - int skip = (int)(tempo * overlapLength + 0.5); + int skip = (int)(tempo * overlapLength + 0.5 * seekLength + 0.5); #ifdef ST_SIMD_AVOID_UNALIGNED // in SIMD mode, round the skip amount to value corresponding to aligned memory address