Created attachment 471468 [details] A video sample demonstrating the distortion and the source code of the demo page There is a bug in Safari on iPadOS 17.5.1 where audio becomes distorted when an AudioContext is created with a sample rate of 44100Hz, and an AudioWorklet is used within that context. This distortion affects any audio played within the AudioContext, regardless of whether the audio is processed by the AudioWorklet. Steps to Reproduce: 1. Create a new AudioContext with a sample rate of 44100Hz. const ctx = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 44100 }); 2. Add an AudioWorklet module to the AudioContext. 3. Play any audio through the AudioContext. const playSound = () => { const oscillator = ctx.createOscillator(); oscillator.connect(ctx.destination); oscillator.start(); } ctx.audioWorklet.addModule("AudioWorkletProcessor.js").then(() => { playSound(); }) Expected Results: The audio should play without distortion. Actual Results: The audio is distorted when played through the AudioContext. Additional Information: -This issue does not occur on iPadOS 17.4.1 but is present on iPadOS 17.5.1. -The device model used for testing is iPad Air (5th generation). -The distortion occurs regardless of the specific operations performed within the AudioWorklet. The distortion occurs even if no AudioWorkletNode is created. -The issue is reproducible almost every time under the given conditions. However, reloading or reopening the Safari tab can change whether the distortion occurs, even with the same code. -The audio sometimes becomes distorted just by adding an AudioWorklet, even without specifying a sample rate at 44100Hz. This distortion always occurs when first opening a new tab without reloading. -A demo web page has been created to reproduce this bug. The URL is https://safari-44100hz-audioworklet-bug-demo.netlify.app/ -A video sample demonstrating the distortion and the source code of the demo page are attached for reference.
<rdar://problem/128551401>
I can reproduce the behavior on macOS as well as iPadOS. This may have regressed via 275262@main, which introduced ShareAudioDestination.
Pull request: https://github.com/WebKit/WebKit/pull/29048
*** Bug 274647 has been marked as a duplicate of this bug. ***
Committed 279409@main (d72323075072): <https://commits.webkit.org/279409@main> Reviewed commits have been landed. Closing PR #29048 and removing active labels.
Committed 272448.1053@safari-7618-branch (01cc3500a26e): <https://commits.webkit.org/272448.1053@safari-7618-branch> Reviewed commits have been landed. Closing PR #1311 and removing active labels.
*** Bug 275726 has been marked as a duplicate of this bug. ***
*** Bug 275801 has been marked as a duplicate of this bug. ***