Bug 257447
Summary: | StereoPannerNode distorts left panned audio | ||
---|---|---|---|
Product: | WebKit | Reporter: | Jason Boyd <jayboyd> |
Component: | Web Audio | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | cdumez, eric.carlson, jer.noble, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari 16 | ||
Hardware: | Mac (Apple Silicon) | ||
OS: | macOS 13 |
Jason Boyd
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Jason Boyd
Oops should have removed the pitch change bit. The issue exists without that.
Chris Dumez
(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
<rdar://problem/110249209>