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

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/moderate-exponentialRamp-expected.txt
    M LayoutTests/webaudio/Oscillator/oscillator-custom-expected.wav
    M LayoutTests/webaudio/Oscillator/oscillator-sawtooth-expected.wav
    M LayoutTests/webaudio/Oscillator/oscillator-sine-expected.wav
    M LayoutTests/webaudio/Oscillator/oscillator-square-expected.wav
    M LayoutTests/webaudio/Oscillator/oscillator-triangle-expected.wav
    M Source/WebCore/Modules/webaudio/AudioParamTimeline.cpp

  Log Message:
  -----------
  exponentialRampToValueAtTime() loses precision by accumulating the ramp in 
single precision
https://bugs.webkit.org/show_bug.cgi?id=270554
rdar://124498013

Reviewed by Chris Dumez.

processExponentialRamp() computed the per-sample multiplier with powf() and
then accumulated the ramp value in a float, so rounding error compounded once
per frame across the whole rendering quantum. By the end of a 128-frame quantum
the drift reached ~49 ulp, losing about 5.6 of the 24 bits of precision.

Compute the ratio and the per-sample multiplier in double precision and carry
the running value in a double, narrowing to float only when storing each
output sample. This keeps the worst-case error at 0.45 ulp over the quantum,
matching a per-sample std::pow() evaluation while retaining the cheap
recurrence relation.

This fixes moderate-exponentialRamp.html and changes the sampled values in
audioparam-exponentialRampToValueAtTime.html, both rebaselined here.

It also requires regenerating the five Oscillator reference files, which
deserves explanation since binary rebaselines in a precision patch are easy to
mistake for papering over a regression.

The Oscillator tests sweep osc.frequency from 10Hz to 24050Hz over 4 seconds
and compare the rendered audio against checked-in WAVs. Those references were
generated in 2020 (216569) by the very code corrected here. Because an
AudioParam value feeding an oscillator is integrated into phase, the old
error was systematic rather than random -- powf() rounded the multiplier
consistently in one direction -- so it accumulated instead of averaging out,
reaching ~0.022 cycles of phase drift by the end of the sweep. At the top of
the sweep that is a large sample-wise difference: SNR against the stale
references falls from ~130 dB to ~31 dB. The references therefore encode the
bug, and no correct fix can keep them.

To confirm the regenerated files are the more accurate ones rather than merely
different, each was measured against the closed-form exponential sweep instead
of against the code that produced it. Over the region where the band-limited
wavetable closely approximates an ideal sine, SNR against the analytic signal
improves from 68.00 dB to 107.75 dB (~97x less error), and the accumulated
phase error at the final zero crossing drops from +0.00016 cycles to
+0.00000.

The thresholds are left at their original strict values (129.72 dB SNR for
sine), so these tests keep their full ability to catch oscillator regressions.
Note that Chromium responded to the equivalent change by marking these tests
as expected failures; regenerating instead preserves the coverage, at the cost
of the references no longer matching upstream's if they are ever re-imported.

* 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/audioparam-exponentialRampToValueAtTime-expected.txt:
 Rebaselined
* 
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/moderate-exponentialRamp-expected.txt:
 Progression
* LayoutTests/webaudio/Oscillator/oscillator-custom-expected.wav: Regenerated
* LayoutTests/webaudio/Oscillator/oscillator-sawtooth-expected.wav: Regenerated
* LayoutTests/webaudio/Oscillator/oscillator-sine-expected.wav: Regenerated
* LayoutTests/webaudio/Oscillator/oscillator-square-expected.wav: Regenerated
* LayoutTests/webaudio/Oscillator/oscillator-triangle-expected.wav: Regenerated
* Source/WebCore/Modules/webaudio/AudioParamTimeline.cpp:
(WebCore::AudioParamTimeline::processExponentialRamp):

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



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

Reply via email to