Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: implement convolution channel configuration #546

Merged
merged 2 commits into from
Jan 13, 2025

Conversation

b-ma
Copy link
Collaborator

@b-ma b-ma commented Jan 12, 2025

This implements the multichannel stuff for the ConvolverNode
cf. https://webaudio.github.io/web-audio-api/#Convolution-channel-configurations

There is still a todo regarding input number of channel changes (i.e. from stereo to mono), I guess we need to add a bit of bookkeeping to properly handle the tail of the channel that disappeared, but not completely sure how to do that yet.

todos

  • input channel number change (delegate to another PR?)
  • wpt check

@b-ma
Copy link
Collaborator Author

b-ma commented Jan 12, 2025

WPT results:

before

- # pass: 260
- # fail: 68
- # type error issues: 0

after

- # pass: 322
- # fail: 6
- # type error issues: 0

Note that this also has an impact on examples/benchmarks.rs since the IR is 2 channels, but results are still ok:

id  | name                 | duration (ms) | Speedup vs. realtime | buffer.duration (s)
13  | Convolution reverb   |       224.155 |                66.92 |             15

@orottier
Copy link
Owner

Alright, that looks nice.
I took me a while to understand the spec regarding multi channel, but as I see it know the number of input channels and the number of convolver channels determine the output channel count. And you create a second (identical) convolver in case the IR buffer has only one channel to handle stereo inputs.

@orottier
Copy link
Owner

Relates to #542

@orottier orottier merged commit 7b1c399 into orottier:main Jan 13, 2025
3 checks passed
@b-ma b-ma deleted the feat/convolver-multichannel branch January 13, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants