ref: d25bd12025e5ae9589fd68c9d020b0947facbe24
parent: 68b8233382ab3433a6c85b63d765b3cfcb4ee384
author: Paul Brossier <[email protected]>
date: Fri Oct 16 17:55:02 EDT 2009
src/tempo: use samplerate
--- a/plugins/puredata/aubiotempo~.c
+++ b/plugins/puredata/aubiotempo~.c
@@ -82,7 +82,8 @@
x->bufsize = 1024;
x->hopsize = x->bufsize / 2;
- x->t = new_aubio_tempo ("complex", x->bufsize, x->hopsize, 1);
+ x->t = new_aubio_tempo ("complex", x->bufsize, x->hopsize, 1,
+ (uint_t) sys_getsr ());
aubio_tempo_set_silence(x->t,x->silence);
aubio_tempo_set_threshold(x->t,x->threshold);
x->output = (fvec_t *)new_fvec(2,1);
--- a/src/tempo/tempo.c
+++ b/src/tempo/tempo.c
@@ -42,6 +42,7 @@
sint_t blockpos; /** current position in dfframe */
uint_t winlen; /** dfframe bufsize */
uint_t step; /** dfframe hopsize */
+ uint_t samplerate; /** sampling rate of the signal */
};
/* execute tempo detection function on iput buffer */
@@ -99,14 +100,15 @@
/* Allocate memory for an tempo detection */
aubio_tempo_t * new_aubio_tempo (char_t * onset_mode,
- uint_t buf_size, uint_t hop_size, uint_t channels)
+ uint_t buf_size, uint_t hop_size, uint_t channels, uint_t samplerate)
{
aubio_tempo_t * o = AUBIO_NEW(aubio_tempo_t);
+ o->samplerate = samplerate;
o->winlen = SQR(512)/hop_size;
o->step = o->winlen/4;
o->blockpos = 0;
o->threshold = 0.3;
- o->silence = -90;
+ o->silence = -90.;
o->blockpos = 0;
o->dfframe = new_fvec(o->winlen,channels);
o->fftgrain = new_cvec(buf_size, channels);
--- a/src/tempo/tempo.h
+++ b/src/tempo/tempo.h
@@ -38,7 +38,7 @@
/** create tempo detection object */
aubio_tempo_t * new_aubio_tempo (char_t * mode,
- uint_t buf_size, uint_t hop_size, uint_t channels);
+ uint_t buf_size, uint_t hop_size, uint_t channels, uint_t samplerate);
/** execute tempo detection */
void aubio_tempo_do (aubio_tempo_t *o, fvec_t * input, fvec_t * tempo);