Bug 248534

Summary: Creating and destroying lots of IIRFilterNodes corrupts AudioContext
Product: WebKit Reporter: ae
Component: Web AudioAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: cdumez, jer.noble, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: iPhone / iPad   
OS: iOS 15   

Description ae 2022-11-30 07:37:18 PST
I have an audio application where the user is able to interactively adjust the parameters of a custom EQ created using createIIRFilter. While the user moves the frequency, gain and Q sliders, the old IIRFilterNode needs to be disconnected and a new one created and connected, as it is apparently not possible to update the coefficients on an existing node (really?).

Very quickly, the audio context will start "lagging behind" (context.currentTime updates much slower than the wall clock), and for example, DynamicsCompressor.reduction will still update in 'realtime'.

I have found no workaround. Even limiting the updates to like 10 per second still makes the problem appear.
Comment 1 ae 2022-11-30 07:43:15 PST
BTW, I've just realized that I've reported some bugs 6 years ago, which have been confirmed by others, and they haven't even been assigned yet. It would be great if QA were a higher priority!
Comment 2 ae 2022-11-30 08:42:24 PST
I've also noticed that after a few hundred calls to createIIRFilter(), one single call will often take more than one second to complete.

(Maybe I'm missing something and this is not the correct way to provide realtime adjustments of IIR Filter coefficients...)
Comment 3 ae 2022-12-03 05:48:58 PST
The problem seems to be related to memory management: It apparently only becomes serious when there's a large (> 100 MB) AudioBuffer object in memory that is being played through a AudioBufferSourceNode. I couldn't reproduce the issue with small (~ 1 MB) buffers.
Comment 4 Radar WebKit Bug Importer 2022-12-08 12:31:03 PST
<rdar://problem/103141531>