Skip to content

refactor: changes for the wpt convolver and delay - #1308

Open
mdydek wants to merge 5 commits into
mainfrom
refactor/delay-convolver-wpt-improvements
Open

mdydek wants to merge 5 commits into
mainfrom
refactor/delay-convolver-wpt-improvements

Conversation

@mdydek

@mdydek mdydek commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Closes #

⚠️ Breaking changes ⚠️

Introduced changes

  • swap the writer and delay in the delaynode so it works correctly
  • constantsourcenode and oscillatornode emit mono output per spec
  • properly validate options in convolver and delay
  • do not zero nyquist component, but treat it separately as two real numbers instead of one complex, because our fft implementation treat those values this way
  • do not treat channelCount property in the audio node as number of channels being given to the output

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added/Conducted relevant tests
  • Performed self-review of the code
  • Updated Web Audio API coverage
  • Added support for web
  • Updated old arch android spec file

@mdydek mdydek added the refactor Code restructuring without altering external behavior or fixing bugs label Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

WPT non-regression comparison

FAIL — 1 regressed section(s), 3 file(s) with new failing subtests · 5 improved section(s) · overall 3420 → 3427 (+7)

Spec section Base pass Head pass Delta
ConvolverNode 203 178 -25
Processing model 0 1 +1
AudioBufferSourceNode 218 220 +2
DelayNode 104 127 +23
PannerNode 723 727 +4
StereoPannerNode 102 104 +2

New failing subtests:

  • the-audio-api/the-convolvernode-interface/convolver-response-1-chan.html
    • X 3: Channel 0 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expected AbsError
    • X 3: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expected AbsError
    • X 4: Channel 0 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expected AbsError
    • X 4: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expected AbsError
    • X 5.1: Channel 0 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0.0000011511867343774294,"relativeThreshold":0}.
      Index Actual Expected A
    • X 5.1: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0.0000011511867343774294,"relativeThreshold":0}.
      Index Actual Expected A
  • the-audio-api/the-convolvernode-interface/convolver-response-2-chan.html
    • X 1: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expected AbsError
    • X 2: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expected AbsError
    • X 3: Channel 0 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expected AbsError
    • X 3: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expected AbsError
    • X 4: Channel 0 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expected AbsError
    • X 4: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expected AbsError
    • X 5.1: Channel 0 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0.0000011511867343774294,"relativeThreshold":0}.
      Index Actual Expected A
    • X 5.1: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0.0000011511867343774294,"relativeThreshold":0}.
      Index Actual Expected A
    • X 2-in explicit mode: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual E
    • X 3-in explicit: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expect
    • X 4-in explicit: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":4.76837158203125e-7,"relativeThreshold":0}.
      Index Actual Expect
    • X 5.1-in explicit: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0.0000016280238925805544,"relativeThreshold":0}.
      Index Actual
  • the-audio-api/the-convolvernode-interface/convolver-response-4-chan.html
    • X 1: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":7.152557373046875e-7,"relativeThreshold":0}.
      Index Actual Expected AbsErro
    • X 3: Channel 0 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":7.152557373046875e-7,"relativeThreshold":0}.
      Index Actual Expected AbsErro
    • X 3: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":7.152557373046875e-7,"relativeThreshold":0}.
      Index Actual Expected AbsErro
    • X 4: Channel 0 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":7.152557373046875e-7,"relativeThreshold":0}.
      Index Actual Expected AbsErro
    • X 4: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":7.152557373046875e-7,"relativeThreshold":0}.
      Index Actual Expected AbsErro
    • X 5.1: Channel 0 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0.0000017267801015661442,"relativeThreshold":0}.
      Index Actual Expected A
    • X 5.1: Channel 1 does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0.0000017267801015661442,"relativeThreshold":0}.
      Index Actual Expected A
Unchanged sections (22)
Spec section Base pass Head pass Delta
Other 56 56 0
AnalyserNode 138 138 0
AudioBuffer 140 140 0
AudioContext 58 58 0
AudioNode 261 261 0
AudioParam 680 680 0
BiquadFilterNode 275 275 0
ChannelMergerNode 30 30 0
ChannelSplitterNode 7 7 0
ConstantSourceNode 64 64 0
DestinationNode 0 0 0
DynamicsCompressorNode 4 4 0
GainNode 15 15 0
IIRFilterNode 87 87 0
MediaElementAudioSourceNode 0 0 0
MediaStreamAudioDestinationNode 1 1 0
MediaStreamAudioSourceNode 0 0 0
OfflineAudioContext 35 35 0
OscillatorNode 104 104 0
PeriodicWave 33 33 0
ScriptProcessorNode 0 0 0
WaveShaperNode 82 82 0

Baseline: 87cca81bff30ee15f3a407008cdc2ee30527ef89 · Candidate: 524d440ebe9ed4f6b479798ba52be7bbab99c75a

Workflow run · this comment is updated on every push.

@mdydek
mdydek added this pull request to stack #1310 September 24, 2026 11:37
@mdydek
mdydek force-pushed the refactor/delay-convolver-wpt-improvements branch from 70209cd to e954a4c Compare September 24, 2026 13:20
@mdydek
mdydek force-pushed the refactor/delay-convolver-wpt-improvements branch from e954a4c to 20f7019 Compare September 24, 2026 14:37
@mdydek
mdydek requested a review from closetcaiman September 25, 2026 17:26
[[nodiscard]] size_t getChannelCount() const;

/// @brief Returns how many channels this node emits on its output.
[[nodiscard]] size_t getOutputChannelNumber() const;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason for this to be named *Number instead of *Count?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to me *Number seems like getting a specific channel

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the ChannelCount refers to something else totally in the api and it would be very chaotic if it was named like that.

return negotiatedChannelCount;
return numberOfInputs_ == 0 ? getOutputChannelNumber() : negotiatedChannelCount;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't overrides of this method solve the problem of outputChannelCount?

@github-actions github-actions Bot added the conflicts This PR has conflicts with the base branch. label Sep 29, 2026
@github-actions github-actions Bot removed the conflicts This PR has conflicts with the base branch. label Sep 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without altering external behavior or fixing bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants