shithub: aubio

Download patch

ref: 8212692b7d1df87a305b3fe5ac23ea343dd7fe04
parent: 4c01c0fe325947e7a0a6141f28755f4995959b3e
parent: f650860dacb65b347c215149b51e224d9061dbff
author: Paul Brossier <piem@piem.org>
date: Sat Jan 9 10:49:40 EST 2010

pull from master

--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -10,6 +10,7 @@
 	aubiomfcc
 
 noinst_PROGRAMS = \
+	aubiopitch
 	aubioquiet
 
 EXTRA_DIST = utils.h sndfileio.h jackio.h
@@ -19,6 +20,7 @@
 aubioonset_SOURCES = aubioonset.c $(COMMON_SOURCE_FILES)
 aubionotes_SOURCES = aubionotes.c $(COMMON_SOURCE_FILES)
 aubiotrack_SOURCES = aubiotrack.c $(COMMON_SOURCE_FILES)
+aubiopitch_SOURCES = aubiopitch.c $(COMMON_SOURCE_FILES)
 aubioquiet_SOURCES = aubioquiet.c $(COMMON_SOURCE_FILES)
 aubiomfcc_SOURCES = aubiomfcc.c $(COMMON_SOURCE_FILES)
 
@@ -25,5 +27,6 @@
 aubioonset_LDADD = @SNDFILE_LIBS@ @JACK_LIBS@
 aubionotes_LDADD = @SNDFILE_LIBS@ @JACK_LIBS@
 aubiotrack_LDADD = @SNDFILE_LIBS@ @JACK_LIBS@
+aubiopitch_LDADD = @SNDFILE_LIBS@ @JACK_LIBS@
 aubioquiet_LDADD = @SNDFILE_LIBS@ @JACK_LIBS@
 aubiomfcc_LDADD = @SNDFILE_LIBS@ @JACK_LIBS@
--- a/examples/utils.c
+++ b/examples/utils.c
@@ -206,22 +206,6 @@
   /* parse command line arguments */
   parse_args (argc, argv);
 
-  woodblock = new_fvec (overlap_size);
-  if (output_filename || usejack) {
-    /* dummy assignement to keep egcs happy */
-    found_wood = (onsetfile = new_aubio_sndfile_ro (onset_filename)) ||
-        (onsetfile = new_aubio_sndfile_ro ("sounds/woodblock.aiff")) ||
-        (onsetfile = new_aubio_sndfile_ro ("../sounds/woodblock.aiff"));
-    if (onsetfile == NULL) {
-      outmsg ("Could not find woodblock.aiff\n");
-      exit (1);
-    }
-  }
-  if (onsetfile) {
-    /* read the output sound once */
-    aubio_sndfile_read_mono (onsetfile, overlap_size, woodblock);
-  }
-
   if (!usejack) {
     debug ("Opening files ...\n");
     file = new_aubio_sndfile_ro (input_filename);
@@ -253,9 +237,24 @@
   }
 #endif /* HAVE_LASH */
 
-  uint_t i;
-  ibuf = new_fvec (overlap_size);
-  obuf = new_fvec (overlap_size);
+  woodblock = new_fvec (overlap_size, channels);
+  if (output_filename || usejack) {
+    /* dummy assignement to keep egcs happy */
+    found_wood = (onsetfile = new_aubio_sndfile_ro (onset_filename)) ||
+        (onsetfile = new_aubio_sndfile_ro ("sounds/woodblock.aiff")) ||
+        (onsetfile = new_aubio_sndfile_ro ("../sounds/woodblock.aiff"));
+    if (onsetfile == NULL) {
+      outmsg ("Could not find woodblock.aiff\n");
+      exit (1);
+    }
+  }
+  if (onsetfile) {
+    /* read the output sound once */
+    aubio_sndfile_read (onsetfile, overlap_size, woodblock);
+  }
+
+  ibuf = new_fvec (overlap_size, channels);
+  obuf = new_fvec (overlap_size, channels);
 
 }
 
--- a/src/spectral/specdesc.c
+++ b/src/spectral/specdesc.c
@@ -273,7 +273,7 @@
   else if (strcmp (onset_mode, "default") == 0)
       onset_type = aubio_onset_default;
   else {
-      AUBIO_ERR("unknown spectral descriptor type %s.\n", onset_mode);
+      AUBIO_ERR("unknown spectral descriptor type %s, using default.\n", onset_mode);
       onset_type = aubio_onset_default;
   }
   switch(onset_type) {
--- /dev/null
+++ b/tests/src/test-pitch.c
@@ -1,0 +1,23 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        fvec_t * out      = new_fvec (1, channels); /* input buffer */
+        aubio_pitch_t *p = new_aubio_pitch ("default", win_s, win_s / 2, channels, 44100);
+        uint_t i = 0;
+
+        while (i < 10) {
+          aubio_pitch_do (p, in, out);
+          i++;
+        };
+
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
+