The soundgrab Home Page
soundgrab is designed to help you slice up a big long ogg vorbis or raw audio file (by
default 44.1 kHz 2 channel signed sixteen bit little endian) and save
your favorite sections to other files. It does this by providing you
with a cassette player like command line interface. Commands like ff
<secs>, rw <secs>, jump <offset_from_start> can be
used while the volume is being played or while it is stopped to move
the player head around. The commands mark and name allow you to give
names to sections between the mark and the current position of the
player head (like emacs mark and point concept), and the export
command exports the named sections to other files in wav, cdr (CD
mastering), or raw format (or ogg or flac format if the appropriate
encoder binaries are found on your system).
Its quite possible you don't need soundgrab at all: especially for
getting music from internet radio stations, streamripper may do
everything you need done.
page has a few more details, though most information is in the
soundgrab is from the perl department of the Maximegalon museum of
diseased imaginings. It needs some other common things in order to
- Perl 5.8.0 or later.
- The Term::ReadLine::Gnu module from the comprehensive perl archive network
(CPAN), or from a package in your linux distribution (for debian
the package is libterm-readline-gnu-perl).
- The aplay program, from the Advanced Linux Sound
Architecture (ALSA) utilities. Likely already on your system if
you have sound support at all. Debian package: alsa-utils.
- The sox program. Debian
- The GNU readline4 library. Almost certainly already on your
- Some command line utilities which are standard everywhere.
If you want support for Ogg Vorbis or FLAC (a lossless compression
format), you will need some or all of the following:
The latest stable version can be downloaded from here.
You can view the ChangeLog for
the latest version.
If anyone sees fit to package this as a .rpm, let me know so
I can add a link, thanks.
How you would use soundgrab
These days the internet is a likely source of data that you may want
to dissect interactively with soundgrab. Unfortunately, many net
audio stream players don't offer recording functionality. Some things
to try (more details available
- ogg123 (for Ogg Vorbis
- mpg123 (for MPEG streams).
- wget, plus a
small jot of scripting.
- The soundcard itself, using appropriate mixer settings to
recapture audio as it is played back.
Usually you can look at the page source of a web page to determine the
URL of the stream you get when you click on a link. Just search for
the visible text of the link in the page source to find the URL.
Streamripper will work with a single M3U URL argument, while
ogg123 and mpg123 need just the URL of the actual stream listed in
the M3U file. You might want to use wget to download the M3U
file itself and have a look at its contents to determine the actual
stream URL you want. This same wget trick works with PLS
files and probably others.
Now all you need to do is make sure your file is in Ogg Vorbis form
and launch soundgrab:
sox audio_foo.mp3 audio_foo.ogg # If necessary.
Type help at the prompt and follow the instructions.
But suppose you aren't starting from an already digitized audio
source. For example, suppose there is an hour long radio-only show
which comes on at 2 in the afternoon on March 5th, and plays all sorts
of eclectic hard-to-find stuff that you love (mixed in with eclectic
stuff that you hate), but you have a mean and nasty boss who insists
that you should be at work by that time of day. You might do
zsomething like this:
# Set mixer parameters to record from line in.
amixer set Capture cap # May vary depending on sound card.
amixer set Capture 60% # May vary depending on sound card.
# Other commands may be required to get input set up,
# depending for example on microphone vs. line in recording,
# etc. See the arecord man page. One might also use
# alsamixer or a graphical mixer if interactive operation is
echo 'arecord -d 3600 two_oclock_show.wav' | at 14:00 Mar 5
echo 'arecord --channels=2 --rate=44100 --format=S16_LE ---duration=3600 - | sox -t wav - two_oclock_show.ogg' | at 14:00 Mar 5
# I just wanna bang on the drum all day...
# Set mixer parameters to allow audible playback of dsp data,
# if necessary. Note that modern hardware allows you to have
# capture enabled without disabling playback.
# Run soundgrab.
If you find a bug
If you find a bug or want to contact me for any other good reason, you
are welcome to email
soundgrab is copyright Britton Leo
Last modified: Sat May 5 15:25:50 AKST 2007