computerhelp Aimoo Forum List | Ticket | Today | Member | Search | Who's On | Help | Sign In | |
computerhelp > Computer Questions > Linux Go to subcategory:
Author Content
  • Subscribe Thread
  • Rank:Diamond Member
  • Score:2669
  • Posts:2669
  • From:USA
  • Register:12/15/2008 12:30 AM

Date Posted:06/01/2014 1:20 AMCopy HTML

If you are doing web or application sound capture in Linux, one of the simplest ways to do it is with a shell script called pa-clone, which captures the sound card's monitor channel and records the output into a .wav file. I have used this method for years, and when the files are converted to mp3 with the lame encoder, you get small files with excellent sound quality.

The pa-clone script is a simple text file that you place in your /home dir and run from a terminal with the command ./pa-clone output.wav when you are ready to record. You stop recording by ctrl-c. You can leave the .wav as is or convert it to something smaller like an mp3. This being said, one thing has appeared with the latest Ubuntu and no doubt many other systems if you are using pa-clone. The pa-clone script requires sox, the "Swiss Army knife of sound processing," in order to function. The pa-clone script is rather old, but on Ubuntu 14.04 and other newer Linuxes, you will be getting a current version of sox when you download it via Synaptic, Yum, or Aptitude, etc.

When you run the script to record sound (command is ./pa-clone), your terminal will give you the following message: "sox: WARN: sox: option -s is deprecated, use -e signed-integer instead." The pa-clone script still functions and sox still functions and so you get your recorded sound file, but every time you run pa-clone you'll see this message. The next version of sox, so I understand, will not even have option -s, at which time an unedited pa-clone script will fail to execute properly.

When you search the web for pa-clone, this is the code you find:

# Copyright 2008-2009, Kees Cook
# Records the PulseAudio monitor channel.
if [ -z "$WAV" ]; then
    echo "Usage: $0 OUTPUT.WAV" >&2
    exit 1
rm -f "$WAV"

# 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 to $WAV ..."
echo "Ctrl-C or Close this window to stop"
parec -d "$MONITOR" | sox -t raw -r 44100 -sLb 16 -c 2 - "$WAV"

This code runs fine, just with the message described above.

Fixing this is quite simple. Open pa-clone in your favorite text editor (gedit, vi, etc.) and go down to the last line and make it look like this:

parec -d "$MONITOR" | sox -t raw -r 44100 -e signed-integer -Lb 16 -c 2 - "$WAV"

Save your newly edited script and run it and you will no longer see the message about option -s being deprecated.


Copyright © 2000- Aimoo Free Forum All rights reserved.