Page 1 of 1

Suspicion of off by one bug in Nyquist sound addition

Posted: Fri Nov 08, 2013 3:40 pm
by Paul L
UPDATE: I concluded the mistake was mine.

We know that Nyquist commits some memory leak errors when adding sounds defined on intervals that touch but do not overlap.

Now some debugging efforts have led me to suspect that Nyquist may also make off-by-one errors in the actual sound result. This has serious results in my case.

In a version of my click fixing tool, I compute the difference between fixed and original versions of a sound on many small intervals, and sum those fixes. I have a tunable parameter for adjusting the crossfaded ends of the fixed interval. When the parameter is just so, so that the fixes just touch, it appears that the earlier of the two is time-shifted left one sample. When the time shifted fix is mixed back with the orignal, it is no longer a fix at all, and the click is still audible. If the parameter is just slightly more or less I do not have the problem.

Is such a problem known? I should try to contrive a simple demonstration in the Nyquist prompt. Perhaps it is related to the memory leak.

Re: Suspicion of off by one bug in Nyquist sound addition

Posted: Fri Nov 08, 2013 3:43 pm
by steve
Paul L wrote: I should try to contrive a simple demonstration in the Nyquist prompt.
Yes please.

Re: Suspicion of off by one bug in Nyquist sound addition

Posted: Fri Nov 08, 2013 7:11 pm
by Paul L
The error was mine! My problem was not quantizing that overlap time parameter, and funny things happened when it was an integer plus a half times sample time.

Re: Suspicion of off by one bug in Nyquist sound addition

Posted: Sat Nov 09, 2013 3:59 am
by steve
Easily done ;)

Re: Suspicion of off by one bug in Nyquist sound addition

Posted: Sat Nov 09, 2013 10:57 pm
by Paul L
I am very glad to have researched and fixed this bug, only because it happened to affect one obvious click which ended up not fixed because of it.