flucoma/flucoma-core

BufStatsClient and derivatives with short samples

AlexHarker opened this issue · 2 comments

Sometimes with short samples the analysis gives only 1 or 2 frames and then buf stats is not able to calculate derivatives:

if (numFrames <= get<kNumDerivatives>())
      return {Result::Status::kError, "Not enough frames"};

It might be preferable in such scenarios if (with an option or by default) derivatives were simply set to zero. In reality that seems to me a valid answer. It looks like that is what the algorithm will return if that check wasn't done, but that's on a quick skim of the code.

I realise that there is a position that says "there are no derivatives because you haven't given enough frames" but that seems punitive and will simply lead to workarounds that will likely end up in the same place.

I will likely test the result of removing the check and report back.

@tremblap - is this a hard and fast design design (happy to bring others in, just seems bad form to tag everyone on the repo who probably already gets notifications - but I thought you might have a position on this).

Or, like, is the derivative of a single point, like, infinity.

Ok. I can get on with the argument that this is too punitive. Nonetheless, I do think people should be alerted if they try do something that (I think) doesn't actually make sense. How would you feel about a warning (with 0s for the derivatives) instead of an error?

I'd be OK with either a warning or an option to set the default value/set modes.

I think warnings you can't switch off are a bit annoying though. I'd prefer options (or options to turn off warnings)