Changeset fe163ad for examples/utils.c


Ignore:
Timestamp:
Oct 15, 2009, 6:54:23 PM (11 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
515c7b2
Parents:
cd77c15
Message:

src/pitch: use a string to set pitch method, add a new function to set pitch unit, keep pitch enums private, update pitch methods where they are used

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/utils.c

    rcd77c15 rfe163ad  
    6565fvec_t *woodblock;
    6666aubio_onsetdetection_t *o;
    67 aubio_onsetdetection_t *o2;
    6867fvec_t *onset;
    6968fvec_t *onset2;
     
    7574smpl_t pitch = 0.;
    7675aubio_pitchdetection_t *pitchdet;
    77 aubio_pitchdetection_type type_pitch = aubio_pitch_yinfft;      // aubio_pitch_mcomb
    78 aubio_pitchdetection_mode mode_pitch = aubio_pitchm_freq;
     76char_t * pitch_unit = "default";
     77char_t * pitch_mode = "default";
    7978uint_t median = 6;
    8079
     
    177176        break;
    178177      case 'p':
    179         if (strcmp (optarg, "mcomb") == 0)
    180           type_pitch = aubio_pitch_mcomb;
    181         else if (strcmp (optarg, "yinfft") == 0)
    182           type_pitch = aubio_pitch_yin;
    183         else if (strcmp (optarg, "yin") == 0)
    184           type_pitch = aubio_pitch_yin;
    185         else if (strcmp (optarg, "schmitt") == 0)
    186           type_pitch = aubio_pitch_schmitt;
    187         else if (strcmp (optarg, "fcomb") == 0)
    188           type_pitch = aubio_pitch_fcomb;
    189         else {
    190           errmsg ("unknown pitch type.\n");
    191           abort ();
    192         }
     178        pitch_mode = optarg;
    193179        break;
    194180      case 'a':
     
    294280
    295281  if (usepitch) {
    296     pitchdet = new_aubio_pitchdetection (buffer_size * 4,
    297         overlap_size, channels, samplerate, type_pitch, mode_pitch);
     282    pitchdet = new_aubio_pitchdetection (pitch_mode, buffer_size * 4,
     283        overlap_size, channels, samplerate);
    298284    aubio_pitchdetection_set_tolerance (pitchdet, 0.7);
    299285    pitch_obuf = new_fvec (1, channels);
     
    325311    }
    326312    del_fvec (pitch_obuf);
    327   }
    328   if (usedoubled) {
    329     del_aubio_onsetdetection (o2);
    330     del_fvec (onset2);
    331313  }
    332314  del_aubio_onsetdetection (o);
Note: See TracChangeset for help on using the changeset viewer.