163

Is there a program for Ubuntu that can record sounds of only the output of the speaker and not any voices from outside the PC?

5

6 Answers 6

190

If I'm not wrong, then I guess you are talking about recording "Stereo Mix" or loopback Output.

In layman's terms, Recording Stereo Mix means recording sound from speaker output.

Here's how to do it:

  1. Install pavucontrol from Ubuntu Software Center.
  2. Install audacity from Ubuntu Software Center.
  3. Select pulse* as recording device in Audacity.
  4. Click Record Button.
  5. Open PulseAudio Volume Control (Search For PulseAudio Volume Control in Dash).
  6. Select Recording Tab.
  7. Now You Should see ALSA plug-in [audacity]. If you do not see ALSA plug-in [audacity], make sure you have clicked Record Button in audacity. You should be running recording in audacity while performing next step.
  8. Select "Monitor from *". See screen shot. Screen shot of PulseAudio Volume Control
  9. Now you should be able to record the sound you hear from speaker or headphones.

Note: Tested in Ubuntu 12.10
Reference PulseAudio - Ubuntu Wiki

17
  • 4
    i did find "pulse" but i couldn't find "pulse:Mix:0" or anything like mix 0. i just went to preferences and then devices and i clicked on recording and it was only pulse there,where can i find pulse:mix:0?
    – AmirRazoR
    Dec 16, 2012 at 16:47
  • @AmirRazoR Update to reflect current version of Ubuntu.
    – user110837
    Dec 17, 2012 at 15:05
  • 2
    Each step happens as you describe, but ultimately no audio is recorded in Audacity (Ubuntu 14.04). What does the * after pulse* mean? Aug 24, 2014 at 16:29
  • 1
    Haven't tried it in 14.04. pulse* here means anything that begin with pulse in it's name.
    – user110837
    Aug 24, 2014 at 16:34
  • 1
    Works on Linux Mint.
    – possumkeys
    Feb 20, 2017 at 7:04
111

A very small, bare-bones software that does exactly what you need, is called (rather obviously) "Audio Recorder", installed like this:

sudo add-apt-repository ppa:audio-recorder/ppa
sudo apt-get update && sudo apt-get install audio-recorder

Files are saved automatically to the ~/Audio directory.

Ubuntu audio-recorder

18
  • 7
    It works like a charm, too! :)
    – conualfy
    Oct 10, 2013 at 1:41
  • 9
    This is lovely, thank you! Very neat, and though Audacity setup works, if you just need to record audio (to ogg, wav, mp3, etc), this is the solution.
    – karni
    Oct 10, 2013 at 16:48
  • 1
    Very simple and neat tool!
    – SunLiWei
    Nov 12, 2014 at 10:02
  • 6
    Why would you go thru all the "hustle" with Audacity when this one does the job you need with a single click ... beats me.
    – poelinca
    Jun 11, 2015 at 8:22
  • 3
    @poelinca because audacity and pulse audio are 2 very powerful and useful softwares, and if I am going to have them installed anyway because I use them for other things, then why would I install a third tool that does something that my current programs can already achieve? Furthermore audacity is better for this because you can cut off any extra audio before and after desired part of recoding. And btw, it's hassle. Hustle means to push or to steal. Jun 14, 2017 at 22:13
60

Command Line

  1. Install sudo apt-get install pulseaudio-utils lame mpg123

  2. Search for your speakers and tap into your speaker's monitor stream:

    pacmd list-sinks | grep -e 'name:' -e 'index' -e 'Speakers'

    or

    pacmd list-sources | grep -e 'name:' -e 'index' -e 'Speakers'

enter image description here

  1. Play anything you want to record and type in parec -d alsa_output.pci-0000_00_1f.3.analog-stereo.monitor | lame -r -V0 - out.mp3

  2. Hit ctrl+c to stop recording and play the recorded file mpg123 out.mp3

Minimalistic GUI

A very simple GUI to do this, pull all the files from here and run install.sh Goto Dash and search for Record Speakers

18
  • 7
    Best solution... <3
    – Peque
    Dec 28, 2016 at 23:55
  • 1
    Of course it's for playback. It's also useful for testing loopback recording software that the software can intercept what is played back. And parec wasn't able to intercept aplay's playback in my test on Ubuntu 14.04.
    – Ruslan
    Feb 19, 2017 at 7:37
  • 12
    Consider removing the | lame [...] pipe and use --file-format=wav output.wav (for example). You can list the supported formats with parec --list-file-formats. Also, consider making a bit more clear the fact that you need to specify the device with the .monitor at the end. ^^
    – Peque
    Apr 5, 2017 at 15:53
  • 1
    Nice, as this can do stereo playback recording. Looks like audacity can't do that. Sep 21, 2018 at 17:07
  • 5
    you don't need necessarily the name of the source... you can also choose the index of the source : parec -d 0 | lame -r -V0 - out.mp3
    – and-bri
    Oct 20, 2018 at 15:37
9

I just made a small alias to record the PC audio output with one single command and stored in opus format instead of mp3.

  1. Install the required packages:

    sudo apt-get install pulseaudio-utils opus-tools
    
  2. Edit your .bashrc file:

    nano ~/.bashrc
    

    Copy the line below and append it to the end of your ~.bashrc:

    alias recaudio="parec --monitor-stream="$(pacmd list-sink-inputs | awk '$1 == "index:" {print $2}')" | opusenc --raw - $(xdg-user-dir MUSIC)/recording-$(date +"%F_%H-%M-%S").opus"
    

    Save the file by pressing Ctrl+X (to close nano), then Y (for "Yes") and Enter (to confirm the file name).

  3. Now load the new ~/.bashrc (or simply open a new terminal):

    source $HOME/.bashrc
    

Then try, just type

recaudio

It will create a file in your Music home folder called recording-[DATE].opus.

Enjoy.

1
  • 2
    What does the --monitor-stream=... part do/mean? My list-sink-inputs is zero unless something's actually playing sound, then it would return a number. So this would have to be started after the sound is already playing?
    – Xen2050
    Nov 28, 2017 at 4:27
3

For those stumbling over this and using pipewire instead of pulseaudio:

pw-record -P '{ stream.capture.sink=true }' test.flac

This would record from the current audio output. (found at https://www.reddit.com/r/archlinux/comments/x2kej0/recording_output_audio_using_pipewire/ )

2

Note: Okay this answer might seem like a cop-out but it works and its great software, especially if you want to additionally record your speaker output and microphone output at the same time. Or if you also need to video record your computer screen.

Anyways, been pulling my hair out forever googling for an answer that is simple to use and provides everything I need.

Install and use Open Broadcaster Software (OBS). Seriously, that's it. Googling it should bring up installation instructions tailored to your machine.

Just record with OBS and it will just make a video with your audio in it. If you only want to record audio, just record without a video source and it will make a blank video with your recording. If you want to record only speaker output and not the mic, simply mute the microphone with a press of a button. Intuitive.

(Note this gives you a video file. It doesn't bother me but if you need an audio file like an mp3 you would have to figure out how to convert the video file you made into an audio file (I don't know how to do that, but there are plenty of resources out there that tell you).)

1
  • this is the better answer for nowadays, the audio-recorder ppa does not work, and speaker-recorder requires python 2. audacity only shows mics as inputs.
    – Ferroao
    Aug 8, 2023 at 18:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .