Ripping NPR to MP3 for an iPod

I bought an iPod Photo just before Thanksgiving and I’ve been enjoying it ever since. I bought it primarily for the gym and for traveling, and it’s worked well for both of those. However, I thought the sessions on the elliptical machine might be more fun with some news or a talk show to listen to.

I listen to NPR in the car anyway and have often wished that I could time shift their shows (a “TiVo for radio”, if you will). Of course, none of their shows are available in MP3 format (well, except for On The Media). I was aware that many NPR stations offered MP3 streams off their websites, but I still didn’t have a way to record and schedule recordings.

After some searching, I discovered Streamripper, a command line utility that records MP3 streams. I then found PublicRadioFan.com which lists the MP3 streams for hundreds of NPR stations. Putting those together, I’ve been able to record NPR as MP3s and, with some scheduling, grab individual shows for my iPod.. Here’re the steps which I went through, in case you wanted to try this on your own. I run this on my PC but this process may be adaptable to other platforms as well (in particular, I’m pretty sure Linux or FreeBSD could be made to work).

  1. First, download the latest version of Streamripper and extract the zip to a directory of your choice (I put mine in “C:\Program Files\Internet\Streamripper\”).

  2. Then, load up PublicRadioFan and set your time zone and, if you like, you can set some other preferences as well. But, be sure to set your time zone — if you don’t, none of this will work.

  3. After that, it’s time to start looking for programs which you’d like to record. So, head over to the Schedule Grid: Advanced Options page. Here’re the settings which I’d recommend:

    • What time? — choose the “starting at” radio button along with “6 hours”. Then, it’s just a matter of choosing a day and time which is kinda close to a program which you’d like to record. So, for Morning Edition, you could choose 5:00am; or, for Marketplace, you could try 2:00pm (keeping in mind that those represent 5:00-11:00am and 2:00-8:00pm, respectively).

    • What Stations? — you could leave this at the default or you may find that setting it to “USA” (assuming you live in the USA) may yield more relevant results (since Europe probably doesn’t have many NPR affiliate stations).

    • What audio formats? — since Streamripper can only grok mp3s, you should uncheck all of these except for “mp3”.

    • What programs? — feel free to narrow this down but “all programs” is probably fine to start; you can always narrow it down later if you end up with too many results.

    • Display format — I find that the “grid” is easiest to work with.

  4. After all that, click on “display listings” to get a list. Look through the programs to find one which you’d like to record and, once you’ve found one, right click on the lightning-bolt icon next to it (the Winamp logo) and choose “Save Link As” to save the link to your local drive. Yeah, this may seem a bit weird, but those links only point to a playlist and we need the URI for the actual mp3 stream.

  5. At this point, it may be helpful to open up a text editor to make a few notes. Anyhow, once you’ve downloaded the playlist file (which should have the extension “m3u”), open that file in another text editor window and copy the path in there to your “notes” text file. Then, going back to your web browser, make a note of these attributes from the show which you’d like to record:

    • Its name
    • Its starting time
    • The recording time, in seconds (which would be 60 x the time in minutes)
  6. Now it’s time to build the batch file (we’re almost there!). Open a third text editor window and enter these two lines:

    • C:\path\to\streamripper.exe http://servername.net:12200 -a D:\path\to\name-of-the-show.mp3 -s -l 7200 -o
    • del D:\path\to\*.cue

    Of course, the “\path\to\” bits represent your respective paths for streamripper and the path you’d like to use for the mp3 file. And, servername.net is the server which you extracted from the .m3u file earlier. The port “12200” is just hypothetical — use whichever port was listed in the m3u file (which may be a different number or there may be none at all). And, you'll also need to specify the time length to record (in seconds) which is the “7200” above.

    So, what’s the “del” statement in there? Well, “.cue” files are a meta-file which are created through the mp3 extraction process; but, they’re useless for our purposes. So, deleting them just makes for less hard drive clutter.

    And, if you’re curious, here’s what each of those parameters do:

    • -a: this records the mp3 to a single file. Without this, Streamripper may try to rip the show into several separate files (which could be useful if you’re ripping an Internet radio station, but not really for public radio).

    • -s: this prevents Steamripper from creating a directory for each stream. I find it easier to just sort the files on my own afterwards.
    • -l: as mentioned above, this specified the length of time to record, in seconds.

    • -o: this tells Streamripper to overwrite tracks in the destination directory. I find this handy since I only really want the most current episode of (say) Morning Edition at any given time.

  7. That’s it for the batch file, so just save it with a “.bat” filename, such as morning-edition.bat or marketplace.bat.

  8. Just two more steps left: scheduling (this one) and id3 tags (the next one). Now that you have a batch file set up, it’s just a matter of telling your OS to run that file at the program’s starting time. To do that, go to Control Panel -> Scheduled Tasks and choose Add Scheduled Task. You can probably figure out the scheduling from here — you choose the batch file which you just created and set it to run at the program’s start time.

  9. At this point, you’re all set to record mp3 streams from NPR but they’ll probably have weak (if any) id3 information in there (which is the data inside an mp3 file that describes the artist name and track number, among other things).

    So, after each time a file is downloaded (or at least just before you sync those files with your iPod), you’ll need to add its id3 information. For that, I prefer to use Mp3tag (which is free). And, here’s the naming scheme which I like to use:

    • Title: the show’s name, such as “Morning Edition”

    • Artist: “NPR”, which ensures that all my public radio mp3s are grouped together

    • Album: the date, in YYYY-MM-DD format. This way, after selecting the Genre and then Artist on my iPod, I can select a date and see all shows from that day.

    • Track: I generally choose a number the chronological sequence of the shows for that day, so that they’ll play back in the same order in my iPod. So, Morning Edition might be “01” followed by Day to Day (“02”) and Marketplace (“03”).

    • Genre: I’ve set all of my NPR recordings to “Public Radio” for the genre.

