AK: Revert "AK: Remove unused Complex.h"
This reverts commit b88e0eb50ad4de2e786884be76a32116bf24da7a. In order to implement interfaces in the WebAudio spec, at least biquad filter and analyser node, complex numbers are needed. This brings back the previously unused Complex.h header.
Please revert this change along with the code that relies on it. As is it simply brings back unused code.
As I understand it was removed because it was unused. I can add in a separate commit some functionality to LibMedia that would use this.
Please revert this change along with the code that relies on it. As is it simply brings back unused code.
As I understand it was removed because it was unused. I can add in a separate commit some functionality to LibMedia that would use this.
and if we merge it as it then it's going to become unused again, so, yes, please include LibMedia commit that uses it.
ok, you added biquad_filter_frequency_response() but now both commits are not actually used by browser engine or anything, right? I am not aware of what is going on LibMedia but this newly added function looks like something we would rather do using library.
The context here is https://github.com/LadybirdBrowser/ladybird/issues/1840
Just to be absolutely clear, this PR needs to have functionality tied in to LibWeb's WebAudio somehow. Also I'm not 100% sold on doing this ourselves vs. using a DSP library. That's something we might need to discuss on Discord.
The next step would be to have the WebAudio::BiquadFilterNode call into this. There's a fixme in its get_frequency_response method.
Using a library is also reasonable, but fwiw I haven't been able to find one straightforwardly exposing a biquad filter, for example. Chromium uses their blink engine for this.
The next step would be to have the
WebAudio::BiquadFilterNodecall into this.
Sure, but make that part of this PR so we don't have an unused Complex.h lying around again :-)
Using a library is also reasonable, but fwiw I haven't been able to find one straightforwardly exposing a biquad filter, for example. Chromium uses their blink engine for this.
I think it's reasonable to start off with our own implementation, and if we find a library able to replace our code then deal with it then.
Sure, but make that part of this PR so we don't have an unused
Complex.hlying around again :-)
Got it, I just didn't want to fall subject to scope creep. I'll do that as soon as I get a chance.
I think it's reasonable to start off with our own implementation, and if we find a library able to replace our code then deal with it then.
This sounds good to me as well. I'm aware that this won't immediately be the most robust implementation in the world. So especially if you have ideas about how to test correctness in different parameter regimes I'm very open to adding those on top of this. I also don't want to bog down the test suite with this relatively niche/compute-heavy feature, so there's some tension there too. I'm open to whatever ideas you might have here
Okay, added another commit with some changes to libWeb. It's a bit lengthy but pretty rote, doing the coefficients for the biquad filter type cases. I had to prefix the calls to cos and sqrt with AK to get them to resolve properly, and CI didn't like my lambda without the extra return statement.
This still doesn't call biquad_filter_frequency_response, but that would be the next line after casting coefficients to void. The next outstanding issue would be how you'd want to pass around pointers and or manage intermediate vectors, given that these web audio functions take buffer sources as arguments. Using a pointer would avoid an unnecessary intermediate, and could make moving to a library easier in the future, but the vector is easier now. Up to you
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!