3rdparty: Soundtouch bump to v2.4.0

Author also moved to https://codeberg.org/soundtouch/soundtouch. Audiochannel bump from 16 to 32 limit.
This commit is contained in:
RedDevilus 2025-05-20 01:43:10 +02:00 committed by Ty
parent 7835ebd14f
commit b03c982706
7 changed files with 42 additions and 36 deletions

View File

@ -15,8 +15,8 @@
<body class="normal"> <body class="normal">
<hr> <hr>
<h1>SoundTouch audio processing library v2.3.3</h1> <h1>SoundTouch audio processing library v2.4.0</h1>
<p class="normal">SoundTouch library Copyright &copy; Olli Parviainen 2001-2024</p> <p class="normal">SoundTouch library Copyright &copy; Olli Parviainen 2001-2025</p>
<hr> <hr>
<h2>1. Introduction </h2> <h2>1. Introduction </h2>
<p>SoundTouch is an open-source audio processing library that allows <p>SoundTouch is an open-source audio processing library that allows
@ -81,8 +81,8 @@
<p>The SoundTouch library compiles in practically any platform <p>The SoundTouch library compiles in practically any platform
supporting GNU compiler (GCC) tools. supporting GNU compiler (GCC) tools.
<h4>2.2.1 Compiling with autotools</h4> <h4>2.2.1 Compiling with autotools</h4>
<p>To install build prerequisites for 'autotools' tool chain:</p> <p>To install build prerequisites for 'autotools' tool chain (for Ubuntu/Debian. Use dnf/yum/etc in other distros):</p>
<pre> sudo apt-get install automake autoconf libtool build-essential</pre> <pre> sudo apt install -y automake autoconf libtool build-essential</pre>
<p>To build and install the binaries, run the following commands in <p>To build and install the binaries, run the following commands in
/soundtouch directory:</p> /soundtouch directory:</p>
<table border="0" cellpadding="0" cellspacing="4"> <table border="0" cellpadding="0" cellspacing="4">
@ -140,8 +140,8 @@
<h4><b>2.2.2 Compiling with cmake</b></h4> <h4><b>2.2.2 Compiling with cmake</b></h4>
<p>'cmake' build scripts are provided as an alternative to the autotools toolchain.</p> <p>'cmake' build scripts are provided as an alternative to the autotools toolchain.</p>
<p>To install cmake build prerequisites:</p> <p>To install cmake build prerequisites (for Ubuntu/Debian. Use dnf/yum/etc in other distros):</p>
<pre> sudo apt-get install libtool build-essential cmake</pre> <pre> sudo apt install -y libtool build-essential cmake</pre>
<p>To build:</p> <p>To build:</p>
<pre> <pre>
cmake . cmake .
@ -205,7 +205,7 @@
separate mono channels, this isn't recommended because processing the separate mono channels, this isn't recommended because processing the
channels separately would result in losing the phase coherency between channels separately would result in losing the phase coherency between
the channels, which consequently would ruin the stereo effect.</p> the channels, which consequently would ruin the stereo effect.</p>
<p>Sample rates between 8000-48000H are supported.</p> <p>Sample rates between 8000-48000Hz are supported.</p>
<h3>3.2. Processing latency</h3> <h3>3.2. Processing latency</h3>
<p>The processing and latency constraints of the SoundTouch library are:</p> <p>The processing and latency constraints of the SoundTouch library are:</p>
<ul> <ul>
@ -606,10 +606,17 @@
<pre>soundstretch original.wav output.wav -pitch=-0.318</pre> <pre>soundstretch original.wav output.wav -pitch=-0.318</pre>
</blockquote> </blockquote>
<hr> <hr>
<h2>5. Change History</h2> <a name="changehistory"><h2>5. Change History</h2></a>
<h3>5.1. SoundTouch library Change History </h3> <h3>5.1. SoundTouch library Change History </h3>
<p><b>2.3.3:</b></p> <p><b>2.4.0:</b></p>
<ul class="current"> <ul class="current">
<li>Set CMake minimum version to 3.5 to avoid deprecation warning</li>
<li>Increase max nr. of channels from 16 to 32</li>
<li>Don't use `pow()` when using integer precision samples</li>
<li>Replace `-Ofast` that's being deprecated in some compilers, by `-O3 -ffast-math`</li>
</ul>
<p><b>2.3.3:</b></p>
<ul>
<li>Fixing compiler warnings, maintenance fixes to make/build files for various systems <li>Fixing compiler warnings, maintenance fixes to make/build files for various systems
</li> </li>
</ul> </ul>
@ -881,9 +888,14 @@
<ul> <ul>
<li> Initial release</li> <li> Initial release</li>
</ul> </ul>
<br><br>
<h3>5.2. SoundStretch application Change History </h3> <h3>5.2. SoundStretch application Change History </h3>
<p><b>2.3.3:</b></p> <p><b>2.4.0:</b></p>
<ul class="current_soundstretch"> <ul class="current_soundstretch">
<li>parse command-line argument values with double float precision.</li>
</ul>
<p><b>2.3.3:</b></p>
<ul>
<li>Added support for Asian / non-latin filenames in Windows. Gnu platform has supported them already earlier.</li> <li>Added support for Asian / non-latin filenames in Windows. Gnu platform has supported them already earlier.</li>
</ul> </ul>
<p><b>1.9:</b></p> <p><b>1.9:</b></p>

View File

@ -56,8 +56,9 @@ typedef unsigned long ulong;
namespace soundtouch namespace soundtouch
{ {
/// Max allowed number of channels /// Max allowed number of channels. This is not a hard limit but to have some
#define SOUNDTOUCH_MAX_CHANNELS 16 /// maximum value for argument sanity checks -- can be increased if necessary
#define SOUNDTOUCH_MAX_CHANNELS 32
/// Activate these undef's to overrule the possible sampletype /// Activate these undef's to overrule the possible sampletype
/// setting inherited from some other header file: /// setting inherited from some other header file:

View File

@ -72,10 +72,10 @@ namespace soundtouch
{ {
/// Soundtouch library version string /// Soundtouch library version string
#define SOUNDTOUCH_VERSION "2.3.3" #define SOUNDTOUCH_VERSION "2.4.0"
/// SoundTouch library version id /// SoundTouch library version id
#define SOUNDTOUCH_VERSION_ID (20303) #define SOUNDTOUCH_VERSION_ID (20400)
// //
// Available setting IDs for the 'setSetting' & 'get_setting' functions: // Available setting IDs for the 'setSetting' & 'get_setting' functions:

View File

@ -301,7 +301,7 @@ void BPMDetect::updateXCorr(int process_samples)
pBuffer = buffer->ptrBegin(); pBuffer = buffer->ptrBegin();
// calculate decay factor for xcorr filtering // calculate decay factor for xcorr filtering
float xcorr_decay = (float)pow(0.5, 1.0 / (XCORR_DECAY_TIME_CONSTANT * TARGET_SRATE / process_samples)); float xcorr_decay = (float)pow(0.5, process_samples / (XCORR_DECAY_TIME_CONSTANT * TARGET_SRATE));
// prescale pbuffer // prescale pbuffer
float tmp[XCORR_UPDATE_SEQUENCE]; float tmp[XCORR_UPDATE_SEQUENCE];

View File

@ -56,7 +56,6 @@ using namespace soundtouch;
FIRFilter::FIRFilter() FIRFilter::FIRFilter()
{ {
resultDivFactor = 0; resultDivFactor = 0;
resultDivider = 0;
length = 0; length = 0;
lengthDiv8 = 0; lengthDiv8 = 0;
filterCoeffs = nullptr; filterCoeffs = nullptr;
@ -79,7 +78,7 @@ uint FIRFilter::evaluateFilterStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, ui
uint ilength = length & -8; uint ilength = length & -8;
assert((length != 0) && (length == ilength) && (src != nullptr) && (dest != nullptr) && (filterCoeffs != nullptr)); assert((length != 0) && (length == ilength) && (src != nullptr) && (dest != nullptr) && (filterCoeffs != nullptr));
assert(numSamples > ilength); assert(numSamples >= ilength);
end = 2 * (numSamples - ilength); end = 2 * (numSamples - ilength);
@ -155,7 +154,7 @@ uint FIRFilter::evaluateFilterMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, uin
assert(src != nullptr); assert(src != nullptr);
assert(dest != nullptr); assert(dest != nullptr);
assert(filterCoeffs != nullptr); assert(filterCoeffs != nullptr);
assert(numChannels < 16); assert(numChannels <= SOUNDTOUCH_MAX_CHANNELS);
// hint compiler autovectorization that loop length is divisible by 8 // hint compiler autovectorization that loop length is divisible by 8
int ilength = length & -8; int ilength = length & -8;
@ -207,24 +206,24 @@ void FIRFilter::setCoefficients(const SAMPLETYPE *coeffs, uint newLength, uint u
assert(newLength > 0); assert(newLength > 0);
if (newLength % 8) ST_THROW_RT_ERROR("FIR filter length not divisible by 8"); if (newLength % 8) ST_THROW_RT_ERROR("FIR filter length not divisible by 8");
#ifdef SOUNDTOUCH_FLOAT_SAMPLES
// scale coefficients already here if using floating samples
double scale = 1.0 / resultDivider;
#else
short scale = 1;
#endif
lengthDiv8 = newLength / 8; lengthDiv8 = newLength / 8;
length = lengthDiv8 * 8; length = lengthDiv8 * 8;
assert(length == newLength); assert(length == newLength);
resultDivFactor = uResultDivFactor; resultDivFactor = uResultDivFactor;
resultDivider = (SAMPLETYPE)::pow(2.0, (int)resultDivFactor);
delete[] filterCoeffs; delete[] filterCoeffs;
filterCoeffs = new SAMPLETYPE[length]; filterCoeffs = new SAMPLETYPE[length];
delete[] filterCoeffsStereo; delete[] filterCoeffsStereo;
filterCoeffsStereo = new SAMPLETYPE[length*2]; filterCoeffsStereo = new SAMPLETYPE[length*2];
#ifdef SOUNDTOUCH_FLOAT_SAMPLES
// scale coefficients already here if using floating samples
const double scale = ::pow(0.5, (int)resultDivFactor);;
#else
const short scale = 1;
#endif
for (uint i = 0; i < length; i ++) for (uint i = 0; i < length; i ++)
{ {
filterCoeffs[i] = (SAMPLETYPE)(coeffs[i] * scale); filterCoeffs[i] = (SAMPLETYPE)(coeffs[i] * scale);

View File

@ -52,9 +52,6 @@ protected:
// Result divider factor in 2^k format // Result divider factor in 2^k format
uint resultDivFactor; uint resultDivFactor;
// Result divider value.
SAMPLETYPE resultDivider;
// Memory for filter coefficients // Memory for filter coefficients
SAMPLETYPE *filterCoeffs; SAMPLETYPE *filterCoeffs;
SAMPLETYPE *filterCoeffsStereo; SAMPLETYPE *filterCoeffsStereo;

View File

@ -211,9 +211,6 @@ FIRFilterSSE::~FIRFilterSSE()
// (overloaded) Calculates filter coefficients for SSE routine // (overloaded) Calculates filter coefficients for SSE routine
void FIRFilterSSE::setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor) void FIRFilterSSE::setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor)
{ {
uint i;
float fDivider;
FIRFilter::setCoefficients(coeffs, newLength, uResultDivFactor); FIRFilter::setCoefficients(coeffs, newLength, uResultDivFactor);
// Scale the filter coefficients so that it won't be necessary to scale the filtering result // Scale the filter coefficients so that it won't be necessary to scale the filtering result
@ -223,13 +220,13 @@ void FIRFilterSSE::setCoefficients(const float *coeffs, uint newLength, uint uRe
filterCoeffsUnalign = new float[2 * newLength + 4]; filterCoeffsUnalign = new float[2 * newLength + 4];
filterCoeffsAlign = (float *)SOUNDTOUCH_ALIGN_POINTER_16(filterCoeffsUnalign); filterCoeffsAlign = (float *)SOUNDTOUCH_ALIGN_POINTER_16(filterCoeffsUnalign);
fDivider = (float)resultDivider; const float scale = ::pow(0.5, (int)resultDivFactor);
// rearrange the filter coefficients for mmx routines // rearrange the filter coefficients for sse routines
for (i = 0; i < newLength; i ++) for (auto i = 0U; i < newLength; i ++)
{ {
filterCoeffsAlign[2 * i + 0] = filterCoeffsAlign[2 * i + 0] =
filterCoeffsAlign[2 * i + 1] = coeffs[i + 0] / fDivider; filterCoeffsAlign[2 * i + 1] = coeffs[i] * scale;
} }
} }