$wp_cache_home_path = '/'; $wp_cache_slash_check = 1; $cache_page_secret = 'b0f3d271d1bb32c81a8fd217b4871e52'; $wp_cache_home_path = '/'; $wp_cache_slash_check = 1; $cache_page_secret = 'b0f3d271d1bb32c81a8fd217b4871e52'; nthmost » Blog Archive » Using the Raspberry Pi as a Streaming Radio Source

Using the Raspberry Pi as a Streaming Radio Source

A friend of mine from Mutiny Radio picked up a Raspberry Pi as a potential replacement for their on-the-fly mp3-encoding / up-streaming machine. Theoretically the 700MHz chip on this little computer should be able to handle the job, so this past weekend I started the process of exploring its capabilities.

Raspberry Pi: "It takes a while!"

After deactivating Raspbian’s tremendously greedy GUI, the rPi has horsepower to spare. However, its Linux distro “raspbian” is limited by the fact that it is itself a subset of a limited debian distribution for ARM processors.

Consequently, while darkice can be found in raspbian’s standard repositories, you can’t get mp3 streaming due to debian’s draconian anti-mp3 laws, and you won’t get mp3 support just by installing liblame. You gotta compile darkice from source.

Fortunately, Steffan Muller over here wrote a nice tutorial on how to compile darkice for raspbian, which was sweet because I hate mucking around with debian distro stuff. His tutorial shows you how to compile mp3 and alsa support into darkice and then fold it back into the debian package system.

Just be aware, compiling from source on the raspbian is… let’s just say it takes me back to the early days of Gentoo. Which makes sense, because 700MHz basically represents a top-of-the-line laptop circa 2000.

With a streaming source (finally, arduously) compiled, I needed to then find a suitable USB audio device. The MAudio Transit lying in my “audio gadgets” box was a lost cause, but a beat up old Griffin iMic, despite failing to work on both my MacBook Pro and my Windows 7 desktop, worked like a charm, save for a bit of distortion that doesn’t resolve when I adjust the levels.

The power handling on the rPi is damn impressive, but it’s possible that the audio distortion comes from running a USB wifi card alongside the USB audio device. I don’t have a powered USB hub at my disposal, so I will update this post when I got a hold of one and try that out.

I have now run darkice continuously for 24 hours from the Raspberry Pi, streaming it up to my linode-based server (which also hosts Mutiny Radio and Radio Feliz Navidad Forever as well as yet another toy radio station in the works that I will reveal in a week or two).

The load average just running darkice to produce a 128kbps stream (with no recording) has been about 0.9, making this setup just fine as a single-serving appliance. In the past we’ve liked to run dual encodings, one at 128kbps and one at 192kbps, with the latter serving as an “archival” stream to be recorded, but there are less CPU-wrecking ways to achieve this, like splitting the audio off to a separate machine to record it there. With the RPi as inexpensive as it is, the idea of getting a second one to handle the recordings makes a lot of sense and contributes to the sort of “appliance-y” feel of this approach.

So with the audio distortions sorted out, and potentially producing my own mini raspbian repo for darkice and attendant libraries, I’d say using the Raspberry Pi to run a streaming radio station is a sure thing.

Update: it does seem that the old iMic was causing the distortions. Hooray for throwing money at a problem.

I’m now using a behringer U-Control UCA202 “ultra-low latency” 2 In / 2 Out USB interface, bought from Amazon for roughly $30. The Raspberry Pi recognizes this device right away.

The only weird part is that this device has no capture controls. Like, when you go to alsamixer to adjust levels for your cards, you get nothing for the input controls on this device. Indeed, the chip has no capture controls.

Despite that little piece of configuration vertigo, darkice can “hear” the RCA input just fine. I have my device line set to hw:1,0 to capture.

All in all, using the Raspberry Pi has felt a lot like… well, like setting up a laptop from the year 2000. It took a lot of updating the OS and compiling quite a few libraries from source to get things going, which involved a few hours of waiting.

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS