src/pitch: use a string to set pitch method, add a new function to set pitch unit...
authorPaul Brossier <piem@piem.org>
Thu, 15 Oct 2009 16:54:23 +0000 (18:54 +0200)
committerPaul Brossier <piem@piem.org>
Thu, 15 Oct 2009 16:54:23 +0000 (18:54 +0200)
14 files changed:
examples/aubionotes.c
examples/aubioonset.c
examples/utils.c
examples/utils.h
plugins/puredata/aubiopitch~.c
python/aubio/aubioclass.py
python/aubio/task/params.py
python/aubio/task/pitch.py
python/aubio/task/utils.py
python/aubiopitch
src/pitch/pitchdetection.c
src/pitch/pitchdetection.h
swig/aubio.i
tests/src/test-pitchdetection.c

index 39af51b82ec6295f41761444e46aab899b8da016..7017bd988cdffb6ef64f1be0a0fa9feb23597138 100644 (file)
@@ -39,10 +39,6 @@ int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
       /* block loop */
       aubio_pvoc_do (pv,ibuf, fftgrain);
       aubio_onsetdetection_do(o,fftgrain, onset);
-      if (usedoubled) {
-        aubio_onsetdetection_do(o2,fftgrain, onset2);
-        onset->data[0][0] *= onset2->data[0][0];
-      }
       isonset = aubio_peakpicker_do(parms, onset);
       
       aubio_pitchdetection_do (pitchdet, ibuf, pitch_obuf);
index d0b8d9f789f3ee1704ea8741d2040abd58c41272..1af5b3eaf565180840b0f8568f4593d5c1e22a48 100644 (file)
@@ -39,10 +39,6 @@ int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
       /* block loop */
       aubio_pvoc_do (pv,ibuf, fftgrain);
       aubio_onsetdetection_do (o,fftgrain, onset);
-      if (usedoubled) {
-        aubio_onsetdetection_do (o2,fftgrain, onset2);
-        onset->data[0][0] *= onset2->data[0][0];
-      }
       isonset = aubio_peakpicker_do(parms, onset);
       if (isonset) {
         /* test for silence */
index 5fc764256592b8b62a5f83e3b3c7557246aa691c..22e6b95ab8f0d363e34599bd4688fef2353a2628 100644 (file)
@@ -64,7 +64,6 @@ fvec_t *pitch_obuf;
 cvec_t *fftgrain;
 fvec_t *woodblock;
 aubio_onsetdetection_t *o;
-aubio_onsetdetection_t *o2;
 fvec_t *onset;
 fvec_t *onset2;
 smpl_t isonset = 0;
@@ -74,8 +73,8 @@ aubio_peakpicker_t *parms;
 /* pitch objects */
 smpl_t pitch = 0.;
 aubio_pitchdetection_t *pitchdet;
-aubio_pitchdetection_type type_pitch = aubio_pitch_yinfft;      // aubio_pitch_mcomb
-aubio_pitchdetection_mode mode_pitch = aubio_pitchm_freq;
+char_t * pitch_unit = "default";
+char_t * pitch_mode = "default";
 uint_t median = 6;
 
 fvec_t *note_buffer = NULL;
@@ -176,20 +175,7 @@ parse_args (int argc, char **argv)
          */
         break;
       case 'p':
-        if (strcmp (optarg, "mcomb") == 0)
-          type_pitch = aubio_pitch_mcomb;
-        else if (strcmp (optarg, "yinfft") == 0)
-          type_pitch = aubio_pitch_yin;
-        else if (strcmp (optarg, "yin") == 0)
-          type_pitch = aubio_pitch_yin;
-        else if (strcmp (optarg, "schmitt") == 0)
-          type_pitch = aubio_pitch_schmitt;
-        else if (strcmp (optarg, "fcomb") == 0)
-          type_pitch = aubio_pitch_fcomb;
-        else {
-          errmsg ("unknown pitch type.\n");
-          abort ();
-        }
+        pitch_mode = optarg;
         break;
       case 'a':
         averaging = 1;
@@ -293,8 +279,8 @@ examples_common_init (int argc, char **argv)
   fftgrain = new_cvec (buffer_size, channels);
 
   if (usepitch) {
-    pitchdet = new_aubio_pitchdetection (buffer_size * 4,
-        overlap_size, channels, samplerate, type_pitch, mode_pitch);
+    pitchdet = new_aubio_pitchdetection (pitch_mode, buffer_size * 4,
+        overlap_size, channels, samplerate);
     aubio_pitchdetection_set_tolerance (pitchdet, 0.7);
     pitch_obuf = new_fvec (1, channels);
 
@@ -325,10 +311,6 @@ examples_common_del (void)
     }
     del_fvec (pitch_obuf);
   }
