How to Turn a Raspberry Pi 3 into a Darkice Stream Encoder

Since signing on Classic Pop Radio a couple of years ago, I have used two computers to run the radio station. The first is a CentOS box running the Rivendell Radio Automation system. The second was a Windows XP laptop with a dead LCD screen running AltaCast. (Why not do everything on the CentOS box? I like running outboard audio processing, and I like having the ability to plug in an audio console when I want to go live and it’s easier to do both with a separate streaming box.)

I’ve always looked at the laptop as a temporary solution and I’ve longingly looked at the Raspberry Pi as the device to become my streaming appliance. Since all I want it to do is encode a stream and send it to my streaming host, I don’t need fancy, and a fanless low power box is perfect to sit in the corner of my home office.

There are several blog posts on the internet that detail how to do this project. Several of them are old and state that the Pi is not robust enough to handle a stereo stream. With the advent of newer Pi hardware such as the Pi 3 this is no longer the case. You can stream in stereo to your heart’s content with the current hardware. Also, several of those tutorials are aimed at people who stream scanner audio. If you want a great sounding internet radio station, this is the tutorial for you.

What You Need

  1. A Raspberry Pi 3. I bought the Raspberry Pi 3 Model B at MCM Electronics. Tip: If you buy their bundle (Pi, case, power supply) you also get a Micro SD card that’s pre-loaded with NOOBS (New Out Of Box Software) that lets you download the OS of your choice.I did things the hard way and bought the Pi, case, and power supply separately because I wanted a different case – and found out that the Micro SD card didn’t come along for the ride. One Sunday morning trip to the nearest big box store for a Micro SD card and a quick download of NOOBS from later I was ready to go. Buying the bundle would have saved about an hour of my time.
  2. A USB sound card that supports Linux. There is a 3.5 mm jack on the side of the Pi that has audio and composite video on it, but that’s output only. The only way to get audio into the Pi is via the USB port. If this is for an internet radio station, don’t go for the cheap $3 USB sound card from Ebay if you want it to sound good. But since internet radio rarely makes a profit, don’t go nuts spending money on the hardware, either. I have had good experiences with the Behringer UCA-202 and UCA-222; I used the UCA-202 here.

Getting Started

  1. Boot up the Pi and select Raspbian as your operating system. After it finishes installing the OS, it will boot to the desktop. Before you get too deep, now would be a good time to change the default password for the “pi” user. If you haven’t blocked ssh on your firewall, you should, because most people know the easiest way into a Pi is via ssh, so an open port plus default password is a bad thing. (Firewall your network and use a VPN to get to your Pi if you need remote access. Don’t leave ports open or do port forwarding on your firewall.) If you’re going to have a keyboard, mouse, and monitor plugged into your Pi, you could even turn off ssh on the Pi if you really want to lock things down. There’s a checkbox to do this in the Raspberry Pi config menu in the X (windows-like) interface.
  2. Compile and install Darkice. This is the software used to encode your stream and send it to an Icecast, Icecast 2, or Shoutcast server. Steffen Müller has written the definitive blog post on this *and* he has built his own package with MP3 support. So click over there and follow his steps for compiling and installing Darkice with MP3. When you get to the section on creating the rules file, follow his suggestion on downloading his file and copying it as opposed to copying and pasting to avoid errors (the rules file is expecting tabs, which does not copy and paste well).
  3. After you have compiled Darkice per Steffen’s instructions, you need to set up the config file. Copy the template into your /etc/ folder:
    $ sudo cp /usr/share/doc/darkice/examples/darkice.cfg /etc/

    You will need to know the address of your USB soundcard in ALSA when you edit the config. You can get this from arecord:

    $ arecord -l
    **** List of CAPTURE Hardware Devices ****
    card 1: U0x46d0x825 [USB Device 0x46d:0x825], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0

    This is card 1, device 0, which translates to hw1,0 in the config file.

    The config template has sections for Icecast, Icecast 2, and Shoutcast. My station uses Icecast 2, so I cut out the sections that didn’t apply to me. Here’s my config, with my server info removed. You’ll use your own settings from your stream host.
    Note that if your mount point has a leading slash (ie /live) you will OMIT the leading slash in the config file. I find that a 2 second buffer is sufficient.

  4. Now it’s time to run Darkice. IMPORTANT: you will want to run this as super user. The standard user (pi) doesn’t have access to the realtime OS, but super user does.
    $ sudo darkice

    If you just launch it by typing darkice and omit the sudo, you will get clicks, pops, squeals, and pauses. Run it as super user.

    If you get a sink error like this, you probably have a mistyped something in your login information.

    DarkIce: LameLibEncoder.cpp:75: lame lib opening underlying sink error [0]

    If you don’t get audio at all, check to make sure that you didn’t put a leading slash in for your mount point.

  5. You will want to add a command to fire up Darkice on boot. I like using rc.local for this because everything it starts runs as root (aka the super user).Enjoy!



