Changeset 1070378


Ignore:
Timestamp:
Jul 24, 2017, 2:13:52 PM (3 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master
Children:
ccd0327
Parents:
ddea34b (diff), 9fa0ed1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'yinfast'

Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • doc/web.cfg

    rddea34b r1070378  
    836836                         ../src/pitch/pitchyin.h \
    837837                         ../src/pitch/pitchyinfft.h \
     838                         ../src/pitch/pitchyinfast.h \
    838839                         ../src/pitch/pitchschmitt.h \
    839840                         ../src/pitch/pitchfcomb.h \
  • python/lib/gen_external.py

    rddea34b r1070378  
    3131    'pitchyin',
    3232    'pitchyinfft',
     33    'pitchyinfast',
    3334    'sink',
    3435    'sink_apple_audio',
  • python/tests/test_pitch.py

    rddea34b r1070378  
    7171        #print 'median errors: ', median(errors), 'median pitches: ', median(pitches)
    7272
    73 pitch_algorithms = [ "default", "yinfft", "yin", "schmitt", "mcomb", "fcomb" , "specacf" ]
    74 pitch_algorithms = [ "default", "yinfft", "yin", "schmitt", "mcomb", "fcomb" ]
     73pitch_algorithms = [ "default", "yinfft", "yin", "yinfast", "schmitt", "mcomb", "fcomb" , "specacf" ]
     74pitch_algorithms = [ "default", "yinfft", "yin", "yinfast", "schmitt", "mcomb", "fcomb" ]
    7575
    7676#freqs = [ 27.5, 55., 110., 220., 440., 880., 1760., 3520. ]
  • src/aubio.h

    rddea34b r1070378  
    215215#include "pitch/pitchyin.h"
    216216#include "pitch/pitchyinfft.h"
     217#include "pitch/pitchyinfast.h"
    217218#include "pitch/pitchschmitt.h"
    218219#include "pitch/pitchfcomb.h"
  • src/pitch/pitch.c

    rddea34b r1070378  
    3333#include "pitch/pitchschmitt.h"
    3434#include "pitch/pitchyinfft.h"
     35#include "pitch/pitchyinfast.h"
    3536#include "pitch/pitchspecacf.h"
    3637#include "pitch/pitch.h"
     
    4647  aubio_pitcht_fcomb,      /**< `fcomb`, Fast comb filter */
    4748  aubio_pitcht_yinfft,     /**< `yinfft`, Spectral YIN */
     49  aubio_pitcht_yinfast,    /**< `yinfast`, YIN fast */
    4850  aubio_pitcht_specacf,    /**< `specacf`, Spectral autocorrelation */
    4951  aubio_pitcht_default
     
    9597static void aubio_pitch_do_fcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
    9698static void aubio_pitch_do_yinfft (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
     99static void aubio_pitch_do_yinfast (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
    97100static void aubio_pitch_do_specacf (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
    98101
     
    118121  if (strcmp (pitch_mode, "mcomb") == 0)
    119122    pitch_type = aubio_pitcht_mcomb;
     123  else if (strcmp (pitch_mode, "yinfast") == 0)
     124    pitch_type = aubio_pitcht_yinfast;
    120125  else if (strcmp (pitch_mode, "yinfft") == 0)
    121126    pitch_type = aubio_pitcht_yinfft;
     
    193198      aubio_pitchyinfft_set_tolerance (p->p_object, 0.85);
    194199      break;
     200    case aubio_pitcht_yinfast:
     201      p->buf = new_fvec (bufsize);
     202      p->p_object = new_aubio_pitchyinfast (bufsize);
     203      if (!p->p_object) goto beach;
     204      p->detect_cb = aubio_pitch_do_yinfast;
     205      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyinfast_get_confidence;
     206      aubio_pitchyinfast_set_tolerance (p->p_object, 0.15);
     207      break;
    195208    case aubio_pitcht_specacf:
    196209      p->buf = new_fvec (bufsize);
     
    239252      del_fvec (p->buf);
    240253      del_aubio_pitchyinfft (p->p_object);
     254      break;
     255    case aubio_pitcht_yinfast:
     256      del_fvec (p->buf);
     257      del_aubio_pitchyinfast (p->p_object);
    241258      break;
    242259    case aubio_pitcht_specacf:
     
    330347      aubio_pitchyinfft_set_tolerance (p->p_object, tol);
    331348      break;
     349    case aubio_pitcht_yinfast:
     350      aubio_pitchyinfast_set_tolerance (p->p_object, tol);
     351      break;
    332352    default:
    333353      break;
     
    346366    case aubio_pitcht_yinfft:
    347367      tolerance = aubio_pitchyinfft_get_tolerance (p->p_object);
     368      break;
     369    case aubio_pitcht_yinfast:
     370      tolerance = aubio_pitchyinfast_get_tolerance (p->p_object);
    348371      break;
    349372    default:
     
    415438  aubio_pitch_slideblock (p, ibuf);
    416439  aubio_pitchyinfft_do (p->p_object, p->buf, obuf);
     440  pitch = obuf->data[0];
     441  if (pitch > 0) {
     442    pitch = p->samplerate / (pitch + 0.);
     443  } else {
     444    pitch = 0.;
     445  }
     446  obuf->data[0] = pitch;
     447}
     448
     449void
     450aubio_pitch_do_yinfast (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf)
     451{
     452  smpl_t pitch = 0.;
     453  aubio_pitch_slideblock (p, ibuf);
     454  aubio_pitchyinfast_do (p->p_object, p->buf, obuf);
    417455  pitch = obuf->data[0];
    418456  if (pitch > 0) {
  • src/pitch/pitch.h

    rddea34b r1070378  
    8181
    8282  see http://recherche.ircam.fr/equipes/pcm/pub/people/cheveign.html
     83
     84  \b \p yinfast : Yinfast algorithm
     85
     86  This algorithm is equivalent to the YIN algorithm, but computed in the
     87  spectral domain for efficiency. See also `python/demos/demo_yin_compare.py`.
    8388
    8489  \b \p yinfft : Yinfft algorithm
Note: See TracChangeset for help on using the changeset viewer.