shithub: aubio

Download patch

ref: c1656cf8f471bd852affbd839abbfff6e7b8f210
parent: 14aebced4f6fec5bbd91cc76023a666f8a9b7451
parent: 97525e4f81d3798352e3a0ba310d857993661a77
author: Paul Brossier <[email protected]>
date: Thu Oct 25 00:02:06 EDT 2007

merge from main branch

--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,7 @@
 
 dnl Check for programs
 AC_PROG_CC
+AM_PROG_CC_C_O dnl compiling with per-target flag 
 if test "$ac_cv_prog_cc" = "no" ; then
    AC_MSG_ERROR([*** No C compiler found !])
 fi
--- a/examples/tests/test-beattracking.c
+++ b/examples/tests/test-beattracking.c
@@ -12,12 +12,17 @@
 
         uint_t i = 0;
 
-        smpl_t curtempo;
+        smpl_t curtempo, curtempoconf;
 
         while (i < 10) {
           aubio_beattracking_do(tempo,in,out);
           curtempo = aubio_beattracking_get_bpm(tempo);
           if (curtempo != 0.) {
+            fprintf(stdout,"%f\n",curtempo);
+            return 1;
+          }
+          curtempoconf = aubio_beattracking_get_confidence(tempo);
+          if (curtempoconf != 0.) {
             fprintf(stdout,"%f\n",curtempo);
             return 1;
           }
--- a/examples/tests/test-tempo.c
+++ b/examples/tests/test-tempo.c
@@ -9,7 +9,7 @@
         aubio_tempo_t * o  = new_aubio_tempo(aubio_onset_complex, win_s, win_s/4, channels);
         uint_t i = 0;
 
-        smpl_t curtempo;
+        smpl_t curtempo, curtempoconf;
 
         while (i < 1000) {
           aubio_tempo(o,in,out);
@@ -16,6 +16,12 @@
           curtempo = aubio_tempo_get_bpm(o);
           if (curtempo != 0.) {
             fprintf(stdout,"%f\n",curtempo);
+            return 1;
+          }
+          curtempoconf = aubio_beattracking_get_confidence(o);
+          if (curtempoconf != 0.) {
+            fprintf(stdout,"%f\n",curtempo);
+            return 1;
           }
           i++;
         };
--- a/python/test/all_tests.py
+++ /dev/null
@@ -1,15 +1,0 @@
-#! /usr/bin/python
-
-# add ${src}/python and ${src}/python/aubio/.libs to python path
-# so the script is runnable from a compiled source tree.
-import sys, os
-sys.path.append('..')
-sys.path.append(os.path.join('..','aubio','.libs'))
-
-import unittest
-
-modules_to_test = ['aubiomodule', 'fvec', 'cvec', 'filterbank']
-
-if __name__ == '__main__':
-  for module in modules_to_test: exec('from %s import *' % module)
-  unittest.main()
--- /dev/null
+++ b/python/test/list_missing_tests
@@ -1,0 +1,30 @@
+#! /usr/bin/python
+
+from glob import glob
+from os.path import splitext, exists
+import sys
+
+if len(sys.argv) > 1: verbose = True
+else: verbose = False
+
+cfiles = [ file.split('/')[-1] for file in glob('../../src/*.c') ]
+cfiles.sort()
+
+for cfile in cfiles: 
+  pythonfile=splitext(cfile)[0]+'.py'
+  if not exists(pythonfile):
+    print "[X] %30s" % cfile, "[ ] %30s" % pythonfile
+    #print cfile, "has NO test", pythonfile
+  elif verbose:
+    print "[X] %30s" % cfile, "[X] %30s" % pythonfile
+
+pythonfiles = [ file.split('/')[-1] for file in glob('*.py') ]
+pythonfiles.sort()
+
+for pythonfile in pythonfiles: 
+  cfile=splitext(pythonfile)[0]+'.c'
+  if not exists('../../'+cfile):
+    print "[ ] %30s" % cfile, "[X] %30s" % pythonfile
+    #print pythonfile, "has NO source", cfile
+  elif verbose:
+    print "[X] %30s" % cfile, "[X] %30s" % pythonfile
--- /dev/null
+++ b/python/test/run_all_tests
@@ -1,0 +1,15 @@
+#! /usr/bin/python
+
+# add ${src}/python and ${src}/python/aubio/.libs to python path
+# so the script is runnable from a compiled source tree.
+import sys, os
+sys.path.append('..')
+sys.path.append(os.path.join('..','aubio','.libs'))
+
+import unittest
+
+modules_to_test = ['aubiomodule', 'fvec', 'cvec', 'filterbank']
+
+if __name__ == '__main__':
+  for module in modules_to_test: exec('from %s import *' % module)
+  unittest.main()
--- a/src/beattracking.c
+++ b/src/beattracking.c
@@ -460,3 +460,8 @@
           return 0.;
         }
 }
+
+smpl_t aubio_beattracking_get_confidence(aubio_beattracking_t * bt) {
+        if (bt->gp) return vec_max(bt->acfout);
+        else return 0.;
+}
--- a/src/beattracking.h
+++ b/src/beattracking.h
@@ -68,6 +68,15 @@
 
 */
 smpl_t aubio_beattracking_get_bpm(aubio_beattracking_t * bt);
+/** get current tempo confidence 
+
+  \param bt beat tracking object
+
+  Returns the confidence with which the tempo has been observed, 0 if no
+  consistent value is found.
+
+*/
+smpl_t aubio_beattracking_get_confidence(aubio_beattracking_t * bt);
 /** delete beat tracking object
 
   \param p beat tracking object
--- a/src/tempo.c
+++ b/src/tempo.c
@@ -127,6 +127,10 @@
   return aubio_beattracking_get_bpm(o->bt);
 }
 
+smpl_t aubio_tempo_get_confidence(aubio_tempo_t *o) {
+  return aubio_beattracking_get_confidence(o->bt);
+}
+
 void del_aubio_tempo (aubio_tempo_t *o)
 {
   del_aubio_onsetdetection(o->od);
--- a/src/tempo.h
+++ b/src/tempo.h
@@ -58,6 +58,16 @@
 */
 smpl_t aubio_tempo_get_bpm(aubio_tempo_t * bt);
 
+/** get current tempo confidence
+
+  \param bt beat tracking object
+
+  Returns the confidence with which the tempo has been observed, 0 if no
+  consistent value is found.
+
+*/
+smpl_t aubio_tempo_get_confidence(aubio_tempo_t * bt);
+
 /** delete tempo detection object */
 void del_aubio_tempo(aubio_tempo_t * o);
 
--- a/swig/aubio.i
+++ b/swig/aubio.i
@@ -270,6 +270,8 @@
 aubio_beattracking_t * new_aubio_beattracking(uint_t winlen, uint_t channels);
 void aubio_beattracking_do(aubio_beattracking_t * bt, fvec_t * dfframes, fvec_t * out);
 void del_aubio_beattracking(aubio_beattracking_t * p);
+smpl_t aubio_beattracking_get_bpm(aubio_beattracking_t * p);
+smpl_t aubio_beattracking_get_confidence(aubio_beattracking_t * p);