I need a piece of software that allows me to record sound output from my soundcard

The Linuxator

Banned
Jun 13, 2005
3,121
1
0
I listen to alot of internet talk shows , streaming through beep media player ( which is a gtk port of xmms) beep supports multiple sound format just like xmms, the shows I listen to are 132-192kbps winamp stream (that works on beep).

I am not sure if the info on top is much relevant but ok, the problem is that I would like to record some of the talk shows that I listen to, so I can go back to them later and see if I missed anything later, now I need a program that would record whatever my sound card is outputing into an mp3 file of the same bitrate (prefarably) and I don't want any solution that would require any type of hardware (like doing any connections form my soundcard to anything else), I just want to utlize software, any suggestions ?

And BTW I am using Fedora Core 4 on an R50e Thinkpad.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Personally I like the mplayer method of doing it.

If you have mplayer installed then you can go like this:

mplayer protocol://servername/streamname.whatever -dumpstream -dumpfile /path/to/filename.whatever

And that will output the file to whatever name you want with the same format as the capture.

-dumpstream will output both audio and video, -dumpvideo will dump just video, and -dumpaudio will just output audio.

If you don't specificy a name with the -dumpfile flag it will output stream.dump or similar name. You can only use one type of 'dump' option at a time.

If you want to do a encoding into a different format you can do a audio rip like this:

mplayer medianame.whatever -ao pcm -aofile filename.wav

And that will output a uncompressed wav file. The default name is like audiodump.wav

Then you can re-encode in whatever format you want. I prefer Ogg Vorbis because I can get better sound with smaller file sizes, but mp3 is what you need for lots of hardware mp3 devices.


If it's a regularly scedualed show, and you want to record everyday into a wav file and then re-encode into mp3 then you can go like this...
#! /bin/bash

mplayer "http://whatever.com/directoryname/showname.ram" -ao pcm -aofile /tmp/showname.wav &

# make a killme variable containing the PID number of the previous proccess
# running in the background...
KILLME = $!

# if it's a hour long show...
sleep 65m

# kill it...
kill $KILLME

# make sure it's realy dead..
# mplayer likes to stick around...
sleep 10
kill -9 $KILLME

#encode wav into mp3...
lame -h -b 128 /tmp/showname.wav /home/username/audiosaved/showname-`date +%F`.mp3

Then you can run that in your user's crontab. If it works (test it and doublecheck, and maybe figure out how to notify yourself if the mplayer recording fails) you should end up with a mp3 recording like: rushlimbaughshow-2005-11-12.mp3

If you want to listen to it while it's recording then you can just play the wav file from the /tmp directory as it's downloading, or just spawn another media player if it won't interfer with the feed.

Say you don't want to record everyday and that you don't want to reencode and just save it in your original format you can write a script like 'recordshow.bash'

#! /bin/bash

mplayer "$1" --dumpstream --dumpfile "$2"

Then you can do:

recordshow.bash "whatever://whatever.com/whatever/whatever.wmv" "whatever.wmv"

Whenever you want to record a show. Then hit ctrl-c when it's finished.

If your doing it over a network you can use 'screen' to keep the job alive if you close out the window or loose the connection.

Carefull of spaces and special characters in the name and such.

I never used this method for recording online shows, but i've used dumpstream before and it worked great.

I did, however, use a similar method to scedual recordings of TV shows using mplayer and my video capture card. :)

Also for one off recordings you can use the 'at' command to scedual stuff. Like if something like this:

at 16:30
> recordshow.bash "whatever://whatever.com/whatever/whatever.wmv" "whatever.wmv" &
> KILLME=$!
> sleep 36m
> kill $KILLME
> (then hit ctrl-d, for EOF)

Stuff like that.

If you want you can get pretty fancy with the bash scripts and add some error control and make it easy to do one off recordings.

Things about bash scripts is that they can do simple stuff easily and reliably, but errors are difficult to handle. But they work and mplayer and such is powerfull.

online has lots of resources on bash scripting, cron jobs, atd, and the like.
 

The Linuxator

Banned
Jun 13, 2005
3,121
1
0
Now I can't find record.mp3 in the directory I designated it for , why ?

Ok I found it it's recording to a file called My on my desktop , I don't why this happened liek that but hey it works :D.

now the reason why I don't think it's a perfect soluton is because if something comes up and I want to record ASAP I have to go and type that url and put and execute from terminal, is there a way to make Mplayer record whatever is being outputed from the soundcard into an MP3 player, like in one click (like making a script file that would contain commands fomr recording the output)
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Oh it's that space thing isn't it? you have /blah/blah/My Desktop/etc/etc/name.mp3

Mplayer thinks that you want "/blah/blah/My"

Next time you want to put something with a space in it just remember to put a \ before the space.. like
My\ Desktop, put the entire thing in quotes like:
"/blah/blah/My Desktop/etc/etc/name.mp3"

:)