Is there a way to record the audio from only a specific program, so that other sounds (e.g. notifications) are not recorded?

I'm running Archlinux with pulseaudio.


You can use pacat which is part of pulseaudio.

First open your application. THen run pactl list and find your device. in my example, I will use chrome


Client #229
Driver: protocol-native.c
    Owner Module: 8
        application.name = "Chrome input"
    native-protocol.peer = "UNIX socket client"
        native-protocol.version = "28"
    application.process.id = "16404"
        application.process.user = "robert"
        application.process.host = "HS"
        application.process.binary = "chrome"
        application.language = "en_US.UTF-8"
    window.x11.display = ":0.0"
        application.process.machine_id = "15d4d55cf80e320acb892977520d0894"
        application.process.session_id = "c1"

I'll grab the application name and run pacat.

 pacat -r -n "Chrome input" | sox -t raw -r 44100 -s -L -b 16 -c 2 - "output.wav"

You can also use pacat to capture from a device, etc. the pacat man page has some more info

  • This looks good! I've never used sox before though.. I get sox WARN getopt: option `s' not recognized when trying to run your example. – gandalf3 May 1 '15 at 23:42
  • 1
    @gandalf3 I'll have to test it before I update my answer, but you can probably do away with sox and just use pacat to write to wav files. If you want to stream to a compressed format, you can pipe pacat to your favorite encoder. example: pacat --volume=32768 --format=s16ne --channels=2 --rate=44100 -r -n "Chrome Input" > /home/[user]/Desktop/chrome.wav – Rob Calistri May 4 '15 at 12:04

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.