Will the Comcast Tech Update Kill Your TiVo?

Comcast is rolling out an update to MPEG-4 compression in many markets, including Houston where I am located. It appears they are going to send out their HD content in MPEG-4. This is a more efficient codec, so this gives them the flexibility to add more HD content or improve picture quality.

If you have a TiVo, when they flip the switch your cable card won’t change, but if your TiVo can’t support MPEG-4 you won’t get HD channels.

If you have the TiVo Bolt or TiVo Roamio, you are compatible and you do not need to make any changes.

If you have a TiVo HD or TiVo HD XL and your TSN begins with 652 or 658, you are compatible.

If you have a TiVo Series 3, you will lose your HD channels. If you want to stay with TiVo, you need to either upgrade to a Bolt or Roamio. If you are affected by this, TiVo Customer Service will make you a deal on a Roamio. If you don’t want to stay with TiVo, you could always start leasing a DVR from Comcast to keep getting HD channels. Otherwise your box will only get standard def.

I’m a fan of owning my own equipment, but this points out that technology sometimes moves faster than what you own. If you’re going to buy a set top box, pick something current and not a refurb of a model that’s a few years old if you want to get the maximum life out of your investment.

Sticking It To The Man – Or How To Not Rent Equipment From Comcast

I admit it, I’m a cheap geek. I detest paying $10-20/month for a cable modem or cable box.

The cable and satellite companies would rather you rent equipment. There was a time where DirecTV sold its equipment to you, but as the devices have become more networked, pretty much all of the pay TV providers rent you the equipment.

I can see both sides of the argument. If you rent the gear, they can upgrade you as technology improves and they don’t have to worry about backward compatibility to older equipment. But after you’ve been their customer for awhile, there comes a point where you have paid enough in rental fees to buy that box several times over, which is extra profit that you’re putting in the cable company’s pocket.

So I like owning my equipment. Here’s how you can do it, too.

Cable Modems for New Customers

If you’re getting ready to order cable internet from Comcast and you’re ordering online, it’s pretty easy to get this set up. From my experience, placing an order online with Kabletown is the way to go because you don’t have to deal with their call center and can make decisions at your own speed.

When you click to order your service you’ll be presented with a choice to provide your own equipment or not. Providing your own equipment means you don’t have to pay a $10/month rental fee. When you make this choice they’ll strongly recommend that you rent from them, but they’ll give you a link to their list of certified equipment. Here’s what you do when you click that link:


Select the speed tier that you’re planning to order by clicking and dragging on the slider. This filters out modems that are not compatible with your tier. Not all modems are created equal. Then check the “Retail Devices Only” box.

Note that if you plan to also get voice service from Comcast you can only buy a telephony modem (which limits your choices). The telephony modem that is sold is pretty much the same box you would rent from them; the one that Best Buy sells even says Xfinity on the box. If you want flexibility and really want VoIP service, you might consider getting your VoIP from someone like Vonage or Oooma.

If you think you might want to upgrade to a faster tier later, consider dragging that slider to an upper tier to ensure that what you buy will work with where you plan to go.

The rule to follow is that you need a “retail box” modem. If you find a cheap modem on eBay and it was stolen/not returned by a customer and you try to activate it, Comcast will refuse. Tick the “Retail Devices Only” box and save yourself the trouble.

Leave the End of Life box unchecked. Sure, you can save money on a modem that’s been discontinued, but you won’t get much manufacturer support.

