#include "utils_tests.h"
int test_wrong_params(void);
int main (int argc, char **argv)
{
if (argc < 2) {
PRINT_WRN("no arguments, running tests\n");
err = test_wrong_params();
PRINT_MSG("usage: %s <source_path> [samplerate] [win_size] [hop_size]\n",
argv[0]);
return err;
}
if ( argc >= 3 ) samplerate = atoi(argv[2]);
if ( argc >= 4 ) win_size = atoi(argv[3]);
uint_t hop_size = win_size / 4;
if ( argc >= 5 ) hop_size = atoi(argv[4]);
uint_t n_frames = 0, read = 0;
char_t *source_path = argv[1];
hop_size);
if (!source) { err = 1; goto beach; }
samplerate);
if (!o) { err = 1; goto beach_tempo; }
do {
PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2f bpm "
"with confidence %.2f\n",
}
n_frames += read;
} while ( read == hop_size );
PRINT_MSG("read %.2fs, %d frames at %dHz (%d blocks) from %s\n",
n_frames * 1. / samplerate,
n_frames, samplerate,
n_frames / hop_size, source_path);
beach_tempo:
beach:
return err;
}
int test_wrong_params(void)
{
if (
new_aubio_tempo(
"undefined", win_size, hop_size, samplerate))
return 1;
if (!t) return 1;
if (!t) return 1;
for (i = 0; i < 256 + 1; i++)
{
PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2f bpm "
"with confidence %.2f, was tatum %d\n",
}
return run_on_default_source(main);
}
Global aubio include file.
fvec_t * new_fvec(uint_t length)
fvec_t buffer creation function
void del_fvec(fvec_t *s)
fvec_t buffer deletion function
void aubio_cleanup(void)
clean up cached memory at the end of program
uint_t aubio_source_get_samplerate(aubio_source_t *s)
get samplerate of source object
struct _aubio_source_t aubio_source_t
media source object
aubio_source_t * new_aubio_source(const char_t *uri, uint_t samplerate, uint_t hop_size)
create new aubio_source_t
void del_aubio_source(aubio_source_t *s)
close source and cleanup memory
void aubio_source_do(aubio_source_t *s, fvec_t *read_to, uint_t *read)
read monophonic vector of length hop_size from source object
smpl_t * data
data vector of length fvec_t.length
smpl_t aubio_tempo_get_confidence(aubio_tempo_t *o)
get current tempo confidence
aubio_tempo_t * new_aubio_tempo(const char_t *method, uint_t buf_size, uint_t hop_size, uint_t samplerate)
create tempo detection object
void del_aubio_tempo(aubio_tempo_t *o)
delete tempo detection object
struct _aubio_tempo_t aubio_tempo_t
tempo detection structure
smpl_t aubio_tempo_get_last_s(aubio_tempo_t *o)
get the time of the latest beat detected, in seconds
uint_t aubio_tempo_get_last(aubio_tempo_t *o)
get the time of the latest beat detected, in samples
void aubio_tempo_do(aubio_tempo_t *o, const fvec_t *input, fvec_t *tempo)
execute tempo detection
smpl_t aubio_tempo_get_last_ms(aubio_tempo_t *o)
get the time of the latest beat detected, in milliseconds
smpl_t aubio_tempo_get_bpm(aubio_tempo_t *o)
get current tempo
uint_t aubio_tempo_was_tatum(aubio_tempo_t *o)
check whether a tatum was detected in the current frame
unsigned int uint_t
unsigned integer