Giter VIP home page Giter VIP logo

rubberband's People

Contributors

bmatherly avatar cannam avatar logiclrd avatar michel-slm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rubberband's Issues

`setTimeRatio` does nothing and `setPitchScale` only resamples

I'm not sure if it's a usage issue or what but there are two problems:

  1. setTimeRatio does nothing to the output. Setting this to any value has no effect.
  2. setPitchScale only resamples. I.e. if set to 2, there is an octave shift upwards but the duration of halved.

I've tried using a circular buffer for input/output, reading/writing directly to and from vectors, arrays, juce::AudioBuffer, etc. The sample values are not exactly the same but are extremely close which makes me think it is a function of the input being processed by whatever FFT process and being resynthesized.

I'm attempting to do this all offline so I don't have to deal with latency since time-stretching is inherently non-realtime.

A toned-down example with lots of experiments removed:

void PitchShifter::processOffline (AudioBuffer<float>* buffer, const String& writePath)
{
    int                      samples        = buffer->getNumSamples();
    size_t                   sampsToProcess = 0;
    size_t                   numProcessed   = 0;
    int                      numAvailable   = 0;
    size_t                   writeOffset    = 0;
    size_t                   processedInBlock     = 0;
    bool                     saved          = false;
    size_t                   blockSize      = 512;
    juce::AudioBuffer<float> output (buffer->getNumChannels(), buffer->getNumSamples()*2);
    float*                   inPtrs[buffer->getNumChannels()]; // <- these are in/outs of RubberBand
    float*                   outPtrs[output.getNumChannels()]; // <- these are in/outs of RubberBand

    shifter->reset();
    shifter->setMaxProcessSize(blockSize);
    output.clear(); // make sure things are clear

    /*
        I don't know why the time scaling isn't working and why the pitch is not
        independent of time! Note that when you set pitchscale to 2, the duration
        also halves. WTF.
    */
    shifter->setPitchScale (pitchScale);
    shifter->setTimeRatio (timeRatio);

    samplesRequired = static_cast<int> (shifter->getSamplesRequired());

    // do the whole file
    while (numProcessed < samples)
    {

        // do each block of blocksize samples (512)
        while (processedInBlock < blockSize && numProcessed < samples)
        {
            // update the pointers
            for (size_t c = 0; c < buffer->getNumChannels(); ++c)
            {
                inPtrs[c]  = (float* const) buffer->getReadPointer (static_cast<int> (c), numProcessed);
                outPtrs[c] = (float* const) output.getWritePointer (static_cast<int> (c), writeOffset);
            }

            sampsToProcess = std::min (blockSize, std::min (shifter->getSamplesRequired(), samples - numProcessed)); // pass the minumum required
            // sampsToProcess = std::min (blockSize, samples - numProcessed);

            if (numProcessed + sampsToProcess <= samples)
            {
                shifter->process (inPtrs, sampsToProcess, false);
            }
            else
            {
                shifter->process (inPtrs, sampsToProcess, true);
            }

            // return as many samples as we can
            numAvailable = shifter->available();
            if (numAvailable > 0)
            {
                writeOffset += shifter->retrieve (outPtrs, numAvailable);;

            }

            numProcessed += sampsToProcess;
            processedInBlock += sampsToProcess;
            numAvailable = 0; // just in case
        }


        processedInBlock = 0;
        while (shifter->available() > 0)
        {
            numAvailable = shifter->available();
            writeOffset += shifter->retrieve (outPtrs, numAvailable);
        }
    }

    saved = saveBufferToFile (writePath, output, fs); // function that lives elsewhere
}

This simply ends up writing the input buffer to the output buffer when shifter->setPitchRatio(1) and shifter->setTimeScale(x) where x is literally any number.

2.0.2 does not recognise flac, 1.9.0 works

./rubberband-2.0.2-gpl-executable-macos/rubberband -q --time 1.08084 --pitch 6.0184 --crisp 1 -F @/tmp/_^3ab7x88qyK8.opus-ss3705-to4293-ln.flac @/tmp/_^3ab7x88qyK8.opus-ss3705-to4293-t1.08084-p6.0184-c1-F-ln.wav~
ERROR: Failed to open input file "@/tmp/_^3ab7x88qyK8.opus-ss3705-to4293-ln.flac": File contains data in an unimplemented format.

no errors with ./rubberband-1.9.0-gpl-executable-macos/rubberband

the file was created with ffmpeg

file  \@/tmp/_\^3ab7x88qyK8.opus-ss3705-to4293-ln.flac
@/tmp/_^3ab7x88qyK8.opus-ss3705-to4293-ln.flac: FLAC audio bitstream data, 24 bit, stereo, 192 kHz, 112837152 samples

Add to conda

This should be installable via conda install :)

Cannot build Rubber Band library with libsamplerate and libfftw3 installed

OS: GNU/Linux Ubuntu 20.04
gcc version: (Ubuntu 9.3.0-10ubuntu2) 9.3.0

libsamplerate and libfftw3 have all been built and installed correctly, however I'm having a linking error at the make library phase:

