Suspicion of off by one bug in Nyquist sound addition

Using Nyquist scripts in Audacity.
Post and download new plug-ins.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
Paul L
Posts: 1782
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

Suspicion of off by one bug in Nyquist sound addition

Post by Paul L » Fri Nov 08, 2013 3:40 pm

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.
Last edited by Paul L on Fri Nov 08, 2013 7:19 pm, edited 1 time in total.

steve
Site Admin
Posts: 80679
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

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

Post by steve » Fri Nov 08, 2013 3:43 pm

Paul L wrote: I should try to contrive a simple demonstration in the Nyquist prompt.
Yes please.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Paul L
Posts: 1782
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

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

Post by Paul L » Fri Nov 08, 2013 7:11 pm

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.

steve
Site Admin
Posts: 80679
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

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

Post by steve » Sat Nov 09, 2013 3:59 am

Easily done ;)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Paul L
Posts: 1782
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

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

Post by Paul L » Sat Nov 09, 2013 10:57 pm

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.

Post Reply