Debian Codegraph @

README.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3
4 <head>
5 <title>SoundTouch library README</title>
6 <meta http-equiv="Content-Language" content="en-us">
7 <meta name="author" content="Olli Parviainen">
8 <meta name="description" content="Readme file for SoundTouch audio processing library">
9 <style>
10 body {
11 font-family: Arial, Helvetica;
12 }
13 </style>
14 </head>
15
16 <body class="normal">
17 <hr>
18 <h1>SoundTouch audio processing library v2.4.0</h1>
19 <p class="normal">SoundTouch library Copyright &copy; Olli Parviainen 2001-2025</p>
20 <hr>
21 <h2>1. Introduction </h2>
22 <p>SoundTouch is an open-source audio processing library that allows
23 changing the sound tempo, pitch and playback rate parameters
24 independently from each other, i.e.:</p>
25 <ul>
26 <li> Sound tempo can be increased or decreased while maintaining the
27 original pitch</li>
28 <li> Sound pitch can be increased or decreased while maintaining the
29 original tempo</li>
30 <li> Change playback rate that affects both tempo and pitch at the
31 same time</li>
32 <li> Choose any combination of tempo/pitch/rate</li>
33 </ul>
34 <h3>1.1 Contact information </h3>
35 <p>Author email: oparviai 'at' iki.fi </p>
36 <p>SoundTouch WWW page: <a href="http://soundtouch.surina.net">http://soundtouch.surina.net</a></p>
37 <p>SoundTouch git repository: <a
38 href="https://codeberg.org/soundtouch/soundtouch.git">https://codeberg.org/soundtouch/soundtouch.git</a></p>
39 <hr>
40 <h2>2. Compiling SoundTouch</h2>
41 <p>Before compiling, notice that you can choose the sample data format if it's
42 desirable to use 16bit integer sample data instead of floating point samples. See
43 section &quot;sample data format&quot; for more information.</p>
44 <p>Also notice that SoundTouch can use OpenMP instructions for parallel
45 computation to accelerate the runtime processing speed in multi-core systems,
46 however, these improvements need to be separately enabled before compiling. See
47 OpenMP notes in Chapter 3 below.</p>
48 <h3>2.1. Building in Microsoft Windows</h3>
49 <p>Project files for Microsoft Visual C++ are supplied with the source
50 code package. Go to Microsoft WWW page to download
51 <a href="http://www.visualstudio.com/en-US/products/visual-studio-express-vs">
52 Microsoft Visual Studio Express version for free</a>.
53 </p>
54 <p>To build the binaries with Visual C++ compiler, either run
55 "make-win.bat" script, or open the appropriate project files in source
56 code directories with Visual Studio. The final executable will appear
57 under the "SoundTouch\bin" directory. If using the Visual Studio IDE
58 instead of the make-win.bat script, directories bin and lib may need to
59 be created manually to the SoundTouch package root for the final
60 executables. The make-win.bat script creates these directories
61 automatically. </p>
62 <p><strong>C# example</strong>: The source code package includes also a C# example
63 application for Windows that shows how to invoke SoundTouch.dll
64 dynamic-load library for processing mp3 audio.
65 <p><strong>OpenMP NOTE</strong>: If activating the OpenMP parallel computing in
66 the compilation, the target program will require additional vcomp dll library to
67 properly run. In Visual C++ 9.0 these libraries can be found in the following
68 folders.</p>
69 <ul>
70 <li>x86 32bit: C:\Program Files (x86)\Microsoft Visual Studio
71 9.0\VC\redist\x86\Microsoft.VC90.OPENMP\vcomp90.dll</li>
72 <li>x64 64bit: C:\Program Files (x86)\Microsoft Visual Studio
73 9.0\VC\redist\amd64\Microsoft.VC90.OPENMP\vcomp90.dll</li>
74 </ul>
75 <p>In other VC++ versions the required library will be expectedly found in similar
76 &quot;redist&quot; location.</p>
77 <p>Notice that as minor demonstration of a &quot;dll hell&quot; phenomenon both the 32-bit
78 and 64-bit version of vcomp90.dll have the same filename but different contents,
79 thus choose the proper version to allow the program to start.</p>
80 <h3>2.2. Building in Gnu platforms</h3>
81 <p>The SoundTouch library compiles in practically any platform
82 supporting GNU compiler (GCC) tools.
83 <h4>2.2.1 Compiling with autotools</h4>
84 <p>To install build prerequisites for 'autotools' tool chain (for Ubuntu/Debian. Use dnf/yum/etc in other distros):</p>
85 <pre> sudo apt install -y automake autoconf libtool build-essential</pre>
86 <p>To build and install the binaries, run the following commands in
87 /soundtouch directory:</p>
88 <table border="0" cellpadding="0" cellspacing="4">
89 <tbody>
90 <tr>
91 <td style="vertical-align: top;">
92 <pre>./bootstrap -</pre>
93 </td>
94 <td style="vertical-align: top;">Creates "configure" file with
95 local autoconf/automake toolset.<br>
96 </td>
97 </tr>
98 <tr valign="top">
99 <td>
100 <pre>./configure -</pre>
101 </td>
102 <td>
103 <p>Configures the SoundTouch package for the local environment.
104 Notice that "configure" file is not available before running the
105 "./bootstrap" command as above.<br>
106 </p>
107 </td>
108 </tr>
109 <tr valign="top">
110 <td>
111 <pre>make -</pre>
112 </td>
113 <td>
114 <p>Builds the SoundTouch library &amp; SoundStretch utility. You can
115 optionally add &quot;-j&quot; switch after &quot;make&quot; to speed up the compilation in
116 multi-core systems.</p>
117 </td>
118 </tr>
119 <tr valign="top">
120 <td>
121 <pre>make install -</pre>
122 </td>
123 <td>
124 <p>Installs the SoundTouch &amp; BPM libraries to <b>/usr/local/lib</b>
125 and SoundStretch utility to <b>/usr/local/bin</b>. Please notice that
126 'root' privileges may be required to install the binaries to the
127 destination locations.</p>
128 </td>
129 </tr>
130 </tbody>
131 </table>
132
133 <b>Compiling portable Shared Library / DLL version</b>
134 <p> The GNU autotools compilation automatically builds an additional dynamic-link version
135 of SoundTouch library that features position-independent code and "C"-style API that is
136 more suitable for calling the SoundTouch routines from other programming languages.</p>
137 <p>This dynamic-link library is built under source/SoundTouchDLL directory, whose
138 subdirectories also comtain simple example apps that use the dynamic-link library.
139 </p>
140
141 <h4><b>2.2.2 Compiling with cmake</b></h4>
142 <p>'cmake' build scripts are provided as an alternative to the autotools toolchain.</p>
143 <p>To install cmake build prerequisites (for Ubuntu/Debian. Use dnf/yum/etc in other distros):</p>
144 <pre> sudo apt install -y libtool build-essential cmake</pre>
145 <p>To build:</p>
146 <pre>
147 cmake .
148 make -j
149 make install</pre>
150 <p>To list available build options:</p>
151 <pre>
152 cmake -LH</pre>
153 <p>To compile the additional portable Shared Library / DLL version with the native C-language API:</p>
154 <pre>
155 cmake . -DSOUNDTOUCH_DLL=ON
156 make -j
157 make install</pre>
158
159 <h3>2.3. Building in Android</h3>
160 <p>Android compilation instructions are within the
161 source code package, see file &quot;<b>source/Android-lib/README-SoundTouch-Android.html</b>&quot;
162 in the source code package. </p>
163 <p>The Android compilation automatically builds separate .so library binaries
164 for ARM, X86 and MIPS processor architectures. For optimal device support,
165 include all these .so library binaries into the Android .apk application
166 package, so the target Android device can automatically choose the proper
167 library binary version to use.</p>
168 <p>The <strong>source/Android-lib</strong> folder includes also an Android
169 example application that processes WAV audio files using SoundTouch library in
170 Android devices.</p>
171
172 <h3>2.4. Building in Mac</h3>
173 <p>Install autoconf tool as instructed in <a
174 href="http://macappstore.org/autoconf/">http://macappstore.org/autoconf/</a>, or alternatively the 'cmake' toolchain.</p>
175 <p>Then, build as described above in section "Building in Gnu platforms".</p>
176
177 <hr>
178 <h2>3. About implementation &amp; Usage tips <h3>3.1. Supported sample data formats</h3>
179 <p>The sample data format can be chosen between 16bit signed integer
180 and 32bit floating point values.</p>
181 </p> The default sample type is 32bit floating point format,
182 which also provides better sound quality than integer format because
183 integer algorithms need to scale already intermediate calculation results to
184 avoid integer overflows. These early integer scalings can slightly degrade
185 output quality.</p>
186 <p> In Windows environment, the sample data format is chosen in file
187 "STTypes.h" by choosing one of the following defines:</p>
188 <ul>
189 <li> <span style="font-weight: bold;">#define
190 SOUNDTOUCH_INTEGER_SAMPLES</span> for 16bit signed integer</li>
191 <li> <span style="font-weight: bold;">#define </span><span style="font-weight: bold;">SOUNDTOUCH_</span><span
192 style="font-weight: bold;">FLOAT_SAMPLES</span> for 32bit floating
193 point</li>
194 </ul>
195 <p> In GNU environment, the floating sample format is used by default,
196 but integer sample format can be chosen by giving the following switch
197 to the configure script: </p>
198 <blockquote>
199 <pre>./configure --enable-integer-samples</pre>
200 </blockquote>
201 <p>The sample data can have either single (mono) or double (stereo)
202 audio channel. Stereo data is interleaved so that every other data
203 value is for left channel and every second for right channel. Notice
204 that while it'd be possible in theory to process stereo sound as two
205 separate mono channels, this isn't recommended because processing the
206 channels separately would result in losing the phase coherency between
207 the channels, which consequently would ruin the stereo effect.</p>
208 <p>Sample rates between 8000-48000Hz are supported.</p>
209 <h3>3.2. Processing latency</h3>
210 <p>The processing and latency constraints of the SoundTouch library are:</p>
211 <ul>
212 <li> Input/output processing latency for the SoundTouch processor is
213 around 100 ms. This is when time-stretching is used. If the rate
214 transposing effect alone is used, the latency requirement is much
215 shorter, see section 'About algorithms'.</li>
216 <li> Processing CD-quality sound (16bit stereo sound with 44100H
217 sample rate) in real-time or faster is possible starting from
218 processors equivalent to Intel Pentium 133Mh or better, if using the
219 "quick" processing algorithm. If not using the "quick" mode or if
220 floating point sample data are being used, several times more CPU power
221 is typically required.</li>
222 </ul>
223 <h3>3.3. About algorithms</h3>
224 <p>SoundTouch provides three seemingly independent effects: tempo,
225 pitch and playback rate control. These three controls are implemented
226 as combination of two primary effects, <em>sample rate transposing</em>
227 and <em>time-stretching</em>.</p>
228 <p><em>Sample rate transposing</em> affects both the audio stream
229 duration and pitch. It's implemented simply by converting the original
230 audio sample stream to the desired duration by interpolating from
231 the original audio samples. In SoundTouch, linear interpolation with
232 anti-alias filtering is used. Theoretically a higher-order
233 interpolation provide better result than 1st order linear
234 interpolation, but in audio application linear interpolation together
235 with anti-alias filtering performs subjectively about as well as
236 higher-order filtering would.</p>
237 <p><em>Time-stretching </em>means changing the audio stream duration
238 without affecting it's pitch. SoundTouch uses WSOLA-like
239 time-stretching routines that operate in the time domain. Compared to
240 sample rate transposing, time-stretching is a much heavier operation
241 and also requires a longer processing "window" of sound samples used by
242 the processing algorithm, thus increasing the algorithm input/output
243 latency. Typical i/o latency for the SoundTouch time-stretch algorithm
244 is around 100 ms.</p>
245 <p>Sample rate transposing and time-stretching are then used together
246 to produce the tempo, pitch and rate controls:</p>
247 <ul>
248 <li> <strong>'Tempo'</strong> control is implemented purely by
249 time-stretching.</li>
250 <li> <strong>'Rate</strong>' control is implemented purely by sample
251 rate transposing.</li>
252 <li> <strong>'Pitch</strong>' control is implemented as a
253 combination of time-stretching and sample rate transposing. For
254 example, to increase pitch the audio stream is first time-stretched to
255 longer duration (without affecting pitch) and then transposed back to
256 original duration by sample rate transposing, which simultaneously
257 reduces duration and increases pitch. The result is original duration
258 but increased pitch.</li>
259 </ul>
260 <h3>3.4 Tuning the algorithm parameters</h3>
261 <p>The time-stretch algorithm has few parameters that can be tuned to
262 optimize sound quality for certain application. The current default
263 parameters have been chosen by iterative if-then analysis (read: "trial
264 and error") to obtain best subjective sound quality in pop/rock music
265 processing, but in applications processing different kind of sound the
266 default parameter set may result into a sub-optimal result.</p>
267 <p>The time-stretch algorithm default parameter values are set by the
268 following #defines in file "TDStretch.h":</p>
269 <blockquote>
270 <pre>#define DEFAULT_SEQUENCE_MS AUTOMATIC<br>#define DEFAULT_SEEKWINDOW_MS AUTOMATIC<br>#define DEFAULT_OVERLAP_MS 8</pre>
271 </blockquote>
272 <p>These parameters affect to the time-stretch algorithm as follows:</p>
273 <ul>
274 <li> <strong>DEFAULT_SEQUENCE_MS</strong>: This is the default
275 length of a single processing sequence in milliseconds which determines
276 the how the original sound is chopped in the time-stretch algorithm.
277 Larger values mean fewer sequences are used in processing. In principle
278 a larger value sounds better when slowing down the tempo, but worse
279 when increasing the tempo and vice versa.<br>
280 <br>
281 By default, this setting value is calculated automatically according to
282 tempo value.<br>
283 </li>
284 <li> <strong>DEFAULT_SEEKWINDOW_MS</strong>: The seeking window
285 default length in milliseconds is for the algorithm that seeks the best
286 possible overlapping location. This determines from how wide a sample
287 "window" the algorithm can use to find an optimal mixing location when
288 the sound sequences are to be linked back together.<br>
289 <br>
290 The bigger this window setting is, the higher the possibility to find a
291 better mixing position becomes, but at the same time large values may
292 cause a "drifting" sound artifact because neighboring sequences can be
293 chosen at more uneven intervals. If there's a disturbing artifact that
294 sounds as if a constant frequency was drifting around, try reducing
295 this setting.<br>
296 <br>
297 By default, this setting value is calculated automatically according to
298 tempo value.<br>
299 </li>
300 <li> <strong>DEFAULT_OVERLAP_MS</strong>: Overlap length in
301 milliseconds. When the sound sequences are mixed back together to form
302 again a continuous sound stream, this parameter defines how much the
303 ends of the consecutive sequences will overlap with each other.<br>
304 <br>
305 This shouldn't be that critical parameter. If you reduce the
306 DEFAULT_SEQUENCE_MS setting by a large amount, you might wish to try a
307 smaller value on this.
308 </li>
309 </ul>
310 <p>Notice that these parameters can also be set during execution time
311 with functions "<strong>TDStretch::setParameters()</strong>" and "<strong>SoundTouch::setSetting()</strong>".</p>
312 <p>The table below summaries how the parameters can be adjusted for
313 different applications:</p>
314 <table border="1">
315 <tbody>
316 <tr>
317 <td valign="top"><strong>Parameter name</strong></td>
318 <td valign="top"><strong>Default value magnitude</strong></td>
319 <td valign="top"><strong>Larger value affects...</strong></td>
320 <td valign="top"><strong>Smaller value affects...</strong></td>
321 <td valign="top"><strong>Effect to CPU burden</strong></td>
322 </tr>
323 <tr>
324 <td valign="top">
325 <pre>SEQUENCE_MS</pre>
326 </td>
327 <td valign="top">Default value is relatively large, chosen for
328 slowing down music tempo</td>
329 <td valign="top">Larger value is usually better for slowing down
330 tempo. Growing the value decelerates the "echoing" artifact when
331 slowing down the tempo.</td>
332 <td valign="top">Smaller value might be better for speeding up
333 tempo. Reducing the value accelerates the "echoing" artifact when
334 slowing down the tempo </td>
335 <td valign="top">Increasing the parameter value reduces
336 computation burden</td>
337 </tr>
338 <tr>
339 <td valign="top">
340 <pre>SEEKWINDOW_MS</pre>
341 </td>
342 <td valign="top">Default value is relatively large, chosen for
343 slowing down music tempo</td>
344 <td valign="top">Larger value eases finding a good mixing
345 position, but may cause a "drifting" artifact</td>
346 <td valign="top">Smaller reduce possibility to find a good mixing
347 position, but reduce the "drifting" artifact.</td>
348 <td valign="top">Increasing the parameter value increases
349 computation burden</td>
350 </tr>
351 <tr>
352 <td valign="top">
353 <pre>OVERLAP_MS</pre>
354 </td>
355 <td valign="top">Default value is relatively large, chosen to
356 suit with above parameters.</td>
357 <td valign="top"></td>
358 <td valign="top">If you reduce the "sequence ms" setting, you
359 might wish to try a smaller value.</td>
360 <td valign="top">Increasing the parameter value increases
361 computation burden</td>
362 </tr>
363 </tbody>
364 </table>
365 <h3>3.5 Performance Optimizations </h3>
366 <p><strong>Integer vs floating point:</strong></p>
367 <p>Floating point sample type is generally recommended because it provides
368 better sound quality.</p>
369
370 <p>However, execution speed difference between integer and floating point processing
371 depends on the CPU architecture. As rule of thumb,
372 <ul>
373 <li>in 32-bit x86 floating point and integer are roughly equally fast</li>
374 <li>in 64-bit x86/x64 floating point can be significantly faster than integer
375 version, because MMX integer optimizations are not available in the x64 architecture.
376 That depends on the compiler however, so that gcc can autovectorize integer routines
377 to work equally fast as floating point, where as Visual C++ (2017) does not
378 perform equally well and produces integer code that runs some 3x slower than
379 SSE-optimized floating poing code.
380 </li>
381 <li>in ARMv7 integer routines are twice as fast as floating point. Their
382 relative difference is roughly the same both with and without NEON; NEON
383 vfpu can however bring 2.4x speed improvement.
384 </li>
385 <li>in other platforms: try out if the execution time performance makes a
386 big difference</li>
387 </ul>
388 </p>
389 <p><strong>General optimizations:</strong></p>
390 <p>The time-stretch routine has a 'quick' mode that substantially
391 speeds up the algorithm but may slightly compromise the sound quality.
392 This mode is activated by calling SoundTouch::setSetting()
393 function with parameter id of SETTING_USE_QUICKSEEK and value
394 "1", i.e. </p>
395 <blockquote>
396 <p>setSetting(SETTING_USE_QUICKSEEK, 1);</p>
397 </blockquote>
398 <p><strong>CPU-specific optimizations:</strong></p>
399 <p>Intel x86 specific SIMD optimizations are implemented using compiler
400 intrinsics, providing about a 3x processing speedup for x86 compatible
401 processors vs. non-SIMD implementation:</p>
402 <ul>
403 <li> MMX optimized routines are used in 32-bit x86 build when 16bit integer
404 sample type is used</li>
405 <li> SSE optimized routines are used in 32- and 64-bit x86 CPUs when 32bit
406 floating point sample type is used</li>
407 </ul>
408 <p>The algorithms are tuned to utilize autovectorization efficiently
409 also in other CPU architectures, for example ARM cpus see approx 2.4x processing
410 speedup when NEON SIMD support is present.
411 </p>
412 <h3>3.5 OpenMP parallel computation</h3>
413 <p>SoundTouch 1.9 onwards support running the algorithms parallel in several CPU
414 cores. Based on benchmark the experienced multi-core processing speed-up gain
415 ranges between +30% (on a high-spec dual-core x86 Windows PC) to 215% (on a moderately low-spec
416 quad-core ARM of Raspberry Pi2). </p>
417 <p>See an external blog article with more detailed discussion about the
418 <a href="http://www.softwarecoven.com/parallel-computing-in-embedded-mobile-devices/">
419 SoundTouch OpenMP optimization</a>.
420 </p>
421 <p>The parallel computing support is implemented using OpenMP spec 3.0
422 instructions. These instructions are supported by Visual C++ 2008 and later, and
423 GCC v4.2 and later. Compilers that do not supporting OpenMP will ignore these
424 optimizations and routines will still work properly. Possible warnings about
425 unknown #pragmas are related to OpenMP support and can be safely ignored.</p>
426 <p>The OpenMP improvements are disabled by default, and need to be enabled by
427 developer during compile-time. Reason for this is that parallel processing adds
428 moderate runtime overhead in managing the multi-threading, so it may not be
429 necessary nor desirable in all applications. For example real-time processing
430 that is not constrained by CPU power will not benefit of speed-up provided by
431 the parallel processing, in the contrary it may increase power consumption due
432 to the increased overhead.</p>
433 <p>However, applications that run on low-spec multi-core CPUs and may otherwise
434 have possibly constrained performance will benefit of the OpenMP improvements.
435 This include for example multi-core embedded devices.</p>
436 <p>OpenMP parallel computation can be enabled before compiling SoundTouch
437 library as follows:</p>
438 <ul>
439 <li><strong>Visual Studio</strong>: Open properties for the <strong>SoundTouch
440 </strong>sub-project, browse to <strong>C/C++</strong> and <strong>Language
441 </strong>settings. Set
442 there &quot;<strong>OpenMP support</strong>&quot; to &quot;<strong>Yes</strong>&quot;. Alternatively add
443 <strong>/openmp</strong> switch to command-line
444 parameters
445 </li>
446 <li><strong>GNU</strong>: Run the configure script with &quot;<strong>./configure
447 --enable-openmp</strong>&quot; switch, then run make as usually</li>
448 <li><strong>Android</strong>: Add &quot;<strong>-fopenmp</strong>&quot; switches to compiler &amp; linker
449 options, see README-SoundTouch-Android.html in the source code package for
450 more detailed instructions.</li>
451 </ul>
452 <hr>
453 <h2><a name="SoundStretch"></a>4. SoundStretch audio processing utility
454 </h2>
455 <p>SoundStretch audio processing utility<br>
456 Copyright (c) Olli Parviainen 2002-2024</p>
457 <p>SoundStretch is a simple command-line application that can change
458 tempo, pitch and playback rates of WAV sound files. This program is
459 intended primarily to demonstrate how the "SoundTouch" library can be
460 used to process sound in your own program, but it can as well be used
461 for processing sound files.</p>
462 <h3>4.1. SoundStretch Usage Instructions</h3>
463 <p>SoundStretch Usage syntax:</p>
464 <blockquote>
465 <pre>soundstretch infilename outfilename [switches]</pre>
466 </blockquote>
467 <p>Where: </p>
468 <table width="100%" border="0" cellpadding="2">
469 <tbody>
470 <tr>
471 <td valign="top">
472 <pre>"infilename"</pre>
473 </td>
474 <td valign="top">Name of the input sound data file (in .WAV audio
475 file format). Give "stdin" as filename to use standard input pipe. </td>
476 </tr>
477 <tr>
478 <td valign="top">
479 <pre>"outfilename"</pre>
480 </td>
481 <td valign="top">Name of the output sound file where the
482 resulting sound is saved (in .WAV audio file format). This parameter
483 may be omitted if you don't want to save the output (e.g. when
484 only calculating BPM rate with '-bpm' switch). Give "stdout" as
485 filename to use standard output pipe.</td>
486 </tr>
487 <tr>
488 <td valign="top">
489 <pre>[switches]</pre>
490 </td>
491 <td valign="top">Are one or more control switches.</td>
492 </tr>
493 </tbody>
494 </table>
495 <p>Available control switches are:</p>
496 <table width="100%" border="0" cellpadding="2">
497 <tbody>
498 <tr>
499 <td valign="top">
500 <pre>-tempo=n </pre>
501 </td>
502 <td valign="top">Change the sound tempo by n percents (n = -95.0
503 .. +5000.0 %) </td>
504 </tr>
505 <tr>
506 <td valign="top">
507 <pre>-pitch=n</pre>
508 </td>
509 <td valign="top">Change the sound pitch by n semitones (n = -60.0
510 .. + 60.0 semitones) </td>
511 </tr>
512 <tr>
513 <td valign="top">
514 <pre>-rate=n</pre>
515 </td>
516 <td valign="top">Change the sound playback rate by n percents (n
517 = -95.0 .. +5000.0 %) </td>
518 </tr>
519 <tr>
520 <td valign="top">
521 <pre>-bpm=n</pre>
522 </td>
523 <td valign="top">Detect the Beats-Per-Minute (BPM) rate of the
524 sound and adjust the tempo to meet 'n' BPMs. When this switch is
525 applied, the "-tempo" switch is ignored. If "=n" is omitted, i.e.
526 switch "-bpm" is used alone, then the BPM rate is estimated and
527 displayed, but tempo not adjusted according to the BPM value. </td>
528 </tr>
529 <tr>
530 <td valign="top">
531 <pre>-quick</pre>
532 </td>
533 <td valign="top">Use quicker tempo change algorithm. Gains speed
534 but loses sound quality. </td>
535 </tr>
536 <tr>
537 <td valign="top">
538 <pre>-naa</pre>
539 </td>
540 <td valign="top">Don't use anti-alias filtering in sample rate
541 transposing. Gains speed but loses sound quality. </td>
542 </tr>
543 <tr>
544 <td valign="top">
545 <pre>-license</pre>
546 </td>
547 <td valign="top">Displays the program license text (LGPL)</td>
548 </tr>
549 </tbody>
550 </table>
551 <p>Notes:</p>
552 <ul>
553 <li> To use standard input/output pipes for processing, give "stdin"
554 and "stdout" as input/output filenames correspondingly. The standard
555 input/output pipes will still carry the audio data in .wav audio file
556 format.</li>
557 <li> The numerical switches allow both integer (e.g. "-tempo=123")
558 and decimal (e.g. "-tempo=123.45") numbers.</li>
559 <li> The "-naa" and/or "-quick" switches can be used to reduce CPU
560 usage while compromising some sound quality</li>
561 <li> The BPM detection algorithm works by detecting repeating bass or
562 drum patterns at low frequencies of &lt;250Hz. A lower-than-expected
563 BPM figure may be reported for music with uneven or complex bass
564 patterns.</li>
565 </ul>
566 <h3>4.2. SoundStretch usage examples </h3>
567 <p><strong>Example 1</strong></p>
568 <p>The following command increases tempo of the sound file
569 "originalfile.wav" by 12.5% and stores result to file
570 "destinationfile.wav":</p>
571 <blockquote>
572 <pre>soundstretch originalfile.wav destinationfile.wav -tempo=12.5</pre>
573 </blockquote>
574 <p><strong>Example 2</strong></p>
575 <p>The following command decreases the sound pitch (key) of the sound
576 file "orig.wav" by two semitones and stores the result to file
577 "dest.wav":</p>
578 <blockquote>
579 <pre>soundstretch orig.wav dest.wav -pitch=-2</pre>
580 </blockquote>
581 <p><strong>Example 3</strong></p>
582 <p>The following command processes the file "orig.wav" by decreasing
583 the sound tempo by 25.3% and increasing the sound pitch (key) by 1.5
584 semitones. Resulting .wav audio data is directed to standard output
585 pipe:</p>
586 <blockquote>
587 <pre>soundstretch orig.wav stdout -tempo=-25.3 -pitch=1.5</pre>
588 </blockquote>
589 <p><strong>Example 4</strong></p>
590 <p>The following command detects the BPM rate of the file "orig.wav"
591 and adjusts the tempo to match 100 beats per minute. Result is stored
592 to file "dest.wav":</p>
593 <blockquote>
594 <pre>soundstretch orig.wav dest.wav -bpm=100</pre>
595 </blockquote>
596 <p><strong>Example 5</strong></p>
597 <p>The following command reads .wav sound data from standard input pipe
598 and estimates the BPM rate:</p>
599 <blockquote>
600 <pre>soundstretch stdin -bpm</pre>
601 </blockquote>
602 <p><strong>Example 6</strong></p>
603 <p>The following command tunes song from original 440Hz tuning to 432Hz tuning:
604 this corresponds to lowering the pitch by -0.318 semitones:</p>
605 <blockquote>
606 <pre>soundstretch original.wav output.wav -pitch=-0.318</pre>
607 </blockquote>
608 <hr>
609 <a name="changehistory"><h2>5. Change History</h2></a>
610 <h3>5.1. SoundTouch library Change History </h3>
611 <p><b>2.4.1:</b></p>
612 <ul class="current">
613 <li>Resolve buffer overflow in FIR filter when processing more than 16 channels</li>
614 </ul>
615 <p><b>2.4.0:</b></p>
616 <ul>
617 <li>Set CMake minimum version to 3.5 to avoid deprecation warning</li>
618 <li>Increase max nr. of channels from 16 to 32</li>
619 <li>Don't use `pow()` when using integer precision samples</li>
620 <li>Replace `-Ofast` that's being deprecated in some compilers, by `-O3 -ffast-math`</li>
621 </ul>
622 <p><b>2.3.3:</b></p>
623 <ul>
624 <li>Fixing compiler warnings, maintenance fixes to make/build files for various systems
625 </li>
626 </ul>
627 <p><b>2.3.2:</b></p>
628 <ul>
629 <li>Improve autotools makefiles to build the `SoundTouchDLL` dynamic-link link library with
630 C-style API. This library variation is easier to import and use from other programming
631 languages than the default C++ library.
632 </li>
633 </ul>
634 <p><b>2.3.1:</b></p>
635 <ul>
636 <li>Adjusted cmake build settings and header files that cmake installs</li>
637 </ul>
638 <p><b>2.3.0:</b></p>
639 <ul>
640 <li>Disable setting "SOUNDTOUCH_ALLOW_NONEXACT_SIMD_OPTIMIZATION" by default. The original
641 purpose of this setting was to avoid performance penalty due to unaligned SIMD memory
642 accesses in old CPUs, but that is not any more issue in concurrent CPU SIMD implementations
643 and having this setting enabled can cause slight compromise in result quality.
644 </li>
645 <li>Bugfix: soundtouch.clear() to really clear whole processing pipeline state. Earlier
646 individual variables were left uncleared, which caused slightly different result if
647 the same audio stream were processed again after calling clear().
648 </li>
649 <li>Bugfix: TDstretch to align initial offset position to be in middle of correlation search
650 window. This ensures that with zero tempo change the output will be same as input.
651 </li>
652 <li>Bugfix: Fix a bug in TDstrectch with too small initial skipFract value that occurred
653 with certain processing parameter settings: Replace assert with assignment that
654 corrects the situation.
655 </li>
656 <li>Remove OpenMP "_init_threading" workaround from Android build as it's not needed with concurrent
657 Android SDKs any more.</li>
658 </ul>
659 <p><b>2.2:</b></p>
660 <ul>
661 <li>Improved source codes so that compiler can autovectorize them more effectively.
662 This brings remarkable improvement e.g. ARM cpus equipped with NEON vfpu: Bencmarked
663 2.4x improvement in execution speed in ARMv7l vs the previous SoundTouch version
664 for both integer and floating point sample types.
665 </li>
666 <li>Bugfix: Resolved bad sound quality when using integer sample types in non-x86 CPU</li>
667 <li>Bugfix: Fixed possible reading past end of array in BPM peak detection algorithm</li>
668 </ul>
669 <p><b>2.1.2:</b></p>
670 <ul>
671 <li>Bump version to 2.1.2 also in configure.ac. The earlier release had old version info for GNU autotools.</li>
672 </ul>
673 <p><b>2.1.1:</b></p>
674 <ul>
675 <li>Bugfixes: Fixed potential buffer overwrite bugs in WavFile routines. Replaced asserts with runtime exceptions.
676 </li>
677 <li>Android: Migrated the SoundTouch Android example to new Android Studio</li>
678 <li>Automake: unset ACLOCAL in bootstrap script in case earlier build script has set it</li>
679
680 </ul>
681 <p><b>2.1:</b></p>
682 <ul>
683 <li>Refactored C# interface example</li>
684 <li>Disable anti-alias filter when switch
685 SOUNDTOUCH_PREVENT_CLICK_AT_RATE_CROSSOVER defined because anti-alias
686 filter cause slight click if the rate change crosses zero during
687 processing</li>
688 <li>Added script for building SoundTouchDll dynamic-link-library for GNU platforms</li>
689 <li>Rewrote Beats-per-Minute analysis algorithm for more reliable BPM detection</li>
690 <li>Added BPM functions to SoundTouchDll API</li>
691 <li>Migrated Visual Studio project files to MSVC 201x format</li>
692 <li>Replaced function parameter value asserts with runtime exceptions</li>
693 <li>Code maintenance & style cleanup</li>
694 </ul>
695 <p><b>2.0:</b></p>
696 <ul>
697 <li>Added functions to get initial processing latency, duration ratio between the original input and processed
698 output tracks, and clarified reporting of input/output batch sizes</li>
699 <li>Fixed issue that added brief sequence of silence to beginning of output audio</li>
700 <li>Adjusted algorithm parameters to reduce reverberating effect at tempo slowdown</li>
701 <li>Bugfix: Fixed a glitch that could cause negative array indexing in quick seek algorithm</li>
702 <li>Bugfix: flush() didn't properly flush final samples from the pipeline on 2nd time in case that soundtouch
703 object instance was recycled and used for processing a second audio stream.</li>
704 <li>Bugfix: Pi value had incorrect 9th/10th decimals</li>
705 <li>Added C# example application that uses SoundTouch dll library for processing MP3 files</li>
706 </ul>
707 <p><b>1.9.2:</b></p>
708 <ul>
709 <li>Fix in GNU package configuration</li>
710 </ul>
711 <p><b>1.9.1:</b></p>
712 <ul>
713 <li>Improved SoundTouch::flush() function so that it returns precisely the desired amount of samples for exact
714 output duration control</li>
715 <li>Redesigned quickseek algorithm for improved sound quality when using the quickseek mode. The new quickseek
716 algorithm can find 99% as good results as the
717 default full-scan mode, while the quickseek algorithm is remarkable less
718 CPU intensive.</li>
719 <li>Added adaptive integer divider scaling for improved sound quality when using integer processing algorithm
720 </li>
721 </ul>
722 <p><b>1.9:</b></p>
723 <ul>
724 <li>Added support for parallel computation support via OpenMP primitives for better performance in multicore
725 systems.
726 Benchmarks show that achieved parallel processing speedup improvement
727 typically range from +30% (x86 dual-core) to +180% (ARM quad-core). The
728 OpenMP optimizations are disabled by default, see OpenMP notes above in this
729 readme file how to enabled these optimizations.</li>
730 <li>Android: Added support for Android devices featuring X86 and MIPS CPUs,
731 in addition to ARM CPUs.</li>
732 <li>Android: More versatile Android example application that processes WAV
733 audio files with SoundTouch library</li>
734 <li>Replaced Windows-like 'BOOL' types with native 'bool'</li>
735 <li>Changed documentation token to "dist_doc_DATA" in Makefile.am file</li>
736 <li>Miscellaneous small fixes and improvements</li>
737 </ul>
738 <p><b>1.8.0:</b></p>
739 <ul>
740 <li>Added support for multi-channel audio processing</li>
741 <li>Added support for <b>cubic</b> and <b>shannon</b> interpolation for rate and pitch shift effects besides
742 the original <b>linear</b> interpolation, to reduce aliasing at high frequencies due to interpolation.
743 Cubic interpolation is used as default for floating point processing, and linear interpolation for integer
744 processing.</li>
745 <li>Fixed bug in anti-alias filtering that limited stop-band attenuation to -10 dB instead of <-50dB, and
746 increased filter length from 32 to 64 taps to further reduce aliasing due to frequency folding.</li>
747 <li>Performance improvements in cross-correlation algorithm</li>
748 <li>Other bug and compatibility fixes</li>
749 </ul>
750 <p><b>1.7.1:</b></p>
751 <ul>
752 <li>Added files for Android compilation
753 </ul>
754 <p><b>1.7.0:</b></p>
755 <ul>
756 <li>Sound quality improvements/li>
757 <li>Improved flush() to adjust output sound stream duration to match better with
758 ideal duration</li>
759 <li>Rewrote x86 cpu feature check to resolve compatibility problems</li>
760 <li>Configure script automatically checks if CPU supports mmx & sse compatibility for GNU platform, and
761 the script support now "--enable-x86-optimizations" switch to allow disabling x86-specific optimizations.</li>
762 <li>Revised #define conditions for 32bit/64bit compatibility</li>
763 <li>gnu autoconf/automake script compatibility fixes</li>
764 <li>Tuned beat-per-minute detection algorithm</li>
765 </ul>
766 <p><b>1.6.0:</b></p>
767 <ul>
768 <li> Added automatic cutoff threshold adaptation to beat detection
769 routine to better adapt BPM calculation to different types of music</li>
770 <li> Retired 3DNow! optimization support as 3DNow! is nowadays
771 obsoleted and assembler code is nuisance to maintain</li>
772 <li>Retired "configure" file from source code package due to
773 autoconf/automake versio conflicts, so that it is from now on to be
774 generated by invoking "boostrap" script that uses locally available
775 toolchain version for generating the "configure" file</li>
776 <li>Resolved namespace/label naming conflicts with other libraries by
777 replacing global labels such as INTEGER_SAMPLES with more specific
778 SOUNDTOUCH_INTEGER_SAMPLES etc.<br>
779 </li>
780 <li>Updated windows build scripts &amp; project files for Visual
781 Studio 2008 support</li>
782 <li> Updated SoundTouch.dll API for .NET compatibility</li>
783 <li> Added API for querying nominal processing input &amp; output
784 sample batch sizes</li>
785 </ul>
786 <p><strong>1.5.0:</strong></p>
787 <ul>
788 <li> Added normalization to correlation calculation and improvement
789 automatic seek/sequence parameter calculation to improve sound quality</li>
790 <li> Bugfixes:
791 <ul>
792 <li> Fixed negative array indexing in quick seek algorithm</li>
793 <li> FIR autoalias filter running too far in processing buffer</li>
794 <li> Check against zero sample count in rate transposing</li>
795 <li> Fix for x86-64 support: Removed pop/push instructions from
796 the cpu detection algorithm.</li>
797 <li> Check against empty buffers in FIFOSampleBuffer</li>
798 <li> Other minor fixes &amp; code cleanup</li>
799 </ul>
800 </li>
801 <li> Fixes in compilation scripts for non-Intel platforms</li>
802 <li> Added Dynamic-Link-Library (DLL) version of SoundTouch library
803 build, provided with Delphi/Pascal wrapper for calling the dll routines
804 </li>
805 <li> Added #define PREVENT_CLICK_AT_RATE_CROSSOVER that prevents a
806 click artifact when crossing the nominal pitch from either positive to
807 negative side or vice versa</li>
808 </ul>
809 <p><strong>1.4.1:</strong></p>
810 <ul>
811 <li> Fixed a buffer overflow bug in BPM detect algorithm routines if
812 processing more than 2048 samples at one call</li>
813 </ul>
814 <p><strong>1.4.0:</strong></p>
815 <ul>
816 <li> Improved sound quality by automatic calculation of time stretch
817 algorithm processing parameters according to tempo setting</li>
818 <li> Moved BPM detection routines from SoundStretch application into
819 SoundTouch library</li>
820 <li> Bugfixes: Usage of uninitialied variables, GNU build scripts,
821 compiler errors due to 'const' keyword mismatch.</li>
822 <li> Source code cleanup</li>
823 </ul>
824 <p><strong>1.3.1: </strong> </p>
825 <ul>
826 <li> Changed static class declaration to GCC 4.x compiler compatible
827 syntax.</li>
828 <li> Enabled MMX/SSE-optimized routines also for GCC compilers.
829 Earlier the MMX/SSE-optimized routines were written in
830 compiler-specific inline assembler, now these routines are migrated to
831 use compiler intrinsic syntax which allows compiling the same
832 MMX/SSE-optimized source code with both Visual C++ and GCC compilers.</li>
833 <li> Set floating point as the default sample format and added switch
834 to the GNU configure script for selecting the other sample format.</li>
835 </ul>
836 <p><strong>1.3.0: </strong> </p>
837 <ul>
838 <li> Fixed tempo routine output duration inaccuracy due to rounding
839 error</li>
840 <li> Implemented separate processing routines for integer and
841 floating arithmetic to allow improvements to floating point routines
842 (earlier used algorithms mostly optimized for integer arithmetic also
843 for floating point samples)</li>
844 <li> Fixed a bug that distorts sound if sample rate changes during
845 the sound stream</li>
846 <li> Fixed a memory leak that appeared in MMX/SSE/3DNow! optimized
847 routines</li>
848 <li> Reduced redundant code pieces in MMX/SSE/3DNow! optimized
849 routines vs. the standard C routines.</li>
850 <li> MMX routine incompatibility with new gcc compiler versions</li>
851 <li> Other miscellaneous bug fixes</li>
852 </ul>
853 <p><strong>1.2.1: </strong> </p>
854 <ul>
855 <li> Added automake/autoconf scripts for GNU platforms (in courtesy
856 of David Durham)</li>
857 <li> Fixed SCALE overflow bug in rate transposer routine.</li>
858 <li> Fixed 64bit address space bugs.</li>
859 <li> Created a 'soundtouch' namespace for SAMPLETYPE definitions.</li>
860 </ul>
861 <p><strong>1.2.0: </strong> </p>
862 <ul>
863 <li> Added support for 32bit floating point sample data type with
864 SSE/3DNow! optimizations for Win32 platform (SSE/3DNow! optimizations
865 currently not supported in GCC environment)</li>
866 <li> Replaced 'make-gcc' script for GNU environment by master
867 Makefile</li>
868 <li> Added time-stretch routine configurability to SoundTouch main
869 class</li>
870 <li> Bugfixes</li>
871 </ul>
872 <p><strong>1.1.1: </strong> </p>
873 <ul>
874 <li> Moved SoundTouch under lesser GPL license (LGPL). This allows
875 using SoundTouch library in programs that aren't released under GPL
876 license.</li>
877 <li> Changed MMX routine organiation so that MMX optimized routines
878 are now implemented in classes that are derived from the basic classes
879 having the standard non-mmx routines.</li>
880 <li> MMX routines to support gcc version 3.</li>
881 <li> Replaced windows makefiles by script using the .dsw files</li>
882 </ul>
883 <p><strong>1.0.1: </strong> </p>
884 <ul>
885 <li> "mmx_gcc.cpp": Added "using namespace std" and removed "return
886 0" from a function with void return value to fix compiler errors when
887 compiling the library in Solaris environment.</li>
888 <li> Moved file "FIFOSampleBuffer.h" to "include" directory to allow
889 accessing the FIFOSampleBuffer class from external files.</li>
890 </ul>
891 <p><strong>1.0: </strong> </p>
892 <ul>
893 <li> Initial release</li>
894 </ul>
895 <br><br>
896 <h3>5.2. SoundStretch application Change History </h3>
897 <p><b>2.4.0:</b></p>
898 <ul class="current_soundstretch">
899 <li>parse command-line argument values with double float precision.</li>
900 </ul>
901 <p><b>2.3.3:</b></p>
902 <ul>
903 <li>Added support for Asian / non-latin filenames in Windows. Gnu platform has supported them already earlier.</li>
904 </ul>
905 <p><b>1.9:</b></p>
906 <ul>
907 <li>Added support for WAV file 'fact' information chunk.</li>
908 </ul>
909 <p><b>1.7.0:</b></p>
910 <ul>
911 <li>Bugfixes in Wavfile: exception string formatting, avoid getLengthMs() integer
912 precision overflow, support WAV files using 24/32bit sample format.</li>
913 </ul>
914 <p><b>1.5.0:</b></p>
915 <ul>
916 <li> Added "-speech" switch to activate algorithm parameters more
917 suitable for speech processing than the default parameters tuned for
918 music processing.</li>
919 </ul>
920 <p><strong>1.4.0:</strong></p>
921 <ul>
922 <li> Moved BPM detection routines from SoundStretch application into
923 SoundTouch library</li>
924 <li> Allow using standard input/output pipes as audio processing
925 input/output streams</li>
926 </ul>
927 <p><strong>1.3.0:</strong></p>
928 <ul>
929 <li> Simplified accessing WAV files with floating point sample
930 format.</li>
931 </ul>
932 <p><strong>1.2.1: </strong> </p>
933 <ul>
934 <li> Fixed 64bit address space bugs.</li>
935 </ul>
936 <p><strong>1.2.0: </strong> </p>
937 <ul>
938 <li> Added support for 32bit floating point sample data type</li>
939 <li> Restructured the BPM routines into separate library</li>
940 <li> Fixed big-endian conversion bugs in WAV file routines (hopefully
941 :)</li>
942 </ul>
943 <p><strong>1.1.1: </strong> </p>
944 <ul>
945 <li> Fixed bugs in WAV file reading &amp; added byte-order conversion
946 for big-endian processors.</li>
947 <li> Moved SoundStretch source code under 'example' directory to
948 highlight difference from SoundTouch stuff.</li>
949 <li> Replaced windows makefiles by script using the .dsw files</li>
950 <li> Output file name isn't required if output isn't desired (e.g. if
951 using the switch '-bpm' in plain format only)</li>
952 </ul>
953 <p><strong>1.1:</strong></p>
954 <ul>
955 <li> Fixed "Release" settings in Microsoft Visual C++ project file
956 (.dsp)</li>
957 <li> Added beats-per-minute (BPM) detection routine and command-line
958 switch "-bpm"</li>
959 </ul>
960 <p><strong>1.01: </strong> </p>
961 <ul>
962 <li> Initial release</li>
963 </ul>
964 <hr>
965 <h2>6. Acknowledgements </h2>
966 <p>Kudos for these people who have contributed to development or
967 submitted bugfixes:</p>
968 <ul>
969 <li> Arthur A</li>
970 <li> Paul Adenot</li>
971 <li> Richard Ash</li>
972 <li> Stanislav Brabec</li>
973 <li> Christian Budde</li>
974 <li> Jamie Bullock</li>
975 <li> Chris Bryan</li>
976 <li> Jacek Caban</li>
977 <li> Marketa Calabkova</li>
978 <li> Brian Cameron</li>
979 <li> Jason Champion</li>
980 <li> Giuseppe Cigala</li>
981 <li> David Clark</li>
982 <li> Patrick Colis</li>
983 <li> Miquel Colon</li>
984 <li> Jim Credland</li>
985 <li> Sandro Cumerlato</li>
986 <li> Gerry Fan</li>
987 <li> Justin Frankel</li>
988 <li> Masa H.</li>
989 <li> Jason Garland</li>
990 <li> Takashi Iwai</li>
991 <li> Thomas Klausner</li>
992 <li> Lu Zhihe</li>
993 <li> Luzpaz</li>
994 <li> Tony Mechelynck </li>
995 <li> Mathias M&ouml;hl</li>
996 <li> Yuval Naveh</li>
997 <li> Mats Palmgren </li>
998 <li> Chandni Patel</li>
999 <li> Paulo Pizarro</li>
1000 <li> Andrey Ponomarenko</li>
1001 <li> Blaise Potard</li>
1002 <li> Michael Pruett</li>
1003 <li> Rajeev Puran</li>
1004 <li> RJ Ryan</li>
1005 <li> Serge Sans Paille</li>
1006 <li> John Sheehy</li>
1007 <li> Tim Shuttleworth</li>
1008 <li> Albert Sirvent</li>
1009 <li> Tyson Smith</li>
1010 <li> John Stumpo</li>
1011 <li> Mario di Vece</li>
1012 <li> Rémi Verschelde</li>
1013 <li> Katja Vetter</li>
1014 <li> Wu Q.</li>
1015 <li> Olivier Laflamme</li>
1016 </ul>
1017 <p>Moral greetings to all other contributors and users also!</p>
1018 <hr>
1019 <h2>7. LICENSE </h2>
1020 <p>SoundTouch audio processing library<br>
1021 Copyright (c) Olli Parviainen</p>
1022 <p>This library is free software; you can redistribute it and/or modify
1023 it under the terms of the GNU Lesser General Public License version 2.1
1024 as published by the Free Software Foundation.</p>
1025 <p>This library is distributed in the hope that it will be useful, but
1026 WITHOUT ANY WARRANTY; without even the implied warranty of
1027 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
1028 General Public License for more details.</p>
1029 <p>You should have received a copy of the GNU Lesser General Public
1030 License along with this library; if not, write to the Free Software
1031 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p>
1032 <p>---</p>
1033 <p>commercial license alternative also available, contact author for details.</p>
1034 <hr>
1035 </body>
1036
1037 </html>