24#ifndef RUBBERBAND_STRETCHER_H
25#define RUBBERBAND_STRETCHER_H
27#define RUBBERBAND_VERSION "3.1.0"
28#define RUBBERBAND_API_MAJOR_VERSION 2
29#define RUBBERBAND_API_MINOR_VERSION 7
31#undef RUBBERBAND_DLLEXPORT
33#define RUBBERBAND_DLLEXPORT __declspec(dllexport)
35#define RUBBERBAND_DLLEXPORT
387 OptionProcessOffline = 0x00000000,
388 OptionProcessRealTime = 0x00000001,
390 OptionStretchElastic = 0x00000000,
391 OptionStretchPrecise = 0x00000010,
393 OptionTransientsCrisp = 0x00000000,
394 OptionTransientsMixed = 0x00000100,
395 OptionTransientsSmooth = 0x00000200,
397 OptionDetectorCompound = 0x00000000,
398 OptionDetectorPercussive = 0x00000400,
399 OptionDetectorSoft = 0x00000800,
401 OptionPhaseLaminar = 0x00000000,
402 OptionPhaseIndependent = 0x00002000,
404 OptionThreadingAuto = 0x00000000,
405 OptionThreadingNever = 0x00010000,
406 OptionThreadingAlways = 0x00020000,
408 OptionWindowStandard = 0x00000000,
409 OptionWindowShort = 0x00100000,
410 OptionWindowLong = 0x00200000,
412 OptionSmoothingOff = 0x00000000,
413 OptionSmoothingOn = 0x00800000,
415 OptionFormantShifted = 0x00000000,
416 OptionFormantPreserved = 0x01000000,
418 OptionPitchHighSpeed = 0x00000000,
419 OptionPitchHighQuality = 0x02000000,
420 OptionPitchHighConsistency = 0x04000000,
422 OptionChannelsApart = 0x00000000,
423 OptionChannelsTogether = 0x10000000,
425 OptionEngineFaster = 0x00000000,
426 OptionEngineFiner = 0x20000000
438 DefaultOptions = 0x00000000,
439 PercussiveOptions = 0x00102000
462 virtual void log(
const char *) = 0;
465 virtual void log(
const char *,
double) = 0;
468 virtual void log(
const char *,
double,
double) = 0;
507 Options options = DefaultOptions,
508 double initialTimeRatio = 1.0,
509 double initialPitchScale = 1.0);
529 std::shared_ptr<Logger> logger,
530 Options options = DefaultOptions,
531 double initialTimeRatio = 1.0,
532 double initialPitchScale = 1.0);
892 void study(
const float *
const *input,
size_t samples,
bool final);
911 void process(
const float *
const *input,
size_t samples,
bool final);
950 size_t retrieve(
float *
const *output,
size_t samples)
const;
#define RUBBERBAND_DLLEXPORT
size_t getPreferredStartPad() const
In RealTime mode (unlike in Offline mode) the stretcher performs no automatic padding or delay/latenc...
int Options
A bitwise OR of values from the RubberBandStretcher::Option enum.
void process(const float *const *input, size_t samples, bool final)
Provide a block of "samples" sample frames for processing.
size_t getInputIncrement() const
Retrieve the value of the internal input block increment value.
void setFrequencyCutoff(int n, float f)
Set the value of internal frequency cutoff n to f Hz.
void calculateStretch()
Force the stretcher to calculate a stretch profile.
std::vector< int > getExactTimePoints() const
In offline mode, retrieve the sequence of internal frames for which exact timing has been sought,...
std::vector< float > getPhaseResetCurve() const
In offline mode, retrieve the sequence of internal phase reset detection function values,...
void setDebugLevel(int level)
Set the level of debug output.
float getFrequencyCutoff(int n) const
Return the value of internal frequency cutoff value n.
void reset()
Reset the stretcher's internal buffers.
void setExpectedInputDuration(size_t samples)
Tell the stretcher exactly how many input sample frames it will receive.
void study(const float *const *input, size_t samples, bool final)
Provide a block of "samples" sample frames for the stretcher to study and calculate a stretch profile...
RubberBandStretcher(size_t sampleRate, size_t channels, std::shared_ptr< Logger > logger, Options options=DefaultOptions, double initialTimeRatio=1.0, double initialPitchScale=1.0)
Construct a time and pitch stretcher object with a custom debug logger.
void setFormantScale(double scale)
Set a pitch scale for the vocal formant envelope separately from the overall pitch scale.
double getTimeRatio() const
Return the last time ratio value that was set (either on construction or with setTimeRatio()).
int available() const
Ask the stretcher how many audio sample frames of output data are available for reading (via retrieve...
double getFormantScale() const
Return the last formant scaling ratio that was set with setFormantScale, or 0.0 if the default automa...
size_t getStartDelay() const
Return the output delay of the stretcher.
static void setDefaultDebugLevel(int level)
Set the default level of debug output for subsequently constructed stretchers.
Option
Processing options for the timestretcher.
void setPitchOption(Options options)
Change an OptionPitch configuration setting.
void setFormantOption(Options options)
Change an OptionFormant configuration setting.
size_t getLatency() const
Return the start delay of the stretcher.
std::vector< int > getOutputIncrements() const
In offline mode, retrieve the sequence of internal block increments for output, for the entire audio ...
void setDetectorOption(Options options)
Change an OptionDetector configuration setting.
void setPhaseOption(Options options)
Change an OptionPhase configuration setting.
void setMaxProcessSize(size_t samples)
Tell the stretcher the maximum number of sample frames that you will ever be passing in to a single p...
void setTimeRatio(double ratio)
Set the time ratio for the stretcher.
RubberBandStretcher(const RubberBandStretcher &)=delete
RubberBandStretcher(size_t sampleRate, size_t channels, Options options=DefaultOptions, double initialTimeRatio=1.0, double initialPitchScale=1.0)
Construct a time and pitch stretcher object to run at the given sample rate, with the given number of...
RubberBandStretcher & operator=(const RubberBandStretcher &)=delete
size_t getChannelCount() const
Return the number of channels this stretcher was constructed with.
size_t retrieve(float *const *output, size_t samples) const
Obtain some processed output data from the stretcher.
size_t getSamplesRequired() const
Ask the stretcher how many audio sample frames should be provided as input in order to ensure that so...
int getEngineVersion() const
Return the active internal engine version, according to the OptionEngine flag supplied on constructio...
void setPitchScale(double scale)
Set the pitch scaling ratio for the stretcher.
void setKeyFrameMap(const std::map< size_t, size_t > &)
Provide a set of mappings from "before" to "after" sample numbers so as to enforce a particular stret...
void setTransientsOption(Options options)
Change an OptionTransients configuration setting.
double getPitchScale() const
Return the last pitch scaling ratio value that was set (either on construction or with setPitchScale(...
Interface for log callbacks that may optionally be provided to the stretcher on construction.
virtual void log(const char *, double)=0
Receive a log message and one accompanying numeric value.
virtual void log(const char *)=0
Receive a log message with no numeric values.
virtual void log(const char *, double, double)=0
Receive a log message and two accompanying numeric values.