adamstark@114: adamstark@114: adamstark@60:
adamstark@60: adamstark@114: adamstark@114: adamstark@114: adamstark@61:
adamstark@60: BTrack - A Real-Time Beat Tracker
adamstark@60:
adamstark@60: |
adamstark@60:
A real-time beat tracker, implemented in C++.
adamstark@61:Written by Adam Stark, Matthew Davies and Mark Plumbley.
adamstark@114:BTrack is made available under the GNU General Public License, version 3. Please see the included LICENSE.txt for more details.
adamstark@114:STEP 1
adamstark@114:Include the BTrack header file as follows:
#include "BTrack.h" adamstark@114:
STEP 2
adamstark@114:Instantiate the algorithm by one of the following:
adamstark@61:// to use the default 512 hop size and 1024 frame size adamstark@61: BTrack b; adamstark@114:
or:
// to specify a hop size (e.g. 512) and have a frame size of 2 x the hop size adamstark@61: BTrack b(512); adamstark@114:
or:
// to specify both the hop size and frame size adamstark@61: BTrack b(512,1024); adamstark@114:
STEP 3.1 - Audio Input
adamstark@114:In the processing loop, fill a double precision array with one frame of audio samples (as determined in step 2):
double *frame; adamstark@61: adamstark@61: // ! adamstark@61: // do something here to fill the frame with audio samples adamstark@61: // ! adamstark@114:
and then call:
b.processAudioFrame(frame); adamstark@114:
and to check for beats, simply call:
if (b.beatDueInCurrentFrame()) adamstark@61: { adamstark@61: // do something on the beat adamstark@61: } adamstark@114:
STEP 3.2 - Onset Detection Function Input
adamstark@114:
The algorithm can process onset detection function samples. Given a double precision onset detection function sample called 'newSamples', at each step, call:
b.processOnsetDetectionFunctionSample(newSample); adamstark@114:
and then check for beats with:
if (b.beatDueInCurrentFrame()) adamstark@61: { adamstark@61: // do something on the beat adamstark@61: } adamstark@114:
For any questions, please email Adam Stark (email at http://www.adamstark.co.uk).
adamstark@114: