JavaScript issue: Web Audio API's getChannelData() returns incorrect values on Brave

Hey all! Just joined Brave’s Community so apologies if I’m not explaining things how they should be explained on here lol
I’ve had a feature on my website for about a year where when you play an audio file, it generates a waveform by sending an XMLHttpRequest request to that file, then using decodeAudioData() on the response, then using getChannelData() to get the waveform data to then draw it on an HTML Canvas. The problem is, on Brave, the values are completely off. I’ll attach two images, one having the correct waveform on Edge, and the other being the incorrect waveform on Brave.

I should also note that this issue is present on the mobile version of Brave as well

So yeah, if there was a recent change to Brave’s handling of the Web Audio API, or ArrayBuffers, or whatever something like this could involve, please look into this! Thank you!

Hey @Cosmoa Do you have an example? or upload to ?

Well, I have my website itself, but no actual isolated code of it that I can upload to jsfiddle. I can make one though! Hold on B)

Alright, it’s a bit performance-heavy, but here it is!

No error messages on jsfiddle, played back the sample sound okay. What should I expect from the sample js @Cosmoa

Wait what the heck 0_o

It looks like this for me:

But on Edge it looks like what you have. That’s super weird

Does it work in private window mode? and/or in a clean Brave profile?

Alright, those questions led to a small investigation on my part, and I figured out what the issue is. Setting Brave Shield’s Fingerprinting blocking to “Strict, may break sites” actually does wind up breaking sites, who woulda guessed?

Well, if this weirdness with getChannelData() is something that can be avoided while still not compromising security/privacy, that would be beautiful. For now though I guess I’ll keep the fingerprint blocking set at Standard. Thank you very much for your help! : )

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.