BPMDetect.h (1.9.2) | | BPMDetect.h (2.0.0) |
| | |
skipping to change at line 29 | | skipping to change at line 29 |
/// - After whole sound data file has been analyzed as above, the bpm level
is | | /// - After whole sound data file has been analyzed as above, the bpm level
is |
/// detected by function 'getBpm' that finds the highest peak of the auto
correlation | | /// detected by function 'getBpm' that finds the highest peak of the auto
correlation |
/// function, calculates it's precise location and converts this reading
to bpm's. | | /// function, calculates it's precise location and converts this reading
to bpm's. |
/// | | /// |
/// Author : Copyright (c) Olli Parviainen | | /// Author : Copyright (c) Olli Parviainen |
/// Author e-mail : oparviai 'at' iki.fi | | /// Author e-mail : oparviai 'at' iki.fi |
/// SoundTouch WWW: http://www.surina.net/soundtouch | | /// SoundTouch WWW: http://www.surina.net/soundtouch |
/// | | /// |
///////////////////////////////////////////////////////////////////////////
///// | | ///////////////////////////////////////////////////////////////////////////
///// |
// | | // |
|
// Last changed : $Date: 2012-08-30 22:53:44 +0300 (Thu, 30 Aug 2012) $ | | // Last changed : $Date: 2016-01-12 19:24:46 +0200 (ti, 12 tammi 2016) $ |
// File revision : $Revision: 4 $ | | // File revision : $Revision: 4 $ |
// | | // |
|
// $Id: BPMDetect.h 150 2012-08-30 19:53:44Z oparviai $ | | // $Id: BPMDetect.h 239 2016-01-12 17:24:46Z oparviai $ |
// | | // |
///////////////////////////////////////////////////////////////////////////
///// | | ///////////////////////////////////////////////////////////////////////////
///// |
// | | // |
// License : | | // License : |
// | | // |
// SoundTouch audio processing library | | // SoundTouch audio processing library |
// Copyright (c) Olli Parviainen | | // Copyright (c) Olli Parviainen |
// | | // |
// This library is free software; you can redistribute it and/or | | // This library is free software; you can redistribute it and/or |
// modify it under the terms of the GNU Lesser General Public | | // modify it under the terms of the GNU Lesser General Public |
| | |
skipping to change at line 79 | | skipping to change at line 79 |
/// Maximum allowed BPM rate. Used to restrict accepted result below a reas
onable limit. | | /// Maximum allowed BPM rate. Used to restrict accepted result below a reas
onable limit. |
#define MAX_BPM 200 | | #define MAX_BPM 200 |
| | |
/// Class for calculating BPM rate for audio data. | | /// Class for calculating BPM rate for audio data. |
class BPMDetect | | class BPMDetect |
{ | | { |
protected: | | protected: |
/// Auto-correlation accumulator bins. | | /// Auto-correlation accumulator bins. |
float *xcorr; | | float *xcorr; |
| | |
|
/// Amplitude envelope sliding average approximation level accumulator | | |
double envelopeAccu; | | |
| | |
/// RMS volume sliding average approximation level accumulator | | |
double RMSVolumeAccu; | | |
| | |
/// Sample average counter. | | /// Sample average counter. |
int decimateCount; | | int decimateCount; |
| | |
/// Sample average accumulator for FIFO-like decimation. | | /// Sample average accumulator for FIFO-like decimation. |
soundtouch::LONG_SAMPLETYPE decimateSum; | | soundtouch::LONG_SAMPLETYPE decimateSum; |
| | |
/// Decimate sound by this coefficient to reach approx. 500 Hz. | | /// Decimate sound by this coefficient to reach approx. 500 Hz. |
int decimateBy; | | int decimateBy; |
| | |
/// Auto-correlation window length | | /// Auto-correlation window length |
| | |
End of changes. 3 change blocks. |
8 lines changed or deleted | | 2 lines changed or added |
|
SoundTouch.h (1.9.2) | | SoundTouch.h (2.0.0) |
| | |
skipping to change at line 44 | | skipping to change at line 44 |
/// tempo and pitch in the same ratio) of the sound. The third available
control | | /// tempo and pitch in the same ratio) of the sound. The third available
control |
/// 'pitch' (change pitch but maintain tempo) is produced by a combinatio
n of | | /// 'pitch' (change pitch but maintain tempo) is produced by a combinatio
n of |
/// combining the two other controls. | | /// combining the two other controls. |
/// | | /// |
/// Author : Copyright (c) Olli Parviainen | | /// Author : Copyright (c) Olli Parviainen |
/// Author e-mail : oparviai 'at' iki.fi | | /// Author e-mail : oparviai 'at' iki.fi |
/// SoundTouch WWW: http://www.surina.net/soundtouch | | /// SoundTouch WWW: http://www.surina.net/soundtouch |
/// | | /// |
///////////////////////////////////////////////////////////////////////////
///// | | ///////////////////////////////////////////////////////////////////////////
///// |
// | | // |
|
// Last changed : $Date: 2015-09-20 10:38:32 +0300 (Sun, 20 Sep 2015) $ | | // Last changed : $Date: 2017-07-30 12:35:00 +0300 (su, 30 heinä 2017) $ |
// File revision : $Revision: 4 $ | | // File revision : $Revision: 4 $ |
// | | // |
|
// $Id: SoundTouch.h 230 2015-09-20 07:38:32Z oparviai $ | | // $Id: SoundTouch.h 253 2017-07-30 09:35:00Z oparviai $ |
// | | // |
///////////////////////////////////////////////////////////////////////////
///// | | ///////////////////////////////////////////////////////////////////////////
///// |
// | | // |
// License : | | // License : |
// | | // |
// SoundTouch audio processing library | | // SoundTouch audio processing library |
// Copyright (c) Olli Parviainen | | // Copyright (c) Olli Parviainen |
// | | // |
// This library is free software; you can redistribute it and/or | | // This library is free software; you can redistribute it and/or |
// modify it under the terms of the GNU Lesser General Public | | // modify it under the terms of the GNU Lesser General Public |
| | |
skipping to change at line 82 | | skipping to change at line 82 |
#ifndef SoundTouch_H | | #ifndef SoundTouch_H |
#define SoundTouch_H | | #define SoundTouch_H |
| | |
#include "FIFOSamplePipe.h" | | #include "FIFOSamplePipe.h" |
#include "STTypes.h" | | #include "STTypes.h" |
| | |
namespace soundtouch | | namespace soundtouch |
{ | | { |
| | |
/// Soundtouch library version string | | /// Soundtouch library version string |
|
#define SOUNDTOUCH_VERSION "1.9.2" | | #define SOUNDTOUCH_VERSION "2.0.0" |
| | |
/// SoundTouch library version id | | /// SoundTouch library version id |
|
#define SOUNDTOUCH_VERSION_ID (10902) | | #define SOUNDTOUCH_VERSION_ID (20000) |
| | |
// | | // |
// Available setting IDs for the 'setSetting' & 'get_setting' functions: | | // Available setting IDs for the 'setSetting' & 'get_setting' functions: |
| | |
/// Enable/disable anti-alias filter in pitch transposer (0 = disable) | | /// Enable/disable anti-alias filter in pitch transposer (0 = disable) |
#define SETTING_USE_AA_FILTER 0 | | #define SETTING_USE_AA_FILTER 0 |
| | |
/// Pitch transposer anti-alias filter length (8 .. 128 taps, default = 32) | | /// Pitch transposer anti-alias filter length (8 .. 128 taps, default = 32) |
#define SETTING_AA_FILTER_LENGTH 1 | | #define SETTING_AA_FILTER_LENGTH 1 |
| | |
| | |
skipping to change at line 118 | | skipping to change at line 118 |
/// may look for an optimal joining location when mixing the sound sequence
s back together. | | /// may look for an optimal joining location when mixing the sound sequence
s back together. |
/// See "STTypes.h" or README for more information. | | /// See "STTypes.h" or README for more information. |
#define SETTING_SEEKWINDOW_MS 4 | | #define SETTING_SEEKWINDOW_MS 4 |
| | |
/// Time-stretch algorithm overlap length in milliseconds. When the chopped
sound sequences | | /// Time-stretch algorithm overlap length in milliseconds. When the chopped
sound sequences |
/// are mixed back together, to form a continuous sound stream, this parame
ter defines over | | /// are mixed back together, to form a continuous sound stream, this parame
ter defines over |
/// how long period the two consecutive sequences are let to overlap each o
ther. | | /// how long period the two consecutive sequences are let to overlap each o
ther. |
/// See "STTypes.h" or README for more information. | | /// See "STTypes.h" or README for more information. |
#define SETTING_OVERLAP_MS 5 | | #define SETTING_OVERLAP_MS 5 |
| | |
|
/// Call "getSetting" with this ID to query nominal average processing sequ | | /// Call "getSetting" with this ID to query processing sequence size in sam |
ence | | ples. |
/// size in samples. This value tells approcimate value how many input samp | | /// This value gives approximate value of how many input samples you'll nee |
les | | d to |
/// SoundTouch needs to gather before it does DSP processing run for the sa | | /// feed into SoundTouch after initial buffering to get out a new batch of |
mple batch. | | /// output samples. |
| | /// |
| | /// This value does not include initial buffering at beginning of a new pro |
| | cessing |
| | /// stream, use SETTING_INITIAL_LATENCY to get the initial buffering size. |
/// | | /// |
/// Notices: | | /// Notices: |
/// - This is read-only parameter, i.e. setSetting ignores this parameter | | /// - This is read-only parameter, i.e. setSetting ignores this parameter |
|
/// - Returned value is approximate average value, exact processing batch | | /// - This parameter value is not constant but change depending on |
/// size may wary from time to time | | |
/// - This parameter value is not constant but may change depending on | | |
/// tempo/pitch/rate/samplerate settings. | | /// tempo/pitch/rate/samplerate settings. |
|
#define SETTING_NOMINAL_INPUT_SEQUENCE 6 | | #define SETTING_NOMINAL_INPUT_SEQUENCE 6 |
| | |
/// Call "getSetting" with this ID to query nominal average processing outp
ut | | /// Call "getSetting" with this ID to query nominal average processing outp
ut |
/// size in samples. This value tells approcimate value how many output sam
ples | | /// size in samples. This value tells approcimate value how many output sam
ples |
/// SoundTouch outputs once it does DSP processing run for a batch of input
samples. | | /// SoundTouch outputs once it does DSP processing run for a batch of input
samples. |
/// | | /// |
/// Notices: | | /// Notices: |
/// - This is read-only parameter, i.e. setSetting ignores this parameter | | /// - This is read-only parameter, i.e. setSetting ignores this parameter |
|
/// - Returned value is approximate average value, exact processing batch | | /// - This parameter value is not constant but change depending on |
/// size may wary from time to time | | |
/// - This parameter value is not constant but may change depending on | | |
/// tempo/pitch/rate/samplerate settings. | | /// tempo/pitch/rate/samplerate settings. |
|
#define SETTING_NOMINAL_OUTPUT_SEQUENCE 7 | | #define SETTING_NOMINAL_OUTPUT_SEQUENCE 7 |
| | |
| | /// Call "getSetting" with this ID to query initial processing latency, i.e |
| | . |
| | /// approx. how many samples you'll need to enter to SoundTouch pipeline be |
| | fore |
| | /// you can expect to get first batch of ready output samples out. |
| | /// |
| | /// After the first output batch, you can then expect to get approx. |
| | /// SETTING_NOMINAL_OUTPUT_SEQUENCE ready samples out for every |
| | /// SETTING_NOMINAL_INPUT_SEQUENCE samples that you enter into SoundTouch. |
| | /// |
| | /// Example: |
| | /// processing with parameter -tempo=5 |
| | /// => initial latency = 5509 samples |
| | /// input sequence = 4167 samples |
| | /// output sequence = 3969 samples |
| | /// |
| | /// Accordingly, you can expect to feed in approx. 5509 samples at beginnin |
| | g of |
| | /// the stream, and then you'll get out the first 3969 samples. After that, |
| | for |
| | /// every approx. 4167 samples that you'll put in, you'll receive again app |
| | rox. |
| | /// 3969 samples out. |
| | /// |
| | /// This also means that average latency during stream processing is |
| | /// INITIAL_LATENCY-OUTPUT_SEQUENCE/2, in the above example case 5509-3969/ |
| | 2 |
| | /// = 3524 samples |
| | /// |
| | /// Notices: |
| | /// - This is read-only parameter, i.e. setSetting ignores this parameter |
| | /// - This parameter value is not constant but change depending on |
| | /// tempo/pitch/rate/samplerate settings. |
| | #define SETTING_INITIAL_LATENCY 8 |
| | |
class SoundTouch : public FIFOProcessor | | class SoundTouch : public FIFOProcessor |
{ | | { |
private: | | private: |
/// Rate transposer class instance | | /// Rate transposer class instance |
class RateTransposer *pRateTransposer; | | class RateTransposer *pRateTransposer; |
| | |
/// Time-stretch class instance | | /// Time-stretch class instance |
class TDStretch *pTDStretch; | | class TDStretch *pTDStretch; |
| | |
| | |
skipping to change at line 229 | | skipping to change at line 258 |
/// (-12 .. +12) | | /// (-12 .. +12) |
void setPitchSemiTones(int newPitch); | | void setPitchSemiTones(int newPitch); |
void setPitchSemiTones(double newPitch); | | void setPitchSemiTones(double newPitch); |
| | |
/// Sets the number of channels, 1 = mono, 2 = stereo | | /// Sets the number of channels, 1 = mono, 2 = stereo |
void setChannels(uint numChannels); | | void setChannels(uint numChannels); |
| | |
/// Sets sample rate. | | /// Sets sample rate. |
void setSampleRate(uint srate); | | void setSampleRate(uint srate); |
| | |
|
| | /// Get ratio between input and output audio durations, useful for calc |
| | ulating |
| | /// processed output duration: if you'll process a stream of N samples, |
| | then |
| | /// you can expect to get out N * getInputOutputSampleRatio() samples. |
| | /// |
| | /// This ratio will give accurate target duration ratio for a full audi |
| | o track, |
| | /// given that the the whole track is processed with same processing pa |
| | rameters. |
| | /// |
| | /// If this ratio is applied to calculate intermediate offsets inside a |
| | processing |
| | /// stream, then this ratio is approximate and can deviate +- some tens |
| | of milliseconds |
| | /// from ideal offset, yet by end of the audio stream the duration rati |
| | o will become |
| | /// exact. |
| | /// |
| | /// Example: if processing with parameters "-tempo=15 -pitch=-3", the f |
| | unction |
| | /// will return value 0.8695652... Now, if processing an audio stream w |
| | hose duration |
| | /// is exactly one million audio samples, then you can expect the proce |
| | ssed |
| | /// output duration be 0.869565 * 1000000 = 869565 samples. |
| | double getInputOutputSampleRatio(); |
| | |
/// Flushes the last samples from the processing pipeline to the output
. | | /// Flushes the last samples from the processing pipeline to the output
. |
/// Clears also the internal processing buffers. | | /// Clears also the internal processing buffers. |
// | | // |
/// Note: This function is meant for extracting the last samples of a s
ound | | /// Note: This function is meant for extracting the last samples of a s
ound |
/// stream. This function may introduce additional blank samples in the
end | | /// stream. This function may introduce additional blank samples in the
end |
/// of the sound stream, and thus it's not recommended to call this fun
ction | | /// of the sound stream, and thus it's not recommended to call this fun
ction |
/// in the middle of a sound stream. | | /// in the middle of a sound stream. |
void flush(); | | void flush(); |
| | |
/// Adds 'numSamples' pcs of samples from the 'samples' memory position
into | | /// Adds 'numSamples' pcs of samples from the 'samples' memory position
into |
| | |
skipping to change at line 287 | | skipping to change at line 334 |
/// Reads a setting controlling the processing system behaviour. See th
e | | /// Reads a setting controlling the processing system behaviour. See th
e |
/// 'SETTING_...' defines for available setting ID's. | | /// 'SETTING_...' defines for available setting ID's. |
/// | | /// |
/// \return the setting value. | | /// \return the setting value. |
int getSetting(int settingId ///< Setting ID number, see SETTING_...
defines. | | int getSetting(int settingId ///< Setting ID number, see SETTING_...
defines. |
) const; | | ) const; |
| | |
/// Returns number of samples currently unprocessed. | | /// Returns number of samples currently unprocessed. |
virtual uint numUnprocessedSamples() const; | | virtual uint numUnprocessedSamples() const; |
| | |
|
| | /// Return number of channels |
| | uint numChannels() const |
| | { |
| | return channels; |
| | } |
| | |
/// Other handy functions that are implemented in the ancestor classes
(see | | /// Other handy functions that are implemented in the ancestor classes
(see |
/// classes 'FIFOProcessor' and 'FIFOSamplePipe') | | /// classes 'FIFOProcessor' and 'FIFOSamplePipe') |
/// | | /// |
/// - receiveSamples() : Use this function to receive 'ready' processed
samples from SoundTouch. | | /// - receiveSamples() : Use this function to receive 'ready' processed
samples from SoundTouch. |
/// - numSamples() : Get number of 'ready' samples that can be rece
ived with | | /// - numSamples() : Get number of 'ready' samples that can be rece
ived with |
/// function 'receiveSamples()' | | /// function 'receiveSamples()' |
/// - isEmpty() : Returns nonzero if there aren't any 'ready' sa
mples. | | /// - isEmpty() : Returns nonzero if there aren't any 'ready' sa
mples. |
/// - clear() : Clears all samples from ready/processing buffe
rs. | | /// - clear() : Clears all samples from ready/processing buffe
rs. |
}; | | }; |
| | |
| | |
End of changes. 11 change blocks. |
18 lines changed or deleted | | 87 lines changed or added |
|
STTypes.h (1.9.2) | | STTypes.h (2.0.0) |
///////////////////////////////////////////////////////////////////////////
///// | | ///////////////////////////////////////////////////////////////////////////
///// |
/// | | /// |
/// Common type definitions for SoundTouch audio processing library. | | /// Common type definitions for SoundTouch audio processing library. |
/// | | /// |
/// Author : Copyright (c) Olli Parviainen | | /// Author : Copyright (c) Olli Parviainen |
/// Author e-mail : oparviai 'at' iki.fi | | /// Author e-mail : oparviai 'at' iki.fi |
/// SoundTouch WWW: http://www.surina.net/soundtouch | | /// SoundTouch WWW: http://www.surina.net/soundtouch |
/// | | /// |
///////////////////////////////////////////////////////////////////////////
///// | | ///////////////////////////////////////////////////////////////////////////
///// |
// | | // |
|
// Last changed : $Date: 2015-05-18 18:25:07 +0300 (Mon, 18 May 2015) $ | | // Last changed : $Date: 2017-07-30 12:28:06 +0300 (su, 30 heinä 2017) $ |
// File revision : $Revision: 3 $ | | // File revision : $Revision: 3 $ |
// | | // |
|
// $Id: STTypes.h 215 2015-05-18 15:25:07Z oparviai $ | | // $Id: STTypes.h 252 2017-07-30 09:28:06Z oparviai $ |
// | | // |
///////////////////////////////////////////////////////////////////////////
///// | | ///////////////////////////////////////////////////////////////////////////
///// |
// | | // |
// License : | | // License : |
// | | // |
// SoundTouch audio processing library | | // SoundTouch audio processing library |
// Copyright (c) Olli Parviainen | | // Copyright (c) Olli Parviainen |
// | | // |
// This library is free software; you can redistribute it and/or | | // This library is free software; you can redistribute it and/or |
// modify it under the terms of the GNU Lesser General Public | | // modify it under the terms of the GNU Lesser General Public |
| | |
skipping to change at line 142 | | skipping to change at line 142 |
typedef short SAMPLETYPE; | | typedef short SAMPLETYPE; |
// data type for sample accumulation: Use 32bit integer to prevent
overflows | | // data type for sample accumulation: Use 32bit integer to prevent
overflows |
typedef long LONG_SAMPLETYPE; | | typedef long LONG_SAMPLETYPE; |
| | |
#ifdef SOUNDTOUCH_FLOAT_SAMPLES | | #ifdef SOUNDTOUCH_FLOAT_SAMPLES |
// check that only one sample type is defined | | // check that only one sample type is defined |
#error "conflicting sample types defined" | | #error "conflicting sample types defined" |
#endif // SOUNDTOUCH_FLOAT_SAMPLES | | #endif // SOUNDTOUCH_FLOAT_SAMPLES |
| | |
#ifdef SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS | | #ifdef SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS |
|
// Allow MMX optimizations | | // Allow MMX optimizations (not available in X64 mode) |
#define SOUNDTOUCH_ALLOW_MMX 1 | | #if (!_M_X64) |
| | #define SOUNDTOUCH_ALLOW_MMX 1 |
| | #endif |
#endif | | #endif |
| | |
#else | | #else |
| | |
// floating point samples | | // floating point samples |
typedef float SAMPLETYPE; | | typedef float SAMPLETYPE; |
// data type for sample accumulation: Use double to utilize full pr
ecision. | | // data type for sample accumulation: Use double to utilize full pr
ecision. |
typedef double LONG_SAMPLETYPE; | | typedef double LONG_SAMPLETYPE; |
| | |
#ifdef SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS | | #ifdef SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS |
| | |
End of changes. 3 change blocks. |
4 lines changed or deleted | | 6 lines changed or added |
|