-  if (usedoubled) {
-    del_aubio_onsetdetection (o2);
-    del_fvec (onset2);
-  }
   del_aubio_onsetdetection (o);
   del_aubio_peakpicker (parms);
   del_aubio_pvoc (pv);
index 3a857aa14a5f73b555c1b9948d62a929a2b596f5..c14ef60051375bf022942091c29cb899652fe004 100644 (file)
@@ -107,7 +107,6 @@ extern aubio_peakpicker_t *parms;
 /* pitch objects */
 extern smpl_t pitch;
 extern aubio_pitchdetection_t *pitchdet;
-extern aubio_pitchdetection_type mode;
 extern uint_t median;
 
 extern fvec_t *note_buffer;
index fad8882b14e5b5493f8aa79a27c2cb7c1adae510..487c01b49cc736b3564931098e6c909e0c87764e 100644 (file)
@@ -13,9 +13,6 @@
 
 char aubiopitch_version[] = "aubiopitch~ version 0.1";
 
-aubio_pitchdetection_type type_pitch = aubio_pitch_yinfft;
-aubio_pitchdetection_mode mode_pitch = aubio_pitchm_freq;
-
 static t_class *aubiopitch_tilde_class;
 
 void aubiopitch_tilde_setup (void);
@@ -78,23 +75,9 @@ static void *aubiopitch_tilde_new (t_symbol * s)
        x->bufsize   = 2048;
        x->hopsize   = x->bufsize / 2;
 
-        if (strcmp(s->s_name,"mcomb") == 0) 
-                type_pitch = aubio_pitch_mcomb;
-        else if (strcmp(s->s_name,"yinfft") == 0) 
-                type_pitch = aubio_pitch_yin;
-        else if (strcmp(s->s_name,"yin") == 0) 
-                type_pitch = aubio_pitch_yin;
-        else if (strcmp(s->s_name,"schmitt") == 0) 
-                type_pitch = aubio_pitch_schmitt;
-        else if (strcmp(s->s_name,"fcomb") == 0) 
-                type_pitch = aubio_pitch_fcomb;
-        else {
-                post("unknown pitch type, using default.\n");
-        }
-
        //FIXME: get the real samplerate
-       x->o = new_aubio_pitchdetection(x->bufsize, 
-                    x->hopsize, 1, 44100., type_pitch, mode_pitch);
+    x->o = new_aubio_pitchdetection(s->s_name, x->bufsize, 
+            x->hopsize, 1, 44100.);
        aubio_pitchdetection_set_tolerance (x->o, 0.7);
        x->vec = (fvec_t *)new_fvec(x->hopsize,1);
        x->pitchvec = (fvec_t *)new_fvec(1,1);
index 6ec95ace002c931c2abad72b6341e944c9c28c4f..530fa4b8d9381f2a36bb3bb816803f14c9886a2b 100644 (file)
@@ -124,11 +124,12 @@ class onsetpick:
         return isonset, dval
 
 class pitchdetection:
-    def __init__(self,mode=aubio_pitch_mcomb,bufsize=2048,hopsize=1024,
-        channels=1,samplerate=44100.,omode=aubio_pitchm_freq,tolerance=0.1):
-        self.pitchp = new_aubio_pitchdetection(bufsize,hopsize,channels,
-                samplerate,mode,omode)
+    def __init__(self,mode="mcomb",bufsize=2048,hopsize=1024,
+        channels=1,samplerate=44100.,omode="freq",tolerance=0.1):
+        self.pitchp = new_aubio_pitchdetection(mode,bufsize,hopsize,channels,
+            samplerate)
         self.mypitch = fvec(1, channels)
+        aubio_pitchdetection_set_unit(self.pitchp,omode)
         aubio_pitchdetection_set_tolerance(self.pitchp,tolerance)
         #self.filt     = filter(srate,"adsgn")
     def __del__(self):
index 8907da039216ab51cab61de20267c276da79a3fb..b6be43f311e552f58072c382e71cbf5470bac7d7 100644 (file)
@@ -1,4 +1,3 @@
-from aubio.aubioclass import aubio_pitchm_freq
 
 class taskparams(object):
        """ default parameters for task classes """
@@ -29,6 +28,6 @@ class taskparams(object):
                self.pitchmax=20000.
                self.pitchdelay = -0.5
                self.dcthreshold = -1.
-               self.omode = aubio_pitchm_freq
+               self.omode = "freq"
                self.verbose   = False
 
index 1db00b3b74fb10b77f0dfd5e843be63bb8ca6955..1a10327d7045c6a962b30a6445e4d8e9d61f1be7 100644 (file)
@@ -13,7 +13,7 @@ class taskpitch(task):
                        tolerance = self.params.yinfftthresh
                else:
                        tolerance = 0.
-               self.pitchdet   = pitchdetection(mode=get_pitch_mode(self.params.pitchmode),
+               self.pitchdet   = pitchdetection(mode=self.params.pitchmode,
                        bufsize=self.params.bufsize,
                        hopsize=self.params.hopsize,
                        channels=self.channels,
index 95491a601d1d4d549044e215b96abdadf8d46a30..eb33f72e4d4a0439431b3729a4ce38a37b14faf6 100644 (file)
@@ -25,23 +25,6 @@ def get_onset_mode(nvalue):
                 print "unknown onset detection function selected: %s" % nvalue
                 sys.exit(1)
 
-def get_pitch_mode(nvalue):
-       """ utility function to convert a string to aubio_pitchdetection_type """
-       if   nvalue == 'mcomb'  :
-                return aubio_pitch_mcomb
-       elif nvalue == 'yin'    :
-                return aubio_pitch_yin
-       elif nvalue == 'fcomb'  :
-                return aubio_pitch_fcomb
-       elif nvalue == 'schmitt':
-                return aubio_pitch_schmitt
-       elif nvalue == 'yinfft':
-                return aubio_pitch_yinfft
-       else:
-                import sys
-                print "error: unknown pitch detection function selected"
-                sys.exit(1)
-
 def check_onset_mode(option, opt, value, parser):
        """ wrapper function to convert a list of modes to 
                aubio_onsetdetection_type """
@@ -58,21 +41,3 @@ def check_pitch_mode(option, opt, value, parser):
        for nvalue in nvalues:
                val.append(get_pitch_mode(nvalue))
                setattr(parser.values, option.dest, val)
-
-def check_pitchm_mode(option, opt, value, parser):
-       """ utility function to convert a string to aubio_pitchdetection_mode """
-       nvalue = parser.rargs[0]
-       if   nvalue == 'freq'  :
-                setattr(parser.values, option.dest, aubio_pitchm_freq)
-       elif nvalue == 'midi'  :
-                setattr(parser.values, option.dest, aubio_pitchm_midi)
-       elif nvalue == 'cent'  :
-                setattr(parser.values, option.dest, aubio_pitchm_cent)
-       elif nvalue == 'bin'   :
-                setattr(parser.values, option.dest, aubio_pitchm_bin)
-       else:
-                import sys
-                print "error: unknown pitch detection output selected"
-                sys.exit(1)
-
-
index 49d30a2f6b7f2e3bc30586ebd687e28f06518cbf..3db19ea461b74336ad64ba688efe2c983d588acc 100755 (executable)
@@ -17,12 +17,11 @@ def parse_args():
       action="store", dest="filename", 
       help="input sound file")
   parser.add_option("-m","--mode", 
-      action="store", dest="mode", default='mcomb',
+      action="store", dest="mode", default='yinfft',
       help="pitch detection mode [default=mcomb] \
       mcomb|yin|fcomb|schmitt")
-  parser.add_option("-u","--units", action="callback", 
-      callback=check_pitchm_mode, dest="omode",
-      default=aubio_pitchm_freq,
+  parser.add_option("-u","--units",
+      action="store", dest="omode", default="freq",
       help="output pitch in units [default=Hz] \
       freq|midi|cent|bin")
   parser.add_option("-B","--bufsize",
@@ -77,10 +76,10 @@ def parse_args():
       help="be quiet")
   (options, args) = parser.parse_args()
   if not options.bufsize:
-    if options.mode == aubio_pitch_yin:     options.bufsize = 1024
-    if options.mode == aubio_pitch_schmitt: options.bufsize = 2048
-    if options.mode == aubio_pitch_mcomb:   options.bufsize = 4096
-    if options.mode == aubio_pitch_fcomb:   options.bufsize = 4096 
+    if options.mode == "yin":     options.bufsize = 1024
+    if options.mode == "schmitt": options.bufsize = 2048
+    if options.mode == "mcomb":   options.bufsize = 4096
+    if options.mode == "fcomb":   options.bufsize = 4096 
     else: options.bufsize = 2048
   if not options.hopsize:
     options.hopsize = float(options.bufsize) / 2
@@ -105,7 +104,6 @@ params.verbose    = options.verbose
 if options.smoothing: params.pitchsmooth = int(options.smoothing)
 if options.pitchmax:  params.pitchmax    = int(options.pitchmax)
 if options.pitchmin:  params.pitchmin    = int(options.pitchmin)
-if options.omode:     params.omode       = int(options.omode)
 #mintol     = float(options.mintol)*step
 # default take back system delay
 if options.delay: params.pitchdelay = float(options.delay)
index da3d0feeb8c235e4903d6b5cbe603582503b70d9..9c85b311567c55df62a70bd0643df43e8c78af15 100644 (file)
 #include "pitch/pitchyinfft.h"
 #include "pitch/pitchdetection.h"
 
+/** pitch detection algorithm */
+typedef enum {
+  aubio_pitch_yin,     /**< YIN algorithm */
+  aubio_pitch_mcomb,   /**< Multi-comb filter */
+  aubio_pitch_schmitt, /**< Schmitt trigger */
+  aubio_pitch_fcomb,   /**< Fast comb filter */
+  aubio_pitch_yinfft,   /**< Spectral YIN */
+  aubio_pitch_default = aubio_pitch_yinfft, /**< the one used when "default" is asked */
+} aubio_pitchdetection_type;
+
+/** pitch detection output mode */
+typedef enum {
+  aubio_pitchm_freq,   /**< Frequency (Hz) */
+  aubio_pitchm_midi,   /**< MIDI note (0.,127) */
+  aubio_pitchm_cent,   /**< Cent */
+  aubio_pitchm_bin,    /**< Frequency bin (0,bufsize) */
+  aubio_pitchm_default = aubio_pitchm_freq, /**< the one used when "default" is asked */
+} aubio_pitchdetection_mode;
+
 typedef void (*aubio_pitchdetection_func_t)
   (aubio_pitchdetection_t *p, fvec_t * ibuf, fvec_t *obuf);
 typedef smpl_t (*aubio_pitchdetection_conv_t)
@@ -80,17 +99,32 @@ smpl_t freqconvpass(smpl_t f,uint_t srate UNUSED,uint_t bufsize UNUSED){
   return f;
 }
 
-aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize, 
-    uint_t hopsize, 
-    uint_t channels,
-    uint_t samplerate,
-    aubio_pitchdetection_type type,
-    aubio_pitchdetection_mode mode)
+aubio_pitchdetection_t *
+new_aubio_pitchdetection (char_t * pitch_mode,
+    uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate)
 {
   aubio_pitchdetection_t *p = AUBIO_NEW(aubio_pitchdetection_t);
+  aubio_pitchdetection_type pitch_type;
+  if (strcmp (pitch_mode, "mcomb") == 0)
+      pitch_type = aubio_pitch_mcomb;
+  else if (strcmp (pitch_mode, "yinfft") == 0)
+      pitch_type = aubio_pitch_yin;
+  else if (strcmp (pitch_mode, "yin") == 0)
+      pitch_type = aubio_pitch_yin;
+  else if (strcmp (pitch_mode, "schmitt") == 0)
+      pitch_type = aubio_pitch_schmitt;
+  else if (strcmp (pitch_mode, "fcomb") == 0)
+      pitch_type = aubio_pitch_fcomb;
+  else if (strcmp (pitch_mode, "default") == 0)
+      pitch_type = aubio_pitch_default;
+  else {
+      AUBIO_ERR ("unknown pitch detection method %s, using default.\n", pitch_mode);
+      pitch_type = aubio_pitch_default;
+      return NULL;
+  }
   p->srate = samplerate;
-  p->type = type;
-  p->mode = mode;
+  p->type = pitch_type;
+  aubio_pitchdetection_set_unit (p, "default");
   p->bufsize = bufsize;
   switch(p->type) {
     case aubio_pitch_yin:
@@ -125,23 +159,6 @@ aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize,
     default:
       break;
   }
-  switch(p->mode) {
-    case aubio_pitchm_freq:
-      p->freqconv = freqconvpass;
-      break;
-    case aubio_pitchm_midi:
-      p->freqconv = freqconvmidi;
-      break;
-    case aubio_pitchm_cent:
-      /* bug: not implemented */
-      p->freqconv = freqconvmidi;
-      break;
-    case aubio_pitchm_bin:
-      p->freqconv = freqconvbin;
-      break;
-    default:
-      break;
-  }
   return p;
 }
 
@@ -190,6 +207,43 @@ void aubio_pitchdetection_slideblock(aubio_pitchdetection_t *p, fvec_t *ibuf){
   }
 }
 
