Featured Free Software

Friday, February 06, 2009

Record and Play from Radio Shark in Ubuntu Update


I found that there are actually easier ways to play (and record) music from the Radio Shark 2 in Ubuntu (versus using ecasound...see the full previous post here). You can use arecord/aplay (built-in command-line sound programs in Linux). You will still have to follow the previous instructions on installing libhid. To use arecord/aplay, open a terminal as described in the previous post, and enter the following:

$ arecord -c 2 -f dat -D hw:1,0 | aplay -D hw:0,0

Record 2 channels using "dat" format from Radio Shark, and then send the recorded output to aplay via your PC sound card (so you can actually hear it).

You can also wish to simply record directly to a file for later consumption, so you can do this instead:

$ arecord -c 2 -f dat -D hw:1,0 foo.wav

This says to record as before, but to a .wav file called "foo"

Then play the file using aplay:

$ aplay foo.wav

To record to an mp3 file directly, you need to install lame (see instructions in previous post on how to install using Synaptic). Search for "lame" in the package manager to find and install. Then you can use the following command to directly record to mp3.

$ arecord -c 2 -f dat -D hw:1,0 | lame - sample.mp3

Same as above except the "|" (known in UNIX parlance as a pipe) now "pipes" the arecord output to lame, which reads from standard in (in this case the previous command's output) and converts/stores the audio stream into an mp3.

So you can replace the ecasound command in the previously posted bash script with the ones above you would like to use instead. Maybe have 2 bash scripts; one for recording and the other for simple playback.

You will notice that you can't do real-time audio shifting and simultaneous recording using only the methods I have posted here. This is a hangup if you really want to use the Shark to make your own mp3s quickly and easily. I must recommend the Windows version for that, as the time-shifting features allow you to go back to a point in the broadcast where, say, a song starts, and then start recording from there. You can also listen while recording and stop it when the song ends, but even the Windows option is not as easy as it once was. The excellent SnapTune service is no longer available, which could automatically tag and save the songs from the radio stream (into mp3s). Still, it is progress for Linux users who might have an RS 2, and don't need another paperweight on their desk. For instance, if you want to record talk radio programs (instead of songs), then you can easily set up a cron job in Unix to start/stop your scripts at preset times/days, but this is getting into more advanced topics. Stay tuned for the next post. Now that we can at least play, and record using RS and Linux, I will post on what else there might be for this cool audio gadget.


No comments: