BTrack - A Real-Time Beat Tracker
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
BTrack Class Reference

#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)
 

Detailed Description

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

Constructor & Destructor Documentation

◆ BTrack() [1/3]

BTrack::BTrack ( )

Constructor assuming hop size of 512 and frame size of 1024

◆ BTrack() [2/3]

BTrack::BTrack ( int  hopSize)

Constructor assuming frame size will be double the hopSize

Parameters
hopSizethe hop size in audio samples

◆ BTrack() [3/3]

BTrack::BTrack ( int  hopSize,
int  frameSize 
)

Constructor taking both hopSize and frameSize

Parameters
hopSizethe hop size in audio samples
frameSizethe frame size in audio samples

◆ ~BTrack()

BTrack::~BTrack ( )

Destructor

Member Function Documentation

◆ beatDueInCurrentFrame()

bool BTrack::beatDueInCurrentFrame ( )
Returns
true if a beat should occur in the current audio frame

◆ doNotFixTempo()

void BTrack::doNotFixTempo ( )

Tell the algorithm to not fix the tempo anymore

◆ fixTempo()

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

Parameters
tempothe tempo in beats per minute (bpm)

◆ getBeatTimeInSeconds()

double BTrack::getBeatTimeInSeconds ( long  frameNumber,
int  hopSize,
int  fs 
)
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

Parameters
frameNumberthe index of the current frame
hopSizethe hop size in audio samples
fsthe sampling frequency in Hz
Returns
a beat time in seconds

◆ getCurrentTempoEstimate()

double BTrack::getCurrentTempoEstimate ( )
Returns
the current tempo estimate being used by the beat tracker

◆ getHopSize()

int BTrack::getHopSize ( )
Returns
the current hop size being used by the beat tracker

◆ getLatestCumulativeScoreValue()

double BTrack::getLatestCumulativeScoreValue ( )
Returns
the most recent value of the cumulative score function

◆ processAudioFrame()

void BTrack::processAudioFrame ( double *  frame)

Process a single audio frame

Parameters
framea pointer to an array containing an audio frame. The number of samples should match the frame size that the algorithm was initialised with.

◆ processOnsetDetectionFunctionSample()

void BTrack::processOnsetDetectionFunctionSample ( double  sample)

Add new onset detection function sample to buffer and apply beat tracking

Parameters
samplean onset detection function sample

◆ setTempo()

void BTrack::setTempo ( double  tempo)

Set the tempo of the beat tracker

Parameters
tempothe tempo in beats per minute (bpm)

◆ updateHopAndFrameSize()

void BTrack::updateHopAndFrameSize ( int  hopSize,
int  frameSize 
)

Updates the hop and frame size used by the beat tracker

Parameters
hopSizethe hop size in audio samples
frameSizethe frame size in audio samples

The documentation for this class was generated from the following files: