Changeset 283a619a


Ignore:
Timestamp:
Dec 6, 2018, 11:30:54 AM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
Children:
3a96d3d
Parents:
633400d
Message:

[pitchshift] check if hopsize and samplerate are valid, use _set_transpose in new_, comment about final always 0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/effects/pitchshift_rubberband.c

    r633400d r283a619a  
    5050  p->hopsize = hopsize;
    5151  p->pitchscale = 1.;
    52   if (transpose >= -24. && transpose <= 24.) {
    53     p->pitchscale = POW(2., transpose / 12.);
    54   } else {
    55     AUBIO_ERR("pitchshift: transpose should be in the range [-24, 24], got %f\n", transpose);
     52  if ((sint_t)hopsize <= 0) {
     53    AUBIO_ERR("pitchshift: hop_size should be >= 0, got %d\n", hopsize);
     54    goto beach;
     55  }
     56  if ((sint_t)samplerate <= 0) {
     57    AUBIO_ERR("pitchshift: samplerate should be >= 0, got %d\n", samplerate);
    5658    goto beach;
    5759  }
     
    6264    goto beach;
    6365  }
     66
    6467  //AUBIO_MSG("pitchshift: using pitch shifting method %s\n", mode);
    6568
     
    6770  rubberband_set_max_process_size(p->rb, p->hopsize);
    6871  //rubberband_set_debug_level(p->rb, 10);
     72
     73  if (aubio_pitchshift_set_transpose(p, transpose)) goto beach;
    6974
    7075#if 1
     
    140145aubio_pitchshift_do (aubio_pitchshift_t * p, const fvec_t * in, fvec_t * out)
    141146{
    142   int output = 0;
    143   rubberband_process(p->rb, (const float* const*)&(in->data), p->hopsize, output);
     147  // third parameter is always 0 since we are never expecting a final frame
     148  rubberband_process(p->rb, (const float* const*)&(in->data), p->hopsize, 0);
    144149  if (rubberband_available(p->rb) >= (int)p->hopsize) {
    145150    rubberband_retrieve(p->rb, (float* const*)&(out->data), p->hopsize);
Note: See TracChangeset for help on using the changeset viewer.