From 7a5f963c4247c6278e82c463042701a791a6eb8a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 19 Sep 2016 20:14:21 +0200 Subject: [PATCH] src/effects/pitchshift.c: add crispness as per rubberband command line option --- src/effects/pitchshift.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/effects/pitchshift.c b/src/effects/pitchshift.c index ed22c3d6..8aa7d87a 100644 --- a/src/effects/pitchshift.c +++ b/src/effects/pitchshift.c @@ -56,6 +56,37 @@ new_aubio_pitchshift (const char_t * mode, p->pitchscale = pitchscale; p->rboptions = RubberBandOptionProcessRealTime; + + if ( strcmp(mode,"crispness:0") == 0 ) { + p->rboptions |= RubberBandOptionTransientsSmooth; + p->rboptions |= RubberBandOptionWindowLong; + p->rboptions |= RubberBandOptionPhaseIndependent; + } else if ( strcmp(mode, "crispness:1") == 0 ) { + p->rboptions |= RubberBandOptionDetectorSoft; + p->rboptions |= RubberBandOptionTransientsSmooth; + p->rboptions |= RubberBandOptionWindowLong; + p->rboptions |= RubberBandOptionPhaseIndependent; + } else if ( strcmp(mode, "crispness:2") == 0 ) { + p->rboptions |= RubberBandOptionTransientsSmooth; + p->rboptions |= RubberBandOptionPhaseIndependent; + } else if ( strcmp(mode, "crispness:3") == 0 ) { + p->rboptions |= RubberBandOptionTransientsSmooth; + } else if ( strcmp(mode, "crispness:4") == 0 ) { + // same as "default" + } else if ( strcmp(mode, "crispness:5") == 0 ) { + p->rboptions |= RubberBandOptionTransientsCrisp; + } else if ( strcmp(mode, "crispness:6") == 0 ) { + p->rboptions |= RubberBandOptionTransientsCrisp; + p->rboptions |= RubberBandOptionWindowShort; + p->rboptions |= RubberBandOptionPhaseIndependent; + } else if ( strcmp(mode, "default") == 0 ) { + // nothing to do + } else { + AUBIO_ERR("pitchshift: unknown pitch shifting method %s\n", mode); + goto beach; + } + //AUBIO_MSG("pitchshift: using pitch shifting method %s\n", mode); + //p->rboptions |= RubberBandOptionTransientsCrisp; //p->rboptions |= RubberBandOptionWindowStandard; //p->rboptions |= RubberBandOptionSmoothingOff; -- 2.11.0