Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 27d3de8f8b2289fbcba9812b6eb37d16a3db96fd
      
https://github.com/WebKit/WebKit/commit/27d3de8f8b2289fbcba9812b6eb37d16a3db96fd
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-26 (Sun, 26 Jul 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/sub-sample-start-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/sub-sample-start.html
    M Source/WebCore/Modules/webaudio/OscillatorNode.cpp

  Log Message:
  -----------
  OscillatorNode with a-rate automation ignores sub-sample start time and 
begins out of phase
https://bugs.webkit.org/show_bug.cgi?id=320277
rdar://183194827

Reviewed by Chris Dumez.

This patch aligns WebKit with Gecko / Firefox.

When an oscillator is started at a sub-sample-accurate time,
OscillatorNode::process() advances the initial virtualReadIndex by the
fractional start offset scaled by one phase increment, so the oscillator
begins at the correct sub-sample phase. That compensation was written as
`startFrameOffset * frequency * rateScale`, but `frequency` is a local
that is only assigned in the k-rate (!hasSampleAccurateValues) branch.
Whenever a-rate frequency or detune automation is active, `frequency`
stays 0, so the compensation term is 0 and the oscillator starts on the
frame boundary instead of at the requested sub-sample offset, i.e.
audibly out of phase.

Use the first sample-accurate phase increment (phaseIncrements[0]) for
the compensation when hasSampleAccurateValues is true, falling back to
frequency * rateScale for the k-rate case. For a constant frequency the
two are identical, so this only changes behavior when automation is
active.

This matches the k-rate path, which already advances by
`frequency * rateScale` per frame.

Test: 
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/sub-sample-start.html

* 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/sub-sample-start-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/sub-sample-start.html:
 Added.
* Source/WebCore/Modules/webaudio/OscillatorNode.cpp:
(WebCore::OscillatorNode::process):

Canonical link: https://commits.webkit.org/317953@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to