catfact / softcut

library for seamless audio looping
12 stars 1 forks source link

read/write index drift #6

Closed catfact closed 5 years ago

catfact commented 5 years ago

there is still some drift between read frame index, and write frame index when resampling. it appears rate-dependent.

depending on the rate, the drift is bad enough that the positions cross and we get a glitch:

diff-0 47

this shows the difference between read phase (float) and write phase (int). the small variations are expected; the overall sawtooth shape is not. especially bad is that the difference changes sign.

catfact commented 5 years ago

this seems to be rounding error. storing rate and phase as double puts the error back into +/-1 sample index.

leaving open, since it's not nice to have an error at all; needs more testing with long loop times.

(read/write indices are re-synced when a subhead position change happens, e.g. at loop endpoint.)

catfact commented 5 years ago

seems fixed with 7db3c3c1307d5ac473f346a5a96d323cbb7d505d