Changes in / [22d7902:0770148]


Ignore:
Files:
4 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • python/lib/gen_external.py

    r22d7902 r0770148  
    4747    'audio_unit',
    4848    'spectral_whitening',
    49     'timestretch', # TODO fix parsing of uint_t *read in _do
    5049]
    5150
  • src/aubio.h

    r22d7902 r0770148  
    222222#include "tempo/beattracking.h"
    223223#include "effects/pitchshift.h"
    224 #include "effects/timestretch.h"
    225224#include "utils/scale.h"
    226225#include "utils/hist.h"
  • src/effects/pitchshift.h

    r22d7902 r0770148  
    4646
    4747*/
    48 void aubio_pitchshift_do (aubio_pitchshift_t * o, const fvec_t * in,
    49         fvec_t * out);
     48void aubio_pitchshift_do (aubio_pitchshift_t * o, const fvec_t * in, fvec_t * out);
    5049
    5150/** deletion of the pitch shifting object
     
    8382  \param pitchscale new pitch scale of the pitch shifting object
    8483
    85   pitchscale is a frequency ratio. It should be in the range [0.25, 4].
    86 
    8784  \return 0 if successfull, non-zero otherwise
    8885
    8986*/
    90 uint_t aubio_pitchshift_set_pitchscale (aubio_pitchshift_t * o,
    91         smpl_t pitchscale);
     87uint_t aubio_pitchshift_set_pitchscale (aubio_pitchshift_t * o, smpl_t pitchscale);
    9288
    9389/** get the pitchscale of the pitch shifting object
     
    10399
    104100  \param o pitch shifting object as returned by new_aubio_pitchshift()
    105   \param transpose new pitch transposition of the pitch shifting object,
    106   expressed in semitones (should be in the range [-24;+24])
     101  \param transpose new pitch transposition of the pitch shifting object, expressed
     102  in semitones (should be in the range [-24;+24])
    107103
    108104  \return 0 if successfull, non-zero otherwise
    109105
    110106*/
    111 uint_t aubio_pitchshift_set_transpose (aubio_pitchshift_t * o,
    112         smpl_t transpose);
     107uint_t aubio_pitchshift_set_transpose (aubio_pitchshift_t * o, smpl_t transpose);
    113108
    114109/** get the transposition of the pitch shifting object, in semitones
  • src/effects/pitchshift_rubberband.c

    r22d7902 r0770148  
    2626#include "effects/pitchshift.h"
    2727
    28 #include <rubberband/rubberband-c.h>
     28#include "rubberband/rubberband-c.h"
    2929
    3030/** generic pitch shifting structure */
     
    7979  fvec_t *zeros = new_fvec(p->hopsize);
    8080  while (available <= (int)latency) {
    81     rubberband_process(p->rb,
    82         (const float* const*)&(zeros->data), p->hopsize, 0);
     81    rubberband_process(p->rb, (const float* const*)&(zeros->data), p->hopsize, 0);
    8382    available = rubberband_available(p->rb);
    8483  }
     
    114113    return AUBIO_OK;
    115114  } else {
    116     AUBIO_ERR("pitchshift: could not set pitchscale to '%f',"
    117         " should be in the range [0.25, 4.].\n", pitchscale);
     115    AUBIO_ERR("pitchshift: could not set pitchscale to %.2f\n", pitchscale);
    118116    return AUBIO_FAIL;
    119117  }
     
    133131    return aubio_pitchshift_set_pitchscale(p, pitchscale);
    134132  } else {
    135     AUBIO_ERR("pitchshift: could not set transpose to '%f',"
    136         " should be in the range [-24; 24.].\n", transpose);
     133    AUBIO_ERR("pitchshift: could not set transpose to %.2f\n", transpose);
    137134    return AUBIO_FAIL;
    138135  }
     
    153150    rubberband_retrieve(p->rb, (float* const*)&(out->data), p->hopsize);
    154151  } else {
    155     AUBIO_WRN("pitchshift: catching up with zeros"
    156         ", only %d available, needed: %d, current pitchscale: %f\n",
     152    AUBIO_WRN("pitchshift: catching up with zeros, only %d available, needed: %d, "
     153        "current pitchscale: %f\n",
    157154        rubberband_available(p->rb), p->hopsize, p->pitchscale);
    158155    fvec_zeros(out);
  • src/effects/rubberband_utils.c

    r22d7902 r0770148  
    55#ifdef HAVE_RUBBERBAND
    66
    7 #include <rubberband/rubberband-c.h>
     7#include "rubberband/rubberband-c.h"
    88
    99// check rubberband is 1.8.1, warn if 1.3
     
    1414#define RubberBandOptionDetectorSoft 0x00000000
    1515#endif
    16 
    17 #include <stdio.h>
    18 #include <stdlib.h>
    19 #include <string.h>
    20 #include <assert.h>
    21 
    22 char_t** aubio_split_str(const char_t* str, const char_t sep) {
    23   char_t** result = 0;
    24   uint_t count = 0;
    25   char_t input[PATH_MAX];
    26   char_t* in_ptr = input;
    27   char_t* last_sep = 0;
    28   char_t delim[2]; delim[0] = sep; delim[1] = 0;
    29 
    30   strncpy(input, str, PATH_MAX);
    31   input[PATH_MAX - 1] = '\0';
    32 
    33   // count number of elements
    34   while (*in_ptr) {
    35     if (sep == *in_ptr) {
    36       count++;
    37       last_sep = in_ptr;
    38     }
    39     in_ptr++;
    40   }
    41   // add space for trailing token.
    42   count += last_sep < (input + strlen(input) - 1);
    43   count++;
    44 
    45   result = AUBIO_ARRAY(char_t*, count);
    46   if (result) {
    47     uint_t idx  = 0;
    48     char_t* params = strtok(input, delim);
    49     while (params) {
    50       // make sure we don't got in the wild
    51       assert(idx < count);
    52       *(result + idx++) = strdup(params);
    53       params = strtok(0, delim);
    54     }
    55     assert(idx == count - 1);
    56     // add null string at the end
    57     *(result + idx) = 0;
    58   }
    59   return result;
    60 }
    6116
    6217RubberBandOptions aubio_get_rubberband_opts(const char_t *mode)
     
    8944    // nothing to do
    9045  } else {
    91     // attempt to parse a list of options, separated with ','
    92     char_t **params = aubio_split_str(mode, ':');
    93     uint_t i = 0;
    94     if (!params || !params[0]) {
    95       // memory failure occurred or empty string was passed
    96       AUBIO_ERR("rubberband_utils: failed parsing options\n");
    97       rboptions = -1;
    98     }
    99     while (*(params + i) != NULL) {
    100       if ( strcmp(params[i], "ProcessOffline" ) == 0 )        {
    101              rboptions = RubberBandOptionProcessOffline;
    102         // TODO: add wrapper to rb study(smpl_t *input, uint_t write)
    103         AUBIO_ERR("rubberband_utils: RubberBandOptionProcessOffline is not available\n");
    104         rboptions = -1;
    105       }
    106       else if ( strcmp(params[i], "ProcessRealTime" ) == 0 )       rboptions |= RubberBandOptionProcessRealTime;
    107       else if ( strcmp(params[i], "StretchElastic" ) == 0 )        rboptions |= RubberBandOptionStretchElastic;
    108       else if ( strcmp(params[i], "StretchPrecise" ) == 0 )        rboptions |= RubberBandOptionStretchPrecise;
    109       else if ( strcmp(params[i], "TransientsCrisp" ) == 0 )       rboptions |= RubberBandOptionTransientsCrisp;
    110       else if ( strcmp(params[i], "TransientsMixed" ) == 0 )       rboptions |= RubberBandOptionTransientsMixed;
    111       else if ( strcmp(params[i], "TransientsSmooth" ) == 0 )      rboptions |= RubberBandOptionTransientsSmooth;
    112       else if ( strcmp(params[i], "DetectorCompound" ) == 0 )      rboptions |= RubberBandOptionDetectorCompound;
    113       else if ( strcmp(params[i], "DetectorPercussive" ) == 0 )    rboptions |= RubberBandOptionDetectorPercussive;
    114       else if ( strcmp(params[i], "DetectorSoft" ) == 0 )          rboptions |= RubberBandOptionDetectorSoft;
    115       else if ( strcmp(params[i], "PhaseLaminar" ) == 0 )          rboptions |= RubberBandOptionPhaseLaminar;
    116       else if ( strcmp(params[i], "PhaseIndependent" ) == 0 )      rboptions |= RubberBandOptionPhaseIndependent;
    117       else if ( strcmp(params[i], "ThreadingAuto" ) == 0 )         rboptions |= RubberBandOptionThreadingAuto;
    118       else if ( strcmp(params[i], "ThreadingNever" ) == 0 )        rboptions |= RubberBandOptionThreadingNever;
    119       else if ( strcmp(params[i], "ThreadingAlways" ) == 0 )       rboptions |= RubberBandOptionThreadingAlways;
    120       else if ( strcmp(params[i], "WindowStandard" ) == 0 )        rboptions |= RubberBandOptionWindowStandard;
    121       else if ( strcmp(params[i], "WindowShort" ) == 0 )           rboptions |= RubberBandOptionWindowShort;
    122       else if ( strcmp(params[i], "WindowLong" ) == 0 )            rboptions |= RubberBandOptionWindowLong;
    123       else if ( strcmp(params[i], "SmoothingOff" ) == 0 )          rboptions |= RubberBandOptionSmoothingOff;
    124       else if ( strcmp(params[i], "SmoothingOn" ) == 0 )           rboptions |= RubberBandOptionSmoothingOn;
    125       else if ( strcmp(params[i], "FormantShifted" ) == 0 )        rboptions |= RubberBandOptionFormantShifted;
    126       else if ( strcmp(params[i], "FormantPreserved" ) == 0 )      rboptions |= RubberBandOptionFormantPreserved;
    127       else if ( strcmp(params[i], "PitchHighSpeed" ) == 0 )        rboptions |= RubberBandOptionPitchHighSpeed;
    128       else if ( strcmp(params[i], "PitchHighQuality" ) == 0 )      rboptions |= RubberBandOptionPitchHighQuality;
    129       else if ( strcmp(params[i], "PitchHighConsistency" ) == 0 )  rboptions |= RubberBandOptionPitchHighConsistency;
    130       else if ( strcmp(params[i], "ChannelsApart" ) == 0 )         rboptions |= RubberBandOptionChannelsApart;
    131       else if ( strcmp(params[i], "ChannelsTogether" ) == 0 )      rboptions |= RubberBandOptionChannelsTogether;
    132       else {
    133         AUBIO_ERR("rubberband_utils: did not understand option '%s', should be one of: "
    134           "StretchElastic|StretchPrecise, TransientsCrisp|TransientsMixed|TransientsSmooth, "
    135           "DetectorCompound|DetectorPercussive|DetectorSoft, PhaseLaminar|PhaseIndependent, "
    136           "ThreadingAuto|ThreadingNever|ThreadingAlways, WindowStandard|WindowLong|WindowShort, "
    137           "SmoothingOn|SmoothingOff, FormantShifted|FormantPreserved, "
    138           "PitchHighSpeed|PitchHighQuality|PitchHighConsistency, ChannelsApart|ChannelsTogether\n"
    139           , params[i]);
    140         rboptions = -1;
    141       }
    142       AUBIO_FREE(params[i]);
    143       i++;
    144     }
    145     AUBIO_FREE(params);
     46    // failed parsing option string
     47    return -1;
    14648  }
     49  // other options to include
     50  //p->rboptions |= RubberBandOptionWindowStandard;
     51  //p->rboptions |= RubberBandOptionSmoothingOff;
     52  //p->rboptions |= RubberBandOptionFormantShifted;
     53  //p->rboptions |= RubberBandOptionPitchHighConsistency;
    14754  return rboptions;
    14855}
  • tests/src/effects/test-pitchshift.c

    r22d7902 r0770148  
    7676  del_fvec(out);
    7777beach_fvec:
    78   aubio_cleanup();
    7978#else
    8079  err = 0;
Note: See TracChangeset for help on using the changeset viewer.