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?

share|improve this question
1  
Why do you want to record sound from inside the computer?? – jPlatte Dec 15 '12 at 16:48
1  
there is a virtual piano website, and i want to play piano and record it while i'm listening to it from my headphones and not outloud. – AmirRazoR Dec 15 '12 at 16:56
3  
So you just want to record the output sound of a website? I think almost everyone here thought you were talking about sounds of your computer components :D – jPlatte Dec 15 '12 at 17:42
    
My answer on this similar question might be helpful: askubuntu.com/questions/167061 – user76204 Dec 21 '12 at 0:02
1  
See also How to record any internal sound in and out using Ubuntu and Audacity. There this answer did work for me, unlike all answers given here. – Ruslan Feb 18 '17 at 10:52
up vote 92 down vote accepted

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

share|improve this answer
1  
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 '12 at 16:47
    
@AmirRazoR Update to reflect current version of Ubuntu. – 465544 Dec 17 '12 at 15:05
    
The Recording tab in puvucontrol is empty and I too could not find how to change to pulse in audacity. – kroiz May 10 '13 at 6:31
    
This works great for me. Thanks! – J. Taylor Oct 2 '13 at 6:39
1  
Works on Linux Mint. – possumkeys Feb 20 '17 at 7:04

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

Ubuntu audio-recorder

share|improve this answer
1  
It works like a charm, too! :) – conualfy Oct 10 '13 at 1:41
1  
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 '13 at 16:48
    
Very simple and neat tool! – SunLiWei Nov 12 '14 at 10:02
2  
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 '15 at 8:22
    
audio-recorder currently doesn't work in Ubuntu 14.04: audio-recorder: symbol lookup error: audio-recorder: undefined symbol: _gst_message_type – Aleksander Alekseev Feb 26 '16 at 8:29

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'enter image description here

  3. 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

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

Minimalistic GUI

I fixed up a very simple GUI to do this. Pull all the files from here and run install.sh Goto Dash and search for Record Speakers

share|improve this answer
3  
Best solution... <3 – Peque Dec 28 '16 at 23:55
    
Records silence when I do a test aplay /dev/urandom. – Ruslan Feb 18 '17 at 10:41
    
@Ruslan aplay is for playback, it's counterpart for recording is arecord – Bhargav Feb 19 '17 at 7:02
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 '17 at 7:37
3  
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 '17 at 15:53

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.

share|improve this answer
    
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 '17 at 4:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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