Results 1 to 10 of 40

Thread: How to record all audio output from sound card in Ubuntu 9.10 Karmic Koala

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Location
    Canada
    Beans
    517

    Lightbulb How to record all audio output from sound card in Ubuntu 9.10 Karmic Koala

    Have you ever wanted to capture the audio that gets sent to the speaker and save it in a file?

    To do this in Ubuntu 9.10, it is quite simple with kees audio pa-clone script

    Simply open a terminal, download the script (review it), make it executable and run it. Then simply play the song and stop the script when the song is over.

    Code:
    $ wget http://outflux.net/software/pa-clone
    $ chmod u+x pa-clone
    $ ./pa-clone output.wav
    Play your song and then return to the terminal and press CTRL-C to stop the pa-clone script from recording.



    Rock on and give thanks to kees for the script. =D>
    http://www.outflux.net/blog/archives...o/#comment-802
    Last edited by komputes; November 20th, 2009 at 04:27 PM.
    My Top Bugs - Launchpad Profile - Wiki Page

    Appreciate what the severe effort of many converging wills has produced.

  2. #2
    Join Date
    Jan 2008
    Beans
    71
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: How to record all audio output from sound card in Ubuntu 9.10 Karmic Koala

    when i try to do this i get

    max@max-laptop:~$ sudo ./pa-clone output.wav
    Recording to output.wav ...
    Ctrl-C or Close this window to stop
    ./pa-clone: line 21: sox: command not found
    write() failed: Broken pipe

    please help

  3. #3
    Join Date
    Mar 2008
    Location
    Sparta NC
    Beans
    478
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to record all audio output from sound card in Ubuntu 9.10 Karmic Koala

    This may fix it.

    sudo apt-get install sox
    "Not a window in the house but somehow there's more light..."

    Linux Power Tools

  4. #4
    Join Date
    Jan 2008
    Beans
    71
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: How to record all audio output from sound card in Ubuntu 9.10 Karmic Koala

    Fancypiper I got to thank you and the OP a lot, i've been stressing ever since i switched to karmic because audacity's settings have changed but now I've found something better thx

  5. #5
    Join Date
    Jun 2006
    Location
    Canada
    Beans
    517

    Re: How to record all audio output from sound card in Ubuntu 9.10 Karmic Koala

    I changed the script a bit, this way, you don't have to define output path in case you need to quickly record something. It will simply write the date and time of the recording in the filename and write it to the home directory.

    Code:
    #!/bin/bash
    #This script require sox
    #sudo apt-get install sox
    TIME=$(date +%d-%b-%y_%H%M-%Z)
    
    # Get sink monitor:
    MONITOR=$(pactl list | grep -A2 '^Source #' | \
        grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1)
    
    # Record it raw, and convert to a wav
    echo "Recording. Ctrl-C or close window to stop"
    parec -d "$MONITOR" | sox -t raw -r 44100 -sLb 16 -c 2 - ~/Taped_Recording_$TIME.wav
    I also add an entry to my .bashrc to make aliases for quick recording.

    Code:
    alias tape ="~/bin/soundrip.sh"
    Can anyone take this and make it a gnome panel applet for quick graphical recording. I think the functionality is already done (take a look at gtk-recordmydesktop code).
    My Top Bugs - Launchpad Profile - Wiki Page

    Appreciate what the severe effort of many converging wills has produced.

  6. #6
    Join Date
    Dec 2009
    Beans
    Hidden!

    Re: How to record all audio output from sound card in Ubuntu 9.10 Karmic Koala

    I've tried several things including this which doesn't work. Audacity has no success. Neither of the recording devices allow me to capture output and there is no mix option. I use alsa, not pulseaudio. arecord is giving me crap saying something like my pcm doesn't exist or cannot be found. My sound works fine but recording from output is looking impossible and incredibly annoying. It shouldn't be this difficult to record sound through my output.

  7. #7
    Join Date
    Nov 2009
    Beans
    6

    Re: How to record all audio output from sound card in Ubuntu 9.10 Karmic Koala

    Quote Originally Posted by komputes View Post
    I changed the script a bit, this way, you don't have to define output path in case you need to quickly record something. It will simply write the date and time of the recording in the filename and write it to the home directory.

    Code:
    #!/bin/bash
    #This script require sox
    #sudo apt-get install sox
    TIME=$(date +%d-%b-%y_%H%M-%Z)
    
    # Get sink monitor:
    MONITOR=$(pactl list | grep -A2 '^Source #' | \
        grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1)
    
    # Record it raw, and convert to a wav
    echo "Recording. Ctrl-C or close window to stop"
    parec -d "$MONITOR" | sox -t raw -r 44100 -sLb 16 -c 2 - ~/Taped_Recording_$TIME.wav
    I also add an entry to my .bashrc to make aliases for quick recording.

    Code:
    alias tape ="~/bin/soundrip.sh"
    Can anyone take this and make it a gnome panel applet for quick graphical recording. I think the functionality is already done (take a look at gtk-recordmydesktop code).
    Hi Komputers, the script works excellent in a terminal. The only bad thing I found is that the files need much space, there is a way of being able to compress? Show romanization
    Another thing, is there any way to store them in MP3 format instead WAV?



    I am doing a graphical application using your script, but when I run it freezes even though continues running, how can i fix it?

  8. #8
    Join Date
    Jul 2007
    Beans
    414
    Distro
    Xubuntu 13.04 Raring Ringtail

    Re: How to record all audio output from sound card in Ubuntu 9.10 Karmic Koala

    Quote Originally Posted by komputes View Post
    I changed the script a bit, this way, you don't have to define output path in case you need to quickly record something. It will simply write the date and time of the recording in the filename and write it to the home directory.

    Code:
    #!/bin/bash
    #This script require sox
    #sudo apt-get install sox
    TIME=$(date +%d-%b-%y_%H%M-%Z)
    
    # Get sink monitor:
    MONITOR=$(pactl list | grep -A2 '^Source #' | \
        grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1)
    
    # Record it raw, and convert to a wav
    echo "Recording. Ctrl-C or close window to stop"
    parec -d "$MONITOR" | sox -t raw -r 44100 -sLb 16 -c 2 - ~/Taped_Recording_$TIME.wav
    I also add an entry to my .bashrc to make aliases for quick recording.

    Code:
    alias tape ="~/bin/soundrip.sh"
    Can anyone take this and make it a gnome panel applet for quick graphical recording. I think the functionality is already done (take a look at gtk-recordmydesktop code).
    Thanks for this. For ages I thought my crappy in-built sound card was to blame. Every attempt I made at recording the speaker output failed, but this script captures the output perfectly.

  9. #9
    Join Date
    Nov 2005
    Location
    Hong Kong
    Beans
    31
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to record all audio output from sound card in Ubuntu 9.10 Karmic Koala

    Quote Originally Posted by komputes View Post
    I changed the script a bit, this way, you don't have to define output path in case you need to quickly record something. It will simply write the date and time of the recording in the filename and write it to the home directory.

    Code:
    #!/bin/bash
    #This script require sox
    #sudo apt-get install sox
    TIME=$(date +%d-%b-%y_%H%M-%Z)
    
    # Get sink monitor:
    MONITOR=$(pactl list | grep -A2 '^Source #' | \
        grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1)
    
    # Record it raw, and convert to a wav
    echo "Recording. Ctrl-C or close window to stop"
    parec -d "$MONITOR" | sox -t raw -r 44100 -sLb 16 -c 2 - ~/Taped_Recording_$TIME.wav
    I also add an entry to my .bashrc to make aliases for quick recording.

    Code:
    alias tape ="~/bin/soundrip.sh"
    Can anyone take this and make it a gnome panel applet for quick graphical recording. I think the functionality is already done (take a look at gtk-recordmydesktop code).

    The script is great, thanks first.

    I found that it has some problem under different language settings. Because pactl honors locale settings and outputs accordingly, that keeps "grep 'Name: .*\.monitor$'" from working on some system. I've made some changes to the script to fix this.

    I've also added optional Filename parameter so you may choose to use your own filename or let it generate that for you.

    Code:
    #!/bin/bash
    
    # check if user provided the filename
    # if not, generate one
    if [ "$1" != "" ]; then
      eval LAST_ARG=\$$#
      FILENAME="$LAST_ARG.wav"
    else
      TIME=$(date +%d-%b-%y_%H%M-%Z)
      FILENAME="sound_rip-$TIME.wav"
    fi
    
    
    # Get sink monitor:
    LANG_SYSTEM_DEFAULT=$LANGUAGE
    export LANGUAGE="en"
    MONITOR=$(pactl list | grep -A2 '^Source #' | \
        grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1)
    export LANGUAGE=$LANG_SYSTEM_DEFAULT
    
    # Record it raw, and convert to a wav
    echo "Recording to '$FILENAME'. Ctrl-C or close window to stop"
    parec -d "$MONITOR" | sox -t raw -r 44100 -sLb 16 -c 2 - "$FILENAME"
    I've checked. It also works on Ubuntu 10.04.
    Last edited by yookoala; July 21st, 2010 at 03:12 AM. Reason: change some text and grammar
    HP Spectre X360 with Ubuntu 17.10

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •