Is it possible to record all the audio that goes in and out of a programme on Linux? I'm using normal Ubuntu 9.10, and I'd like to be able to do something like.

$ audiorecord PROGNAME

Where PROGNAME is the name of the programme I want to record the audio in and out of. Sort of like a keylogger for my speaker and microphone. I'm just using stock Ubuntu 9.10, so I assume that's PulseAudio or something? For Example, I could record the music that I play with

$ audiorecord banshee

and record my skype converstations with

$ audiorecord skype

It's for things like skype that I'd like to record the audio in aswell.

Is this possible?


There's not a simple command-line way of doing it like that, no.

The best way, for programs that support it, is JACK. Tell a program to use JACK output, and use a JACK-capable recording tool (which could include command-line ones such as jack_capture, qarecord, ecasound or even plain old jackrec) to connect to that application's output port and save it.

For ALSA apps, it's possible, but potentially more work. You'd need to install the pavucontrol package from Synaptic. This is part of PulseAudio that for some reason Ubuntu don't include by default. Run it along with a recording app such as gnome-sound-recorder and when you start that recording you should see it in the ‘Recording’ tab. You can then switch its input to ‘Monitor of (your sound card)’ to pick up all the sound being produced.

Unfortunately this doesn't isolate one particular application. If you needed to do that with an ALSA/Pulse app, you'd have to create a .asoundrc file to configure a fake sound card that only your selected application would make sounds on, and record from that. Alternatively you could install a proper libasound2-plugins that includes the ALSA->JACK plug and then just use the JACK stuff. Unfortunately Ubuntu's libasound2-plugins doesn't include it, because that would just be too easy wouldn't it?

Skype is a further PITA, it has always had difficulty choosing where to send its output. For me, the newest version seems only ever to want to talk directly, unconfigurably, to Pulse, which has rather scuppered my attempts to connect it to anything else.

Sigh. Linux audio is a mess. Skype is a mess. Both of them together is a horror.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.