Bug 183253

Summary: Multiple calls to setTargetAtTime with separate timestamps has unpredictable behavior
Product: WebKit Reporter: ae
Component: Web AudioAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: jer.noble, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: iPhone / iPad   
OS: iOS 11   

ae
Reported 2018-03-01 11:45:29 PST
I've spent the last 2 days trying to make a simple ADSR envelope generator using setTargetAtTime. It's hard to isolate a testcase, but I can say that as soon as several targets are added to the timeline, for example: 0 at 1 second, 1 at 2 seconds, 0.5 at 3 seconds, and 0 at 4 seconds), the resulting curves are unpredictable, especially when interrupted with cancelScheduledValues and then re-constructed (both are necessary for making a working real-world ADSR generator). The same code works flawlessly in Chrome and Firefox... I could possibly provide a testcase if needed.
Attachments
ae
Comment 1 2018-03-01 12:54:50 PST
OK, sorry for the original inaccurate report. More investigation revealed the following: node.gain.setValueAtTime(1, timestamp) node.gain.setTargetAtTime(0.5, timestamp, 1) This code seems to cause a race condition when both timestamps are equal. If I use "timestamp + 0.001" in the second line, the problem goes away.
Radar WebKit Bug Importer
Comment 2 2018-03-02 17:07:15 PST
Note You need to log in before you can comment on or make changes to this bug.