Linux DevCenter    
 Published on Linux DevCenter (http://www.linuxdevcenter.com/)
 See this if you're having trouble printing code examples


Indie Podcasting with Open Source

by John Littler
06/22/2006

There have been quite a few articles and books on podcasting already, and some of them are excellent--particularly the ones that deal with some small part of the process. Quite often, however, they neglect to mention a common goal of podcasting: to be like a radio station, slick and with easily understood formats. That's odd to me. Podcasting is an ideal medium for experimentation because the costs are so low, so you should try out some off-the-wall stuff.

That said, how do you put a podcast together?

Equipment

For gearheads this can be a difficult area, because there is absolutely no limit to the amount of expensive gear you can accumulate! However, the basics are straightforward and relatively cheap. You need a computer with a sound card and audio ins and outs, a net connection, web space, some editing and recording software, and a mic. For intensive, multitrack editing with effects, you need quite a hot computer. For straight interviews, you can concievably get away with something like a Pentium I.

For location work, you need something that can travel, such as your laptop. Mstation uses a minidisc recorder purchased secondhand, plus a tiny Sony stereo mic (ECM719) that provides quite reasonable quality. This sort of setup is ideal if you want to be semi-invisible and not make a big deal of what you're doing. The flip side is that some interviewees might regard that sort of setup as looking unimportant. More than likely, though, they'll settle down sooner without having a big mic stuck in their faces.

Information on sound cards is readily available, but researching mics can be more difficult, especially if you want to record music or ambient sound. If you want to really get into it, reading some of the audio-engineering specialist texts will be rewarding. If you don't, then going to a couple of pro audio shops and asking around will yield an answer within your budget. Brand names such as Shure are usually pretty safe; even Radio Shack has some good models.

For recording standard phone calls, there are two types of special mics. One is an induction loop that attaches to the handset, but the sound quality is pretty low. The higher-quality option is one that goes inline with a wired phone handset.

Recording something like Skype doesn't require any mics beyond the one necessary for the phone call. Here are a couple of how to's: Recording Skype in Linux, Recording Skype in Windows.

Recording

The Audacity application has occupied a lot of column inches in podcasting articles, and rightly so. It is easy to use, free, and runs on all the major platforms. You can record directly into it, edit, and use the LAME plugin to produce an MP3 from inside it.

A lesser-known alternative is Ardour. Its goal is to become the Open Source competitor of high-end products such as Pro Tools. It's big and powerful, and while not quite as intuitive as Audacity, it is more rewarding for power users. Among other things, it plays with multi-in audio cards such as the RME Hammerfall, and works with control surfaces. (Yes, that's part of the no-limit gear goal.) Control surfaces are digital mixers that let you use knobs and faders rather than a mouse. A mouse can do only one thing at a time, whereas you can perform many tasks simultaneously on a control surface. They also provide a nice tactile sense, even though most control surfaces aren't actually all that nice. This sort of setup only becomes really necessary if you need to balance a lot of inputs.

Ardour is available for Linux and Mac OS X.

One point worth making here is that more powerful apps give you more choices. You might find it easier to be creative with them once you know the basics.

Program Decisions

In the world of indie podcasting, format decisions are the servant of content rather than vice-versa. (I just made that up but it sounds valid to me.) If you think about it, some of the most annoying moments of commercial TV and radio have to do with formatting decisions determined mostly by the need for advertisements; the same goes for quite a few web pages. The fact that this sort of programming can be lively and appealing to those with no attention span, no need for actual information, and no IQ worth mentioning, is beside the point. (Or, maybe it is the point.)

There are no rules for indie media, other than maybe "honor the content," where content is some combination of the idea and truth. Otherwise, especially with something like an interview, there wouldn't be any creativity at all--just the raw data.

Another topic of discussion has been the assumption that you should always look for the biggest market for your output. What is it about gigantism that gets people's juices flowing? What is it about "big" that makes some people equate it with "good"? Personal podcasting removes the need to cover the costs of expensive studios, license fees, and various employees. Make the most of it and let your mind roam free.

Enough of the rhetorical questions.

Everyone needs some affirmation and ego-stroking, of course, and the number of downloads you get is a direct affirmation. The question is: how big is big enough?

Editing and Quality Control

OK, you've clicked the big red button in Audacity or armed a track and pressed record in Ardour, and recorded yourself putting the world to rights.

