The officially official Devuan Forum!

You are not logged in.

#1 Yesterday 23:06:22

stultumanto
Member
Registered: 2023-12-12
Posts: 95  

Output lag routing OBS through apulse

OBS Studio only supports PulseAudio for output monitoring, so I'm using apulse to route its output to ALSA. It works OK, but there is an unusual amount of audio lag; it sounds like several hundred milliseconds. I've tested looping back my microphone through ALSA using sox, and there's almost no latency at all. Either apulse or OBS is causing the lag, but I can't tell which. I was wondering if anyone else had any experience with latency issues using these two programs. My searches didn't turn up anything specific.

Offline

#2 Yesterday 23:19:10

g4sra
Member
Registered: 2018-12-12
Posts: 68  

Re: Output lag routing OBS through apulse

I used apulse with firefox for a while and suffered with bad latency, I assumed it was firefox. After having a hissy fit and purging apulse after my headset refused to work I forgot I had done so and launched firefox to discover the latency was greatly reduced. Not conclusive, but if you can find a method to resize apuls'es buffers it might be worth the effort to try it.

Offline

#3 Yesterday 23:38:51

stultumanto
Member
Registered: 2023-12-12
Posts: 95  

Re: Output lag routing OBS through apulse

Thanks for sharing that data point. I just tried using apulse with Firefox ESR on a Debian installation. (The Firefox packaged with mainline Debian no longer supports ALSA directly.) I observed exactly what you describe. It seems apulse is the source of the high latency. What's odd is that, according to the documentation, apulse simply wraps the ALSA mixing tools dmix, dsnoop, and plug. Logically, then, it would seem these tools must be the source of the latency.

I actually did find some discussions by people who claimed to have latency issues with the ALSA userspace utilities. Perhaps there is a buffer setting in these tools I can adjust. If that doesn't work, though, I may just give in and install PipeWire, as it appears more and more applications are coming to rely on it.

Offline

#4 Today 00:41:26

igorzwx
Member
Registered: 2024-05-06
Posts: 383  

Re: Output lag routing OBS through apulse

stultumanto wrote:

The Firefox packaged with mainline Debian no longer supports ALSA directly.

It is not true. Firefox-esr works with ALSA. To reduce latency, you have to disable pulse-rust backend and recompile libasound2-plugins with --disable-pulseaudio
_https://dev1galaxy.org/viewtopic.php?id=7523

It is not difficult to compile Firefox without pulseaudio.

Firefox uses 32-bit floating-point audio format by default. If your sound card does not natively support this format, direct hw:device access will not work. You must use the ALSA plug plugin for format conversion. Configure your ALSA default device to use type plug with slave.pcm "hw:X,Y" for automatic format conversion.

Last edited by igorzwx (Today 00:59:41)

Offline

#5 Today 07:58:23

stultumanto
Member
Registered: 2023-12-12
Posts: 95  

Re: Output lag routing OBS through apulse

It is not true. Firefox-esr works with ALSA.

No argument here; I was only testing the PulseAudio version to help troubleshoot my issues with apulse and OBS Studio. I appreciate the detailed instructions for recompiling Firefox; however, there doesn't appear to be an equivalent way to coerce OBS into support ALSA for output monitoring. It seems this feature is only available if one installs PulseAudio or PipeWire, which is strange, as OBS supports ALSA input sources without issue.

Offline

Board footer