+uint_t aubio_pitchdetection_set_unit (aubio_pitchdetection_t *p, char_t * pitch_unit) {
+  aubio_pitchdetection_mode pitch_mode;
+  if (strcmp (pitch_unit, "freq") == 0)
+      pitch_mode = aubio_pitchm_freq;
+  else if (strcmp (pitch_unit, "midi") == 0)
+      pitch_mode = aubio_pitchm_midi;
+  else if (strcmp (pitch_unit, "cent") == 0)
+      pitch_mode = aubio_pitchm_cent;
+  else if (strcmp (pitch_unit, "bin") == 0)
+      pitch_mode = aubio_pitchm_bin;
+  else if (strcmp (pitch_unit, "default") == 0)
+      pitch_mode = aubio_pitchm_default;
+  else {
+      AUBIO_ERR ("unknown pitch detection unit %s, using default\n", pitch_unit);
+      pitch_mode = aubio_pitchm_default;
+  }
+  p->mode = pitch_mode;
+  switch(p->mode) {
+    case aubio_pitchm_freq:
+      p->freqconv = freqconvpass;
+      break;
+    case aubio_pitchm_midi:
+      p->freqconv = freqconvmidi;
+      break;
+    case aubio_pitchm_cent:
+      /* bug: not implemented */
+      p->freqconv = freqconvmidi;
+      break;
+    case aubio_pitchm_bin:
+      p->freqconv = freqconvbin;
+      break;
+    default:
+      break;
+  }
+  return 0;
+}
+
 void aubio_pitchdetection_set_tolerance(aubio_pitchdetection_t *p, smpl_t tol) {
   switch(p->type) {
     case aubio_pitch_yin:
index fa013fd4a10617d22c80580b32de006e1386ab69..e2c9bfdfa041afd0a7d3118c1f26be1bea1406be 100644 (file)
@@ -32,23 +32,6 @@ extern "C" {
 
 */
 
-/** pitch detection algorithm */
-typedef enum {
-  aubio_pitch_yin,     /**< YIN algorithm */
-  aubio_pitch_mcomb,   /**< Multi-comb filter */
-  aubio_pitch_schmitt, /**< Schmitt trigger */
-  aubio_pitch_fcomb,   /**< Fast comb filter */
-  aubio_pitch_yinfft   /**< Spectral YIN */
-} aubio_pitchdetection_type;
-
-/** pitch detection output mode */
-typedef enum {
-  aubio_pitchm_freq,   /**< Frequency (Hz) */
-  aubio_pitchm_midi,   /**< MIDI note (0.,127) */
-  aubio_pitchm_cent,   /**< Cent */
-  aubio_pitchm_bin     /**< Frequency bin (0,bufsize) */
-} aubio_pitchdetection_mode;
-
 /** pitch detection object */
 typedef struct _aubio_pitchdetection_t aubio_pitchdetection_t;
 
@@ -84,12 +67,11 @@ void del_aubio_pitchdetection(aubio_pitchdetection_t * p);
   \param mode set pitch units for output
 
 */
-aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize,
-    uint_t hopsize,
-    uint_t channels,
-    uint_t samplerate,
-    aubio_pitchdetection_type pitch_type,
-    aubio_pitchdetection_mode pitch_mode);
+aubio_pitchdetection_t *new_aubio_pitchdetection (char_t * pitch_mode,
+    uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate);
+
+/** set the output unit of the pitch detection object */
+uint_t aubio_pitchdetection_set_unit (aubio_pitchdetection_t *p, char_t * pitch_unit);
 
 #ifdef __cplusplus
 }
index 8842cce5d5d7cc16ce2e135f20a295868c9dfea7..599d205469688e67c02af4ede613e69db66aef1d 100644 (file)
@@ -198,34 +198,13 @@ void aubio_pvoc_do(aubio_pvoc_t *pv, fvec_t *in, cvec_t * fftgrain);
 void aubio_pvoc_rdo(aubio_pvoc_t *pv, cvec_t * fftgrain, fvec_t *out);
 
 /* pitch detection */
-typedef enum {
-        aubio_pitch_yin,
-        aubio_pitch_mcomb,
-        aubio_pitch_schmitt,
-        aubio_pitch_fcomb,
-        aubio_pitch_yinfft
-} aubio_pitchdetection_type;
-
-typedef enum {
-        aubio_pitchm_freq,
-        aubio_pitchm_midi,
-        aubio_pitchm_cent,
-        aubio_pitchm_bin
-} aubio_pitchdetection_mode;
-
+aubio_pitchdetection_t *new_aubio_pitchdetection (char *pitch_mode,
+    uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate);
 void aubio_pitchdetection_do (aubio_pitchdetection_t * p, fvec_t * ibuf, fvec_t * obuf);
-
 void aubio_pitchdetection_set_tolerance(aubio_pitchdetection_t *p, smpl_t thres);
-
+void aubio_pitchdetection_set_unit(aubio_pitchdetection_t *p, char * pitch_unit);
 void del_aubio_pitchdetection(aubio_pitchdetection_t * p);
 
-aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize, 
-    uint_t hopsize, 
-    uint_t channels,
-    uint_t samplerate,
-    aubio_pitchdetection_type type,
-    aubio_pitchdetection_mode mode);
-
 
 /* pitch mcomb */
 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t bufsize, uint_t hopsize, uint_t channels);
