globalSpeed icon indicating copy to clipboard operation
globalSpeed copied to clipboard

YouTube sounds ragged when using the battery

Open Cabus1982 opened this issue 1 year ago • 6 comments

Hi, I have a problem using the EQ (no speed changes) in battery mode, the audio sounds annoyingly choppy, when I connect to the AC the problem disappears. I have the Windows and Edge Browser profiles in high performance in both, I have no extensions or active optimization functions, all updated and the problem persists. 🤔

Ultrabook Dell 7480 (i7 7600U - 16 GB)

Cabus1982 avatar Jul 08 '22 18:07 Cabus1982

Hello. Seems like a Chromium battery saving optimization, even if it should be disabled. Not sure if the issue is fixable. Maybe try this version. I added a very low latencyHint instead of leaving it unspecified.

https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/AudioContext#latencyhint

  1. Open edge://extensions.
  2. Disable the original Global Speed.
  3. Enable developers mode.
  4. Download packed.zip and unzip the folder.
  5. Click "Load unpacked" and load the folder. (ignore the Manifest v2 depreciated warning, haven't updated yet).

[ DELETED ]

polywock avatar Jul 08 '22 19:07 polywock

Didn’t get any better

Cabus1982 avatar Jul 09 '22 05:07 Cabus1982

Too bad. :( Global Speed uses the Tab Capture API to get tab's audio, and the Web Audio API (particularly the BiquadFilterNode for the EQ feature). I suspect it's a chromium issue with one of these. You can run this bookmarklet while a Youtube video is playing to narrow it down. This circumvents Tab Capture API so if this works (not choppy), the issue is with the Tab Capture API. If it doesn't work, the issue is with the Web Audio API.

[ DELETED }

polywock avatar Jul 09 '22 17:07 polywock

I just noticed an issue with the bookmarklet code. Forgot the semicolons so it wouldn't have run. My bad. Here's the corrected code.

  1. Edit any bookmark and set the URL to the following code. As for name, you can choose anything.
  2. Click on the bookmark while a Youtube video is playing.
  3. Let me know if it sounds choppy or not (when you're using battery).
javascript:(() => {
    const video = document.querySelector("video");
    const ctx = new AudioContext();
    const mediaSrc = ctx.createMediaElementSource(video);
    const filter = ctx.createBiquadFilter();
    filter.freq = 1000;
    filter.gain = 0;
    filter.q = 1.4;
    mediaSrc.connect(filter);
    filter.connect(ctx.destination);
})()

polywock avatar Jul 09 '22 22:07 polywock

Unfortunately, when I clic on the bookmark the sound of the video become weak and gray and the choppy sound still there. 😢

Cabus1982 avatar Jul 12 '22 03:07 Cabus1982

The sound becoming weak is normal because of the Biquad filter. But, since it's still choppy, that means the issue is with the Web Audio API. Edge also uses Chromium, so it's very likely a Chromium bug. To confirm, try the bookmarklet on Chrome as well.

If you want, you could report this issue to the Chromium team. Only way I see this issue being resolved.

https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3EWebAudio

polywock avatar Jul 14 '22 06:07 polywock