Changeset 25a19c2 for src/effects
- Timestamp:
- Sep 21, 2016, 5:36:50 PM (8 years ago)
- Branches:
- feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch
- Children:
- 3ffedf22
- Parents:
- 6e6849d
- Location:
- src/effects
- Files:
-
- 2 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/effects/pitchshift_rubberband.c
r6e6849d r25a19c2 20 20 21 21 #include "config.h" 22 23 #ifdef HAVE_RUBBERBAND 24 22 25 #include "aubio_priv.h" 23 26 #include "fvec.h" 24 27 #include "effects/pitchshift.h" 25 28 26 #ifdef HAVE_RUBBERBAND27 28 29 #include "rubberband/rubberband-c.h" 29 30 // check rubberband is 1.8.1, warn if 1.331 #if !((RUBBERBAND_API_MAJOR_VERSION >= 2) && \32 (RUBBERBAND_API_MINOR_VERSION >= 5))33 #warning RubberBandOptionDetectorSoft not available, \34 please upgrade rubberband to version 1.8.1 or higher35 #define RubberBandOptionDetectorSoft 0x0000000036 #endif37 30 38 31 /** generic pitch shifting structure */ … … 46 39 RubberBandOptions rboptions; 47 40 }; 41 42 extern RubberBandOptions aubio_get_rubberband_opts(const char_t *mode); 48 43 49 44 aubio_pitchshift_t * … … 62 57 } 63 58 64 p->rboptions = RubberBandOptionProcessRealTime; 65 66 if ( strcmp(mode,"crispness:0") == 0 ) { 67 p->rboptions |= RubberBandOptionTransientsSmooth; 68 p->rboptions |= RubberBandOptionWindowLong; 69 p->rboptions |= RubberBandOptionPhaseIndependent; 70 } else if ( strcmp(mode, "crispness:1") == 0 ) { 71 p->rboptions |= RubberBandOptionDetectorSoft; 72 p->rboptions |= RubberBandOptionTransientsSmooth; 73 p->rboptions |= RubberBandOptionWindowLong; 74 p->rboptions |= RubberBandOptionPhaseIndependent; 75 } else if ( strcmp(mode, "crispness:2") == 0 ) { 76 p->rboptions |= RubberBandOptionTransientsSmooth; 77 p->rboptions |= RubberBandOptionPhaseIndependent; 78 } else if ( strcmp(mode, "crispness:3") == 0 ) { 79 p->rboptions |= RubberBandOptionTransientsSmooth; 80 } else if ( strcmp(mode, "crispness:4") == 0 ) { 81 // same as "default" 82 } else if ( strcmp(mode, "crispness:5") == 0 ) { 83 p->rboptions |= RubberBandOptionTransientsCrisp; 84 } else if ( strcmp(mode, "crispness:6") == 0 ) { 85 p->rboptions |= RubberBandOptionTransientsCrisp; 86 p->rboptions |= RubberBandOptionWindowShort; 87 p->rboptions |= RubberBandOptionPhaseIndependent; 88 } else if ( strcmp(mode, "default") == 0 ) { 89 // nothing to do 90 } else { 91 AUBIO_ERR("pitchshift: unknown pitch shifting method %s\n", mode); 59 p->rboptions = aubio_get_rubberband_opts(mode); 60 if (p->rboptions < 0) { 61 AUBIO_ERR("timestretch: unknown pitch shifting method %s\n", mode); 92 62 goto beach; 93 63 } 94 64 //AUBIO_MSG("pitchshift: using pitch shifting method %s\n", mode); 95 65 96 //p->rboptions |= RubberBandOptionTransientsCrisp;97 //p->rboptions |= RubberBandOptionWindowStandard;98 //p->rboptions |= RubberBandOptionSmoothingOff;99 //p->rboptions |= RubberBandOptionFormantShifted;100 //p->rboptions |= RubberBandOptionPitchHighConsistency;101 66 p->rb = rubberband_new(samplerate, 1, p->rboptions, 1., p->pitchscale); 102 67 rubberband_set_max_process_size(p->rb, p->hopsize); … … 187 152 } 188 153 189 #else 190 191 // TODO fallback pitch shifting implementation 192 193 struct _aubio_pitchshift_t 194 { 195 void *dummy; 196 }; 197 198 void aubio_pitchshift_do (aubio_pitchshift_t * o UNUSED, const fvec_t * in UNUSED, 199 fvec_t * out UNUSED) { 200 } 201 202 void del_aubio_pitchshift (aubio_pitchshift_t * o UNUSED) { 203 } 204 205 aubio_pitchshift_t *new_aubio_pitchshift (const char_t * method UNUSED, 206 smpl_t pitchscale UNUSED, uint_t hop_size UNUSED, uint_t samplerate UNUSED) 207 { 208 AUBIO_ERR ("aubio was not compiled with rubberband\n"); 209 return NULL; 210 } 211 212 uint_t aubio_pitchshift_set_pitchscale (aubio_pitchshift_t * o UNUSED, smpl_t pitchscale UNUSED) 213 { 214 return AUBIO_FAIL; 215 } 216 217 smpl_t aubio_pitchshift_get_pitchscale (aubio_pitchshift_t * o UNUSED) 218 { 219 return 1.; 220 } 221 222 uint_t aubio_pitchshift_set_transpose (aubio_pitchshift_t * o UNUSED, smpl_t transpose UNUSED) { 223 return AUBIO_FAIL; 224 } 225 226 smpl_t aubio_pitchshift_get_transpose (aubio_pitchshift_t * o UNUSED) { 227 return 0.; 228 } 229 230 uint_t aubio_pitchshift_get_latency (aubio_pitchshift_t * o UNUSED) { 231 return 0.; 232 } 233 234 // end of dummy implementation 235 236 #endif /* HAVE_RUBBERBAND */ 154 #endif
Note: See TracChangeset
for help on using the changeset viewer.