g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/rubberband-c.o src/rubberband-c.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/RubberBandStretcher.o src/RubberBandStretcher.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/StretcherProcess.o src/StretcherProcess.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/StretchCalculator.o src/StretchCalculator.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/base/Profiler.o src/base/Profiler.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/dsp/AudioCurveCalculator.o src/dsp/AudioCurveCalculator.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/audiocurves/CompoundAudioCurve.o src/audiocurves/CompoundAudioCurve.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/audiocurves/SpectralDifferenceAudioCurve.o src/audiocurves/SpectralDifferenceAudioCurve.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/audiocurves/HighFrequencyAudioCurve.o src/audiocurves/HighFrequencyAudioCurve.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/audiocurves/SilentAudioCurve.o src/audiocurves/SilentAudioCurve.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/audiocurves/ConstantAudioCurve.o src/audiocurves/ConstantAudioCurve.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/audiocurves/PercussiveAudioCurve.o src/audiocurves/PercussiveAudioCurve.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/dsp/Resampler.o src/dsp/Resampler.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/dsp/FFT.o src/dsp/FFT.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/system/Allocators.o src/system/Allocators.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/system/sysutils.o src/system/sysutils.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/system/Thread.o src/system/Thread.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/StretcherChannelData.o src/StretcherChannelData.cpp
g++ -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHECKS -DUSE_PTHREADS -DNO_TIMING -DNDEBUG -I. -Isrc -Irubberband -g -O2 -fPIC -Wall -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include    -c -o src/StretcherImpl.o src/StretcherImpl.cpp
ar rsc lib/librubberband.a src/rubberband-c.o src/RubberBandStretcher.o src/StretcherProcess.o src/StretchCalculator.o src/base/Profiler.o src/dsp/AudioCurveCalculator.o src/audiocurves/CompoundAudioCurve.o src/audiocurves/SpectralDifferenceAudioCurve.o src/audiocurves/HighFrequencyAudioCurve.o src/audiocurves/SilentAudioCurve.o src/audiocurves/ConstantAudioCurve.o src/audiocurves/PercussiveAudioCurve.o src/dsp/Resampler.o src/dsp/FFT.o src/system/Allocators.o src/system/sysutils.o src/system/Thread.o src/StretcherChannelData.o src/StretcherImpl.o
g++ -shared -Wl,-Bsymbolic -Wl,-soname=librubberband.so.2 src/rubberband-c.o src/RubberBandStretcher.o src/StretcherProcess.o src/StretchCalculator.o src/base/Profiler.o src/dsp/AudioCurveCalculator.o src/audiocurves/CompoundAudioCurve.o src/audiocurves/SpectralDifferenceAudioCurve.o src/audiocurves/HighFrequencyAudioCurve.o src/audiocurves/SilentAudioCurve.o src/audiocurves/ConstantAudioCurve.o src/audiocurves/PercussiveAudioCurve.o src/dsp/Resampler.o src/dsp/FFT.o src/system/Allocators.o src/system/sysutils.o src/system/Thread.o src/StretcherChannelData.o src/StretcherImpl.o -o lib/librubberband.so -L/usr/local/lib -lsamplerate -L/usr/local/lib -lfftw3  -lpthread 
/usr/bin/ld: /usr/local/lib/libfftw3.a(assert.o): relocation R_X86_64_PC32 against symbol `stdout@@GLIBC_2.2.5' can not be used when making a shared object; recompiled using -fPIC
/usr/bin/ld : finale linked failed : bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:146: lib/librubberband.so] Error 1

What could be the issue please?

Obscure crash in Rubberband::Profiler

This happened to me once, and I certainly can't reproduce it. It's possible my program is at fault and not RubberBand, however I'm posting this here in case there's some obviously fixable issue with RB from looking at the call stack.

Basically, I was stress testing my app under the debugger by "clicking around wildly" and this happened:

Thread 110: EXC_BAD_ACCESS (code=1, address=0x18)

#0	0x0000000117e22d03 in void std::__1::__tree_balance_after_insert<std::__1::__tree_node_base<void*>*>(std::__1::__tree_node_base<void*>*, std::__1::__tree_node_base<void*>*) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tree:277
#1	0x0000000117e2f522 in std::__1::__tree<std::__1::__value_type<char const*, float>, std::__1::__map_value_compare<char const*, std::__1::__value_type<char const*, float>, std::__1::less<char const*>, true>, std::__1::allocator<std::__1::__value_type<char const*, float> > >::__insert_node_at(std::__1::__tree_end_node<std::__1::__tree_node_base<void*>*>*, std::__1::__tree_node_base<void*>*&, std::__1::__tree_node_base<void*>*) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tree:2085
#2	0x0000000117e2e3f7 in std::__1::pair<std::__1::__tree_iterator<std::__1::__value_type<char const*, float>, std::__1::__tree_node<std::__1::__value_type<char const*, float>, void*>*, long>, bool> std::__1::__tree<std::__1::__value_type<char const*, float>, std::__1::__map_value_compare<char const*, std::__1::__value_type<char const*, float>, std::__1::less<char const*>, true>, std::__1::allocator<std::__1::__value_type<char const*, float> > >::__emplace_unique_key_args<char const*, std::__1::piecewise_construct_t const&, std::__1::tuple<char const* const&>, std::__1::tuple<> >(char const* const&, std::__1::piecewise_construct_t const&&&, std::__1::tuple<char const* const&>&&, std::__1::tuple<>&&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tree:2112
#3	0x0000000117e26fce in std::__1::map<char const*, float, std::__1::less<char const*>, std::__1::allocator<std::__1::pair<char const* const, float> > >::operator[](char const* const&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/map:1366
#4	0x0000000117e26d64 in RubberBand::Profiler::add(char const*, float) at /Users/jamie/Documents/plugin/Source/External/rubberband/src/base/Profiler.cpp:63
#5	0x0000000117e2ba09 in RubberBand::Profiler::end() at /Users/jamie/Documents/plugin/Source/External/rubberband/src/base/Profiler.cpp:209
#6	0x0000000117e2b937 in RubberBand::Profiler::~Profiler() at /Users/jamie/Documents/plugin/Source/External/rubberband/src/base/Profiler.cpp:186
#7	0x0000000117e2ba35 in RubberBand::Profiler::~Profiler() at /Users/jamie/Documents/plugin/Source/External/rubberband/src/base/Profiler.cpp:185
#8	0x0000000117e7f20f in RubberBand::RubberBandStretcher::Impl::modifyChunk(unsigned long, unsigned long, bool) at /Users/jamie/Documents/plugin/Source/External/rubberband/src/StretcherProcess.cpp:902
#9	0x0000000117e7d2ab in RubberBand::RubberBandStretcher::Impl::processChunkForChannel(unsigned long, unsigned long, unsigned long, bool) at /Users/jamie/Documents/plugin/Source/External/rubberband/src/StretcherProcess.cpp:473
#10	0x0000000117e7bc97 in RubberBand::RubberBandStretcher::Impl::processChunks(unsigned long, bool&, bool&) at /Users/jamie/Documents/plugin/Source/External/rubberband/src/StretcherProcess.cpp:308
#11	0x0000000117e7b6bc in RubberBand::RubberBandStretcher::Impl::ProcessThread::run() at /Users/jamie/Documents/plugin/Source/External/rubberband/src/StretcherProcess.cpp:82
#12	0x0000000117e41dce in RubberBand::Thread::staticRun(void*) at /Users/jamie/Documents/plugin/Source/External/rubberband/src/system/Thread.cpp:367

ticks while changing pitch scale constantly

Hi to you all, I'm really appreciate your help with this issue, I'm not sure if I doing all as I should cause I saw this issue already solved in,
#30
https://todo.sr.ht/~breakfastquay/rubberband/6

Vary thanks for your time..

When I'm trying to change the pitchshift (dynamically) constantly there is a lot of ticking along the all output.

What have I done:

  1. downloaded the repo from git.

  2. opened it in visual studio 2015

  3. added libsamplerate from https://github.com/libsndfile/libsamplerate.

    • I took the relevant source files from the repo and added them to the project.
  4. than, in the main.cpp and Resampler.cpp I add
    #define HAVE_LIBSAMPLERATE"
    #define DUSE_SPEEX

  5. run main.cpp in debug mode with the flags -t 1 -p 5 -R

  6. In the RT loop I change the pitchshift scale in each iteration like you can see in the script below,

Maybe I didn't add libsamplerate properly or I need to configure something else?
Please tell me if you need anything to help you help me..

while (frame < sfinfo.frames) {

    int count = -1;

if ((count = sf_readf_float(sndfile, fbuf, ibs)) < 0) break;
    
    countIn += count;

    for (size_t c = 0; c < channels; ++c) {
        for (int i = 0; i < count; ++i) {
            float value = fbuf[i * channels + c];
            ibuf[c][i] = value;
        }
    }

    // ****************   SET NEW PITCH SCALE - the only change
    new_pitch_scale = ...
    rb.setPitchScale(new_pitch_scale);
    // ****************

    bool final = (frame + ibs >= sfinfo.frames);

    if (debug > 2) {
        cerr << "count = " << count << ", ibs = " << ibs << ", frame = " << frame << ", frames = " << sfinfo.frames << ", final = " << final << endl;
    }

    ts.process(ibuf, count, final);

    int avail = ts.available();
    if (debug > 1) cerr << "available = " << avail << endl;

    if (avail > 0) {
        float **obf = new float *[channels];
        for (size_t i = 0; i < channels; ++i) {
            obf[i] = new float[avail];
        }
        ts.retrieve(obf, avail);
        countOut += avail;
        float *fobf = new float[channels * avail];
        for (size_t c = 0; c < channels; ++c) {
            for (int i = 0; i < avail; ++i) {
                float value = obf[c][i];
                if (value > 1.f) value = 1.f;
                if (value < -1.f) value = -1.f;
                fobf[i * channels + c] = value;
            }
        }

        sf_writef_float(sndfileOut, fobf, avail);
        delete[] fobf;
        for (size_t i = 0; i < channels; ++i) {
            delete[] obf[i];
        }
        delete[] obf;
    }

    if (frame == 0 && !realtime && !quiet) {
        cerr << "Pass 2: Processing..." << endl;
    }

int p = int((double(frame) * 100.0) / sfinfo.frames);
if (p > percent || frame == 0) {
    percent = p;
        if (!quiet) {
            cerr << "\r" << percent << "% ";
        }
}

    frame += ibs;
}

Thank you !
Hagay

Remove real-time mode for the CLI

Hi, I am quite new to this project, so I decided to make an issue first before immediately doing a pull request. I noticed the CLI provides a -R option to enter real-time mode. However, I believe streaming input and output is not supported with the CLI?

I do know that when using the C++ library, the real-time mode can be used, so I would suggest only removing the -R option to enter the mode for the CLI. The reason being that it can confuse CLI users (like myself).

Hopefully, I am not missing anything. For example, the CLI somehow does support streaming or that this is a planned feature.

Problem with Makefile.osx with FFTW3 and LIBSAMPLERATE

on Mac (mine is 10.13), if we simply set -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 flag and change LIBRARY_LIBS accordingly (-L/usr/local/lib -lsamplerate -L/usr/local/lib -lfftw3), the make just doesn't work. There're still a lot of undefined symbols. In order to make it work, we need to set:
-DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY
Please also fix this in the README, thanks:)

Actually I think what most people would like to see is a universal "configuire and make" system for both linux and mac, or you could make it a cmake supportable. Just to get rid of the Makefile.osx

The output sample count is not equal to the input sample count in offline mode

while using Rubberband to perform pitch shifting contiuously, I found that when the pitch scale changes from postive to negative, the output sample count is not equal to input sample count. I reset the stretcher before reset the pitch scale. However, in offline mode, after the study step, the output sample count should be equal to the input sample count. Is this situation normal or not?

Mismatch between C++ and C option values

In C++:

OptionPitchHighSpeed   = 0x00000000,
OptionPitchHighQuality = 0x02000000,

In C:

RubberBandOptionPitchHighQuality = 0x00000000,
RubberBandOptionPitchHighSpeed   = 0x02000000,

The enum order (and values) are swapped in the C and C++ headers.

Undefined Symbols Error

Hello there, I've followed the proper install instructions on a 10.12.6 Mac and included the "rubberband/RubberBandStretcher.h" and copied over the required src folder and rubberband folder but I'm getting errors at compile time that the rubberband functions are not defined...
here's an example..

"RubberBand::RubberBandStretcher::~RubberBandStretcher()", referenced from:
        autoTune::autoTune() in MainApp.o

ld: symbol(s) not found for architecture x86_64

hope to hear back soon, I'm loving the way this is coded and can't wait to hear it in action

I've also tried the portaudio approach by dropping in the compiled .dylib and .a and .h for rubberband and that didn't get as far as these errors

EXTREME Time Stretch Quality

do you have any plans of improving the audio quality of Audio Output?

as so far it seems to produce ALMOST identical sound quality in comparison to FL STUDIO (version 20 used)

as this is the original file, with a detected bpm of 132.077

WAIFU METAL V. 1.0 TRIMMED.wav.zip

and this is the FL Studio ZPLANE Elastique time stretched version, set in Stretch mode, NOT Resample Mode

WAIFU METAL V. 1.0 TRIMMED 25 percent time stretch FL STUDIO ZPLANE.wav.zip

rubberband.exe "WAIFU METAL V. 1.0 TRIMMED.wav" s25.wav -p 0 -T .25
s25.zip

HOWEVER it deverges when you go to extreme stretches (eg 10% (ratio 10))
(61 BARS in FL, original is 7 BARS)

this is the FL Studio ZPLANE Elastique time stretched version, set in Stretch mode, NOT Resample Mode
s10_time_stretch_FL_STUDIO_ZPLANE.zip

rubberband.exe "WAIFU METAL V. 1.0 TRIMMED.wav" s10.wav -p 0 -T .10
s10.zip

Output sample range can be beyond [-1, 1]

Hi There,

I've come across a behaviour where the samples I get from retrieve can be above 1. I thought I could assume the range to be [-1, 1], if not, is there a way I can find the range?
I'm running the stretcher in real time mode, providing getSamplesRequired number of samples to process. I'm using a loud pop song. Could you please advise if this is expected and if I can set the range of sample values?

Cheers,

Amy

Win64 meson cross compile broken on v2.0.0

Seems like the cstdint import is just missing, I would add a PR but idk if you want that import to happen in sysutils.h or in StretchCalculator.h

Build log

FAILED: rubberband.lib.p/src_StretchCalculator.cpp.obj
x86_64-w64-mingw32-g++ -Irubberband.lib.p -I. -I.. -I../rubberband -I../src -I/xc/workdir/toolchain/x86_64-w64-mingw32/xc/workdir/toolchain/x86_64-w64-mingw32/x86_64-w64-mingw32/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++14 -O3 -O3 -mtune=skylake -march=skylake -ffast-math -pthread -DUSE_BUILTIN_FFT -DHAVE_LIBSAMPLERATE -DNO_THREAD_CHECKS -DNO_TIMING -DNDEBUG -D_WIN32 -DNOMINMAX -D_USE_MATH_DEFINES -DGETOPT_API= -MD -MQ rubberband.lib.p/src_StretchCalculator.cpp.obj -MF rubberband.lib.p/src_StretchCalculator.cpp.obj.d -o rubberband.lib.p/src_StretchCalculator.cpp.obj -c ../src/StretchCalculator.cpp
In file included from ../src/StretchCalculator.cpp:24:
../src/StretchCalculator.h:116:5: error: 'int64_t' does not name a type
  116 |     int64_t m_inFrameCounter;
      |     ^~~~~~~
../src/StretchCalculator.h:31:1: note: 'int64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
   30 | #include <map>
  +++ |+#include <cstdint>
   31 |
../src/StretchCalculator.h:117:15: error: 'int64_t' was not declared in this scope
  117 |     std::pair<int64_t, int64_t> m_frameCheckpoint;
      |               ^~~~~~~
../src/StretchCalculator.h:117:15: note: 'int64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
../src/StretchCalculator.h:117:24: error: 'int64_t' was not declared in this scope
  117 |     std::pair<int64_t, int64_t> m_frameCheckpoint;
      |                        ^~~~~~~
../src/StretchCalculator.h:117:24: note: 'int64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
../src/StretchCalculator.h:117:31: error: template argument 1 is invalid
  117 |     std::pair<int64_t, int64_t> m_frameCheckpoint;
      |                               ^
../src/StretchCalculator.h:117:31: error: template argument 2 is invalid
../src/StretchCalculator.h:118:5: error: 'int64_t' does not name a type
  118 |     int64_t expectedOutFrame(int64_t inFrame, double timeRatio);
      |     ^~~~~~~
../src/StretchCalculator.h:118:5: note: 'int64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
../src/StretchCalculator.cpp: In constructor 'RubberBand::StretchCalculator::StretchCalculator(size_t, size_t, bool)':
../src/StretchCalculator.cpp:49:5: error: class 'RubberBand::StretchCalculator' does not have any field named 'm_inFrameCounter'
   49 |     m_inFrameCounter(0),
      |     ^~~~~~~~~~~~~~~~
../src/StretchCalculator.cpp:50:5: error: expression list treated as compound expression in mem-initializer [-fpermissive]
   50 |     m_frameCheckpoint(0, 0),
      |     ^~~~~~~~~~~~~~~~~~~~~~~
../src/StretchCalculator.cpp:50:23: warning: left operand of comma operator has no effect [-Wunused-value]
   50 |     m_frameCheckpoint(0, 0),
      |                       ^
../src/StretchCalculator.cpp: At global scope:
../src/StretchCalculator.cpp:324:1: error: no declaration matches 'int64_t RubberBand::StretchCalculator::expectedOutFrame(int64_t, double)'
  324 | StretchCalculator::expectedOutFrame(int64_t inFrame, double timeRatio)
      | ^~~~~~~~~~~~~~~~~
../src/StretchCalculator.cpp:324:1: note: no functions named 'int64_t RubberBand::StretchCalculator::expectedOutFrame(int64_t, double)'
In file included from ../src/StretchCalculator.cpp:24:
../src/StretchCalculator.h:35:7: note: 'class RubberBand::StretchCalculator' defined here
   35 | class StretchCalculator
      |       ^~~~~~~~~~~~~~~~~
../src/StretchCalculator.cpp: In member function 'int RubberBand::StretchCalculator::calculateSingle(double, double, float, size_t, size_t, size_t)':
../src/StretchCalculator.cpp:387:14: error: 'm_inFrameCounter' was not declared in this scope; did you mean 'm_outFrameCounter'?
  387 |             (m_inFrameCounter, m_prevTimeRatio);
      |              ^~~~~~~~~~~~~~~~
      |              m_outFrameCounter
../src/StretchCalculator.cpp:386:32: error: 'expectedOutFrame' was not declared in this scope
  386 |         int64_t toCheckpoint = expectedOutFrame
      |                                ^~~~~~~~~~~~~~~~
../src/StretchCalculator.cpp:407:45: error: 'm_inFrameCounter' was not declared in this scope; did you mean 'm_outFrameCounter'?
  407 |         std::cerr << "inFrameCounter = " << m_inFrameCounter
      |                                             ^~~~~~~~~~~~~~~~
      |                                             m_outFrameCounter
../src/StretchCalculator.cpp:415:10: error: 'm_inFrameCounter' was not declared in this scope; did you mean 'm_outFrameCounter'?
  415 |         (m_inFrameCounter + analysisWindowSize/4, timeRatio);
      |          ^~~~~~~~~~~~~~~~
      |          m_outFrameCounter
../src/StretchCalculator.cpp:414:24: error: 'expectedOutFrame' was not declared in this scope
  414 |     int64_t intended = expectedOutFrame
      |                        ^~~~~~~~~~~~~~~~
../src/StretchCalculator.cpp: In member function 'void RubberBand::StretchCalculator::reset()':
../src/StretchCalculator.cpp:533:5: error: 'm_inFrameCounter' was not declared in this scope; did you mean 'm_outFrameCounter'?
  533 |     m_inFrameCounter = 0;
      |     ^~~~~~~~~~~~~~~~
      |     m_outFrameCounter
../src/StretchCalculator.cpp:534:30: error: cannot convert 'std::pair<long long int, long long int>' to 'int' in assignment
  534 |     m_frameCheckpoint = std::pair<int64_t, int64_t>(0, 0);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              std::pair<long long int, long long int>
[9/30] Compiling C++ object rubberband.lib.p/src_system_Allocators.cpp.obj
[10/30] Compiling C++ object rubberband.lib.p/src_audiocurves_PercussiveAudioCurve.cpp.obj
[11/30] Compiling C++ object rubberband.lib.p/src_dsp_Resampler.cpp.obj
[12/30] Compiling C++ object rubberband.lib.p/src_base_Profiler.cpp.obj
[13/30] Compiling C++ object rubberband.lib.p/src_RubberBandStretcher.cpp.obj
[14/30] Compiling C++ object rubberband.lib.p/src_StretcherProcess.cpp.obj
In file included from ../src/dsp/Window.h:31,
                 from ../src/StretcherImpl.h:29,
                 from ../src/StretcherProcess.cpp:24:
../src/base/RingBuffer.h: In instantiation of 'RubberBand::RingBuffer<T>::~RingBuffer() [with T = float]':
../src/base/RingBuffer.h:219:1:   required from here
../src/dsp/../system/sysutils.h:119:22: warning: statement has no effect [-Wunused-value]
  119 | #define MUNLOCK(a,b) 1
      |                      ^
../src/base/RingBuffer.h:226:9: note: in expansion of macro 'MUNLOCK'
  226 |         MUNLOCK((void *)m_buffer, m_size * sizeof(T));
      |         ^~~~~~~
[15/30] Compiling C++ object rubberband.lib.p/src_dsp_FFT.cpp.obj
ninja: build stopped: subcommand failed.

Broken cross-compilation with meson

Since 1.9.1 removed the autotools based build system, I was forced to use meson.
However, cross-compiling using meson has so far proven impossible.

The reason is a pretty simple one:
https://github.com/breakfastquay/rubberband/blob/default/meson.build#L20

Here the system variable is taken from build_machine instead of host_machine, thus on a build for Windows from Linux, it won't be "windows", and the build script will enable a bunch of non-Windows things, breaking the build.

Just replacing that with host_machine.system() appears to fix the build.

speex... crashing - quite easy to fix

Hi Chris,

I've found that the speex code is very prone to crashing, due to hidden signed/unsigned conversions.
macOS/iOS/tvOS, using Clang.

For example:

for (j = old_length - 2 + st->magic_samples[i]; j >= 0; j--) {

If old_length is 0, this leads to j becoming a seriously out of range value (because old_length is unsigned...)

Needs protecting with e.g. something like:

if (old_length > 2) {
  for (j = old_length - 2 + st->magic_samples[i]; j >= 0; j--) {

HTH

Pete

Build failure without ladspa-sdk installed

This should be checked in the configure script.

In file included from ladspa/RubberBandPitchShifter.cpp:24:
ladspa/RubberBandPitchShifter.h:27:10: fatal error: ladspa.h: Datei oder Verzeichnis nicht gefunden
   27 | #include <ladspa.h>
      |          ^~~~~~~~~~
compilation terminated.

Tested with current master branch on Ubuntu Focal 20.4

You have an error in docs on the main page of this git

Here you write the example:

For example,
  $ rubberband -t 1.5 -p 2.0 test.wav output.wav
stretches the file test.wav to 50% longer than its original duration, shifts it up in pitch by one octave, and writes the output to output.wav.

but it's a pitch for one NOTE not an octave. Correct me if I'm wrong.
Tested on RubberBand 2.0.2

setPitchScale(...) can lead to audible glitching

Hi Chris,

I’m finding that if I adjust pitch - even by a tiny amount - using setPitchScale(..), in real-time mode; this is rarely handled smoothly by the library. It always settles down, but the change is very audible / glitchy.

Is this a known issue?

Great library btw! Pete

make install fails when jni isn't built

In the makefile, the 'all' target doesn't build JNI. Which is good--I don't want to build JNI, I'm just using this for ffmpeg. But then the 'install' target tries to copy the librubberband-jni.so file, and fails, and as a result, the pc file isn't created and the install is useless:
cp -f lib/librubberband-jni.so /home/texasdex/target/lib/librubberband-jni.so
cp: cannot stat ‘lib/librubberband-jni.so’: No such file or directory

I'm not a makefile expert but I checked with someone who was and they said I wasn't doing anything wrong, the issue was with the makefile itself.

I can work around this with make install JNI_TARGET=/dev/null but that's an awful hack that results in an empty file being installed--not ideal.

Low sampling rates (50 - 100 Hz)

Hi, I am working with seismic data (WAV files) which is usually sampled at 100 Hz.
First I tried to stretch time (-t) or shift pitch (-f) but there is no progress at all.

On the contrary, working with regular audio wav files (44 kHz) works perfectly.

To evaluate if the low sampling rate might be causing the problem I changed it to 1000 Hz -which creates an undesired time shortening (10x) and pitch shift, also 10x-.

Now rubberband manage to process the file, but creates wrong waves. For example, trying to stretch time back to original (-t 10) results in a concatenation of the same wave...

I then realized that the window size of analysis and sythesis (8162) is to big for the limited number of samples, I think this might be the problem. Is there a way to change this default value for example 1024 samples?

I would appreciate any light on this issue. I provide the WAV file I am using.
wave.zip

Leo

Request for Adding New Android Example

Current android example of rubberband is outdated and hard to use in practice, so I'm requesting for adding this example to documentation(or alter existing Android example).

Link to Example Repository

This example uses ExoPlayer with custom audio processor RubberBandAudioProcessor, which I implemented. Any audio source supported by ExoPlayer (including stream source) could be played without any effort.
The project is compatible for Android Studio, and targets Android SDK 30(Android 11).

I had no way to create pull request to android example repository(as it is in sourcehut), so I had to ask you via issue tracker.

Best regards.

Pitch-shifting in real-time mode seems to cause audio dropouts at the start of a stream

Hi @cannam! Thanks for Rubber Band - big fan of the library.

I've recently helped integrate Rubber Band into Pedalboard, a Python audio effects library I maintain, but I'm having a bit of trouble with it. Namely, I'm using Rubber Band in real-time mode with threading disabled to fit into a plugin chain, and I find that with modest pitch shifts (1.25x), I'm getting audio dropouts at the start of processing.

For my test case, I'm using setPitchShift(1.25) and running Rubber Band with the following options:

RubberBandStretcher::OptionProcessRealTime 
RubberBandStretcher::OptionThreadingNever
RubberBandStretcher::OptionChannelsTogether
RubberBandStretcher::OptionPitchHighQuality

When passing in fixed-size blocks of 512 samples (44.1kHz, stereo) to process, followed by immediate calls to available and retrieve, I get the following sequence of log lines from my test harness:

Rubber Band getLatency() reports 819 samples of latency.

Pushed 512 samples into Rubber Band.
Pulled 0 samples out of Rubber Band (0 were available).
Pushed 512 samples into Rubber Band.
Pulled 0 samples out of Rubber Band (0 were available).
Pushed 512 samples into Rubber Band.
Pulled 0 samples out of Rubber Band (0 were available).
Pushed 512 samples into Rubber Band.
Pulled 117 samples out of Rubber Band (117 were available).
Pushed 512 samples into Rubber Band.
Pulled 215 samples out of Rubber Band (215 were available).
Pushed 512 samples into Rubber Band.
Pulled 213 samples out of Rubber Band (213 were available).
Pushed 512 samples into Rubber Band.
Pulled 213 samples out of Rubber Band (213 were available).
Pushed 512 samples into Rubber Band.
Pulled 213 samples out of Rubber Band (213 were available).
Pushed 512 samples into Rubber Band.
Pulled 212 samples out of Rubber Band (212 were available).
Pushed 512 samples into Rubber Band.
Pulled 224 samples out of Rubber Band (224 were available).
Pushed 512 samples into Rubber Band.
Pulled 435 samples out of Rubber Band (435 were available).
Pushed 512 samples into Rubber Band.
Pulled 512 samples out of Rubber Band (637 were available).
Pushed 512 samples into Rubber Band.
Pulled 512 samples out of Rubber Band (542 were available).
Pushed 512 samples into Rubber Band.
Pulled 512 samples out of Rubber Band (650 were available).
Pushed 512 samples into Rubber Band.
Pulled 512 samples out of Rubber Band (549 were available).
... (all subsequent log lines show at least 512 samples being supplied)

Only after supplying in 2,048 samples do I start to get output, despite the fact that the stretcher is reporting only 819 samples of latency. Also, once the output does start coming out, it comes out in patches for the first couple calls, which all report fewer samples available than provided until about 128ms of audio has been passed in. This results in audible dropouts at the start of any audio file that's been processed.

I feel like I must be missing something obvious here - am I using Rubber Band incorrectly? Is there a way to ensure that Rubber Band supplies a constant audio stream (without any dropouts) when feeding it a constant stream of input? (Thanks for your help!)

link failure with 3.0.0 and Clang 14.0 on Linux

With environment variables CC=clang and CXX=clang++ when running Meson, the build fails with:

[27/44] Linking target librubberband.so.2.2.0
FAILED: librubberband.so.2.2.0
clang++  -o librubberband.so.2.2.0 librubberband_objlib.a.p/src_rubberband-c.cpp.o librubberband_objlib.a.p/src_RubberBandStretcher.cpp.o librubberband_objlib.a.p/src_faster_AudioCurveCalculator.cpp.o librubberband_objlib.a.p/src_faster_CompoundAudioCurve.cpp.o librubberband_objlib.a.p/src_faster_HighFrequencyAudioCurve.cpp.o librubberband_objlib.a.p/src_faster_SilentAudioCurve.cpp.o librubberband_objlib.a.p/src_faster_PercussiveAudioCurve.cpp.o librubberband_objlib.a.p/src_faster_R2Stretcher.cpp.o librubberband_objlib.a.p/src_faster_StretcherChannelData.cpp.o librubberband_objlib.a.p/src_faster_StretcherProcess.cpp.o librubberband_objlib.a.p/src_common_Allocators.cpp.o librubberband_objlib.a.p/src_common_FFT.cpp.o librubberband_objlib.a.p/src_common_Log.cpp.o librubberband_objlib.a.p/src_common_Profiler.cpp.o librubberband_objlib.a.p/src_common_Resampler.cpp.o librubberband_objlib.a.p/src_common_StretchCalculator.cpp.o librubberband_objlib.a.p/src_common_sysutils.cpp.o librubberband_objlib.a.p/src_common_Thread.cpp.o librubberband_objlib.a.p/src_finer_R3Stretcher.cpp.o librubberband_objlib.a.p/src_common_BQResampler.cpp.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,librubberband.so.2 -Wl,--end-group -fuse-ld=mold -pthread
mold: error: undefined symbol: __atomic_is_lock_free
>>> referenced by R3Stretcher.cpp
>>>               librubberband_objlib.a.p/src_finer_R3Stretcher.cpp.o:(RubberBand::R3Stretcher::R3Stretcher(RubberBand::R3Stretcher::Parameters, double, double, RubberBand::Log))>>> referenced by R3Stretcher.cpp
>>>               librubberband_objlib.a.p/src_finer_R3Stretcher.cpp.o:(RubberBand::R3Stretcher::R3Stretcher(RubberBand::R3Stretcher::Parameters, double, double, RubberBand::Log))
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

The error is reproducible regardless of linker (mold, lld, GNU ld).

Compiling with GCC 12.1.1 works.

dotnet on Linux

I tried to build the dotnet sln but it failed at importing the following projects in rubberband-dll.vcxproj:

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

This looks like being specific to Windows, but I'm on Linux. Any suggestions to get the .NET wrapper work on Linux please?

Transients at half speed

Hi! Really great library!

Using the standalone application I noticed there's a quirk when you slow down to half speed using mushy preset. If you switch back and forth from "Percussive" and back to "Mushy" the transients will sound perfect. I guess that "half speed" is a special case, but i think it would be great if this can be done automatically.

Use speexdsp library

Since 1.2rc2, speexdsp is a separate package and a library, so rubberband does not need a copy of the speex resampler source code anymore.

Clicks while changing pitch shift factor

Hello, and first of all thanks for this amazing library.

I am having troubles in changing the pitch shift factor dynamically, I am not sure I'm doing the right steps.
I need to do it off-line, but if I understand correctly, dynamic change of shift is only possible in RealTime mode, hence I:

  • instantiate the RubberBandStretcher with RealTime options
  • study the blocks (do I need to set the right pitch scale for each block before studying it? Or can I refrain from that?)
  • process each block (changing the pitch beforehand), and collect the available samples.
    The changes in pitch are of course small from one block to the next, it's an interpolation of a breakpoint function.
    However, I am having lots and lots of small clicks in the output result. Some of them are negligible, but when you add them all up they make the output result quite dirty.

Is there something I should do to smooth things in this case?
What is the correct way to implement a dynamic pitch shifting?
(I have tried all the options I could find, without success.)

Thanks in advance. I'm putting a simplified version of my code below.

Daniele

`
RubberBandStretcher rb((long)sr, channelcount, options, 1., initial_pitch_scale);
rb.setExpectedInputDuration(framecount);

