News for hackers. Stuff that matters.
Re:303Gen – 303 acid loops generator by strogonoff on Thursday August 07, 2025 @07:09AM (#44823013)
What are the intended uses for xAtTime functions (like cancelAndHoldAtTime) in Web Audio? I suspect a call to one would suffer from the lag due to main thread and audio thread communication, so it wouldn’t work best where sample precision is called for.
Re:303Gen – 303 acid loops generator by padenot on Thursday August 07, 2025 @12:25PM (#44826572)
Those methods are sub-sample accurate, granted you call them a bit in advance to account for the cross-thread communication, as you say. But yes, in general this was designed (prior to me becoming an editor) with scheduling in mind, not with low-latency interactivity. That said, it goes quite far.

Other systems go further, such as Web Audio Modules (that builds on top of AudioWorklet) implement sample-accurate parameter change from within the rendering thread, using wait-free ring-buffers. That requires `SharedArrayBuffer` but works great, and is the lowest latency possible (since it uses atomic loads and stores from e.g. the main thread to the rendering thread).