Wasted-Audio / hvcc

The heavy hvcc compiler for Pure Data patches. Updated to python3 and additional generators
https://wasted-audio.github.io/hvcc/
GNU General Public License v3.0
257 stars 30 forks source link

[wasm] - [noise~] becomes high pitch at higher amplitudes in Microsoft Edge (Windows 11) #181

Closed diemildefreude closed 4 months ago

diemildefreude commented 4 months ago

With a simple patch of just [noise~]->[*~]->[dac~], with [*~] taking a volume value, if the volume is set to 1.0, the noise immediately changes into something like a sustained, very high-pitched sine wave. If the volume is set to 0.9, the same thing happens, but it takes around 10 seconds of noise before the change occurs. 0.5 is stable and doesn't produce this bug.

Firefox does not have this problem.

dromer commented 4 months ago

I assume that this is with AudioWorklet. What if you force using AudioLib, does it give the same result?

You can do this by setting this variable to false: https://github.com/Wasted-Audio/hvcc/blob/develop/hvcc/generators/c2js/template/hv_wrapper.js#L3

diemildefreude commented 4 months ago

Yeah, I'm getting the same bug with ScriptProcessorNode/audiolib too.

Also, once it happens, I can't turn off the audio with the generated index.html's start/stop transport (loader.stop() call). The high pitch remains.

diemildefreude commented 4 months ago

OK, as you requested (on Discord), I've tested it in Chrome and the same bug happens as in Edge. However, I've also discovered that this is bug was happening only when using the bluetooth connection of my Bose QC 35 II headphones. It does not happen when plugging the headphones directly into the computer's headphone jack or when using the laptop's speakers. I then tested it with another bluetooth device (a little Anker speaker) and the bug does not occur with that either.

I don't know much about Bluetooth audio, but apparently it overrides any sound cards you have with its own compression algorithm.

So this is a bug specific to using heavy's js implementation with the Bose QC 35 II's bluetooth (and presumably any other Bluetooth devices that share the same bluetooth sound-processor as it). And it happens in Edge and Chrome but not in Firefox. Oof.

dromer commented 4 months ago

Hmm, that's one very strange bug and not sure if it's something that we can really do anything about.