NEW 257447
StereoPannerNode distorts left panned audio
https://bugs.webkit.org/show_bug.cgi?id=257447
Summary StereoPannerNode distorts left panned audio
Jason Boyd
Reported 2023-05-28 23:44:28 PDT
When I create a StereoPannerNode and pan it to anything less than 0, the audio is very distorted. This happens in both Chrome and Safari on my Mac running Ventura 13.2.1. The problem is identical if I do new StereoPannerNode() or audioContext.createStereoPanner(), and is identical whether I use a mono or stereo version of the same audio sample. It is also identical wherever I place the stereo panner node in the audio chain. When I play the audio sample using the OS (right-click from finder and preview), changing the OS pan setting, there is no distortion. Here's a bit of code: function playSound(name, volume=1, pan=0, octave=0) { const buffer = loadedAudio[name]; if (!buffer) { console.warn('sound buffer not loaded for '+name); return; } if (audioCtx.state === 'suspended') { return; } const source = audioCtx.createBufferSource(); const gainNode = audioCtx.createGain(); // const panNode = new StereoPannerNode(audioCtx, {pan: pan}); const panNode = audioCtx.createStereoPanner(); source.buffer = buffer; const note = Math.floor(Math.random() * NOTES.length); const pitch = Math.pow(2, octave) * NOTES[note]; source.playbackRate.value = pitch; panNode.pan.value = pan; gainNode.gain.value = volume; source.connect(gainNode); gainNode.connect(panNode); panNode.connect(audioCtx.destination); source.start(0); }
Attachments
Jason Boyd
Comment 1 2023-05-28 23:46:09 PDT
Oops should have removed the pitch change bit. The issue exists without that.
Chris Dumez
Comment 2 2023-05-30 10:37:12 PDT
(In reply to Jason Boyd from comment #1) > Oops should have removed the pitch change bit. The issue exists without that. Are you able to provide a standalone reproduction case?
Radar WebKit Bug Importer
Comment 3 2023-06-04 23:45:17 PDT
Note You need to log in before you can comment on or make changes to this bug.