Recording a real audio stream can be done in Linux fairly easily. The basic process is to play the stream and instead of sending the audio to your sound card you send it to a virtual sound card which saves it as a wav file. You can then encode it as an mp3 for later listening.
To do this you will need three apps installed:
- mplayer – you will use this to play the stream
- vsound – this is the virtual sound driver that will send the output to a wav file
- lame – this is the mp3 encoder you will use to encode the wav file to an mp3
You can now use a simple script to record a stream and convert it to mp3. The below script takes two parameters – the first being the URL of the stream to record, and the second the filename of the mp3 to output
Script:
#/bin/bash echo Recording stream: $1 echo To filename: $2 /usr/local/bin/vsound -f outputfile.wav /usr/bin/mplayer $1 /usr/bin/lame -v --nohist outputfile.wav $2