In instances where people need to figure out what you're saying or the detail of what you're recording, quality is important. How much quality do you really need? It's safe to say that the better the quality, the longer people will listen. Lots of people will sit still for recordings of Skyped interviews, but quite a few will not. Part of it depends on how compelling the subject matter is.

At this point, you're beyond the quality of the equipment in the recording chain. That's a done deal for now. This is the stage in which you can get rid of any major annoyances, such as a door slamming or a coughing fit. Audacity and Ardour both make it quite obvious where the noises are and the areas you need to delete, but what happens if the door bangs just as someone makes an important point? What if there is no possibility of a retake? It's your judgment call. Beyond that is the real editing phase, which is where your real taste, honesty, and true intention come in. Practice!

Putting the Files Up

What makes an audio file a podcast? There isn't anything special about the actual file data. It's still an MP3 (or whatever format). What makes it special and what enables people to subscribe to your podcasts is the RSS (Really Simple Syndication, some would say) 2.00 feed. RSS 2.00 added the enclosure tag that makes the whole thing doable.

There are several easy ways to get your podcasts on the web. If you're already a blogger through one of the organized blogging sites, then most likely there's a section where you can simply upload your podcast files and your site will do the rest. Another easy alternative is to use something such as ourmedia.org, which is free and allows you to upload all kinds of video and audio files.

If you're rolling your own, there are a few things to know. (None of it is exactly headache material.)

The first task (assuming you already have web space) is to create a directory for the podcasts. At Mstation, it's podcast_files. You can then use the dircaster PHP script:

<? 
// DirCaster v0.4: Automatic iPodder RSS feed maker Written by Ryan King
// www.shadydentist.com id3 class from frummel No license or warrantee
// expressed, implied, enclosed, etc.

// Drop this script in a directory and it will generate an RSS feed suitable for
// iPodder, etc based off the MP3 files in that directory. To 'cast a new
// file, simply upload it to the directory containing this script.

// Feed information is based on id3 tags, requires PHP4 or better. 
//
// Note: Avoid spaces in your MP3 filenames to avoid ugly filenames coming out
// of iPodder

// Instructions
// 1. Place this file on a server with supports PHP4 or greater.
// 2. Place MP3 files to feed in the same directory, add new files at will
// 3. Point iPodder to the URL of this file.
// ex. http://www.mysite.com/podcast/dircaster.php
// 4. Set the following varibles to match your setup if you wish

// Maximum number of mp3s to offer in a feed
$maxFeed = 10;

//Title of feed/site    Used by iPodder for download subdirectory name
$titleTAG="Your page title";

//iPodder 1.0 seems to ignore everything below
//URL of site feed applies too
$linkTAG="http://your url";
//Description
$descriptionTAG="description";
//Feed language en-us = english USA
$languageTAG="en-us";
//Copyright for feed
$copyrightTAG="various";
//Your email address
$webMasterTAG="podcasts@wherever.org";
//Name of feed generator
$generatorTAG="dirCastv0.4";
// Time to live
$ttlTAG=60;

///////////////
// You should not need to edit anything below this point.
/////////////
// Main Code
///////////
header('Content-type: text/xml', true);
$rootMP3URL = "http://" . $_SERVER[HTTP_HOST] . $_SERVER[REQUEST_URI];
$rootMP3URL =  substr($rootMP3URL, 0, strrpos ($rootMP3URL, "/")); // Trim off script name itself

print "<?xml version=\"1.0\"?>\n";
print "<rss version=\"2.0\">\n";
print"    <channel>\n";
print"        <title>$titleTAG</title>\n";
print"        <link>$linkTAG</link>\n";
print"        <description>$descriptionTAG</description>\n";
print"        <lastBuildDate>" . date("r") ."</lastBuildDate>\n";
print"        <language>$languageTAG</language>\n";
print"        <copyright>$copyrightTAG</copyright>\n";
print"        <generator>$generatorTAG</generator>\n";
print"        <webMaster>$webMasterTAG</webMaster>\n";
print"        <ttl>$ttlTAG</ttl>\n\n";

