|
MythTV
0.26-pre
|
Class for calculating BPM rate for audio data. More...
#include <BPMDetect.h>
Public Member Functions | |
| BPMDetect (int numChannels, int sampleRate) | |
| Constructor. | |
| virtual | ~BPMDetect () |
| Destructor. | |
| void | inputSamples (soundtouch::SAMPLETYPE *samples, int numSamples) |
| Inputs a block of samples for analyzing: Envelopes the samples and then updates the autocorrelation estimation. | |
| float | getBpm () |
| Analyzes the results and returns the BPM rate. | |
Protected Member Functions | |
| void | init (int numChannels, int sampleRate) |
| Initialize the class for processing. | |
| void | updateXCorr (int process_samples) |
| Updates auto-correlation function for given number of decimated samples that are read from the internal 'buffer' pipe (samples aren't removed from the pipe though). | |
| int | decimate (soundtouch::SAMPLETYPE *dest, const soundtouch::SAMPLETYPE *src, int numsamples) |
| Decimates samples to approx. | |
| void | calcEnvelope (soundtouch::SAMPLETYPE *samples, int numsamples) |
| Calculates amplitude envelope for the buffer of samples. | |
Protected Attributes | |
| float * | xcorr |
| Auto-correlation accumulator bins. | |
| float | envelopeAccu |
| Amplitude envelope sliding average approximation level accumulator. | |
| float | RMSVolumeAccu |
| RMS volume sliding average approximation level accumulator. | |
| int | decimateCount |
| Sample average counter. | |
| soundtouch::LONG_SAMPLETYPE | decimateSum |
| Sample average accumulator for FIFO-like decimation. | |
| int | decimateBy |
| Decimate sound by this coefficient to reach approx. 500 Hz. | |
| int | windowLen |
| Auto-correlation window length. | |
| int | channels |
| Number of channels (1 = mono, 2 = stereo) | |
| int | sampleRate |
| sample rate | |
| int | windowStart |
| Beginning of auto-correlation window: Autocorrelation isn't being updated for the first these many correlation bins. | |
| soundtouch::FIFOSampleBuffer * | buffer |
| FIFO-buffer for decimated processing samples. | |
Class for calculating BPM rate for audio data.
Definition at line 71 of file BPMDetect.h.
| BPMDetect::BPMDetect | ( | int | numChannels, |
| int | sampleRate | ||
| ) |
Constructor.
| numChannels | Number of channels in sample data. |
| sampleRate | Sample rate in Hz. |
| virtual BPMDetect::~BPMDetect | ( | ) | [virtual] |
Destructor.
| void BPMDetect::init | ( | int | numChannels, |
| int | sampleRate | ||
| ) | [protected] |
Initialize the class for processing.
| void BPMDetect::updateXCorr | ( | int | process_samples | ) | [protected] |
Updates auto-correlation function for given number of decimated samples that are read from the internal 'buffer' pipe (samples aren't removed from the pipe though).
| process_samples | How many samples are processed. |
| int BPMDetect::decimate | ( | soundtouch::SAMPLETYPE * | dest, |
| const soundtouch::SAMPLETYPE * | src, | ||
| int | numsamples | ||
| ) | [protected] |
Decimates samples to approx.
500 Hz.
| dest | Destination buffer |
| src | Source sample buffer |
| numsamples | Number of source samples. |
| void BPMDetect::calcEnvelope | ( | soundtouch::SAMPLETYPE * | samples, |
| int | numsamples | ||
| ) | [protected] |
Calculates amplitude envelope for the buffer of samples.
Result is output to 'samples'.
| samples | Pointer to input/output data buffer |
| numsamples | Number of samples in buffer |
| void BPMDetect::inputSamples | ( | soundtouch::SAMPLETYPE * | samples, |
| int | numSamples | ||
| ) |
Inputs a block of samples for analyzing: Envelopes the samples and then updates the autocorrelation estimation.
When whole song data has been input in smaller blocks using this function, read the resulting bpm with 'getBpm' function.
Notice that data in 'samples' array can be disrupted in processing.
| samples | Pointer to input/working data buffer |
| numSamples | Number of samples in buffer |
| float BPMDetect::getBpm | ( | ) |
Analyzes the results and returns the BPM rate.
Use this function to read result after whole song data has been input to the class by consecutive calls of 'inputSamples' function.
float* BPMDetect::xcorr [protected] |
Auto-correlation accumulator bins.
Definition at line 75 of file BPMDetect.h.
float BPMDetect::envelopeAccu [protected] |
Amplitude envelope sliding average approximation level accumulator.
Definition at line 78 of file BPMDetect.h.
float BPMDetect::RMSVolumeAccu [protected] |
RMS volume sliding average approximation level accumulator.
Definition at line 81 of file BPMDetect.h.
int BPMDetect::decimateCount [protected] |
Sample average counter.
Definition at line 84 of file BPMDetect.h.
soundtouch::LONG_SAMPLETYPE BPMDetect::decimateSum [protected] |
Sample average accumulator for FIFO-like decimation.
Definition at line 87 of file BPMDetect.h.
int BPMDetect::decimateBy [protected] |
Decimate sound by this coefficient to reach approx. 500 Hz.
Definition at line 90 of file BPMDetect.h.
int BPMDetect::windowLen [protected] |
Auto-correlation window length.
Definition at line 93 of file BPMDetect.h.
int BPMDetect::channels [protected] |
Number of channels (1 = mono, 2 = stereo)
Definition at line 96 of file BPMDetect.h.
int BPMDetect::sampleRate [protected] |
sample rate
Definition at line 99 of file BPMDetect.h.
int BPMDetect::windowStart [protected] |
Beginning of auto-correlation window: Autocorrelation isn't being updated for the first these many correlation bins.
Definition at line 103 of file BPMDetect.h.
soundtouch::FIFOSampleBuffer* BPMDetect::buffer [protected] |
FIFO-buffer for decimated processing samples.
Definition at line 106 of file BPMDetect.h.
1.7.6.1