Click through the list and you’ll see information about all of the modems, complete with Amazon links. If you’d rather get one locally, check Best Buy for the model number; in my experience they were matching the Amazon price in store or at least within a dollar or two.

At our house, I settled on a Zoom 5345. This modem is at both Amazon and Best Buy for about $51 as of this writing and it supports up to 343 Mbps down. I already had a good WiFi router so I didn’t need to order one. If you want a modem with a router or WiFi router built in, some of the models on the list will fit the bill… but chances are you’ll want to upgrade the WiFi sooner than you’ll want to upgrade the modem, so buying the modem and router separately makes more sense to me. YMMV.

Once you have the modem, when the installer shows up and connects your service, s/he’ll activate it as part of the installation.

If you’re an existing customer

You’ll need to choose an approved modem from the list above. Then unplug your old modem and connect the new one using the same cable. Power it up and wait for it to boot. Then connect a computer to the ethernet port, open a web browser, and go to You’ll need the MAC address from the modem. Besides finding it on the modem itself, you’ll usually find that on the side of the retail box, which may be easier to read.

Then make sure you return the modem you were leasing to the Comcast store to ensure you get credit. Tip: get a receipt and save it when you turn it in.

Owning Your Own Cable Box

It’s pretty straightforward to save money on a cable modem; with good modems going for as low as $50, you start coming out ahead in less than 6 months.

If you want your own DVR, it’s hard to make an argument for value. That’s because a TiVo, what I consider the best DVR on the market goes for about $150-$200 and also requires a subscription fee.

There are two plus sides to going with a TiVo:

  1. The user interface rocks. It’s so simple to program a TiVo once you wrap your head around it. You just go looking for shows and you can either watch them streaming from wherever you have an account or live or recorded from your cable subscription. It also finds episodes available on demand without effort. Having everything pulled all together without having to sort through a bunch of menus is really nice. Having an up to date program guide justifies the fee for me.
  2. You can plug in a TiVo Mini in your bedroom and network it to the TiVo in the living room and watch the same live, recorded, or streaming programming as on the TiVo in the living room without paying an additional subscription fee to TiVo or an additional outlet fee to your cable company.

For me, those two things justify having it in our house. But I realize that it’s going to take a long time before I save any money by not renting the box. For me, it’s having a better cable box as opposed to saving money over leasing.

What you need is a multi stream cable card to make this work. The FCC mandates that cable companies provide them to you and they mandate that you are able to install them yourself. And if you can self install, you should, because in my experience cable installers don’t like dealing with cable cards, don’t understand how to deal with cable cards, and they may not have them on the truck. If you don’t need an installer to drop a new outlet in your house, save yourself some time and trouble and just go down to the Comcast store and pick one up yourself.

Here’s the instructions on installing the cable card in a TiVo. Note that during the setup process, it will display the card’s ID numbers and a toll free number to call. Call that number and you’ll reach the activation desk at Comcast; read them the numbers and in a couple of minutes you’ll be in business.

Note that the TiVo Roamio OTA only has a tuner for over the air television and does not have a cable card slot. The TiVo Roamio and TiVo Bolt do. I would not recommend getting an older TiVo on the refurbished market as the technologies are changing and you’ll want a current model for everything to work correctly.

There will come a time when the cable card is obsolete. TiVo says that it is working with Comcast to ensure that they will be able to still work with whatever new technologies are adopted in its place. This is another reason to stay away from discontinued models if you jump on the TiVo train.

I find the TiVo experience superior to any cable or satellite DVR I’ve used, so it’s worth it for me. But if you’re just concerned about saving money, go for just owning your own modem.

(image credit: flickr/paulboxley cc)


The Dirty Little Secret Of Cord Cutting

For the past few years, the blogosphere has proclaimed that cable is dead and everybody who’s somebody has cut the cord.

We’re all presumed to ditch our expensive cable subscription and get everything over the internet or over the air. Broadcast television is so yesterday when we can watch everything on Netflix and Hulu and save money.

There’s one dirty little secret that people don’t talk about: You’re usually not saving any money.

For the past two years, I’ve been trying to write the ultimate cord cutting guide where you can build a digital palace on a budget. Then I get to the part where I compare what I was paying before and paying now and come up with a difference in cost of ten bucks. Woo.

Why don’t you save any money?

The people who sell you your internet access are also the people who are selling you content. Unless you’re a college student tapping into the university fiber for free, you’re buying your internet from a cable company or a telecom company – which is also in the business of selling you video content. They set up the pricing tiers so that one effectively subsidizes the other. Remove the video content from your internet package and the internet price goes up to the point that after adding all of the online services needed to replace what you got from the cable/telecom company you end up back where you started.

Let’s face it: streaming is a pain in the ass.

In our house, we dropped Uverse 6 months ago for internet, television, and landline (I know, I’m old, I have a landline and cell phone) for internet via Comcast, television via Sling, and telephone via Vonage.

The internet service has been great since we made the switch. I bought my own modem so I don’t have to rent one from Comcast, the speeds are consistently faster than anything I got from AT&T, and believe it or not, the customer service from Kabletown is superior to the service I have received from Ma Bell as of late. [A few years ago, this was not the case. ATT’s customer service is in my opinion on a downward trajectory, Comcast seems to be getting its act together.]

Television via Sling? It’s not as convenient as I had hoped. The streams tend to stop and stutter, especially when they go to insert local commercials into the commercial breaks. You can’t skip through commercial breaks on most channels. You can’t DVR episodes of shows. Some networks allow you to watch past episodes of shows on demand, some do not. Overall, the experience of watching television isn’t consistent from one network to the next.

Netflix is Netflix. But I never got into watching television via Hulu, primarily because I don’t watch the types of shows that Hulu carries. (Hence why we get our content from Sling.)

Broadcast TV we get over the air. I live within sight of the transmission towers (not a figure of speech; the strobe lights from KHOU and the Senior Road Master Antenna lights up the front of our house at night) but digital TV reception is still a little wonky and requires fiddling with the antenna often.

The VoIP experience with Vonage is solid. I have no complaints, and it’s fairly cheap.

But let’s do the numbers.

Our old ATT bill clocked in about $150.

Now: Internet costs $70. Sling + Netflix + TiVo costs $56. Vonage costs $10.

Total: $136/month.

So for a savings of $14/month or $168/year, I lose access to 186 channels (most of which, I honestly don’t miss) and access to DVR features on the cable networks that I watch via Sling (which is a feature I do miss). Plus there’s the whole issue of fiddling with the antenna or waiting for Sling to buffer.

Time for a change?

I hit my breaking point yesterday. We had signed up for Sling early on in its life and are on one of its original plans that limit you to one stream. If I wanted to watch something in the living room and my wife wanted to watch something else upstairs, that meant that one of us couldn’t be watching Sling.

Sling has added new plans which allow for multi-streaming of some networks. (Again, the cable networks are adding lots of restrictions on internet delivered television to protect the cable/telecom market). I was about to pull the trigger to bump up to their Orange + Blue plan ($40/month, no contract) to add a few new networks they offer in the Blue package that I didn’t have in Orange and wanted, but would still need to add the sports and lifestyle packs to get the other networks that we watch often, which would raise the Sling bill to $50/month.

That would raise the cost of internet + live TV to $120.

But if I call Comcast and add their middle TV tier to my internet package (which has the networks I want) and connect that to my TiVo using a cable card, I’ll be paying $110/month without a contract. Then I can extend that to the bedroom upstairs using a TiVo Mini. Then we don’t have to switch between using the TiVo to watch local channels and the Roku to watch cable channels (and we can still watch Netflix and MLB.TV on the TiVo, so it’s a consistent user experience).

Remind me again why I had cut the cord?

They’re installing the TV on Saturday. I’ll tell you in a few months whether I’m glad I changed this or not.

(image credit: flickr/Michael Mol/cc2.0 attribution)

A Body Of Work Begins Here.

Everybody has to start somewhere. So this is post number one.

I get paid to write manuals and application notes, but that’s work.

This is a place where I can write about things that don’t feel like work: travel, food, and other things that amuse me.

In the opposite direction, I’ve been working on a cord-cutting guide to chronicle my family’s experience in ditching cable, so I will begin to share that here.

So hello, world. Welcome to my piece of the Internet.