TracktionEngine
Loading...
Searching...
No Matches
tracktion_TempoDetect.h File Reference

Classes

class  engine::soundtouch::FIFOSamplePipe
 Abstract base class for FIFO (first-in-first-out) sample processing classes. More...
class  engine::soundtouch::FIFOProcessor
 Base-class for sound processing routines working in FIFO principle. More...
class  engine::soundtouch::FIFOSampleBuffer
 Sample buffer working in FIFO (first-in-first-out) principle. More...
struct  engine::soundtouch::BEAT
class  engine::soundtouch::IIR2_filter
class  engine::soundtouch::BPMDetect
 Class for calculating BPM rate for audio data. More...
class  engine::TempoDetect
 Uses the SoundTouch BPMDetect class to guess the tempo of some audio. More...

Namespaces

namespace  engine
namespace  engine::soundtouch
 Common type definitions for SoundTouch audio processing library.

Macros

#define _BPMDetect_H_
 Beats-per-minute (BPM) detection routine.
#define STTypes_H
 Common type definitions for SoundTouch audio processing library.
#define SOUNDTOUCH_ALIGN_POINTER_16(x)
#define SOUNDTOUCH_MAX_CHANNELS   16
 Max allowed number of channels.
#define SOUNDTOUCH_FLOAT_SAMPLES   1
 Activate these undef's to overrule the possible sampletype setting inherited from some other header file:
#define SOUNDTOUCH_ALLOW_NONEXACT_SIMD_OPTIMIZATION   1
 Always disable optimizations when not using a x86 systems.
#define ST_THROW_RT_ERROR(x)
#define FIFOSampleBuffer_H
 A buffer class for temporarily storaging sound samples, operates as a first-in-first-out pipe.
#define FIFOSamplePipe_H
 'FIFOSamplePipe' : An abstract base class for classes that manipulate sound samples by operating like a first-in-first-out pipe: New samples are fed into one end of the pipe with the 'putSamples' function, and the processed samples are received from the other end with the 'receiveSamples' function.
#define MIN_BPM   45
 Minimum allowed BPM rate. Used to restrict accepted result above a reasonable limit.
#define MAX_BPM_RANGE   200
 Maximum allowed BPM rate range. Used for calculating algorithm parametrs.
#define MAX_BPM_VALID   190
 Maximum allowed BPM rate range. Used to restrict accepted result below a reasonable limit.

Typedefs

typedef unsigned int engine::uint
typedef unsigned long engine::ulong
typedef ulong engine::ulongptr
typedef float engine::soundtouch::SAMPLETYPE
typedef double engine::soundtouch::LONG_SAMPLETYPE

Macro Definition Documentation

◆ _BPMDetect_H_

#define _BPMDetect_H_

Beats-per-minute (BPM) detection routine.

The beat detection algorithm works as follows:

  • Use function 'inputSamples' to input a chunks of samples to the class for analysis. It's a good idea to enter a large sound file or stream in smallish chunks of around few kilosamples in order not to extinguish too much RAM memory.
  • Input sound data is decimated to approx 500 Hz to reduce calculation burden, which is basically ok as low (bass) frequencies mostly determine the beat rate. Simple averaging is used for anti-alias filtering because the resulting signal quality isn't of that high importance.
  • Decimated sound data is enveloped, i.e. the amplitude shape is detected by taking absolute value that's smoothed by sliding average. Signal levels that are below a couple of times the general RMS amplitude level are cut away to leave only notable peaks there.
  • Repeating sound patterns (e.g. beats) are detected by calculating short-term autocorrelation function of the enveloped signal.
  • 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 autocorrelation function, calculates it's precise location and converts this reading to bpm's.

Author : Copyright (c) Olli Parviainen Author e-mail : oparviai 'at' iki.fi SoundTouch WWW: http://www.surina.net/soundtouch

◆ STTypes_H

#define STTypes_H

Common type definitions for SoundTouch audio processing library.

Author : Copyright (c) Olli Parviainen Author e-mail : oparviai 'at' iki.fi SoundTouch WWW: http://www.surina.net/soundtouch

◆ SOUNDTOUCH_ALIGN_POINTER_16

#define SOUNDTOUCH_ALIGN_POINTER_16 ( x)
Value:
( ( (ulongptr)(x) + 15 ) & ~(ulongptr)15 )

◆ SOUNDTOUCH_MAX_CHANNELS

#define SOUNDTOUCH_MAX_CHANNELS   16

Max allowed number of channels.

◆ SOUNDTOUCH_FLOAT_SAMPLES

#define SOUNDTOUCH_FLOAT_SAMPLES   1

Activate these undef's to overrule the possible sampletype setting inherited from some other header file:

If following flag is defined, always uses multichannel processing routines also for mono and stero sound. This is for routine testing purposes; output should be same with either routines, yet disabling the dedicated mono/stereo processing routines will result in slower runtime performance so recommendation is to keep this off. Choose either 32bit floating point or 16bit integer sampletype by choosing one of the following defines, unless this selection has already been done in some other file.

Notes:

  • In Windows environment, choose the sample format with the following defines.
  • In GNU environment, the floating point samples are used by default, but integer samples can be chosen by giving the following switch to the configure script: ./configure –enable-integer-samples However, if you still prefer to select the sample format here also in GNU environment, then please #undef the INTEGER_SAMPLE and FLOAT_SAMPLE defines first as in comments above.

◆ SOUNDTOUCH_ALLOW_NONEXACT_SIMD_OPTIMIZATION

#define SOUNDTOUCH_ALLOW_NONEXACT_SIMD_OPTIMIZATION   1

Always disable optimizations when not using a x86 systems.

◆ ST_THROW_RT_ERROR

#define ST_THROW_RT_ERROR ( x)
Value:
{throw std::runtime_error(x);}

◆ FIFOSampleBuffer_H

#define FIFOSampleBuffer_H

A buffer class for temporarily storaging sound samples, operates as a first-in-first-out pipe.

Samples are added to the end of the sample buffer with the 'putSamples' function, and are received from the beginning of the buffer by calling the 'receiveSamples' function. The class automatically removes the output samples from the buffer as well as grows the storage size whenever necessary.

Author : Copyright (c) Olli Parviainen Author e-mail : oparviai 'at' iki.fi SoundTouch WWW: http://www.surina.net/soundtouch

◆ FIFOSamplePipe_H

#define FIFOSamplePipe_H

'FIFOSamplePipe' : An abstract base class for classes that manipulate sound samples by operating like a first-in-first-out pipe: New samples are fed into one end of the pipe with the 'putSamples' function, and the processed samples are received from the other end with the 'receiveSamples' function.

'FIFOProcessor' : A base class for classes the do signal processing with the samples while operating like a first-in-first-out pipe. When samples are input with the 'putSamples' function, the class processes them and moves the processed samples to the given 'output' pipe object, which may be either another processing stage, or a fifo sample buffer object.

Author : Copyright (c) Olli Parviainen Author e-mail : oparviai 'at' iki.fi SoundTouch WWW: http://www.surina.net/soundtouch

◆ MIN_BPM

#define MIN_BPM   45

Minimum allowed BPM rate. Used to restrict accepted result above a reasonable limit.

◆ MAX_BPM_RANGE

#define MAX_BPM_RANGE   200

Maximum allowed BPM rate range. Used for calculating algorithm parametrs.

◆ MAX_BPM_VALID

#define MAX_BPM_VALID   190

Maximum allowed BPM rate range. Used to restrict accepted result below a reasonable limit.