Changeset b257b60 for src/pitch/pitch.c


Ignore:
Timestamp:
Aug 12, 2015, 7:21:38 PM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
60fc05b
Parents:
3a1a5d6 (diff), 7b2d740 (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 'develop' into notes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitch/pitch.c

    r3a1a5d6 rb257b60  
    130130    pitch_type = aubio_pitcht_default;
    131131  }
     132
     133  // check parameters are valid
     134  if ((sint_t)hopsize < 1) {
     135    AUBIO_ERR("onset: got hopsize %d, but can not be < 1\n", hopsize);
     136    goto beach;
     137  } else if ((sint_t)bufsize < 1) {
     138    AUBIO_ERR("onset: got buffer_size %d, but can not be < 1\n", bufsize);
     139    goto beach;
     140  } else if (bufsize < hopsize) {
     141    AUBIO_ERR("onset: hop size (%d) is larger than win size (%d)\n", bufsize, hopsize);
     142    goto beach;
     143  } else if ((sint_t)samplerate < 1) {
     144    AUBIO_ERR("onset: samplerate (%d) can not be < 1\n", samplerate);
     145    goto beach;
     146  }
     147
    132148  p->samplerate = samplerate;
    133149  p->type = pitch_type;
     
    179195  }
    180196  return p;
     197
     198beach:
     199  AUBIO_FREE(p);
     200  return NULL;
    181201}
    182202
     
    238258    pitch_mode = aubio_pitchm_freq;
    239259  else if (strcmp (pitch_unit, "hertz") == 0)
     260    pitch_mode = aubio_pitchm_freq;
     261  else if (strcmp (pitch_unit, "Hertz") == 0)
    240262    pitch_mode = aubio_pitchm_freq;
    241263  else if (strcmp (pitch_unit, "Hz") == 0)
     
    296318aubio_pitch_set_silence (aubio_pitch_t * p, smpl_t silence)
    297319{
    298   if (silence < 0 && silence > -200) {
     320  if (silence <= 0 && silence >= -200) {
    299321    p->silence = silence;
    300322    return AUBIO_OK;
    301323  } else {
    302     AUBIO_ERR("pitch: could do set silence to %.2f", silence);
     324    AUBIO_ERR("pitch: could not set silence to %.2f", silence);
    303325    return AUBIO_FAIL;
    304326  }
Note: See TracChangeset for help on using the changeset viewer.