Slashdot Mirror


Realtime Audio Conversion And Serving

Hobadee writes "First of all, Happy Christmas and Merry New Year! This year for Christmas, my dad and I decided to give my mom a Linksys WMLS11B. (Radio which can play MP3 streams) Since my mom listens to a lot of international news radio on the Internet, we figured this would be great so that she wouldn't have to sit at the computer all the time. The problem is that most of the stations she listens to are either RealMedia or Windows Audio streams, while the player only supports MP3 streams. (It claims to support WMA, but we haven't had any luck in our fiddling yet.) So here is the question: Would it be possible to get other types of files to play on the device? My idea is to have an intermediate server download, convert to MP3, and re-stream the files, but I'm not sure of the implementation. Would this be easily do-able with something like Icecast and Lame?"

9 of 153 comments (clear)

  1. Easy as pie by perlionex · · Score: 5, Informative

    I did something like this for my office, streaming Christmas music using Icecast, Lame, and Shout. Here's one possible installation:

    1) Setup Icecast as usual. Take note of the encoding password.
    2) Install the Shout Perl libraries.
    3) Use the example2.pl that comes with Shout.

    For the example2.pl, I think it comes with the basic Perl library installation). By default it takes it the MP3 files specified on the command line, uses LAME to convert them to a bitrate you specify, and sends them to a mountpoint on the LAME server. I modified mine so that it loops indefinitely, and of course I hardcoded my Icecast IP address, mount point, and encoder password. You'll probably need to tweak it a bit to convert OGG / WMA / RM streams as well, but it should be fairly straightforward.

    1. Re:Easy as pie by Anonymous Coward · · Score: 5, Insightful

      You'll probably need to tweak it a bit to convert OGG / WMA / RM streams as well, but it should be fairly straightforward.

      Uh, no. AFAICS that's the hard part the guy wants answering.

  2. Dude, you're gettin a Squeezebox! by seanadams.com · · Score: 5, Informative

    SlimServer / Squeezebox does precisely what you're asking for.

    You might be able to get it to work with the WMLS11B if that device is capable of playing an arbitrary mp3 stream by URL, as SlimServer can convert and rebroadcast streams in
    various formats.

    But if you have the Squeezebox it will work so much better, because it's designed to do all of this, and you can choose the stations (or your own music collection) from the display.

    SlimServer is also open source, so it supports just about every file format and radio format in existence. There is a free emulator included, SoftSqueeze, that you can use to try it
    out.

    PS I work for Slim. Mod up if you want me to answer questions in this thread; mod down if you don't care for self-promotion.

    1. Re:Dude, you're gettin a Squeezebox! by jtmas83 · · Score: 5, Interesting

      I would also recommend SlimServer...and I'm not a Slim employee!

      I've been using SlimServer for at least 6 months now and I absolutely love it. I have it installed on one of my spare linux servers and can access my entire music library anywhere that has internet access and an mp3 player (I'm currently away for the Holidays and as I'm typing this very message I'm listening to my music stored hundreds of miles away). However, the beauty of it is that it should be able to do exactly what you want: it can connect to internet streams and do conversion on the fly. There are also a number of plugins available (for example, here)

      I should mention that I only use their software, SlimServer (which is free), and not their hardware unit, SqueezeBox. This is not because I'm a cheap bastard, but because I'm a college student living in a dorm room...you can't *not* be next to your computer in a dorm, so I have no use for something like SqueezeBox. However, once I move out next year, one of my first pruchases will be a SqueezeBox.

  3. Darkice by meekjt · · Score: 5, Informative

    Check out http://darkice.sourceforge.net/ You should be able to get it to do what you want.

  4. Simple. by seinman · · Score: 5, Informative

    One of the default options in Winamp's Shoutcast plugin is to broadcast from the sound card mixer. Wether it's microphone, line in, or WAV, it encodes and broadcasts it. Install the server, install the plugin, start streaming, then play whatever station you want to hear through whatever player you need to use. Shoutcast/Winamp handles the rest.

  5. Winamp by n17ikh · · Score: 5, Informative

    If you have a random Windows box sitting around doing nothing, you can setup Winamp along with Shoutcast to achieve exactly what you want. Use WA to listen to your streams/play songs and just have Shoutcast rebroadcasting all the time as a high-quality MP3 stream. So simple any idiot can do it, even me.

    --
    Hard work pays off tomorrow, but procrastination pays off NOW!
  6. Low Tech by AndroidCat · · Score: 5, Informative

    I would have gone for a low tech solution by pluging the computer's audio line-out into a FM wireless mic/transmitter. It's not as fancy, without remote control and bells and whistles, but costs less and could be listened to by any FM radio in the house. (And neighbouring houses depending on your power and antenna.)

    --
    One line blog. I hear that they're called Twitters now.
  7. Recording Realaudio, WMF, OGG & MP3 Radio stre by t482 · · Score: 5, Informative

    From a blog entry I wrote a few weeks ago:

    I wanted to record a couple of radio shows so that I can listen to them later on my linux machine. Basically I would like to listen to a mix of realplayer, Windows Media, Ogg and MP3 streams and save them as mp3 or ogg files so I can listen to them later on my computer or iriver ogg/mp3 player.

    First I tried mplayer's dumpstream command

    1) mplayer -dumpfile cores -dumpstream http://wm.warnermusic.com/France/the_corrs/summer_ sunshine/video/Summer_Sunshine_video_458.wmv
    (thi s will give you a file called "cores" in your home-directory)

    2) mplayer -vo null -vc null -ao pcm -aofile audio.wav cores
    (this will convert the videofile to a wav audiofile)

    3) lame audio.wav cores.mp3
    (this will convert the file from wav to mp3)

    However this process core dumped on realplayer recorder over 10 minutes. Also it doesn't know about ram files so you have to download them first (wget filename) and then open them to file the real link to the rm file. So I went on to look for some other tools.

    Most of the tools seem to be wrappers around vsound and/or sox and lame/oggenc. Another tool I looked at is streamripper, which works for mp3 or ogg streams.

    First I grabbed realcap which is a shell script front end to those tools. Downloaded, compiled and installed vsound.

    Trick one - you have to ensure that realplayer is using OSS drivers
    http://www.osl.iu.edu/~tveldhui/radio/

    After that seemed to work I tried directly with vsound. vsound acts as a kind of virtual audio loopback cable ... it allows you to record the output audio stream of ... and line out jacks on the sound card.

    vsound --timing -f myfile.wav realplay http://www.radio.org/ra/show.ram
    oggenc myfile.wav

    I also checked out the trplayer - which is a command line wrapper to realplayer. http://www.linux-speakup.org/trplayer.html

    Got the error:
    Failed to load rmacore.so.6.0: /usr/lib/RealPlayer8/Common/rmacore.so.6.0: Cannot open shared object file: No such file or directory

    Well I figured out that they must be looking for the real player in /usr/lib when it was in /usr/local/ so I copied the directories over to where it wanted to find them and everything worked ok.

    Also I tried out streamripper
    http://streamripper.sourceforge.net/, which seemed to work fine ripping various streams. It didn't seem to be able to read the .m3u file so I had to download the m3u file with wget and look at it and then use streamripper http://url.ogg for it to work. Cool - now I can listen to the BBC and CBC and ABC (Australian Broadcasting) and Netherlands Broadcasting when I want to and where I want to.

    Finally I had a look at mp3record - a bash shell wrapper for lame and sox
    Basically it does this:
    (sox -r $strFreqRate -t ossdsp -w -s /dev/dsp -t raw -c 2 -
    | lame -s 44.1 -x -b $strBitRate -m s - $strFileName) &

    Things to get working...
    1) streaming directly to ogg with no intermediary wav step.
    2) see if I can get this running from a cron job...