Fixed issue that clipped brief sequence of audio from beginning of the input audio

This commit is contained in:
oparviai 2017-01-08 16:27:02 +00:00
parent e302cd7123
commit 1049304b5d
2 changed files with 52 additions and 18 deletions

View File

@ -14,7 +14,7 @@
<body class="normal">
<hr>
<h1>SoundTouch audio processing library v1.9.3pre</h1>
<p class="normal">SoundTouch library Copyright © Olli Parviainen 2001-2015</p>
<p class="normal">SoundTouch library Copyright © Olli Parviainen 2001-2017</p>
<hr>
<h2>1. Introduction </h2>
<p>SoundTouch is an open-source audio processing library that allows
@ -570,6 +570,14 @@ this corresponds to lowering the pitch by -0.318 semitones:</p>
<hr>
<h2>5. Change History</h2>
<h3>5.1. SoundTouch library Change History </h3>
<p><b>1.9.3:</b></p>
<ul>
<li>Added functions to get initial processing latency, duration ratio between the original input and processed output tracks, and clarified reporting of input/output batch sizes</li>
<li>Fixed issue that added brief sequence of silence to beginning of output audio</li>
<li>Bugfix: Fixed a glitch that could cause negative array indexing in quick seek algorithm</li>
<li>Bugfix: flush() didn't properly flush final samples from the pipeline on 2nd time in case that soundtouch object instance was recycled and used for processing a second audio stream.</li>
<li>Bugfix: Pi value had incorrect 9th/10th decimals</li>
</ul>
<p><b>1.9.2:</b></p>
<ul>
<li>Fix in GNU package configuration</li>
@ -822,11 +830,12 @@ switch "-bpm"</li>
<p>Kudos for these people who have contributed to development or
submitted bugfixes:</p>
<ul>
<li> Arthur A</li>
<li> Paul Adenot</li>
<li> Arthur A</li>
<li> Paul Adenot</li>
<li> Richard Ash</li>
<li> Stanislav Brabec</li>
<li> Christian Budde</li>
<li> Jamie Bullock</li>
<li> Chris Bryan</li>
<li> Jacek Caban</li>
<li> Brian Cameron</li>
@ -834,24 +843,24 @@ submitted bugfixes:</p>
<li> David Clark</li>
<li> Patrick Colis</li>
<li> Miquel Colon</li>
<li> Jim Credland</li>
<li> Jim Credland</li>
<li> Sandro Cumerlato</li>
<li> Justin Frankel</li>
<li> Masa H.</li>
<li> Masa H.</li>
<li> Jason Garland</li>
<li> Takashi Iwai</li>
<li> Thomas Klausner</li>
<li> Tony Mechelynck </li>
<li> Mathias Möhl</li>
<li> Thomas Klausner</li>
<li> Tony Mechelynck </li>
<li> Mathias Möhl</li>
<li> Yuval Naveh</li>
<li> Mats Palmgren </li>
<li> Mats Palmgren </li>
<li> Paulo Pizarro</li>
<li> Andrey Ponomarenko</li>
<li> Andrey Ponomarenko</li>
<li> Blaise Potard</li>
<li> Michael Pruett</li>
<li> Michael Pruett</li>
<li> Rajeev Puran</li>
<li> RJ Ryan</li>
<li> John Sheehy</li>
<li> RJ Ryan</li>
<li> John Sheehy</li>
<li> Tim Shuttleworth</li>
<li> Albert Sirvent</li>
<li> John Stumpo</li>

View File

@ -310,6 +310,7 @@ int TDStretch::seekBestOverlapPositionFull(const SAMPLETYPE *refPos)
// Scans for the best correlation value by testing each possible position
// over the permitted range.
bestCorr = calcCrossCorr(refPos, pMidBuffer, norm);
bestCorr = (bestCorr + 0.1) * 0.75;
#pragma omp parallel for
for (i = 1; i < seekLength; i ++)
@ -670,26 +671,50 @@ void TDStretch::processSamples()
// (that's in 'midBuffer')
overlap(outputBuffer.ptrEnd((uint)overlapLength), inputBuffer.ptrBegin(), (uint)offset);
outputBuffer.putSamples((uint)overlapLength);
offset += overlapLength;
}
else
{
// Adjust processing offset at beginning of track:
// - do not perform initial overlapping
// - compensate expected value of 'seekBestOverlapPosition' offset landing to middle of seekLength
isBeginning = false;
int skip = overlapLength + seekLength / 2;
#ifdef SOUNDTOUCH_ALLOW_NONEXACT_SIMD_OPTIMIZATION
#ifdef SOUNDTOUCH_ALLOW_SSE
// if SSE mode, round the skip amount to value corresponding to aligned memory address
if (channels == 1)
{
skip &= -4;
}
else if (channels == 2)
{
skip &= -2;
}
#endif
#endif
skipFract -= skip;
assert(nominalSkip >= -skipFract);
}
isBeginning = false;
// ... then copy sequence samples from 'inputBuffer' to output:
// crosscheck that we don't have buffer overflow...
if ((int)inputBuffer.numSamples() < (offset + seekWindowLength))
if ((int)inputBuffer.numSamples() < (offset + seekWindowLength - overlapLength))
{
continue; // just in case, shouldn't really happen
}
// length of sequence
temp = (seekWindowLength - 2 * overlapLength);
outputBuffer.putSamples(inputBuffer.ptrBegin() + channels * (offset + overlapLength), (uint)temp);
outputBuffer.putSamples(inputBuffer.ptrBegin() + channels * offset, (uint)temp);
// Copies the end of the current sequence from 'inputBuffer' to
// 'midBuffer' for being mixed with the beginning of the next
// processing sequence and so on
assert((offset + temp + overlapLength * 2) <= (int)inputBuffer.numSamples());
memcpy(pMidBuffer, inputBuffer.ptrBegin() + channels * (offset + temp + overlapLength),
assert((offset + temp + overlapLength) <= (int)inputBuffer.numSamples());
memcpy(pMidBuffer, inputBuffer.ptrBegin() + channels * (offset + temp),
channels * sizeof(SAMPLETYPE) * overlapLength);
// Remove the processed samples from the input buffer. Update