// STUDYING....
    for (long i = 0; i < numblocks; i++) {
        new_pitch_scale = ....;       	    // <get the block pitch scale>
        rb.setPitchScale(new_pitch_scale);
        
        long count = ((i+1)*blocksize > framecount ? framecount - i*blocksize : blocksize);
        for (long c = 0; c < channelcount; c++) {
            for (long j = 0; j < count; j++)
                ibuf[c][j] = sample[(i*blocksize+j)*channelcount + c];
        }
        rb.study(ibuf, count, i==(numblocks-1));
    }

    // PROCESSING...
    long outframecount = 0;
    double old_pitch_scale = -1;
    long output_sample_wk_allocated_frames = framecount;
    float *output_sample_wk = (float *)bach_newptr(channelcount * output_sample_wk_allocated_frames * sizeof(float));
    for (long i = 0; i < numblocks; i++) {
        fill(ibuf, ...) // fill buffer from my samples
        
        new_pitch_scale = ....;       	    // <get the block pitch scale>
        rb.setPitchScale(new_pitch_scale);
        
        rb.process(ibuf, count, i==(numblocks-1));
        
        int avail = rb.available();
        if (avail > 0) { // we've got something as output
            float **obf = new float *[channelcount];
            long pivot = outframecount;
            for (long c = 0; c < channelcount; c++) {
                obf[c] = new float[avail];
            }
            rb.retrieve(obf, avail);
            outframecount += avail;
            
	/// then add the samples
            for (long c = 0; c < channelcount; c++) {
                for (int i = 0; i < avail; i++) {
                    output_sample_wk[(pivot + i)*channelcount + c] = obf[c][i];
                }
            }

            for (long c = 0; c < channelcount; c++)
                delete[] obf[c];
            delete[] obf;
        }
    }`

headers not installed with meson

Hi thanks for rubbberband! We use it Shotcut. Last night's nightly builds of Shotcut failed, and I see now it was due to converting to meson. We can consider to pin this to your latest release, but I thought I would go ahead and convert our build over to meson and get it done with. Build fails with fatal error: rubberband/RubberBandStretcher.h: No such file or directory
We are building on Ubuntu 18.04 with:

  1. mason setup builddir --prefix=$FINAL_INSTALL_DIR
  2. ninja -C builddir
root@8dddfa0d338a:~/shotcut/src/rubberband# meson install -C builddir
ninja: Entering directory `builddir'
ninja: no work to do.
Installing librubberband.a to /root/shotcut/Shotcut/Shotcut.app/lib
Installing librubberband.so.2.1.3 to /root/shotcut/Shotcut/Shotcut.app/lib
Installing ladspa-rubberband.so to /root/shotcut/Shotcut/Shotcut.app/lib/ladspa
Installing /root/shotcut/src/rubberband/ladspa/ladspa-rubberband.cat to /root/shotcut/Shotcut/Shotcut.app/lib/ladspa
Installing /root/shotcut/src/rubberband/ladspa/ladspa-rubberband.rdf to /root/shotcut/Shotcut/Shotcut.app/share/ladspa/rdf
Installing /root/shotcut/src/rubberband/builddir/meson-private/rubberband.pc to /root/shotcut/Shotcut/Shotcut.app/lib/pkgconfig
root@8dddfa0d338a:~/shotcut/src/rubberband# ninja install
ninja: error: loading 'build.ninja': No such file or directory
root@8dddfa0d338a:~/shotcut/src/rubberband# ninja -C builddir install
ninja: Entering directory `builddir'
[0/1] Installing files.
Installing librubberband.a to /root/shotcut/Shotcut/Shotcut.app/lib
Installing librubberband.so.2.1.3 to /root/shotcut/Shotcut/Shotcut.app/lib
Installing ladspa-rubberband.so to /root/shotcut/Shotcut/Shotcut.app/lib/ladspa
Installing /root/shotcut/src/rubberband/ladspa/ladspa-rubberband.cat to /root/shotcut/Shotcut/Shotcut.app/lib/ladspa
Installing /root/shotcut/src/rubberband/ladspa/ladspa-rubberband.rdf to /root/shotcut/Shotcut/Shotcut.app/share/ladspa/rdf
Installing /root/shotcut/src/rubberband/builddir/meson-private/rubberband.pc to /root/shotcut/Shotcut/Shotcut.app/lib/pkgconfig

hiss / white noise after rubberband processing

Hi there! I've encountered a problem that after processing .wav file I get .wav file with hiss / white noise effect.

I tried to apply ratio of 1.0 - meaning that resulting file is the same length as the original but can please someone shed a light on what did I do wrong that I get these issues?

Pitch stretching with mid/side processing can cause a heap buffer overflow under certain conditions

Hello again! I think I've run across a very rare edge case with Rubber Band. I seem to be able to consistently make Rubber Band write past the end of an internal buffer and cause a crash when the following conditions are true:

  • Pitch stretching is being used
  • Audio is passed in fixed-size chunks to process (i.e.: passing in more than getSamplesRequired())
  • OptionProcessRealTime, OptionChannelsTogether and PitchHighSpeed are all passed
  • Two channels of audio are passed
  • The size of each audio buffer exceeds 4,096 samples

In this case, Address Sanitizer reports a heap buffer overflow past the end of the ms buffer:

==30666==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x629000040200 at pc 0x00010b95f33e bp 0x7ffee42f55e0 sp 0x7ffee42f55d8
WRITE of size 4 at 0x629000040200 thread T0
    #0 0x10b95f33d in RubberBand::RubberBandStretcher::Impl::prepareChannelMS(unsigned long, float const* const*, unsigned long, unsigned long, float*) StretcherProcess.cpp:160
    #1 0x10b95c649 in RubberBand::RubberBandStretcher::Impl::consumeChannel(unsigned long, float const* const*, unsigned long, unsigned long, bool) StretcherProcess.cpp:216
    #2 0x10b9309e1 in RubberBand::RubberBandStretcher::Impl::process(float const* const*, unsigned long, bool) StretcherImpl.cpp:1335
    #3 0x10b92fed6 in RubberBand::RubberBandStretcher::process(float const* const*, unsigned long, bool) RubberBandStretcher.cpp:146

0x629000040200 is located 0 bytes to the right of 16384-byte region [0x62900003c200,0x629000040200)
allocated by thread T0 here:
    #0 0x10249c17d in wrap_malloc+0x9d (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x4917d)
    #1 0x102275f43 in float* RubberBand::allocate<float>(unsigned long) Allocators.h:84
    #2 0x1022a3604 in float* RubberBand::allocate_and_zero<float>(unsigned long) Allocators.h:165
    #3 0x1022a28d7 in RubberBand::RubberBandStretcher::Impl::ChannelData::construct(std::__1::set<unsigned long, std::__1::less<unsigned long>, std::__1::allocator<unsigned long> > const&, unsigned long, unsigned long, unsigned long) StretcherChannelData.cpp:91
    #4 0x1022a30f8 in RubberBand::RubberBandStretcher::Impl::ChannelData::ChannelData(std::__1::set<unsigned long, std::__1::less<unsigned long>, std::__1::allocator<unsigned long> > const&, unsigned long, unsigned long, unsigned long) StretcherChannelData.cpp:48
    #5 0x1022a3174 in RubberBand::RubberBandStretcher::Impl::ChannelData::ChannelData(std::__1::set<unsigned long, std::__1::less<unsigned long>, std::__1::allocator<unsigned long> > const&, unsigned long, unsigned long, unsigned long) StretcherChannelData.cpp:47
    #6 0x1022aabfe in RubberBand::RubberBandStretcher::Impl::configure() StretcherImpl.cpp:656
    #7 0x1022a8b59 in RubberBand::RubberBandStretcher::Impl::Impl(unsigned long, unsigned long, int, double, double) StretcherImpl.cpp:181
    #8 0x1022858ee in RubberBand::RubberBandStretcher::Impl::Impl(unsigned long, unsigned long, int, double, double) StretcherImpl.cpp:115
    #9 0x10228584b in RubberBand::RubberBandStretcher::RubberBandStretcher(unsigned long, unsigned long, int, double, double) RubberBandStretcher.cpp:35
    #10 0x10228593e in RubberBand::RubberBandStretcher::RubberBandStretcher(unsigned long, unsigned long, int, double, double) RubberBandStretcher.cpp:37
    #11 0x1022c6fac in main rubberband_block_size_test.cpp:12
    #12 0x7fff20418f3c in start+0x0 (libdyld.dylib:x86_64+0x15f3c)

The following test harness seems to reliably reproduce the above crash (only tested on my machine so far, macOS x86):

#include "./vendors/rubberband/single/RubberBandSingle.cpp"

using namespace RubberBand;

// Setting blockSize here to anything bigger than 4096 causes a crash!
static const int blockSize = 8192;
static const float sampleRate = 44100;
static const int numChannels = 2;
static const int numIterations = 2;

int main() {
  RubberBandStretcher stretcher(sampleRate, numChannels,
    RubberBandStretcher::OptionProcessRealTime |
    RubberBandStretcher::OptionThreadingNever |
    RubberBandStretcher::OptionChannelsTogether |
    RubberBandStretcher::OptionPitchHighSpeed);
  stretcher.setPitchScale(1.1);
  
  // The presence of this line seems to have no effect:
  stretcher.setMaxProcessSize(blockSize);
  
  float *inChannels[numChannels] = {
    (float *)malloc(sizeof(float) * blockSize),
    (float *)malloc(sizeof(float) * blockSize),
  };

  // This should cause an overflow (and crash if ASan is enabled)
  stretcher.process(inChannels, blockSize, false);
  
  printf("If you got here, no overflow! Congratulations!\n");
}

Please let me know if you need any more details. (I think it should be possible to work around this crash by only passing at most getSamplesRequired() samples per call to process, but I haven't experimented too much further with that yet.)

static and dynamic libraries both built and installed

This is a hassle for packaging and downstream users. Please use Meson's standard mechanism for controlling whether the library is built statically or dynamically. Per Meson documentation:

It is generally preferred to use the library command instead of shared_library and static_library and then configure which libraries (static or shared or both of them) will be built at the build configuration time using the default_library built-in option.

Map isn't working as expected

Hi,
I am trying to use rubberband with Map parameter using external file that looks like:
100 200
201 300
301 350
After applying it to
rubberband -t 1 -M ramki ruhana.wav ruhana3.wav
I get warning as follows:
ignoring mapping from chunk 0 to sample 0
ignoring mapping from chunk 0 to sample 200
WARNING: calculated output duration 0 != expected 350
ERROR: distributeRegion returned wrong duration 0, expected 350

I don't know how should I correctly create map file that will work with my wave file.
I would appreciate any help.

Rubberband 1.8.2 release status?

Hi,
I see from the commit history that a version 1.8.2 is in the works, although doesn't seem to be officially released yet. Is there a timeline for 1.8.2 to be released? Is the current code considered stable?
Would appreciate your feedback!
Cheers!

librubberband.a(rubberband-c.dev.o)' does not contain bitcode for iOS

I am writing C++ to C wrapper for rubberband to use it in my IOS project. I am getting BitCode error.

librubberband.a(rubberband-c.dev.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64

This is my code

#include "Wrapper.hpp"


#include "rubberband-c.h"
#include "RubberBandStretcher.h"

using namespace RubberBand;

extern "C" int myMethod() {
    rubberband_new(48000, 1, RubberBandOptions(), 2.0, 20.0);
    return 2;
}

If disable the bitCode i get 27 errors and 1 warning.

Warning:
ignoring file /Users/confu002/Documents/Ios/RBTest2/RB/Lib/librubberband.sim.a, missing required architecture arm64 in file /Users/confu002/Documents/Ios/RBTest2/RB/Lib/librubberband.sim.a (2 slices)

Errors:
Undefined symbols for architecture arm64:
"_vDSP_destroy_fftsetup", referenced from:
RubberBand::FFTs::D_VDSP::~D_VDSP() in librubberband.a(FFT.dev.o)
"_vDSP_destroy_fftsetupD", referenced from:
RubberBand::FFTs::D_VDSP::~D_VDSP() in librubberband.a(FFT.dev.o)
"_vvlogf", referenced from:
RubberBand::FFTs::D_VDSP::inverseCepstral(float const*, float*) in librubberband.a(FFT.dev.o)
"_vvsincosf", referenced from:
RubberBand::FFTs::D_VDSP::inversePolar(float const*, float const*, float*) in librubberband.a(FFT.dev.o)
"_vvlog", referenced from:
RubberBand::FFTs::D_VDSP::inverseCepstral(double const*, double*) in librubberband.a(FFT.dev.o)
"_vDSP_vclr", referenced from:
RubberBand::RingBuffer::zero(int) in librubberband.a(StretcherImpl.dev.o)
RubberBand::RubberBandStretcher::Impl::study(float const* const*, unsigned long, bool) in librubberband.a(StretcherImpl.dev.o)
RubberBand::RubberBandStretcher::Impl::synthesiseChunk(unsigned long, unsigned long) in librubberband.a(StretcherProcess.dev.o)
RubberBand::RubberBandStretcher::Impl::writeChunk(unsigned long, unsigned long, bool) in librubberband.a(StretcherProcess.dev.o)
RubberBand::RubberBandStretcher::Impl::ChannelData::construct(std::__1::set<unsigned long, std::__1::less, std::__1::allocator > const&, unsigned long, unsigned long, unsigned long) in librubberband.a(StretcherChannelData.dev.o)
RubberBand::RubberBandStretcher::Impl::ChannelData::setSizes(unsigned long, unsigned long) in librubberband.a(StretcherChannelData.dev.o)
float* RubberBand::reallocate_and_zero(float*, unsigned long, unsigned long) in librubberband.a(StretcherChannelData.dev.o)
...
"_vDSP_ctoz", referenced from:
RubberBand::FFTs::D_VDSP::forward(float const*, float*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardInterleaved(float const*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardPolar(float const*, float*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardMagnitude(float const*, float*) in librubberband.a(FFT.dev.o)
"_vDSP_ztocD", referenced from:
RubberBand::FFTs::D_VDSP::inverse(double const*, double const*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::inverseInterleaved(double const*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::inversePolar(double const*, double const*, double*) in librubberband.a(FFT.dev.o)
"_vDSP_vsdiv", referenced from:
RubberBand::FFTs::D_VDSP::forward(float const*, float*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardMagnitude(float const*, float*) in librubberband.a(FFT.dev.o)
"_vDSP_ztoc", referenced from:
RubberBand::FFTs::D_VDSP::inverse(float const*, float const*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::inverseInterleaved(float const*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::inversePolar(float const*, float const*, float*) in librubberband.a(FFT.dev.o)
"_vvatan2", referenced from:
RubberBand::FFTs::D_VDSP::forwardPolar(double const*, double*, double*) in librubberband.a(FFT.dev.o)
"_vDSP_zvmagsD", referenced from:
RubberBand::FFTs::D_VDSP::forwardPolar(double const*, double*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardMagnitude(double const*, double*) in librubberband.a(FFT.dev.o)
"_vDSP_vclrD", referenced from:
RubberBand::RubberBandStretcher::Impl::calculateIncrements(unsigned long&, unsigned long&, bool&) in librubberband.a(StretcherProcess.dev.o)
void RubberBand::RubberBandStretcher::Impl::cutShiftAndFold<double, float>(double*, int, float*, RubberBand::Window) in librubberband.a(StretcherProcess.dev.o)
RubberBand::MovingMedian::MovingMedian(int, float) in librubberband.a(CompoundAudioCurve.dev.o)
RubberBand::MovingMedian::reset() in librubberband.a(CompoundAudioCurve.dev.o)
RubberBand::RubberBandStretcher::Impl::ChannelData::construct(std::__1::set<unsigned long, std::__1::less, std::__1::allocator > const&, unsigned long, unsigned long, unsigned long) in librubberband.a(StretcherChannelData.dev.o)
RubberBand::RubberBandStretcher::Impl::ChannelData::setSizes(unsigned long, unsigned long) in librubberband.a(StretcherChannelData.dev.o)
double
RubberBand::reallocate_and_zero(double*, unsigned long, unsigned long) in librubberband.a(StretcherChannelData.dev.o)
...
"_vDSP_vsdivD", referenced from:
RubberBand::FFTs::D_VDSP::forward(double const*, double*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardMagnitude(double const*, double*) in librubberband.a(FFT.dev.o)
"_vDSP_ctozD", referenced from:
RubberBand::FFTs::D_VDSP::forward(double const*, double*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardInterleaved(double const*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardPolar(double const*, double*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardMagnitude(double const*, double*) in librubberband.a(FFT.dev.o)
"_vDSP_create_fftsetupD", referenced from:
RubberBand::FFTs::D_VDSP::initDouble() in librubberband.a(FFT.dev.o)
"_vDSP_vspdp", referenced from:
void RubberBand::RubberBandStretcher::Impl::cutShiftAndFold<double, float>(double*, int, float*, RubberBand::Window) in librubberband.a(StretcherProcess.dev.o)
RubberBand::SpectralDifferenceAudioCurve::processFloat(float const
, int) in librubberband.a(SpectralDifferenceAudioCurve.dev.o)
RubberBand::PercussiveAudioCurve::processFloat(float const*, int) in librubberband.a(PercussiveAudioCurve.dev.o)
"_vvatan2f", referenced from:
RubberBand::FFTs::D_VDSP::forwardPolar(float const*, float*, float*) in librubberband.a(FFT.dev.o)
"_vDSP_fft_zriptD", referenced from:
RubberBand::FFTs::D_VDSP::forward(double const*, double*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardInterleaved(double const*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardPolar(double const*, double*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardMagnitude(double const*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::inverse(double const*, double const*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::inverseInterleaved(double const*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::inversePolar(double const*, double const*, double*) in librubberband.a(FFT.dev.o)
...
"_vDSP_create_fftsetup", referenced from:
RubberBand::FFTs::D_VDSP::initFloat() in librubberband.a(FFT.dev.o)
"_vDSP_zvmags", referenced from:
RubberBand::FFTs::D_VDSP::forwardPolar(float const*, float*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardMagnitude(float const*, float*) in librubberband.a(FFT.dev.o)
"_vDSP_vdpsp", referenced from:
RubberBand::RubberBandStretcher::Impl::synthesiseChunk(unsigned long, unsigned long) in librubberband.a(StretcherProcess.dev.o)
"_vvsincos", referenced from:
RubberBand::FFTs::D_VDSP::inversePolar(double const*, double const*, double*) in librubberband.a(FFT.dev.o)
"_vvexp", referenced from:
void RubberBand::v_exp(double*, int) in librubberband.a(StretcherProcess.dev.o)
"_vvsqrtf", referenced from:
RubberBand::FFTs::D_VDSP::forwardPolar(float const*, float*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardMagnitude(float const*, float*) in librubberband.a(FFT.dev.o)
"_vvsqrt", referenced from:
void RubberBand::v_sqrt(double*, int) in librubberband.a(SpectralDifferenceAudioCurve.dev.o)
RubberBand::FFTs::D_VDSP::forwardPolar(double const*, double*, double*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardMagnitude(double const*, double*) in librubberband.a(FFT.dev.o)
"_vDSP_fft_zript", referenced from:
RubberBand::FFTs::D_VDSP::forward(float const*, float*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardInterleaved(float const*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardPolar(float const*, float*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::forwardMagnitude(float const*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::inverse(float const*, float const*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::inverseInterleaved(float const*, float*) in librubberband.a(FFT.dev.o)
RubberBand::FFTs::D_VDSP::inversePolar(float const*, float const*, float*) in librubberband.a(FFT.dev.o)
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any clue how i can solve this issue?

LADSPA clicks/pops

When using the LADSPA plugin in Audacity or Ardour (the hosts I've tried) Rubberband introduces pops and clicks at the start of the audio. This doesn't happen when using the CLI program with the same settings.

Segmentation fault

Due to lack of enough documentation, I'm stuck at a simple task.
I am using Un4seen Bass and I want to use rubberband to change the tempo of my channel data.
My channel data is interleaved so I am using this code but I get segmentation fault at the process function.
I may be missing some trivial thing here but I am trying to understand how to use the library.

std::vector<float> Source::_setTempo(std::vector<float> data, double range, double targetRange) {
  double rangePerc = (range / targetRange);
  stretcher.setTimeRatio(rangePerc);

  std::vector<float *> processData(2); // @todo channel count
  processData[0] = new float[data.size() / 2];
  processData[1] = new float[data.size() / 2];
  for (int i = 0; i < data.size(); ++i) { // data here is the interleaved data from Bass library
    if (i % 2 == 0) {
      processData[0][i/2] = data[i];
    } else {
      processData[1][i/2] = data[i];
    }
  }

  float *const *samples;
  stretcher.process(processData.data(), 44100, false);
  int size = stretcher.retrieve(samples, 44100);

  std::vector<float> result(size * 2);
  for (int i = 0; i < result.size(); ++i) {
    if (i % 2 == 0) {
      result[i] = samples[0][i/2];
    } else {
      result[i] = samples[1][i/2];
    }
  }

  return result;
}

Piping support for the CLI?

First off, amazing library. I have been using this a lot and am very happy with it.
I have one question, is it currently possible to pipe wav files into / out of this tool? When I specify - as the output, I get the following message ERROR: Failed to open output file "-" for writing: Error : this file format does not support pipe write. which may indicate that it's supported but that I am doing something wrong.

If this is not supported, would it be something that is easy to add?

Thanks a lot!
Nick

How to jump to position in a song?

Hi,

I couldn't find a method that allows for setting the playhead position, wonder if this is supported? I noticed the demo app has a slider that allows for jumping to a different position, could you please explain how this is done?

Cheers!

v1.9.1: WARNING: MovingMedian: NaN encountered

We are experiencing issues when running one of our test cases:

https://bugs.launchpad.net/mixxx/+bug/1921955

WARNING: MovingMedian: NaN encountered
WARNING: MovingMedian: NaN encountered
WARNING: MovingMedian: NaN encountered
WARNING: MovingMedian: NaN encountered
WARNING: MovingMedian: NaN encountered
WARNING: MovingMedian: NaN encountered
WARNING: MovingMedian: NaN encountered
WARNING: MovingMedian: NaN encountered
WARNING: MovingMedian: NaN encountered
WARNING: MovingMedian: NaN encountered
corrupted size vs. prev_size

Pitch quality

Which options do I have to use to get the best possible quality when I change pitch +0.5 for a female voice audio without music? It's not clear from documentation.

rubberband -R -P --no-threads -p 0.5 --pitch-hq "C:\in.wav" "C:\out.wav"

Windows build fails to link

[21/23] "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/lib.exe" "csr" librubberband_objlib.a librubberband_objlib.a.p/src_rubberband-c.cpp.obj librubberband_objlib.a.p/src_RubberBandStretcher.cpp.obj librubberband_objlib.a.p/src_StretcherProcess.cpp.obj librubberband_objlib.a.p/src_StretchCalculator.cpp.obj librubberband_objlib.a.p/src_base_Profiler.cpp.obj librubberband_objlib.a.p/src_dsp_AudioCurveCalculator.cpp.obj librubberband_objlib.a.p/src_audiocurves_CompoundAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_SpectralDifferenceAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_HighFrequencyAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_SilentAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_ConstantAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_PercussiveAudioCurve.cpp.obj librubberband_objlib.a.p/src_dsp_Resampler.cpp.obj librubberband_objlib.a.p/src_dsp_FFT.cpp.obj librubberband_objlib.a.p/src_system_Allocators.cpp.obj librubberband_objlib.a.p/src_system_sysutils.cpp.obj librubberband_objlib.a.p/src_system_Thread.cpp.obj librubberband_objlib.a.p/src_StretcherChannelData.cpp.obj librubberband_objlib.a.p/src_StretcherImpl.cpp.obj librubberband_objlib.a.p/src_dsp_BQResampler.cpp.obj
FAILED: librubberband_objlib.a 
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/lib.exe" "csr" librubberband_objlib.a librubberband_objlib.a.p/src_rubberband-c.cpp.obj librubberband_objlib.a.p/src_RubberBandStretcher.cpp.obj librubberband_objlib.a.p/src_StretcherProcess.cpp.obj librubberband_objlib.a.p/src_StretchCalculator.cpp.obj librubberband_objlib.a.p/src_base_Profiler.cpp.obj librubberband_objlib.a.p/src_dsp_AudioCurveCalculator.cpp.obj librubberband_objlib.a.p/src_audiocurves_CompoundAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_SpectralDifferenceAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_HighFrequencyAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_SilentAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_ConstantAudioCurve.cpp.obj librubberband_objlib.a.p/src_audiocurves_PercussiveAudioCurve.cpp.obj librubberband_objlib.a.p/src_dsp_Resampler.cpp.obj librubberband_objlib.a.p/src_dsp_FFT.cpp.obj librubberband_objlib.a.p/src_system_Allocators.cpp.obj librubberband_objlib.a.p/src_system_sysutils.cpp.obj librubberband_objlib.a.p/src_system_Thread.cpp.obj librubberband_objlib.a.p/src_StretcherChannelData.cpp.obj librubberband_objlib.a.p/src_StretcherImpl.cpp.obj librubberband_objlib.a.p/src_dsp_BQResampler.cpp.obj
Microsoft (R) Library Manager Version 14.29.30139.0
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1181: cannot open input file 'csr'

Discovered on vcpkg CI

Meson output:

DEPRECATION: c_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
DEPRECATION: cpp_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
DEPRECATION: c_link_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
DEPRECATION: cpp_link_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
WARNING: Recommend using either -Dbuildtype or -Doptimization + -Ddebug. Using both is redundant since they override each other. See: https://mesonbuild.com/Builtin-options.html#build-type-options
The Meson build system
Version: 0.58.1
Source dir: D:\buildtrees\rubberband\src\v2.0.1-78e2246311.clean
Build dir: D:\buildtrees\rubberband\x64-windows-dbg
Build type: native build
Project name: Rubber Band Library
Project version: 2.0.1
C compiler for the host machine: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe (msvc 19.29.30139 "Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30139 for x64")
C linker for the host machine: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/link.exe link 14.29.30139.0
C++ compiler for the host machine: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe (msvc 19.29.30139 "Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30139 for x64")
C++ linker for the host machine: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/link.exe link 14.29.30139.0
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: D:/downloads/tools/msys2/aa5af7b2aa7e90e8/mingw32/bin/pkg-config.exe (0.29.2)
Found CMake: D:/downloads/tools/cmake-3.21.1-windows/cmake-3.21.1-windows-i386/bin/cmake.exe (3.21.1)
Run-time dependency fftw3 found: NO (tried pkgconfig and cmake)
Run-time dependency samplerate found: NO (tried pkgconfig and cmake)
Run-time dependency sndfile found: NO (tried pkgconfig and cmake)
Run-time dependency vamp-sdk found: NO (tried pkgconfig and cmake)
Run-time dependency threads found: YES
Has header "ladspa.h" : NO 
Has header "lv2.h" : NO 
Checking for function "sincos" : NO 
Has header "jni.h" : NO 
Program javac found: NO
Program jar found: NO
Message: For FFT: using built-in implementation
Message: For resampler: using built-in implementation
Has header "vamp-sdk.h" : NO 
Has header "vamp-sdk.h" : NO (cached)
Has header "sndfile.h" : NO 
Has header "sndfile.h" : NO (cached)
Message: Not building Rubber Band Library static library: default_library option is set to shared
Message: Will build Rubber Band Library dynamic library
Message: Not building Java Native Interface: jni.h header not found
Message: Not building LADSPA plugin: ladspa.h header not found
Message: Not building LV2 plugin: lv2.h header not found
Message: Not building Vamp plugin: Vamp dependency not found
Message: Not building command-line utility: libsndfile dependency not found
Build targets in project: 2

Rubber Band Library 2.0.1

  Directories
    prefix              : D:/packages/rubberband_x64-windows/debug
    bindir              : bin
    libdir              : lib
    datadir             : share

  Configuration
    FFT                 : Built-in
    Resampler           : Built-in
    Build type          : Debug
    Architecture        : x86_64

  Build targets
    Static library      : NO
    Dynamic library     : YES
                          Name: rubberband
    JNI library         : NO
    LADSPA plugin       : NO
    LV2 plugin          : NO
    Vamp plugin         : NO
    Command-line utility: NO

Option buildtype is: plain [default: release]
Option default_library is: shared [default: both]
Found ninja-1.10.2 at D:/downloads/tools/ninja/1.10.2-windows\ninja.EXE

C#/VB .NET port available?

Hello, I´d love to use the rubberband phase vocoder pitch shifter in my application. Unfortunately, it must not have any external dependencies and therefore target .NET.

Is there any port for .NET available or planned? Would be really cool.

At the moment I use the Bernsee phase vocoder instead: https://github.com/naudio/NAudio/blob/master/NAudio/Wave/SampleProviders/SMBPitchShiftingSampleProvider.cs.

I´d really like to explore your approach and compare.

Thanks for reply.

v1.9.2 will not build on RPI, v1.9 builds fine

More a comment of a regression, along with a workaround. I'm trying to integrate rubber band into a raspberry pi project, a RPI Zero with a GPIO sound hat.

Building v1.9.2 doesn't work, as ninja for rpi is too old. I tried the otherbuilds/check.sh option, but ran into linker issue one after another, especially in regards to resampler

After instead pulling down v1.9.0 prior to the build system move, everything complied and linked like a champ.

For reference, here's what I needed on top of raspbian:
sudo apt-get install libgtk-3-dev git libasound2-dev libsndfile1-dev libfftw3-dev libsamplerate0-dev vamp-plugin-sdk

and here's an easy way to just pull that branch:
git clone --depth 1 --branch v1.9 https://github.com/breakfastquay/rubberband.git

Cannot build on Apple Silicon

Makefile.osx hardcodes an architecture and cpu options that are incompatible with Apple Silicon.

This patch is a starting point for arm builds: changing the arch and removing the sse optimizations. Whether a separate Makefile or conditional patch/generation of the existing Makefile.osx depends on the needs of the project.

diff --git a/Makefile.osx b/Makefile.osx
index 642533f..d39b044 100644
--- a/Makefile.osx
+++ b/Makefile.osx
@@ -2,8 +2,8 @@
 PREFIX         := /usr/local
 CXX            := clang++ -stdlib=libc++
 CC             := clang
-ARCHFLAGS      := -arch x86_64 -mmacosx-version-min=10.7
-OPTFLAGS       := -DNDEBUG -ffast-math -mfpmath=sse -msse -msse2 -O3 -ftree-vectorize
+ARCHFLAGS      := -arch arm -mmacosx-version-min=11.0
+OPTFLAGS       := -DNDEBUG -ffast-math -O3 -ftree-vectorize

 CXXFLAGS       := $(ARCHFLAGS) $(OPTFLAGS) -I. -Isrc -Irubberband -I/usr/local/include -DUSE_PTHREADS -DMALLOC_IS_ALIGNED -DHAVE_VDSP -DUSE_SPEEX -DNO_THREAD_CHECKS -DNO_TIMING

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.