So, that’s how you can set up Streamripper to record MP3s from NPR. I know it may look like a lot of steps, but it's not too hard once you get into it. And, if it doesn’t record what you’re expecting, you may find it helpful to try setting your recording time to five seconds or so (temporarily), and then running the batch file manually; that way, you can see whether it’s recording the right station or even whether it’s recording at all. Or, if you get stuck, leave a comment and I’ll try to help out.

iPod Mini Could Play Oggs…

As I search for a portable audio player with Ogg support, I’ve long relied upon the VorbisHardware page in the Xiph wiki. And, though it’s updated regularly, it often lacks depth in its snippets. But, I’ve recently discovered DAPReview.com (Digital-Audio-Player Review), which redirects to AustinV.com (the DAPReview author’s primary domain).

I’m a bit surprised that I hadn’t come across it before (and, thinking about it for a moment, I'm not quite sure how I found it in the first place). In any case, it’s a bit like “Slashdot for mp3 players” — Austin links to articles such as player reviews and news of a new players.

Recently, he linked to this Gizmodo interview with Rio audio engineer Hugo Fiennes. Most interestingly, they discussed the chips in the iPod. And, according to Hugo, though the regular iPods simply don’t have the horsepower to play Oggs, the iPod minis have a newer processor and could conceivably be programmed for Ogg support:

The Rio Karma (developed here, in Cambridge UK) uses a PP5003 CPU. It plays OGG (and FLAC and MP3 and WMA). […]

The 5020 is based on the 5003, and so has the cache bug fixed. It’s capable of playing OGG with 25% or less hit on power (depending how much optimisation is done). I would suspect the 5020 will find its way into the next iPod [it's already in the iPod Mini], as it’s cheaper and integrates both the firewire MAC and the USB2 mac/phy blocks which are separate chips on the gen3. […]

An iPod with Ogg support would probably be the best of both worlds — patent-unencumbered Ogg support along with Apple’s UI expertise. But, I don't really see Apple going through the effort; after all, iPods already play MP3s and Apple wouldn’t want to shift focus from its proprietary AAC format.

Update 06/05: Monty from Xiph.org posted a comment on Slashdot about this where he asserts that iPods really do have the horsepower to play Oggs after all. Still, I don't think I’m going to hold my breath for Ogg support on iPods :-/.