Changes in / [22d7902:0770148]
- Files:
-
- 4 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/gen_external.py
r22d7902 r0770148 47 47 'audio_unit', 48 48 'spectral_whitening', 49 'timestretch', # TODO fix parsing of uint_t *read in _do50 49 ] 51 50 -
src/aubio.h
r22d7902 r0770148 222 222 #include "tempo/beattracking.h" 223 223 #include "effects/pitchshift.h" 224 #include "effects/timestretch.h"225 224 #include "utils/scale.h" 226 225 #include "utils/hist.h" -
src/effects/pitchshift.h
r22d7902 r0770148 46 46 47 47 */ 48 void aubio_pitchshift_do (aubio_pitchshift_t * o, const fvec_t * in, 49 fvec_t * out); 48 void aubio_pitchshift_do (aubio_pitchshift_t * o, const fvec_t * in, fvec_t * out); 50 49 51 50 /** deletion of the pitch shifting object … … 83 82 \param pitchscale new pitch scale of the pitch shifting object 84 83 85 pitchscale is a frequency ratio. It should be in the range [0.25, 4].86 87 84 \return 0 if successfull, non-zero otherwise 88 85 89 86 */ 90 uint_t aubio_pitchshift_set_pitchscale (aubio_pitchshift_t * o, 91 smpl_t pitchscale); 87 uint_t aubio_pitchshift_set_pitchscale (aubio_pitchshift_t * o, smpl_t pitchscale); 92 88 93 89 /** get the pitchscale of the pitch shifting object … … 103 99 104 100 \param o pitch shifting object as returned by new_aubio_pitchshift() 105 \param transpose new pitch transposition of the pitch shifting object, 106 expressedin 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]) 107 103 108 104 \return 0 if successfull, non-zero otherwise 109 105 110 106 */ 111 uint_t aubio_pitchshift_set_transpose (aubio_pitchshift_t * o, 112 smpl_t transpose); 107 uint_t aubio_pitchshift_set_transpose (aubio_pitchshift_t * o, smpl_t transpose); 113 108 114 109 /** get the transposition of the pitch shifting object, in semitones -
src/effects/pitchshift_rubberband.c
r22d7902 r0770148 26 26 #include "effects/pitchshift.h" 27 27 28 #include <rubberband/rubberband-c.h>28 #include "rubberband/rubberband-c.h" 29 29 30 30 /** generic pitch shifting structure */ … … 79 79 fvec_t *zeros = new_fvec(p->hopsize); 80 80 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); 83 82 available = rubberband_available(p->rb); 84 83 } … … 114 113 return AUBIO_OK; 115 114 } 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); 118 116 return AUBIO_FAIL; 119 117 } … … 133 131 return aubio_pitchshift_set_pitchscale(p, pitchscale); 134 132 } 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); 137 134 return AUBIO_FAIL; 138 135 } … … 153 150 rubberband_retrieve(p->rb, (float* const*)&(out->data), p->hopsize); 154 151 } 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", 157 154 rubberband_available(p->rb), p->hopsize, p->pitchscale); 158 155 fvec_zeros(out); -
src/effects/rubberband_utils.c
r22d7902 r0770148 5 5 #ifdef HAVE_RUBBERBAND 6 6 7 #include <rubberband/rubberband-c.h>7 #include "rubberband/rubberband-c.h" 8 8 9 9 // check rubberband is 1.8.1, warn if 1.3 … … 14 14 #define RubberBandOptionDetectorSoft 0x00000000 15 15 #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 elements34 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 wild51 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 end57 *(result + idx) = 0;58 }59 return result;60 }61 16 62 17 RubberBandOptions aubio_get_rubberband_opts(const char_t *mode) … … 89 44 // nothing to do 90 45 } 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; 146 48 } 49 // other options to include 50 //p->rboptions |= RubberBandOptionWindowStandard; 51 //p->rboptions |= RubberBandOptionSmoothingOff; 52 //p->rboptions |= RubberBandOptionFormantShifted; 53 //p->rboptions |= RubberBandOptionPitchHighConsistency; 147 54 return rboptions; 148 55 } -
tests/src/effects/test-pitchshift.c
r22d7902 r0770148 76 76 del_fvec(out); 77 77 beach_fvec: 78 aubio_cleanup();79 78 #else 80 79 err = 0;
Note: See TracChangeset
for help on using the changeset viewer.