Page 1 of 4 123 ... LastLast
Results 1 to 10 of 40

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

  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
    Jun 2006
    Location
    Canada
    Beans
    517

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

    hi techm3,

    I usually just use another program to convert to mp3 after I edit it.

    However you bring up a good point. Looking at the sox manual, compressing to MP3 in realtime should be possible by modifying this line:

    Code:
    parec -d "$MONITOR" | sox -t raw -r 44100 -sLb 16 -c 2 - ~/Taped_Recording_$TIME.wav
    to this:
    Code:
    parec -d "$MONITOR" | sox -t mp3 - ~/Taped_Recording_$TIME.mp3
    However when I try this, I get the error: SoX was compiled without MP3 encoding support
    My Top Bugs - Launchpad Profile - Wiki Page

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

  9. #9
    Join Date
    May 2008
    Beans
    3

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

    First, thanks to komputes for sharing this script, it is very handy!
    I am using 10.04 Netbook and it works well.

    My solution to compressing the output is to add the following to the end of komputes' version of the script (post 5):

    Code:
    # Converts the WAV file to OGG then deletes the WAV.
    echo "Captured. Converting to a compressed format, please be patient..."
    sox ~/Taped_Recording_$TIME.wav ~/Taped_Recording_$TIME.ogg
    rm ~/Taped_Recording_$TIME.wav
    Control-c stops sox, but not the script. This creates an .ogg file from the .wav, then deletes the uncompressed file. It takes a bit of time with long recordings, though.

  10. #10
    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

    I switched from pulse audio to alsa because it was skipping so much but now I get this error ./pa-clone: line 21: parec: command not found, please can anyone help

Page 1 of 4 123 ... LastLast

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
  •