|
BTrack - A Real-Time Beat Tracker
|
#include <BTrack.h>
Public Member Functions | |
| BTrack () | |
| BTrack (int hopSize) | |
| BTrack (int hopSize, int frameSize) | |
| ~BTrack () | |
| void | updateHopAndFrameSize (int hopSize, int frameSize) |
| void | processAudioFrame (double *frame) |
| void | processOnsetDetectionFunctionSample (double sample) |
| int | getHopSize () |
| bool | beatDueInCurrentFrame () |
| double | getCurrentTempoEstimate () |
| double | getLatestCumulativeScoreValue () |
| void | setTempo (double tempo) |
| void | fixTempo (double tempo) |
| void | doNotFixTempo () |
Static Public Member Functions | |
| static double | getBeatTimeInSeconds (long frameNumber, int hopSize, int fs) |
The main beat tracking class and the interface to the BTrack beat tracking algorithm. The algorithm can process either audio frames or onset detection function samples and also contains some static functions for calculating beat times in seconds
| BTrack::BTrack | ( | ) |
Constructor assuming hop size of 512 and frame size of 1024
| BTrack::BTrack | ( | int | hopSize | ) |
Constructor assuming frame size will be double the hopSize
| hopSize | the hop size in audio samples |
| BTrack::BTrack | ( | int | hopSize, |
| int | frameSize | ||
| ) |
Constructor taking both hopSize and frameSize
| hopSize | the hop size in audio samples |
| frameSize | the frame size in audio samples |
| BTrack::~BTrack | ( | ) |
Destructor
| bool BTrack::beatDueInCurrentFrame | ( | ) |
| void BTrack::doNotFixTempo | ( | ) |
Tell the algorithm to not fix the tempo anymore
| void BTrack::fixTempo | ( | double | tempo | ) |
Fix tempo to roughly around some value, so that the algorithm will only try to track tempi around the given tempo
| tempo | the tempo in beats per minute (bpm) |
|
static |
Calculates a beat time in seconds, given the frame number, hop size and sampling frequency. This version uses a long to represent the frame number
| frameNumber | the index of the current frame |
| hopSize | the hop size in audio samples |
| fs | the sampling frequency in Hz |
| double BTrack::getCurrentTempoEstimate | ( | ) |
| int BTrack::getHopSize | ( | ) |
| double BTrack::getLatestCumulativeScoreValue | ( | ) |
| void BTrack::processAudioFrame | ( | double * | frame | ) |
Process a single audio frame
| frame | a pointer to an array containing an audio frame. The number of samples should match the frame size that the algorithm was initialised with. |
| void BTrack::processOnsetDetectionFunctionSample | ( | double | sample | ) |
Add new onset detection function sample to buffer and apply beat tracking
| sample | an onset detection function sample |
| void BTrack::setTempo | ( | double | tempo | ) |
Set the tempo of the beat tracker
| tempo | the tempo in beats per minute (bpm) |
| void BTrack::updateHopAndFrameSize | ( | int | hopSize, |
| int | frameSize | ||
| ) |
Updates the hop and frame size used by the beat tracker
| hopSize | the hop size in audio samples |
| frameSize | the frame size in audio samples |