Changes in / [0770148:22d7902]
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/gen_external.py
r0770148 r22d7902 47 47 'audio_unit', 48 48 'spectral_whitening', 49 'timestretch', # TODO fix parsing of uint_t *read in _do 49 50 ] 50 51 -
src/aubio.h
r0770148 r22d7902 222 222 #include "tempo/beattracking.h" 223 223 #include "effects/pitchshift.h" 224 #include "effects/timestretch.h" 224 225 #include "utils/scale.h" 225 226 #include "utils/hist.h" -
src/effects/pitchshift.h
r0770148 r22d7902 46 46 47 47 */ 48 void aubio_pitchshift_do (aubio_pitchshift_t * o, const fvec_t * in, fvec_t * out); 48 void aubio_pitchshift_do (aubio_pitchshift_t * o, const fvec_t * in, 49 fvec_t * out); 49 50 50 51 /** deletion of the pitch shifting object … … 82 83 \param pitchscale new pitch scale of the pitch shifting object 83 84 85 pitchscale is a frequency ratio. It should be in the range [0.25, 4]. 86 84 87 \return 0 if successfull, non-zero otherwise 85 88 86 89 */ 87 uint_t aubio_pitchshift_set_pitchscale (aubio_pitchshift_t * o, smpl_t pitchscale); 90 uint_t aubio_pitchshift_set_pitchscale (aubio_pitchshift_t * o, 91 smpl_t pitchscale); 88 92 89 93 /** get the pitchscale of the pitch shifting object … … 99 103 100 104 \param o pitch shifting object as returned by new_aubio_pitchshift() 101 \param transpose new pitch transposition of the pitch shifting object, expressed102 in semitones (should be in the range [-24;+24])105 \param transpose new pitch transposition of the pitch shifting object, 106 expressed in semitones (should be in the range [-24;+24]) 103 107 104 108 \return 0 if successfull, non-zero otherwise 105 109 106 110 */ 107 uint_t aubio_pitchshift_set_transpose (aubio_pitchshift_t * o, smpl_t transpose); 111 uint_t aubio_pitchshift_set_transpose (aubio_pitchshift_t * o, 112 smpl_t transpose); 108 113 109 114 /** get the transposition of the pitch shifting object, in semitones -
src/effects/pitchshift_rubberband.c
r0770148 r22d7902 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, (const float* const*)&(zeros->data), p->hopsize, 0); 81 rubberband_process(p->rb, 82 (const float* const*)&(zeros->data), p->hopsize, 0); 82 83 available = rubberband_available(p->rb); 83 84 } … … 113 114 return AUBIO_OK; 114 115 } else { 115 AUBIO_ERR("pitchshift: could not set pitchscale to %.2f\n", pitchscale); 116 AUBIO_ERR("pitchshift: could not set pitchscale to '%f'," 117 " should be in the range [0.25, 4.].\n", pitchscale); 116 118 return AUBIO_FAIL; 117 119 } … … 131 133 return aubio_pitchshift_set_pitchscale(p, pitchscale); 132 134 } else { 133 AUBIO_ERR("pitchshift: could not set transpose to %.2f\n", transpose); 135 AUBIO_ERR("pitchshift: could not set transpose to '%f'," 136 " should be in the range [-24; 24.].\n", transpose); 134 137 return AUBIO_FAIL; 135 138 } … … 150 153 rubberband_retrieve(p->rb, (float* const*)&(out->data), p->hopsize); 151 154 } else { 152 AUBIO_WRN("pitchshift: catching up with zeros , only %d available, needed: %d,"153 " current pitchscale: %f\n",155 AUBIO_WRN("pitchshift: catching up with zeros" 156 ", only %d available, needed: %d, current pitchscale: %f\n", 154 157 rubberband_available(p->rb), p->hopsize, p->pitchscale); 155 158 fvec_zeros(out); -
src/effects/rubberband_utils.c
r0770148 r22d7902 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 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 } 16 61 17 62 RubberBandOptions aubio_get_rubberband_opts(const char_t *mode) … … 44 89 // nothing to do 45 90 } else { 46 // failed parsing option string 47 return -1; 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); 48 146 } 49 // other options to include50 //p->rboptions |= RubberBandOptionWindowStandard;51 //p->rboptions |= RubberBandOptionSmoothingOff;52 //p->rboptions |= RubberBandOptionFormantShifted;53 //p->rboptions |= RubberBandOptionPitchHighConsistency;54 147 return rboptions; 55 148 } -
tests/src/effects/test-pitchshift.c
r0770148 r22d7902 76 76 del_fvec(out); 77 77 beach_fvec: 78 aubio_cleanup(); 78 79 #else 79 80 err = 0;
Note: See TracChangeset
for help on using the changeset viewer.