Question about reported data

Issue #20 new
Jean-Michaël Celerier
created an issue

Hello,

given this code :

#include <rubberband/RubberBandStretcher.h>
#include <vector>
#include <iostream>

int main()
{
  RubberBand::RubberBandStretcher fRubberBand(44100, 2, RubberBand::RubberBandStretcher::OptionProcessRealTime);

  float test[64];
  float* arr[2] = {test, test};
  for(int i = 0; i < 45; i++)
  {
      std::cout << "Latency: " << fRubberBand.getLatency() << "\t"
                << "Required:  " << fRubberBand.getSamplesRequired() << "\t";
      fRubberBand.process(arr, 64, false);
      std::cout << "  ===Provided: " << 64 * (1+i)
                << " \tAvailable: " << fRubberBand.available() << "\n";
  }
}

I have the following results:

Latency: 1025   Required:  2048   ===Provided: 64       Available: 0
Latency: 1025   Required:  1984   ===Provided: 128      Available: 0
Latency: 1025   Required:  1920   ===Provided: 192      Available: 0
Latency: 1025   Required:  1856   ===Provided: 256      Available: 0
Latency: 1025   Required:  1792   ===Provided: 320      Available: 0
Latency: 1025   Required:  1728   ===Provided: 384      Available: 0
Latency: 1025   Required:  1664   ===Provided: 448      Available: 0
Latency: 1025   Required:  1600   ===Provided: 512      Available: 0
Latency: 1025   Required:  1536   ===Provided: 576      Available: 0
Latency: 1025   Required:  1472   ===Provided: 640      Available: 0
Latency: 1025   Required:  1408   ===Provided: 704      Available: 0
Latency: 1025   Required:  1344   ===Provided: 768      Available: 0
Latency: 1025   Required:  1280   ===Provided: 832      Available: 0
Latency: 1025   Required:  1216   ===Provided: 896      Available: 0
Latency: 1025   Required:  1152   ===Provided: 960      Available: 0
Latency: 1025   Required:  1088   ===Provided: 1024     Available: 0
Latency: 1025   Required:  1024   ===Provided: 1088     Available: 0
Latency: 1025   Required:  960    ===Provided: 1152     Available: 0
Latency: 1025   Required:  896    ===Provided: 1216     Available: 0
Latency: 1025   Required:  832    ===Provided: 1280     Available: 0
Latency: 1025   Required:  768    ===Provided: 1344     Available: 0
Latency: 1025   Required:  704    ===Provided: 1408     Available: 0
Latency: 1025   Required:  640    ===Provided: 1472     Available: 0
Latency: 1025   Required:  576    ===Provided: 1536     Available: 0
Latency: 1025   Required:  512    ===Provided: 1600     Available: 0
Latency: 1025   Required:  512    ===Provided: 1664     Available: 0
Latency: 1025   Required:  512    ===Provided: 1728     Available: 0
Latency: 1025   Required:  512    ===Provided: 1792     Available: 0
Latency: 1025   Required:  512    ===Provided: 1856     Available: 0
Latency: 1025   Required:  512    ===Provided: 1920     Available: 0
Latency: 1025   Required:  512    ===Provided: 1984     Available: 0
Latency: 1025   Required:  512    ===Provided: 2048     Available: 512
Latency: 1025   Required:  512    ===Provided: 2112     Available: 512
Latency: 1025   Required:  448    ===Provided: 2176     Available: 512
Latency: 1025   Required:  384    ===Provided: 2240     Available: 512
Latency: 1025   Required:  320    ===Provided: 2304     Available: 512
Latency: 1025   Required:  256    ===Provided: 2368     Available: 512
Latency: 1025   Required:  192    ===Provided: 2432     Available: 512
Latency: 1025   Required:  128    ===Provided: 2496     Available: 512
Latency: 1025   Required:  64     ===Provided: 2560     Available: 1024
Latency: 1025   Required:  512    ===Provided: 2624     Available: 1024
Latency: 1025   Required:  448    ===Provided: 2688     Available: 1024
Latency: 1025   Required:  384    ===Provided: 2752     Available: 1024
Latency: 1025   Required:  320    ===Provided: 2816     Available: 1024
Latency: 1025   Required:  256    ===Provided: 2880     Available: 1024
...

What I find strange is that :

  • At some point, the "getSamplesRequired()" value stays stuck at 512 even if I don't have to provide it 512 more samples ; then when samples are available it finally goes down
  • The latency is of 1025 samples but the intial requirements are of 2048 samples. I don't really see how it makes sense: in practice I won't get any output before I've provided 2048 input which is what I would call "latency".

So, how should these be interpreted ? Thanks (and sorry if it's a dumb question)

Comments (0)

  1. Log in to comment