SCPodcast Creates an MP3 podcast using SC's non-realtime synthesis


A SuperCollider class and a bash script to generate MP3 podcasts automatically from an OSC file. The main procedure is within the bash script, which should make it easy to automate (e.g. using a cron job). The purpose is to create algorithmic podcasts, so your OSC file is expected to have some variation in it (e.g. randomness, context dependency) so that the generated files are not all the same.


Important notes: 

1 - This quark does not provide any help in hosting the RSS/MP3 files on the web. It's your job to either set up a webserver locally, or to transfer the files to a remote webserver once they've been generated.

2 - Since the audio is generated using SC's Non-Realtime-Synthesis, a single sequence of OSC commands is used to control the sound, rather than the full range of facilities available in the SC language. One way to get around this is to use SC code to re-generate the OSC file whenever you want its commands to change.

3 - "LAME" is used to create an MP3 from the audio. The bash script will attempt to search your path for the LAME executable if it's not where it expects; make sure your shell path variable is set correctly if this seems to be failing.


How to create a podcast:


1 - Create a folder in which to store source data for the podcast.

2 - Create a binary OSC file, and store it in the folder you created. 

The OSC file is created in the same way as for general SC Non-Realtime-Synthesis.

3 - (Optional) Create a file rsstop.txt containing the top part to be added to the RSS file.

This is optional because a default rsstop will be generated if none exists, which you can later edit.

4 - Create a folder in which to store the output data for the podcast.

5 - Run the podcast-generating process, either from a unix-like command-line or within SC.

Within SC:

SCPodcast.new(readdir, writedir, baseurl, maxentries, mp3prefix, oscfname, itemtitleprefix).generate;

On a command-line:

./scpodcast.bash readdir writedir baseurl maxentries mp3prefix oscfname itemtitleprefix

baseurl is the URL people will use to access the MP3 files (it'll be written into the RSS data).

maxentries is the maximum number of MP3 files to keep (oldest ones will be deleted).

mp3prefix is an optional prefix added to the audio filenames; helpful for avoiding filename confusion. Don't use spaces or unusual characters, or you may find you have difficulties with URLs etc.

oscfname is the filename of the OSC file.

itemtitleprefix is a prefix for the title of each item as displayed in the podcast feed.

6 - If the procedure has been successful, the return value from the script will be zero and the file "podcast.rss" in the output directory will have been created. This is the podcast file. This file and the MP3s in the output folder need to be accessible by whoever's receiving the podcast.



The SCPodcast class has the following instance methods:


.generate  - Runs the OSC file in non-real-time, converts the audio output to MP3, and updates the RSS file 

.shellCmd  - Returns a string containing the shell command, handy if you want to do it that way

.audiofiles - Searches for MP3 files in the output folder (beginning with the mp3prefix)



Examples


There are two example OSC files provided - one which creates some droney noise, and one which creates some harp-like strumming. (The harp file requires two non-standard plugins - make sure you have Josh Parmenter's [Pluck] UGen and Dan Stowell's [RosslerL] UGen if you want to run it.)


The first example shows all you need to do to create a podcast, using a droney noisescape synth. Sorry if that's not your scene... make up your own SynthDefs!


Please note: generating these examples takes about 5 minutes or so on a PPC Mac, although it seems to be much quicker on an Intel Mac. Most of the time is for the MP3 compression.


// We need to write the synthdef we're going to use; I've defined it in a separate document.

// Just open that document if you want to look at the synthdef graph.

// You only need to do this once.

(SCPodcast.classdir ++ "/examples/scpodcast_fdbknois1_synthdef.scd").load;

// We also need to generate the OSC file. Again, you only need to do this once.

(SCPodcast.classdir ++ "/examples/scpodcast_fdbknois1_makeosc.scd").load;


// Create an instance of the class - data will be read/written within the /examples/ folder next to the class file.

// Note: The URL given here will be written into the RSS file. You may need to change it to suit your webserver location, BEFORE generating data.

p = SCPodcast(SCPodcast.classdir ++ "/examples/inputdata", SCPodcast.classdir ++ "/examples/outputdata", "http://localhost/scpodcast", 6, "scpodcast-example-", "scpodcast_fdbknois1.osc", "Fdbk noise, ");

// Now generate one entry.

// Watch the post window to see what happens. Hopefully, after a couple of minutes, 

//  it'll conclude with RESULT=0 which means success.

p.generate;

// Run the above line repeatedly if you want to generate multiple entries in the podcast.


// On Mac OSX this next line will open the folder to show the files that have been generated.

// Note: Both iTunes and Safari seem incapable of opening "local" RSS files, which is frustrating.

// You will need to get the files served by a webserver in order to see it work in iTunes.

("open" + (SCPodcast.classdir ++ "/examples/outputdata/").escapeChar($ )).unixCmd;



Example 2: This next example is slightly unusual, but we will re-use the same SCPodcast object, modifying it to use the harp-like sound but still to write to the same podcast output folder. This will have the rather nice result that the podcast will contain a mixture of audio renderings, from both the noisish and harpish processes.


// Again, we need to ensure the synthdef and OSC file have been written.

(SCPodcast.classdir ++ "/examples/scpodcast_harp1_synthdef.scd").load;

(SCPodcast.classdir ++ "/examples/scpodcast_harp1_makeosc.scd").load;


// Alter the SCPodcast instance variables a bit.

// You could of course simply create a new instance of the class.

p.oscfname = "scpodcast_harp1.osc";

p.itemtitleprefix = "Harp, ";

// Now let's generate something

p.generate;


There are longer (30 minute) versions of the OSC files distributed with this quark, in case you'd like to use them. The sounds are intended for long-term purposes, you see. Here are the long versions:

// Warning - they may take a long time to generate

(SCPodcast.classdir ++ "/examples/scpodcast_harp1_makeosc_longer.scd").load;

(SCPodcast.classdir ++ "/examples/scpodcast_fdbknois1_makeosc_longer.scd").load;