ref: 416c0b567ac0c973c4cc1bf272d37046cc1ccdb7
parent: ade9afe663f3175a6ed9e75c0866fa436591e3e1
author: Paul Brossier <piem@piem.org>
date: Thu Sep 6 14:01:41 EDT 2007
beattracking.{h,c}: add function aubio_beattracking_get_bpm to return the observed tempo at any moment
--- a/src/beattracking.c
+++ b/src/beattracking.c
@@ -452,3 +452,11 @@
bt->rp2 = rp2;
}
+
+smpl_t aubio_beattracking_get_bpm(aubio_beattracking_t * bt) {
+ if (bt->timesig != 0 && bt->counter == 0 && bt->flagstep == 0) {
+ return 5168. / (smpl_t)bt->gp;
+ } else {
+ return 0.;
+ }
+}
--- a/src/beattracking.h
+++ b/src/beattracking.h
@@ -59,6 +59,15 @@
*/
void aubio_beattracking_do(aubio_beattracking_t * bt, fvec_t * dfframes, fvec_t * out);
+/** get current tempo in bpm
+
+ \param bt beat tracking object
+
+ Returns the currently observed tempo, in beats per minutes, or 0 if no
+ consistent value is found.
+
+*/
+smpl_t aubio_beattracking_get_bpm(aubio_beattracking_t * bt);
/** delete beat tracking object
\param p beat tracking object