@iska@mstdn.starnix.network @cyberspook @fugger I think you're right! I still prefer youtube-dl though. Firefox wants pulseaudio for audio input to work, but as I hate pulse, I use this wrapper called apulse. It introduces some lag which makes audio and video out of sync. It's okay for video calls and such, but it pisses me off watching videos like this. With youtube-dl I can also keep the video if I like it — so youtube-dl is my weapon of choice when it comes to dealing with web video.

@m0xee @iska @cyberspook @fugger Are you using dmix? If you just use e.g. "plughw:0" that removes much of the latency (though it will no longer do software mixing for multiple sources). You can actually go even further and modify and coompile it with a low buffersize and periodsize to get absurdly low latency. For example, I just hackily hardcoded 64 and 16 respectively. It works flawlessly and never overruns.

@mikuphile Yeah, I'm afraid giving exclusive sound card access to Firefox won't cut it for me, I often use mpv and other software, but always leave FF running. I'll look into reducing buffer size, thanks for the tip!
Do you remember which file these values are defined in?

@m0xee Yes, it's under slave. If you named it dmixed, for example, you could add this to your asoundrc:
pcm.dmixed.slave.buffer_size 256
pcm.dmixed.slave.period_size 64
You can check that it works by playing something through it and running:
watch -n.1 cat /proc/asound/card*?/pcm*??/sub*?/hw_params
Your updated values should appear there.
However, you might still have significant latency, depending on the periodsize apulse uses (you only changed the dmix's periodsize). You can download the source of apulse, and in src/apulse-stream.c insert the lines "period_size = 16;" after line 353 and "buffer_size = 64;" after what is now line 375, and compile and install it. Though maybe you should just use 64 and 256, respectively.
Follow

@mikuphile
> You can download the source of apulse, and in src/apulse-stream.c insert the lines "period_size = 16;" after line 353 and "buffer_size = 64;"
Yes, this is exactly what I wanted! I was browsing through apulse's sources, but I couldn't find it myself 🤭
I'm using Void so adding a patch and rebuilding is easy. I'll try that, thanks!

Ā· Web Ā· 0 Ā· 0 Ā· 1
Sign in to participate in the conversation
Librem Social

Librem Social is an opt-in public network. Messages are shared under Creative Commons BY-SA 4.0 license terms. Policy.

Stay safe. Please abide by our code of conduct.

(Source code)

image/svg+xml Librem Chat image/svg+xml