Archive

Posts Tagged ‘module-loopback’

Unwanted Effects on my Line-in Interface

August 26th, 2010 No comments

Shortly after purchasing an xbox360, I wrote a short piece that gave instructions for forwarding your line-in audio through your pc speakers. By using this method and sharing my network connection, I’ve managed to run my xbox as a peripheral to my main computer setup, saving me space and money.

Lately however, the line-in loopback has not been working as expected. At times, it sounds like effects have been applied to the line. In particular, it sounds like somebody has applied a phaser or a delay effect to the input signal.

For the last week or so, I’ve been scratching my head about this issue, trying to figure out what part of my system may have applied effects to my loopback, but not to other audio on the system. Tonight, I was reviewing my original instructions for setting the thing up, and noticed that the module was being loaded on startup after being added to a system config file:

sudo sh -c ' echo "load-module module-loopback" >>  /etc/pulse/default.pa '

On a hunch, I took a look at the end of the file, and found the following lines:

### Make some devices default
#set-default-sink output
#set-default-source input
load-module module-loopback
load-module module-loopback

It looked like the instruction to load the loopback module had ended up in the config file twice! Because of this, the module was being loaded twice on startup.

So what does this have to do with the effects on the line? Well, if you play two copies of the same sound with a half-second gap between them, your ears will be tricked into thinking that you’re hearing one copy of the sound, but that it’s all echoey, as if a delay effect had been applied. If you repeat the experiment but this time decrease the gap between the two sounds even further, say to a few milliseconds, your ears will hear one copy of the sound with a phaser effect applied.

Essentially, when the module loaded twice, it was capturing the mix from the line-in port twice and playing back two separate copies of the audio. Depending on how close together these instances  were, the result sounded normal, phased, or delayed. I fixed the issue by removing one of the lines and then restarting the machine. This time, it started only one copy of the service, and everything sounded fine.

The moral of the story: If you’re loading modules at startup, make sure that you only start one copy of them.




On my Laptop, I am running Linux Mint 12.
On my home media server, I am running Ubuntu 12.04
Check out my profile for more information.

PulseAudio: Monitoring your Line-In Interface

July 11th, 2010 21 comments

At home, my setup consists of three machines -  a laptop, a PC, and an XBOX 360. The latter two share a set of speakers, but I hate having to climb under the desk to switch the cables around, and wanted a better way to switch them back and forth. My good friend Tyler B suggested that I run the line out from the XBOX into the line-in on my sound card, and just let my computer handle the audio in the same way that it handles music and movies. In theory, this works great. In practice, I had one hell of a time figuring out how to force the GNOME sound manager applet into doing my bidding.

After quite a bit of googling, I found the answer on the Ubuntu forums. It turns out that the secret lies in a pulse audio module that isn’t enabled by default. Open up a terminal and use the following commands to permanently enable this behaviour. As always, make sure that you understand what’s up before running random commands that you find on the internet as root:

pactl load-module module-loopback
sudo sh -c ' echo "load-module module-loopback" >>  /etc/pulse/default.pa '

The first line instructs PulseAudio (one of the many ways that your system talks with the underlying sound hardware) to load a module called loopback, which unsurprisingly, loops incoming audio back through your outputs. This means that you can hear everything that comes into your line-in port in real time. Note that this behaviour does not extend to your microphone input by design. The second line simply tells PulseAudio to load this module whenever the system starts.

Now if you’ll excuse me, I have jerks to run over in GTA…




On my Laptop, I am running Linux Mint 12.
On my home media server, I am running Ubuntu 12.04
Check out my profile for more information.