Archive

Archive for July 1st, 2011

Fix PulseAudio loopback delay

July 1st, 2011 13 comments

Sort of a follow up (in spirit) to two of Jon’s previous posts regarding pulse audio loopback; I noticed that there was quite a bit of delay (~500ms to 1second) in the default configuration and began searching for a way to fix it. After some research I found an alternative way to achieve the loopback but with must less delay.

1. Install paman

First install the PulseAudio Manager application so that you can correctly identify the input device (i.e. your mic or line-in) and your output device (i.e. the sound card you are using).

sudo apt-get install paman

You can find the input sources under the Sources section and the output devices under the Sinks section of the Devices tab. Make note of the names of the two devices.

2. Unload any previous loopback modules

If you had followed Jon’s previous posts then you will need to unload the modules (and potentially change your PulseAudio configuration so they don’t get loaded again on next restart). This is to stop it from doubling all loopback sound.

3. Create an executable script

Create a script and copy the following command into it:

pacat -r --latency-msec=1 -d [input] | pacat -p --latency-msec=1 -d [output]

where [input] is the name of your input device found in step 1 and [output] is the name of the output device. In my case it would look like:

pacat -r --latency-msec=1 -d alsa_input.pci-0000_05_02.0.analog-stereo | pacat -p --latency-msec=1 -d alsa_output.pci-0000_05_02.0.analog-surround-51

4. Run script

By simply running the script now you should get correct loopback and with much less delay than using the default loopback module. Even better if you set this script to run at startup you won’t have to worry about it ever again.




I am currently running a variety of distributions, primarily Linux Mint 17.
Previously I was running KDE 4.3.3 on top of Fedora 11 (for the first experiment) and KDE 4.6.5 on top of Gentoo (for the second experiment).
Check out my profile for more information.

Two monitors. Different resolutions. One desktop.

July 1st, 2011 6 comments

If you’ve ever tried to set up two monitors on Linux you’ll know that its a relatively painless process. The only issue that I’ve found comes when the two monitors in question do not share a common resolution between them. In testing a setup of mine I found that when I extended my desktop across the two monitors I was actually left with a ‘dead’ space above one.

Pictures make it easy to understand

As you can see in the above picture there is a space above my left monitor. The way that X does monitor spanning is to create a large ‘logical’ monitor by stacking your real monitor’s resolutions side by side. In effect this created a logical monitor of size 2640×1024 (the total width of the two monitors’ resolutions by the largest of the two’s resolution).

This dead space left me with areas above my left monitor where applications were still being shown, even though I couldn’t see them. Obviously this was unacceptable. Thankfully X has this X-cellent little feature (first and only pun I promise) that allows you to easily fix it. Essentially I added some panning configuration to each monitor which told X that, while the logical monitor could exceed each individual monitor’s resolution, it could not display windows in areas that I couldn’t see. The easiest way to set this up was right within my graphics settings:

just set the panning on each monitor to be the native resolution and you should be set. Alternatively you can do this within xorg.conf (usually located at /etc/X11/xorg.conf) by adding “@AxB” (where A and B are your resolutions, i.e. @1360×768) to your metamodes option in your screen section. For more information hit this link.




I am currently running a variety of distributions, primarily Linux Mint 17.
Previously I was running KDE 4.3.3 on top of Fedora 11 (for the first experiment) and KDE 4.6.5 on top of Gentoo (for the second experiment).
Check out my profile for more information.