why arepairs of damaged audio restricted to 128 samples max?

In repair.cpp → EffectRepair::Process() the repairLen is restricted to a maximum of 128 samples.

The applied Least Squares AutoRegressive Interpolation method imposes no theoretical maximum.

So does anybody know where else this maximum stems from and why a power of 2?

Thanks, jerome42

Change it to for example 512 samples and see how long Repair takes then.


OK, Gale, so there is an almost cubic relation between repairlen and processing time, due to the use of matrices.
However there is no need to restrict the repairlen to a value being a power of 2: e.g. 200 would do also!


If the relationship is cubic, then increasing the number of samples from 128 to 200 would be what? About 4 times longer processing time?

Very good guess, It is 3.8147, if it is really cubic.

If I would like to increase this limit from 128 to 512, which lines should I modify in Repair.cpp?

The Repair.cpp is here

Line 97:

if (repairLen > 128) {

Line 106:

const double spacing = std::max(repair_deltat * 2, 128. / rate);

Should I modify both lines to 512 or just the firs one? And is there anything else?

Discord is a better place to ask this question. See here: https://discord.gg/44CX8yYKXm

Go to channel #audacity-code under BEYOND COMPILING

Assuming that your computer is set up to build Audacity, why don’t you try it both ways?
If your computer is not yet set up to build Audacity, do that first and ensure that you are able to build (and run) the official, unmodified source code.

(From a quick look at the code, it seems to me that the first line that you identified enforces the 128 sample limit, and the second line that you identified relates to the space around the selection that is used to calculate the interpolated repair. I may be wrong - I only took a quick look.)

I already modified both, and made a build of Audacity using the srpm provided by OpenSUSE.

I would like to just know what is the correct way to increase this limit.

You only need to change line 97, though you may want to update the comments at lines 112, 126 and 129.
“spacing” ensures that there is some data on which to base the reconstruction of the waveform.

Thank You!