Large latency with pacat loopback when started via MATE startup applications

Bug #1739904 reported by Jacob Moroni
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu MATE
Invalid
Undecided
Unassigned

Bug Description

Hello,

First, let me just say that this bug report probably isn't the most helpful. I'm mainly posting it to see if this issue has been encountered before, and if not, to see how I can gather some more useful information to help debug. That said, I am pretty confident that this is an actual bug and not just user error.

Also, this may very well not be the right place for this bug report. I think it's a PulseAudio issue, and given that Ubuntu MATE 16.04 uses PulseAudio 8.0 (which is a few versions behind the mainline PulseAudio), I figured I would post it here and hope that it gets propagated to the appropriate place.

If I should post this somewhere else (like a forum), please feel free to redirect me!

Anyway, my system:

- Ubuntu MATE 16.04, up to date
- Asus Xonar DX
- Xeon E3 1275 V6 (Kaby Lake)
- 32G RAM

I have an external audio source (game console) attached to the line-in of my sound card (Asus Xonar DX), and I'd like to be able to listen to the input in real-time, with minimal latency.

As far as I know, there are two solutions:

1. Use module-loopback
2. Use pacat to pipe the input to the output

Both of these solutions work, but have issues.

Module-loopback seemed the most promising, but I noticed that the latency would slowly creep up as the system was left running (hours and days). This was confirmed both audibly as well as by checking the values via "pactl list sink-inputs". After researching, I found that module-loopback had a fix specifically for this in the PulseAudio 11.0 release, but I couldn't find a safe and easy way to upgrade PulseAudio (and failed miserably at trying to compile and load the newer 11.0 version of module-loopback into PA 8.0), so I went with the "pacat" method instead.

I've created a simple script that contains the following line:

"pacat -r --latency-msec=4 -d alsa_input.pci-0000_02_04.0.analog-stereo | pacat -p --latency-msec=4 -d alsa_output.pci-0000_02_04.0.analog-stereo"

Then, I added this script to my "Startup Applications" under MATE. I prefixed it with a "Z" so that it would start last (I don't know if this is really valid, but it seems to work). Since PulseAudio itself appears to be started the same way, I wanted to make sure that my script ran after that.

THE BUG:

The method above works fine except that the latency is somewhere on the order of 0.5 seconds! What's weird is that the latency reported by "pactl list sink-inputs" is only in the 15 ms range. I cannot find where the latency is being introduced.

If I run the command manually, there is no latency issue. It only happens if I start it up automatically via MATE.

To work around the issue, I added a 20 second sleep in the script before the command. This seems to work (it eliminated my latency issue). I don't know why, I don't know how.

My only guess is that there's some issue with using pacat too soon after PulseAudio is actually started.

Any input?

Changed in ubuntu-mate:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.