$dirArray = getDir(".");    // Get a list of the current directory
while (list($filename, $filedate) = each($dirArray)AND $maxFeed > 0) {
    $mp3file = new CMP3File;
    $mp3file->getid3 ($filename);
    print "<item>\n";
    echo ("<title>$mp3file->title</title>\n");
    echo ("<link>$rootMP3URL/". htmlentities(str_replace(" ", "%20", $filename)) ."</link>\n");
    echo ("<description>$mp3file->title - $mp3file->album - $mp3file->artist</description>\n");
    echo ("<pubDate>".date("r",$filedate)."</pubDate>\n");
    echo ("<enclosure url=\"".htmlentities($rootMP3URL)."/". htmlentities(str_replace(" ", "%20", $filename)) ."\" length=\"");
    echo filesize($filename);
    echo ("\" type=\"audio/mpeg\"/>\n");    // Training slash for XML
    print "</item>\n\n";
    $maxFeed--;
}

print "</channel>\n</rss>\n";

// Functions and Classes
function stripJunk ($text) {
// Strip non-text characters
    for ($c=0; $c<strlen($text); $c++) {
        if (ord($text[$c]) >= 32 AND ord($text[$c]) <= 122)
            $outText.=$text[$c];
    }
    return $outText;
}

class CMP3File {
    //properties
    var $title;
    var $artist;
    var $album;
    var $year;
    var $comment;
    var $genre;
    
    function getid3 ($file)
    { // read the ID3 or ID3v2 tag from an MP3 file
        if (file_exists($file))
        { //after verifying the file exists,
            $id_start = filesize($file) - 128;
            
            $fp = fopen($file, "r");
            fseek($fp, $id_start);
            $tag = fread($fp,3);
            if ($tag == "TAG")
            {
                $this->title    = stripJunk(trim(fread($fp, 30)));
                $this->artist    = stripJunk(trim(fread($fp, 30)));
                $this->album    = stripJunk(trim(fread($fp, 30)));
                $this->year        = stripJunk(trim(fread($fp, 4)));
                $this->comment    = stripJunk(trim(fread($fp, 30)));
                $this->genre    = stripJunk(trim(fread($fp, 1)));
                fclose($fp);
                return true;
            }
            else
            { // No ID3 tag
                  fclose($fp);
                return false;
            }
        } else //the file doesn't exist
            return false;
    }
}

function getDir($mp3Dir) {    
// Returns directory as array[file]=date in newest to oldest order
    $dirArray = array();
    $diskdir = "./$mp3Dir/";
    if (is_dir($diskdir)) {
        $dh = opendir($diskdir);
        while (($file = readdir($dh)) != false ) {
            if (filetype($diskdir . $file) == "file" && $file[0]  != ".") {
                if (strrchr(strtolower($file), ".") == ".mp3") {
                    $ftime = filemtime($mp3Dir."/".$file); 
                    $dirArray[$file] = $ftime;
                }
            }
        }
        closedir($dh);
    }
    asort($dirArray);
    $dirArray = array_reverse($dirArray);
    return $dirArray;
}

?>

If you put this in the files directory and head for http://my_url/podcast_files/dircaster.php, you will find a genuine RSS 2.00 feed that people can subscribe to.

The resulting tags that are sent to a browser might look like the following:

<rss version="2.0">

    <channel>
<title>Mstation mmm podcasts</title>
<link>URL</link>
<description>Mstation Podcasts</description>
<lastBuildDate>Mon, 10 Apr 2006 12:01:12 +0100</lastBuildDate>
<language>en-us</language>
<copyright>various</copyright>
<generator>dirCastv0.4</generator>
<webMaster>podcasts*at*mstation.org</webMaster>
<ttl>60</ttl>

    <item>
<title/>

    <link>
http://mstation.org/podcast_files/mstation_dover_st_market.mp3
</link>
<description> -  -</description>
<pubDate>Mon, 20 Mar 2006 11:43:52 +0000</pubDate>
<enclosure url="http://mstation.org/podcast_files/mstation_dover_st_market.mp3" length="12715291" type="audio/mpeg"/>
</item>

At Mstation, we also have a separate Blosxom page where we discuss what the Mstation podcasts are about and how you can subscribe. We've used the Blosxom plugins enclosures, interpolate_fancy, and headlines to produce the layout and enable you to use the Mstation RSS 2.0 Podcast subscription feed with very little work on our part.

Blosxom handles the new m4v format for the TV iPod, while dircaster (at this stage, anyway) does not.

Once you have a subscription URL, you can also register it with iTunes or another feed syndicator such as Wikipedia list of podcast syndicators. On iTunes, you must create an account, but you don't actually have to buy anything to register your feed.

Good luck, and may your mind flow free!

John Littler is chief gopher for Mstation.org.


Return to the Linux DevCenter.

Copyright © 2009 O'Reilly Media, Inc.