Become a fan of Slashdot on Facebook


Forgot your password?
Hardware Hacking Entertainment

Realtime Audio Conversion And Serving 153

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?"
This discussion has been archived. No new comments can be posted.

Realtime Audio Conversion And Serving

Comments Filter:
  • Easy as pie (Score:5, Informative)

    by perlionex ( 703104 ) * <joseph&ganfamily,com> on Saturday December 25, 2004 @10:44PM (#11183073) Homepage

    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 that comes with Shout.

    For the, 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.

    • Re:Easy as pie (Score:5, Insightful)

      by Anonymous Coward on Saturday December 25, 2004 @11:11PM (#11183178)
      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.
    • Good suggestion (Score:3, Insightful)

      The parent poster is correct; that solution will work and is straightforward.

      But one has to ask: Why didnt the original article poster (Hobadee) investigate what product would have suited his mother's needs better?

      As they say a problem avoided is a problem solved, that is the geek way.

      • Re:Good suggestion (Score:4, Insightful)

        by Knetzar ( 698216 ) on Sunday December 26, 2004 @02:30AM (#11183751)
        Yes, but the smart business person knows that a problem created and then solved tends to make one look like a hero.
      • One also has to ask why: Why is this tripe a headline?

        So, a user buys the wrong product, comes to slashdot and gets a headline. I have a better idea: hit Google and a couple of stream related forums for an hour or two. Figure it out. It is not very geek to bring such a basic question to a forum looking for turn-key solutions when you should have read the tech specs in the god damned advertisement before buying it..

        This is what happens when Bush voters get /. accounts.
        • By that arguement, should any of the slashdot posts exist at all? After all, if people wanted to read about the articles posted, they could just go to the sites themselves, couldn't they? What, his question wasn't 'geek' enough? So shutup, go read something else, and let those that would help, help. Having said that, I have no idea how to help with the first guy's problem. Meh.
        • The story is a request to hack either their LinkSys product, or an upstream server, to make the LinkSys product do something they want, but it doesn't do. It's all the more satisfying a hack, because (according to the story) "[i]t claims to support WMA, but we haven't had any luck in our fiddling yet".

          For all your ranting about "reading specs", you haven't read the actual story. And for all your ranting about "Bush voters" on Slashdot, it is *you* who doesn't understand what matters to nerds: hacking produ
    • I would do this if LAME could give good low bit rate results such as are obtained using the Windows *ACM* Fraunhofer IIS MPEG Layer 3 Codec (Professional) at 24 kBit/s, 12,000 Hz , Stereo For radio speech/drama produces fine audio with minimum disk space. At thesame rates LAME is poor. Another thing to consider is how long it takes to download a non-live real stream. On Windows there is some abandonware StreamBox-VCR-1.0 Beta 3.1 that does it in much less than real time for broadband at bbc ListenAgain
    • Using gStreamer should work too.
      It's a looooooong command-line.
      You should look at Fluendo'S flumotion.
      This seems to be a very clean solution, but I haven't tested ot yet.
  • by ( 463190 ) * on Saturday December 25, 2004 @10:44PM (#11183074) Homepage
    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

    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.
    • Source code for codecs included? What codecs? Winamp? Realaudio? I thought that this was the hard part, and difficult to get or release source code for.
    • by jtmas83 ( 794264 ) * on Sunday December 26, 2004 @12:22AM (#11183408)
      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 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.
    • SlimServer / Squeezebox does precisely what you're asking for.

      But if his Mamma gets a Squeezebox, his Daddy will never sleep at nights.

    • Well... if we're doing the self-promotion bit, Sean... I'd better chime in, too. ;)

      AlienBBC (which is a Slimserver plugin) has a transcoder proxy server, which can request a RealAudio stream, and output an mp3 stream. Sounds just about exactly what is required. AlienBBC is available from: []

      The bit you'll actually need is ''. Satisfy it's pre-requisities, and it's just a matter of having it runinng, and pointing your mp3-consuming device to:
  • Possible (Score:4, Informative)

    by respite ( 320388 ) on Saturday December 25, 2004 @10:45PM (#11183077)
    It is definitely doable, but would require a time offset. Transcoding the streams would cause a loss of quality and could not be done entirely realtime.
    • Re:Possible (Score:3, Insightful)

      by PornMaster ( 749461 )
      Yes, well, since the audio isn't syncing to anything, and is already delayed from the on-air broadcast, I can't imagine it would be too harmful to have a 20-second buffer to help out anyway.
    • I can't imagine that there would be that much of a loss in quality, either, if it's done at high bitrates.
  • Darkice (Score:5, Informative)

    by meekjt ( 94667 ) on Saturday December 25, 2004 @10:48PM (#11183089) Homepage
    Check out You should be able to get it to do what you want.
  • Simple. (Score:5, Informative)

    by seinman ( 463076 ) on Saturday December 25, 2004 @10:55PM (#11183114) Homepage Journal
    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.
  • by jmitchel! ( 254506 ) on Saturday December 25, 2004 @11:00PM (#11183132)
    IIRC (I don't have the computer I use for this handy), the magic piece of the puzzle is xine or mplayer and the 12 MBish windows codec pack. One or the other of these can read realaudio streams and transcode them to mp3 files. From there it's a matter of pushing the mp3 files out over shoutcast, or whatever the relevant stream format is, which will hopefully be fairly easy if the Linksys box plays shoutcast streams.
    • To convert realaudio, I use mplayer -vo null -ao pcm -hardframedrop filename.wav To convrert the realaudio to a wav, then oggenc to convert to vorbis. Not sure how well it'd work from a live stream though, as I usually download archived episodes of radio shows.
  • ffmpeg (Score:3, Informative)

    by GiMP ( 10923 ) on Saturday December 25, 2004 @11:01PM (#11183140)
    FFmpeg may do what you want. It will take a file and convert it in realtime to various other formats (and stream them).

    Another options would be any media streamer like icecast.

    If none of these let you specify a media stream as a source input, you can convert it by a line-out -> line-in hack.
  • Winamp (Score:5, Informative)

    by n17ikh ( 750948 ) on Saturday December 25, 2004 @11:03PM (#11183145) Homepage
    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.
    • Aren't there issues with the setup you describe, specifically with Shoutcast and the bitrate the freeware version can (re)broadcast at?
      • I don't think so, I have a version of Shoutcast from Back in the Day before winamp had a pro version, and there's no limitation. I didn't think shoutcast was pay software now anyways...
        Also, it shouldn't matter what version (paid or free) of Winamp you run shoutcast on, it's just a plugin
  • Blogmatrix Sparks (Score:2, Informative)

    by ratpack91 ( 698171 )
    Just started using it this week. Records stations to MP3 using a schedule. Pretty good and has loads of stations preset like all the bbc ones by show.

    "Use BlogMatrix Sparks! to record streaming Internet radio feeds and download podcasts and store them in your media player (iTunes or Windows Media Player). Sparks! uses an interactive directory of radio stations and podcasts to help you find content. Sparks! runs on Windows, Macintosh OS 10.3 and Linux and is open source software."

    http://sparks.blogmatrix []

    • iRecordMusic [] is somthing very similar for the Mac, and it integrates well with iTunes.. I don't work for theese folks, but I did buy the software, and it 'Does What It Says On The Tin," so to speak.
  • It's quite simple. (Score:4, Informative)

    by Guspaz ( 556486 ) on Saturday December 25, 2004 @11:05PM (#11183159)
    All you need is a copy of Winamp and the Shoutcast server/DSP. Have Winamp tune into whatever source you want (In the case of proprietary stuff like Real Audio you'd have to have the realaudio player to play, and set Winamp to record off "wave"), then use that same copy of Winamp to just stream via shoutcast.
    • Well answerd, it's the definatley the easiest solution I've read so far.
      Shouldn't be to hard to get working and it solves the problem. Provided that the Linksys WMLS11B is already bought.
  • There's a free software linux-based firmware for this device here: p []
    Great hacking potential for putting something like helix [] on it, and taking the pc out of the picture altogether :)
    wmamp.img: Linux Compressed ROM File System data
  • by Anonymous Coward
    a litle program called totall recorder will record any sound you hear on a sound card it will do it in mp3 format if that helps it cost about $12 us
  • Low Tech (Score:5, Informative)

    by AndroidCat ( 229562 ) on Saturday December 25, 2004 @11:27PM (#11183228) Homepage
    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.)
    • Oh, forgot to mention that most worries about format , player, DRM or OS go away. (If you can hear it at the computer, you can hear on the radio.) Also, any "you've got mail" or "you have a conference call in five minutes" sounds or speech will heard too -- which may or may not be a good thing.
    • I have been thinking about getting this FM Transmitter from the C Crane Company []. Yes, everyone's favorite radio manufacturer and sponsor of Art Bell and Drug Limbug.

      C Crane makes one whose best feature is that you can set the retransmission frequency. I've bought the cheap ones to find that the four frequencies they choose are often already used in the cities I am in.

      It's currently, uh, $69.95 but comes with free shipping.

      FM Transmitter features:

      * Full stereo on any FM frequency of your choice.
      • The downside of this approach is that its signal is so weak you may not be able to hear it in another room. On my Neuros player, which is far from a good example, I have to place it right next to a receiver to get it to catch its little FM broadcast. The FCC limits broadcast power pretty severly.

        This is a great suggestion if it works. Of course you can roll your own or buy a kit. You can even raise the power and install a nice antenna and I doubt the FCC will come looking for you. Your device will no long
        • I think that after the wave of small pirate FM stations a few years ago, the FCC keeps tighter controls on manufacturers of assembled units than just 100mW and 6' antenna (or whatever Part 15 is limited to these days). The general rules on causing no interference allow them to do that. A kit might allow getting closer to the legal limits without going over. (But you take the responsibility for not causing interference.)
    • This would work assuming he's not in a major radio market where the FM band is saturated with stations.
    • With my mother, the lower tech the solution the better. If you could get the performers to stand in the next room, she would probably understand the system and be able to diagnose and fix problems herself.
  • Hard, very hard. You need to do alot of work.

    First, you need to install MPlayer (1.0-preX), so you can play most of those streams. I'm not sure about RealMedia files, but Windows Media it should play 99% of.

    Then, you need to set up MPlayer to shoot out raw audio and pipe it into LAME, and then IceS. The latter two you may want to try coding up a script with Icecast's Shout perl module, which should do the job roughtly.
    • #!/bin/bash

      PROGRAM=$( echo $STATION | tr '[[:lower:]]' '[[:upper:]]' )

      [ "$2" ] && PROGRAM=$2
      [ $( basename $0 ) == reckste ] && STATION=kste

      LENGTH=`printf "%d" $1`
      TARGETFILE="$PROGRAM - "$(date +"%m.%d.%y %a %R")".mp3"

      [ $LENGTH == 0 ] && echo "Must specify a time in hours or seconds" && exit 1

      [ $LENGTH -lt 10 ] && LENGTH=$(( $LENGTH * 3600 ))

      printf "Recording for %d seconds ( %d:%02d )\n" $LENGTH $(( $LENGTH / 3600 )) $(( $(( $LENGTH % 3600 )) / 60
  • Perhaps it's the my old crotchityness (if that is a word), but I've taken to writing parties that broadcast in the Real format. It usually starts out with "I'm not sure how you got swindled into broadcasting in the Real format, but..." and providing some links to show how really terrible the real client is to the user's computers.

    I know this won't help your situation now, but gosh I can't wait until otherwise credible media producers--such as NPR or the BBC--drop Real for good. As far as I can tell the o
    • and providing some links to show how really terrible the real client is to the user's computers.

      Is the windows player really still that bad with the real player 10 release? It seems like not all, but most of the complaints I've heard were cleaned up there. And the linux version actually seems pretty nice.
  • by Anonymous Coward
    VLC Stream output: []
    • by Anonymous Coward
      To expand on that a bit, here's what I run on my server to convert the WMA feed from KQED (San Francisco public radio station) to a 30Kbps Ogg Vorbis stream I can listen to on my cellphone:

      vlc -I dummy --sout '#transcode{acodec=vorb,ab=30}:standard{access=htt p,mux=ogg,}'

      Remove the space in front of the "p" if you're cutting and pasting that (Slashdot put it in there, not me.)

  • I spent several hours today trying to figure out how I could take NPR's All Music Considered programs which are in Real Media and convert them to MP3 to download to my MP3 player.

    I wasn't terribly successful. Nothing said it could do streaming media and restream it. Several products claim to be able to take streams and record them, and then convert them for you to play back later.

    I didn't find anything GPL'd.

    Non GPL'd products can apparently be found at:
    wmrecorder . com
    • A lateral move, but if you have a WinTV card and can pick up NPR locally, use radio:


      DATE=`date +%d-%m-%Y`

      # Adjust mixer settings

      /usr/bin/aumix -l 100 -v 100

      # Run radio -- parameter is station frequency

      /usr/bin/radio -qf $1

      sox -t ossdsp -w -s -r 44100 -c 2 /dev/dsp -t raw - | lame -x -m s - /radio/$DATE.mp3

      exit 0

      (Run from cron as needed)

      Or you might look into wrapping your player in the vsound program, feeding it the mms parameter, and piping the output as above.

    • I had to do something similiar to this, I pull episodes of This American Life so I can listen to them while jogging or biking. The product that can do this for you is mplayer. Be warned: it takes some doing to get it setup so that it can decode Realmedia streams but once that's done you can use the following commands:

      mplayer -dumpstream -dumpfile file.rm rtsp://...

      mplayer -ao pcm file.rm

      lame -v --resample 44.1 audiodump.wav file.mp3
  • by t482 ( 193197 ) on Sunday December 26, 2004 @12:15AM (#11183385) Homepage
    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 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 []

    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
    oggenc myfile.wav

    I also checked out the trplayer - which is a command line wrapper to realplayer. []

    Got the error:
    Failed to load /usr/lib/RealPlayer8/Common/ 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 [], 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...
  • Does anybody know of a music file server for the WMLS other than twonkyvision-musicserver? It "works" but the combination of it and the WMLS are not terribly reliable.
    • Other UPnP servers include:
      - Microsoft Windows Media Connect (free)
      - Nero MediaHome (part of Nero 6, $70)
      - Musicmatch UPnP music server (?)
      - Allegro Media Server ($25)

      (Note that I don't know whether they are really compatible with the Linksys device, but they should)

  • There is a much cheaper way of doing this. Just get a FM transmitter (Bestbuy, Radioshack or any electronics store should have it) that has power adapter and hook it to the speaker output. Then listen to this music on your favorite Radio/Music system that has FM radio. As far as not being able to read the song/artist title information goes, you already mentioned that you don't want your mom to sit in front of computer (or your linksys radio).
    Maybe you still have time to return it and get something that will
  • Why not get her a real radio that can pick those up?

    Such as this one [] or maybe these [].

    Or maybe go XM Radio []?

    I don't think any of these radio/internet things are ready for primetime yet........

  • by Basehart ( 633304 ) on Sunday December 26, 2004 @01:49AM (#11183632)
    Maybe, shoulda, woulda waited until the Jan 2005 Macworld where I hear there may be an announcement that Apple is making the iPod compatible with Sirius. Much better than listening to the crap pumped out by Clearchannel.
  • I have copied Realplayer files using Gramofile. All you need to do is set up Gramofile to start recoring to a wav, then get realplayer on the station. And yes, you will want to adjust your mixer settings so the sound is good. I suggest running a test segment. I am not sure if this could be scripted, as I don't know if Realplayer or Gramofile takes command line options, but I do know they can be passed through aumix to the mixer. Rob
  • I've been working on BlogMatrix Sparks! [] for the last few months and it's definitely what this person is looking for:

    • it's open source []
    • can record most -- every one I've seen -- streaming radio formats (including Windows Media and Real Player)
    • it runs as a native (GUI) app on Windows and Mac and (in the works) as a Python app on Linux
    • it converts recorded programs into MP3s
    • MP3s are optionally treated as Podcasts and stored in iTunes or Windows Media Player
    • there's a searchable directory of thousan
  • I was reading an article [] on the other day talking about a 'new' craze on 'skypecasting'.
    The author uses (windows) 'Virtual Audio Cable' to dump the audio from skype to wav (then to mp3).
    Basically it acts as a virtual sound card which you can pipe (via a second 'virtual cable' instance) to another app as an input audio device.
    It amounts to having a software cable from your speaker out to your mic in. Any windows based casting software tha
  • I've had one for about 6 months now, and now, one of my friends picked one up as a Christmas gift.

    I'm completely dissapointed in these devices. You can't control the streams, can't control any of the functions without having a Windows Client, and my attempts on breaking the protocol don't seem to work at all.

    The stream listings on it go away (One of my favorite classical streams on this device was WBHM out of Birmingham, Alabama. They moved the streaming location, or moved to WMP, and then it borked. W
  • Media Center 11 [] has an elegant-but-beta Library Server [] that does realtime transcoding of bitrates and formats between its server and attached clients, across LAN or WAN. You can couple this with its "Media Scheduler" module to record internet radio streams and then serve them up in whatever format and bitrate a client specifies. What's nice is that you can also stream video and photos to clients. MC will also do bitrate transcoding while streaming from attached Tivo HMOs. []

    MC also has a beta uPNP module [] tha
  • Could we use this system for a sort of house PA system. I am thinking I could use such a thing. You know, make announcements that must be heard, through these wireless speakers. Maybe programs that at set times, play some music during a some time, and it must be heard. Do you kinda get what I am saying? A PA system, with the capability of making timed pre-recorded etc announcemnts.

If it's not in the computer, it doesn't exist.