Index: src/pitch/pitchyinfft.c
===================================================================
--- src/pitch/pitchyinfft.c	(revision 2ba3440468478fdaaf5b4fbc11e7103d54f7500e)
+++ src/pitch/pitchyinfft.c	(revision 22d33e22c85d5ff1699897f0ef5b6c251a6a5a13)
@@ -34,4 +34,5 @@
   aubio_fft_t * fft;  /**< fft object to compute square difference function */
   fvec_t * yinfft;    /**< Yin function */
+  smpl_t tol;         /**< Yin tolerance */
 };
 
@@ -55,4 +56,5 @@
   p->res    = new_cvec(bufsize,1);
   p->yinfft = new_fvec(bufsize/2+1,1);
+  p->tol    = 0.85;
   p->win    = new_aubio_window(bufsize, aubio_win_hanningz);
   p->weight      = new_fvec(bufsize/2+1,1);
@@ -88,12 +90,14 @@
 }
 
-smpl_t aubio_pitchyinfft_do (aubio_pitchyinfft_t * p, fvec_t * input, smpl_t tol) {
-  uint_t tau, l = 0;
+void aubio_pitchyinfft_do (aubio_pitchyinfft_t * p, fvec_t * input, fvec_t * output) {
+  uint_t i, tau, l;
   uint_t halfperiod;
-  smpl_t tmp = 0, sum = 0;
+  smpl_t tmp, sum;
   cvec_t * res = (cvec_t *)p->res;
   fvec_t * yin = (fvec_t *)p->yinfft;
+  for (i=0; i < input->channels; i++){
+  l = 0; tmp = 0.; sum = 0.;
   for (l=0; l < input->length; l++){
-    p->winput->data[0][l] = p->win->data[0][l] * input->data[0][l];
+    p->winput->data[0][l] = p->win->data[0][l] * input->data[i][l];
   }
   aubio_fft_do(p->fft,p->winput,p->fftout);
@@ -121,5 +125,5 @@
   }
   tau = fvec_min_elem(yin);
-  if (yin->data[0][tau] < tol) {
+  if (yin->data[0][tau] < p->tol) {
     /* no interpolation */
     //return tau;
@@ -128,15 +132,17 @@
     /* additional check for (unlikely) octave doubling in higher frequencies */
     if (tau>35) {
-      return fvec_quadint(yin,tau,1);
+      output->data[i][0] = fvec_quadint(yin,tau,1);
     } else {
       /* should compare the minimum value of each interpolated peaks */
       halfperiod = FLOOR(tau/2+.5);
-      if (yin->data[0][halfperiod] < tol)
-        return fvec_quadint(yin,halfperiod,1);
+      if (yin->data[0][halfperiod] < p->tol)
+        output->data[i][0] = fvec_quadint(yin,halfperiod,1);
       else
-        return fvec_quadint(yin,tau,1);
+        output->data[i][0] = fvec_quadint(yin,tau,1);
     }
-  } else
-    return 0.;
+  } else {
+    output->data[i][0] = 0.;
+  }
+  }
 }
 
@@ -152,2 +158,11 @@
   AUBIO_FREE(p);
 }
+
+uint_t aubio_pitchyinfft_set_tolerance (aubio_pitchyinfft_t * p, smpl_t tol) {
+  p->tol = tol;
+  return 0;
+}
+
+smpl_t aubio_pitchyinfft_get_tolerance (aubio_pitchyinfft_t * p) {
+  return p->tol;
+}
Index: src/pitch/pitchyinfft.h
===================================================================
--- src/pitch/pitchyinfft.h	(revision 2ba3440468478fdaaf5b4fbc11e7103d54f7500e)
+++ src/pitch/pitchyinfft.h	(revision 22d33e22c85d5ff1699897f0ef5b6c251a6a5a13)
@@ -46,8 +46,8 @@
   \param p pitch detection object as returned by new_aubio_pitchyinfft
   \param input input signal window (length as specified at creation time) 
-  \param tol tolerance parameter for minima selection [default 0.85] 
+  \param output pitch period candidates, in samples
  
 */
-smpl_t aubio_pitchyinfft_do (aubio_pitchyinfft_t *p, fvec_t * input, smpl_t tol);
+void aubio_pitchyinfft_do (aubio_pitchyinfft_t *p, fvec_t * input, fvec_t * output);
 /** creation of the pitch detection object
  
@@ -63,4 +63,21 @@
 void del_aubio_pitchyinfft (aubio_pitchyinfft_t *p);
 
+/** get tolerance parameter for YIN algorithm 
+  
+  \param o YIN pitch detection object 
+
+  \return tolerance parameter for minima selection [default 0.15]
+
+*/
+smpl_t aubio_pitchyinfft_get_tolerance (aubio_pitchyinfft_t * p);
+
+/** set tolerance parameter for YIN algorithm 
+  
+  \param o YIN pitch detection object 
+  \param tol tolerance parameter for minima selection [default 0.15]
+
+*/
+uint_t aubio_pitchyinfft_set_tolerance (aubio_pitchyinfft_t * p, smpl_t tol);
+
 #ifdef __cplusplus
 }
Index: tests/src/test-pitchyinfft.c
===================================================================
--- tests/src/test-pitchyinfft.c	(revision 2ba3440468478fdaaf5b4fbc11e7103d54f7500e)
+++ tests/src/test-pitchyinfft.c	(revision 22d33e22c85d5ff1699897f0ef5b6c251a6a5a13)
@@ -6,9 +6,11 @@
         uint_t channels   = 1;                          /* number of channel */
         fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        fvec_t * out      = new_fvec (1, channels); /* output pitch periods */
         aubio_pitchyinfft_t * o  = new_aubio_pitchyinfft(win_s);
+        aubio_pitchyinfft_set_tolerance (o, 0.2);
         uint_t i = 0;
 
         while (i < 10) {
-          aubio_pitchyinfft_do (o,in,0.2);
+          aubio_pitchyinfft_do (o,in,out);
           i++;
         };
