source: src/pitch/pitch.c @ 695a248

feature/crepe_org
Last change on this file since 695a248 was 18278232, checked in by Paul Brossier <piem@piem.org>, 6 years ago

[pitch] crepe only supports samplerate==16000 and bufsize==1024 for now

  • Property mode set to 100644
File size: 17.8 KB
Line 
1/*
2  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
3
4  This file is part of aubio.
5
6  aubio is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10
11  aubio is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15
16  You should have received a copy of the GNU General Public License
17  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
18
19*/
20
21#include "aubio_priv.h"
22#include "fvec.h"
23#include "cvec.h"
24#include "lvec.h"
25#include "mathutils.h"
26#include "musicutils.h"
27#include "spectral/phasevoc.h"
28#include "temporal/filter.h"
29#include "temporal/c_weighting.h"
30#include "pitch/pitchmcomb.h"
31#include "pitch/pitchyin.h"
32#include "pitch/pitchfcomb.h"
33#include "pitch/pitchschmitt.h"
34#include "pitch/pitchyinfft.h"
35#include "pitch/pitchyinfast.h"
36#include "pitch/pitchspecacf.h"
37#include "pitch/pitch.h"
38
39#define DEFAULT_PITCH_SILENCE -50.
40
41/** pitch detection algorithms */
42typedef enum
43{
44  aubio_pitcht_yin,        /**< `yin`, YIN algorithm */
45  aubio_pitcht_mcomb,      /**< `mcomb`, Multi-comb filter */
46  aubio_pitcht_schmitt,    /**< `schmitt`, Schmitt trigger */
47  aubio_pitcht_fcomb,      /**< `fcomb`, Fast comb filter */
48  aubio_pitcht_yinfft,     /**< `yinfft`, Spectral YIN */
49  aubio_pitcht_yinfast,    /**< `yinfast`, YIN fast */
50  aubio_pitcht_specacf,    /**< `specacf`, Spectral autocorrelation */
51  aubio_pitcht_crepe,      /**< `crepe`, convolutional neural network */
52  aubio_pitcht_default
53    = aubio_pitcht_yinfft, /**< `default` */
54} aubio_pitch_type;
55
56/** pitch detection output modes */
57typedef enum
58{
59  aubio_pitchm_freq,   /**< Frequency (Hz) */
60  aubio_pitchm_midi,   /**< MIDI note (0.,127) */
61  aubio_pitchm_cent,   /**< Cent */
62  aubio_pitchm_bin,    /**< Frequency bin (0,bufsize) */
63  aubio_pitchm_default = aubio_pitchm_freq, /**< the one used when "default" is asked */
64} aubio_pitch_mode;
65
66/** callback to get pitch candidate, defined below */
67typedef void (*aubio_pitch_detect_t) (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
68
69/** callback to convert pitch from one unit to another, defined below */
70typedef smpl_t(*aubio_pitch_convert_t) (smpl_t value, uint_t samplerate, uint_t bufsize);
71
72/** callback to fetch the confidence of the algorithm */
73typedef smpl_t (*aubio_pitch_get_conf_t) (void * p);
74
75/** generic pitch detection structure */
76struct _aubio_pitch_t
77{
78  aubio_pitch_type type;          /**< pitch detection mode */
79  aubio_pitch_mode mode;          /**< pitch detection output mode */
80  uint_t samplerate;              /**< samplerate */
81  uint_t bufsize;                 /**< buffer size */
82  void *p_object;                 /**< pointer to pitch object */
83  aubio_filter_t *filter;         /**< filter */
84  fvec_t *filtered;               /**< filtered input */
85  aubio_pvoc_t *pv;               /**< phase vocoder for mcomb */
86  cvec_t *fftgrain;               /**< spectral frame for mcomb */
87  fvec_t *buf;                    /**< temporary buffer for yin */
88  aubio_pitch_detect_t detect_cb; /**< callback to get the pitch candidates */
89  aubio_pitch_convert_t conv_cb;  /**< callback to convert it to the desired unit */
90  aubio_pitch_get_conf_t conf_cb; /**< pointer to the current confidence callback */
91  smpl_t silence;                 /**< silence threshold */
92};
93
94/* callback functions for pitch detection */
95static void aubio_pitch_do_mcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
96static void aubio_pitch_do_yin (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
97static void aubio_pitch_do_schmitt (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
98static void aubio_pitch_do_fcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
99static void aubio_pitch_do_yinfft (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
100static void aubio_pitch_do_yinfast (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
101static void aubio_pitch_do_specacf (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
102static void aubio_pitch_do_crepe (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
103
104/* internal functions for frequency conversion */
105static smpl_t freqconvbin (smpl_t f, uint_t samplerate, uint_t bufsize);
106static smpl_t freqconvmidi (smpl_t f, uint_t samplerate, uint_t bufsize);
107static smpl_t freqconvpass (smpl_t f, uint_t samplerate, uint_t bufsize);
108
109typedef struct _aubio_pitch_crepe_t aubio_pitch_crepe_t;
110extern aubio_pitch_crepe_t *new_aubio_pitch_crepe(void);
111extern void aubio_pitch_crepe_do(aubio_pitch_crepe_t *t, fvec_t *input, fvec_t *out);
112extern void del_aubio_pitch_crepe(aubio_pitch_crepe_t *t);
113extern smpl_t aubio_pitch_crepe_get_confidence (aubio_pitch_crepe_t * o);
114uint_t aubio_pitch_crepe_set_tolerance(aubio_pitch_crepe_t * o, smpl_t
115    tolerance);
116smpl_t aubio_pitch_crepe_get_tolerance (aubio_pitch_crepe_t * o);
117
118/* adapter to stack ibuf new samples at the end of buf, and trim `buf` to `bufsize` */
119void aubio_pitch_slideblock (aubio_pitch_t * p, const fvec_t * ibuf);
120
121
122aubio_pitch_t *
123new_aubio_pitch (const char_t * pitch_mode,
124    uint_t bufsize, uint_t hopsize, uint_t samplerate)
125{
126  aubio_pitch_t *p = AUBIO_NEW (aubio_pitch_t);
127  aubio_pitch_type pitch_type;
128  if (pitch_mode == NULL) {
129    AUBIO_ERR ("pitch: can not use ‘NULL‘ for pitch detection method\n");
130    goto beach;
131  }
132  if (strcmp (pitch_mode, "mcomb") == 0)
133    pitch_type = aubio_pitcht_mcomb;
134  else if (strcmp (pitch_mode, "yinfast") == 0)
135    pitch_type = aubio_pitcht_yinfast;
136  else if (strcmp (pitch_mode, "yinfft") == 0)
137    pitch_type = aubio_pitcht_yinfft;
138  else if (strcmp (pitch_mode, "yin") == 0)
139    pitch_type = aubio_pitcht_yin;
140  else if (strcmp (pitch_mode, "schmitt") == 0)
141    pitch_type = aubio_pitcht_schmitt;
142  else if (strcmp (pitch_mode, "fcomb") == 0)
143    pitch_type = aubio_pitcht_fcomb;
144  else if (strcmp (pitch_mode, "specacf") == 0)
145    pitch_type = aubio_pitcht_specacf;
146  else if (strcmp (pitch_mode, "crepe") == 0)
147    pitch_type = aubio_pitcht_crepe;
148  else if (strcmp (pitch_mode, "default") == 0)
149    pitch_type = aubio_pitcht_default;
150  else {
151    AUBIO_ERR ("pitch: unknown pitch detection method ‘%s’\n", pitch_mode);
152    goto beach;
153  }
154
155  // check parameters are valid
156  if ((sint_t)hopsize < 1) {
157    AUBIO_ERR("pitch: got hopsize %d, but can not be < 1\n", hopsize);
158    goto beach;
159  } else if ((sint_t)bufsize < 1) {
160    AUBIO_ERR("pitch: got buffer_size %d, but can not be < 1\n", bufsize);
161    goto beach;
162  } else if (bufsize < hopsize) {
163    AUBIO_ERR("pitch: hop size (%d) is larger than win size (%d)\n", hopsize, bufsize);
164    goto beach;
165  } else if ((sint_t)samplerate < 1) {
166    AUBIO_ERR("pitch: samplerate (%d) can not be < 1\n", samplerate);
167    goto beach;
168  }
169
170  p->samplerate = samplerate;
171  p->type = pitch_type;
172  aubio_pitch_set_unit (p, "default");
173  p->bufsize = bufsize;
174  p->silence = DEFAULT_PITCH_SILENCE;
175  p->conf_cb = NULL;
176  switch (p->type) {
177    case aubio_pitcht_yin:
178      p->buf = new_fvec (bufsize);
179      p->p_object = new_aubio_pitchyin (bufsize);
180      if (!p->p_object) goto beach;
181      p->detect_cb = aubio_pitch_do_yin;
182      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyin_get_confidence;
183      aubio_pitchyin_set_tolerance (p->p_object, 0.15);
184      break;
185    case aubio_pitcht_mcomb:
186      p->filtered = new_fvec (hopsize);
187      p->pv = new_aubio_pvoc (bufsize, hopsize);
188      if (!p->pv) goto beach;
189      p->fftgrain = new_cvec (bufsize);
190      p->p_object = new_aubio_pitchmcomb (bufsize, hopsize);
191      p->filter = new_aubio_filter_c_weighting (samplerate);
192      p->detect_cb = aubio_pitch_do_mcomb;
193      break;
194    case aubio_pitcht_fcomb:
195      p->buf = new_fvec (bufsize);
196      p->p_object = new_aubio_pitchfcomb (bufsize, hopsize);
197      if (!p->p_object) goto beach;
198      p->detect_cb = aubio_pitch_do_fcomb;
199      break;
200    case aubio_pitcht_schmitt:
201      p->buf = new_fvec (bufsize);
202      p->p_object = new_aubio_pitchschmitt (bufsize);
203      p->detect_cb = aubio_pitch_do_schmitt;
204      break;
205    case aubio_pitcht_yinfft:
206      p->buf = new_fvec (bufsize);
207      p->p_object = new_aubio_pitchyinfft (samplerate, bufsize);
208      if (!p->p_object) goto beach;
209      p->detect_cb = aubio_pitch_do_yinfft;
210      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyinfft_get_confidence;
211      aubio_pitchyinfft_set_tolerance (p->p_object, 0.85);
212      break;
213    case aubio_pitcht_yinfast:
214      p->buf = new_fvec (bufsize);
215      p->p_object = new_aubio_pitchyinfast (bufsize);
216      if (!p->p_object) goto beach;
217      p->detect_cb = aubio_pitch_do_yinfast;
218      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyinfast_get_confidence;
219      aubio_pitchyinfast_set_tolerance (p->p_object, 0.15);
220      break;
221    case aubio_pitcht_specacf:
222      p->buf = new_fvec (bufsize);
223      p->p_object = new_aubio_pitchspecacf (bufsize);
224      if (!p->p_object) goto beach;
225      p->detect_cb = aubio_pitch_do_specacf;
226      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchspecacf_get_tolerance;
227      aubio_pitchspecacf_set_tolerance (p->p_object, 0.85);
228      break;
229    case aubio_pitcht_crepe:
230      // TODO add resampling and blocking
231      if (samplerate != 16000) {
232        AUBIO_ERROR("pitch: crepe samplerate must be 16000Hz, got %d\n",
233            samplerate);
234        goto beach;
235      }
236      if (bufsize != 1024) {
237        AUBIO_ERROR("pitch: crepe buffer size must be 1024, got %d\n",
238            bufsize);
239        goto beach;
240      }
241      p->buf = new_fvec (bufsize);
242      p->p_object = new_aubio_pitch_crepe();
243      if (!p->p_object) goto beach;
244      p->detect_cb = aubio_pitch_do_crepe;
245      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitch_crepe_get_confidence;
246      //aubio_pitch_crepe_set_tolerance (p->p_object, 0.85);
247      break;
248    default:
249      break;
250  }
251  return p;
252
253beach:
254  if (p->filtered) del_fvec(p->filtered);
255  if (p->buf) del_fvec(p->buf);
256  AUBIO_FREE(p);
257  return NULL;
258}
259
260void
261del_aubio_pitch (aubio_pitch_t * p)
262{
263  switch (p->type) {
264    case aubio_pitcht_yin:
265      del_fvec (p->buf);
266      del_aubio_pitchyin (p->p_object);
267      break;
268    case aubio_pitcht_mcomb:
269      del_fvec (p->filtered);
270      del_aubio_pvoc (p->pv);
271      del_cvec (p->fftgrain);
272      del_aubio_filter (p->filter);
273      del_aubio_pitchmcomb (p->p_object);
274      break;
275    case aubio_pitcht_schmitt:
276      del_fvec (p->buf);
277      del_aubio_pitchschmitt (p->p_object);
278      break;
279    case aubio_pitcht_fcomb:
280      del_fvec (p->buf);
281      del_aubio_pitchfcomb (p->p_object);
282      break;
283    case aubio_pitcht_yinfft:
284      del_fvec (p->buf);
285      del_aubio_pitchyinfft (p->p_object);
286      break;
287    case aubio_pitcht_yinfast:
288      del_fvec (p->buf);
289      del_aubio_pitchyinfast (p->p_object);
290      break;
291    case aubio_pitcht_specacf:
292      del_fvec (p->buf);
293      del_aubio_pitchspecacf (p->p_object);
294      break;
295    case aubio_pitcht_crepe:
296      del_fvec (p->buf);
297      del_aubio_pitch_crepe (p->p_object);
298      break;
299    default:
300      break;
301  }
302  AUBIO_FREE (p);
303}
304
305void
306aubio_pitch_slideblock (aubio_pitch_t * p, const fvec_t * ibuf)
307{
308  uint_t overlap_size = p->buf->length - ibuf->length;
309#if 1 //!HAVE_MEMCPY_HACKS
310  uint_t j;
311  for (j = 0; j < overlap_size; j++) {
312    p->buf->data[j] = p->buf->data[j + ibuf->length];
313  }
314  for (j = 0; j < ibuf->length; j++) {
315    p->buf->data[j + overlap_size] = ibuf->data[j];
316  }
317#else
318  smpl_t *data = p->buf->data;
319  smpl_t *newdata = ibuf->data;
320  memmove(data, data + ibuf->length, overlap_size);
321  memcpy(data + overlap_size, newdata, ibuf->length);
322#endif
323}
324
325uint_t
326aubio_pitch_set_unit (aubio_pitch_t * p, const char_t * pitch_unit)
327{
328  uint_t err = AUBIO_OK;
329  aubio_pitch_mode pitch_mode;
330  if (strcmp (pitch_unit, "freq") == 0)
331    pitch_mode = aubio_pitchm_freq;
332  else if (strcmp (pitch_unit, "hertz") == 0)
333    pitch_mode = aubio_pitchm_freq;
334  else if (strcmp (pitch_unit, "Hertz") == 0)
335    pitch_mode = aubio_pitchm_freq;
336  else if (strcmp (pitch_unit, "Hz") == 0)
337    pitch_mode = aubio_pitchm_freq;
338  else if (strcmp (pitch_unit, "f0") == 0)
339    pitch_mode = aubio_pitchm_freq;
340  else if (strcmp (pitch_unit, "midi") == 0)
341    pitch_mode = aubio_pitchm_midi;
342  else if (strcmp (pitch_unit, "cent") == 0)
343    pitch_mode = aubio_pitchm_cent;
344  else if (strcmp (pitch_unit, "bin") == 0)
345    pitch_mode = aubio_pitchm_bin;
346  else if (strcmp (pitch_unit, "default") == 0)
347    pitch_mode = aubio_pitchm_default;
348  else {
349    AUBIO_WRN("pitch: unknown pitch detection unit ‘%s’, using default\n",
350        pitch_unit);
351    pitch_mode = aubio_pitchm_default;
352    err = AUBIO_FAIL;
353  }
354  p->mode = pitch_mode;
355  switch (p->mode) {
356    case aubio_pitchm_freq:
357      p->conv_cb = freqconvpass;
358      break;
359    case aubio_pitchm_midi:
360      p->conv_cb = freqconvmidi;
361      break;
362    case aubio_pitchm_cent:
363      /* bug: not implemented */
364      p->conv_cb = freqconvmidi;
365      break;
366    case aubio_pitchm_bin:
367      p->conv_cb = freqconvbin;
368      break;
369    default:
370      break;
371  }
372  return err;
373}
374
375uint_t
376aubio_pitch_set_tolerance (aubio_pitch_t * p, smpl_t tol)
377{
378  switch (p->type) {
379    case aubio_pitcht_yin:
380      aubio_pitchyin_set_tolerance (p->p_object, tol);
381      break;
382    case aubio_pitcht_yinfft:
383      aubio_pitchyinfft_set_tolerance (p->p_object, tol);
384      break;
385    case aubio_pitcht_yinfast:
386      aubio_pitchyinfast_set_tolerance (p->p_object, tol);
387      break;
388    case aubio_pitcht_crepe:
389      aubio_pitch_crepe_set_tolerance (p->p_object, tol);
390      break;
391    default:
392      break;
393  }
394  return AUBIO_OK;
395}
396
397smpl_t
398aubio_pitch_get_tolerance (aubio_pitch_t * p)
399{
400  smpl_t tolerance = 1.;
401  switch (p->type) {
402    case aubio_pitcht_yin:
403      tolerance = aubio_pitchyin_get_tolerance (p->p_object);
404      break;
405    case aubio_pitcht_yinfft:
406      tolerance = aubio_pitchyinfft_get_tolerance (p->p_object);
407      break;
408    case aubio_pitcht_yinfast:
409      tolerance = aubio_pitchyinfast_get_tolerance (p->p_object);
410      break;
411    case aubio_pitcht_crepe:
412      tolerance = aubio_pitch_crepe_get_tolerance (p->p_object);
413      break;
414    default:
415      break;
416  }
417  return tolerance;
418}
419
420uint_t
421aubio_pitch_set_silence (aubio_pitch_t * p, smpl_t silence)
422{
423  if (silence <= 0 && silence >= -200) {
424    p->silence = silence;
425    return AUBIO_OK;
426  } else {
427    AUBIO_WRN("pitch: could not set silence to %.2f\n", silence);
428    return AUBIO_FAIL;
429  }
430}
431
432smpl_t
433aubio_pitch_get_silence (aubio_pitch_t * p)
434{
435  return p->silence;
436}
437
438
439/* do method, calling the detection callback, then the conversion callback */
440void
441aubio_pitch_do (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf)
442{
443  p->detect_cb (p, ibuf, obuf);
444  if (aubio_silence_detection(ibuf, p->silence) == 1) {
445    obuf->data[0] = 0.;
446  }
447  obuf->data[0] = p->conv_cb (obuf->data[0], p->samplerate, p->bufsize);
448}
449
450/* do method for each algorithm */
451void
452aubio_pitch_do_mcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf)
453{
454  aubio_filter_do_outplace (p->filter, ibuf, p->filtered);
455  aubio_pvoc_do (p->pv, ibuf, p->fftgrain);
456  aubio_pitchmcomb_do (p->p_object, p->fftgrain, obuf);
457  obuf->data[0] = aubio_bintofreq (obuf->data[0], p->samplerate, p->bufsize);
458}
459
460void
461aubio_pitch_do_yin (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf)
462{
463  smpl_t pitch = 0.;
464  aubio_pitch_slideblock (p, ibuf);
465  aubio_pitchyin_do (p->p_object, p->buf, obuf);
466  pitch = obuf->data[0];
467  if (pitch > 0) {
468    pitch = p->samplerate / (pitch + 0.);
469  } else {
470    pitch = 0.;
471  }
472  obuf->data[0] = pitch;
473}
474
475
476void
477aubio_pitch_do_yinfft (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf)
478{
479  smpl_t pitch = 0.;
480  aubio_pitch_slideblock (p, ibuf);
481  aubio_pitchyinfft_do (p->p_object, p->buf, obuf);
482  pitch = obuf->data[0];
483  if (pitch > 0) {
484    pitch = p->samplerate / (pitch + 0.);
485  } else {
486    pitch = 0.;
487  }
488  obuf->data[0] = pitch;
489}
490
491void
492aubio_pitch_do_yinfast (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf)
493{
494  smpl_t pitch = 0.;
495  aubio_pitch_slideblock (p, ibuf);
496  aubio_pitchyinfast_do (p->p_object, p->buf, obuf);
497  pitch = obuf->data[0];
498  if (pitch > 0) {
499    pitch = p->samplerate / (pitch + 0.);
500  } else {
501    pitch = 0.;
502  }
503  obuf->data[0] = pitch;
504}
505
506void
507aubio_pitch_do_specacf (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * out)
508{
509  smpl_t pitch = 0., period;
510  aubio_pitch_slideblock (p, ibuf);
511  aubio_pitchspecacf_do (p->p_object, p->buf, out);
512  //out->data[0] = aubio_bintofreq (out->data[0], p->samplerate, p->bufsize);
513  period = out->data[0];
514  if (period > 0) {
515    pitch = p->samplerate / period;
516  } else {
517    pitch = 0.;
518  }
519  out->data[0] = pitch;
520}
521
522void
523aubio_pitch_do_crepe (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * out)
524{
525  //smpl_t pitch = 0., period;
526  aubio_pitch_slideblock (p, ibuf);
527  aubio_pitch_crepe_do(p->p_object, p->buf, out);
528  out->data[0] = aubio_miditofreq(out->data[0]);
529}
530
531void
532aubio_pitch_do_fcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * out)
533{
534  aubio_pitch_slideblock (p, ibuf);
535  aubio_pitchfcomb_do (p->p_object, p->buf, out);
536  out->data[0] = aubio_bintofreq (out->data[0], p->samplerate, p->bufsize);
537}
538
539void
540aubio_pitch_do_schmitt (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * out)
541{
542  smpl_t period, pitch = 0.;
543  aubio_pitch_slideblock (p, ibuf);
544  aubio_pitchschmitt_do (p->p_object, p->buf, out);
545  period = out->data[0];
546  if (period > 0) {
547    pitch = p->samplerate / period;
548  } else {
549    pitch = 0.;
550  }
551  out->data[0] = pitch;
552}
553
554/* conversion callbacks */
555smpl_t
556freqconvbin(smpl_t f, uint_t samplerate, uint_t bufsize)
557{
558  return aubio_freqtobin(f, samplerate, bufsize);
559}
560
561smpl_t
562freqconvmidi (smpl_t f, uint_t samplerate UNUSED, uint_t bufsize UNUSED)
563{
564  return aubio_freqtomidi (f);
565}
566
567smpl_t
568freqconvpass (smpl_t f, uint_t samplerate UNUSED, uint_t bufsize UNUSED)
569{
570  return f;
571}
572
573/* confidence callbacks */
574smpl_t
575aubio_pitch_get_confidence (aubio_pitch_t * p)
576{
577  if (p->conf_cb) {
578    return p->conf_cb(p->p_object);
579  }
580  return 0.;
581}
Note: See TracBrowser for help on using the repository browser.