[Webkit-unassigned] [Bug 78854] DelayNode has inaccurate delay

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Feb 17 09:54:09 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=78854





--- Comment #3 from Raymond Toy <rtoy at chromium.org>  2012-02-17 09:54:08 PST ---
(In reply to comment #2)
> (In reply to comment #1)
> > Yes, looks like DelayDSPKernel could use your AudioUtilities function
> 
> That will help, but I will need to take a closer look to see if that is enough.

Ok.  Applying timeToSampleFrame to

  double desiredDelayFrames = m_currentDelayTime * sampleRate;

helps with the case of a delay of 0.53 sec.  But consider the case where the delay is 0.005.  This is a delay of 220.5 samples.  Then desiredDelayFrames (after rounding) will be 221.  However, because delayTime comes from an AudioParam that only holds floats, the delayTime is actually 0.004999999888241291 (because 0.005 is converted to a single float which is the value given).  Then the delayTime * sampleRate = 220.49999507144094 which rounds to 220.  Thus, we're off by one.

Maybe the correct solution is to round as single floats instead of doubles?  If we do that delayTime*sampleRate = 220.5 which rounds to 221, as expected.  Would need to investigate if this would cause other problems.

Another solution is to modify AudioParam to use doubles instead of floats.  This might be generally useful if the AudioParam is meant to hold time values as it does for a DelayNode.  This will make webaudio more closely match javascript code.  This would be a fairly invasive change.

Yet another solution is to modify the javascript test code to compute time values in single-precision (by taking a representation (a string or ratio) of the time value and manually converting to a single-precision value that is stored in a double).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list