index 4d72232764d92c37c790354f45314e989ebf7d96..e50f0aa698c53b94e292722b18523c20317da457 100644 (file)
@@ -1,28 +1,27 @@
 #include <aubio.h>
 
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t hop_s      = win_s/4;                    /* hop size */
-        uint_t samplerate = 44100;                      /* samplerate */
-        uint_t channels   = 1;                          /* number of channel */
-        aubio_pitchdetection_mode mode = aubio_pitchm_freq;
-        aubio_pitchdetection_type type = aubio_pitch_yinfft;
-        fvec_t * in       = new_fvec (hop_s, channels); /* input buffer */
-        fvec_t * out       = new_fvec (1, channels); /* input buffer */
-        aubio_pitchdetection_t * o  = new_aubio_pitchdetection(
-          win_s, hop_s, channels, samplerate, type, mode
-          );
-        uint_t i = 0;
+int
+main ()
+{
+  /* allocate some memory */
+  uint_t win_s = 1024;          /* window size */
+  uint_t hop_s = win_s / 4;     /* hop size */
+  uint_t samplerate = 44100;    /* samplerate */
+  uint_t channels = 1;          /* number of channel */
+  fvec_t *in = new_fvec (hop_s, channels);      /* input buffer */
+  fvec_t *out = new_fvec (1, channels); /* input buffer */
+  aubio_pitchdetection_t *o =
+      new_aubio_pitchdetection ("default", win_s, hop_s, channels, samplerate);
+  uint_t i = 0;
 
-        while (i < 100) {
-          aubio_pitchdetection_do (o,in, out);
-          i++;
-        };
+  while (i < 100) {
+    aubio_pitchdetection_do (o, in, out);
+    i++;
+  };
 
-        del_aubio_pitchdetection(o);
-        del_fvec(in);
-        aubio_cleanup();
+  del_aubio_pitchdetection (o);
+  del_fvec (in);
+  aubio_cleanup ();
 
-        return 0;
+  return 0;
 }