Created
July 13, 2023 20:37
-
-
Save paulschwoerer/57e92f20ffb11fee4db4c286d717db3f to your computer and use it in GitHub Desktop.
Minimal working example of Chromium bug when calling createIIRFilter() on Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Run the following file in Firefox and Chromium. | |
It has been observed, that createIIRFilter() takes around 50ms to complete in Chromium-based browsers on Linux (Ubuntu, Gnome, PulseAudio). | |
In Firefox, it takes <1ms. | |
createBiquadFilter() has been included as a reference. | |
It takes <1ms in both browsers. | |
--> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>WebAudioAPI IIR Filter Bug</title> | |
</head> | |
<script type="module"> | |
const ctx = new OfflineAudioContext({ | |
length: 1, | |
sampleRate: 44100, | |
numberOfChannels: 1 | |
}); | |
const feedback = [1, -1.9635105015543133, 0.9658787263376775]; | |
const feedforward = [0.017060636575783206, 0, -0.017060636575783206]; | |
const t1 = performance.now(); | |
const iirNode = ctx.createIIRFilter(feedforward, feedback); | |
const t2 = performance.now(); | |
console.log(`createIIRFilter() took: ${t2 - t1}ms`); | |
const t3 = performance.now(); | |
const biquadNode = ctx.createBiquadFilter(); | |
const t4 = performance.now(); | |
console.log(`createBiquadFilter() took: ${t4 - t3}ms`); | |
</script> | |
<body> | |
See console | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment