Google Hangouts and Jack Audio

Update 06/21/2014: This no longer works. Google made the talkplugin “more intelligent,” so if it can't fondle the card in certain ways (which the loopback card doesn't do) it won't select it. For now, I'm using the analog hole. If I find a better solution, I'll make a new post.
Update 12/18/2015: That “better solution” is PulseAudio's JACK sync, which isn't perfect but works well enough for what I need it for. Hangouts have been mostly for work, not broadcasting. If I needed something for broadcasting, a VM with a Mumble bridge would more than likely be my solution at this point.

This is probably a rare occurrence, but documenting hacks and projects is what this blog is for, so here goes.

I have two sound cards. One of them is for GNOME and Pulse, and one of them is for JACK and my professional audio work. One just goes to some cheap 2.1 PC speakers with a bad volume pot that I haven't gotten around to fixing, the other goes to some Sennheiser headphones and has my DO56 via a 12AX7 preamp.

I was listening to the Atheist Nomads live Google Hangout today, and I was wondering if I were doing the same thing, if I could pipe my usual JACK production tools into it. Pretty straight forward, really: create a loopback soundcard and then run the alsa utilities to carry audio into and out of it. I seem to use Loopback audio cards a lot.

For some reason the google talkplugin saw the Loopback, but wasn't speaking to it in ways that made sense to me. I asked Dustin over at the podcast how he got JACK to work with the hangout, and he said he didn't use JACK, just pulse. Which got me thinking.

I jumped out of GNOME and into Window Maker, launched Chromium, and instead of a small list of hardware devices as in Pulse, I got an ALSA list of devices, and suddenly everything was working fine.

I don't want to have to jump out of GNOME just to do a hangout with the good tools. So I looked into having an application ignore Pulse. Tried a bunch of ways suggested by documentation and web pages, but none of them worked.

Finally, I remembered that Pulse paid attention to some environment variables for the purposes of remote sound. I tried a cheap hack, and lo, it worked:

$ PULSE_SERVER='' chromium

Assuming chromium wasn't already running, I was in business. Connecting to Pulse fails, it falls back to ALSA, and my JACK tools work. Good to go.

I get the reason for Pulse Audio. I'm transitioning back from Mac OS and CoreAudio was a really nice thing to have. Also, I'm not a member of that very strange tribe that hates Lennart Poettering beyond space and time. That said, Pulse makes some choices that feel kind of less than well engineered to me.