Podcast Creation Script – Update

I’m just now posting the latest episodes, and they will all be generated using the updated version of my podcast creation script as described here.

The basic script calls a series of functions:

  • cs_set_variables, cs_set_filenames – set required variables and filenames
  • cs_choose_background_color – choose a background colour for the art, generated based on the episode number in such a way as to have it change significantly for each episode.
  • cs_art_background – create background using ImageMagick
  • cs_art_texts – generate text images
  • cs_art_logo – generate Coiled Spring logo image
  • cs_art_cover – generate cover image
  • cs_art_combine – combine all images into the complete cover art
  • cs_audio_speech – generate all the speech using espeak
  • cs_audio_fix_existing – fix all input audio files for sample rate etc using SoX.
  • cs_audio_logotone – create interstitial logotone using speech and random beeps
  • cs_audio_mix_intro – mix the intro music and the intro speech
  • cs_audio_concat_process – string together all the audio files into the complete episode, process using a dynamic compression algorithm to improve the sound, and then convert to MP3
  • cs_audio_tag – Use eyeD3 to tag the MP3 file with the title and episode number
  • cs_delete_working – delete all the working files

To do

There are still some improvements I could make. The following list includes stuff I thought of when I originally posted the script. Some are now fixed, some are redundant, some are new ideas.

  • I’m sure the script as it stands has some inefficiencies in it. I would like to fix it if I get the chance, or if anyone fancied lending me a hand.
  • Is bash the best language to use? Seems fine to me.
  • Generate multiple logotones instead of just having one repeated. Perhaps say, “End of Part 1 of the Coiled Spring” etc. Use different random beeps in each one, or even a different sound effect. Just leave it for now.
  • Use a seeded random generator to make sure the background color changes sufficiently between episodes. Maybe base it on the episode number and title for predictability. (Alternatively, use a trick to combine the title and episode number, turn it into the color, and not be random at all.) Done. If you’re interested, the background colour is generation is described in a separate blog post.
  • Alternatively, generate the artwork first using a random colour, display the result, and then only proceed to create the sound file when the artwork is approved. I did this for a while, until the colour generation was fixed.
  • Get rid of so many temporary files by using pipes and other things to feed results of one command to another command directly.
  • Understand the artwork filter – make it more like GIMP‘s “colour to alpha” function. Perhaps a normalization before the process starts. I found a script someone wrote that does a pretty good job.
  • Tweak the compression settings to improve the audio quality. I’m happy with it for now.
  • Tweak the sample rate to improve the audio quality. I’m happy with it now.
  • Put the reused files in a different directory, and create the new files in their own directory. This is tricky with bash. Done.
  • Get the script to open a browser, go to OpenStreetMap, find a relevant place (maybe ask for a location (or just a URL to be simple)), use a command-line screenshot tool to grab the map, use ImageMagick to manipulate the image (rotate, crop, filter), and then use that as a background. Maybe just provide a map image, and randomly crop it for each episode. I’ve decided to use a particular image for each episode, filtered specially.
  • Tweak the settings to make the voice a little better (the espeak voice, obviously, ahem). I’m happy with it for now.

Background Colour Selection

This is a super specific technical post, but it was something I worked to figure out, and I said I would document how things got done, so here it is.

The generated artwork is done in a certain style. The text and logo remain the same, the big episode number is always there, and a different processed foreground image is used each time to reflect the subject of the episode.

  1. The background colour must change each time.
  2. It must always be a certain brightness and saturation of colour – no dark browns or shocking picks.
  3. Choosing randomly runs the risk of choosing the same colour twice in a row, or too close a choice.
  4. Just incrementing the colour with the episode number wouldn’t change enough.

Here’s what I came up with. ImageMagick uses various colour models, including RGB and CMYK. But I chose HSL. This takes three values, representing Hue, Saturation, and Lightness.

Saturation is the richness of the colour. I didn’t want things too rich or bright, but rather a toned-down level like those on the Penguin paperbacks I was inspired by. After some experimentation, I chose a level of about 50%. It didn’t have to change for each episode.

Lightness is pretty self-explanatory. The colour had to be light enough to show up the processed black artwork, but dark enough to show up the white text. After some experimentation, I chose a level of about 30%. It didn’t have to change for each episode.

Hue is the actual colour, and is a value of 0-360 around a colour wheel. This colour picking website shows it all quite well, and was very useful in figuring this all out. Hue had to change for each episode.

In order to meet all the criteria listed above, this is the calculation used to generate the colour:

CS_Episode_Colour="hsl($(((episode_number*hue_increment) % 360))%,${saturation},${lightness})"


saturation = 50%, lightness = 30%, hue_increment = 171

What this does is create a HSL specification string in the form “hsl(0-360,0-100%,0-100%)” by taking the episode number, multiplying it by a value called “hue_increment”, dividing by 360 and taking the modulus (remainder), and setting the saturation and lightness values to the regular chosen values. Taking the modulus ensured that the value was within the range 0-360.

Where did I get 171 from? Once the other values had been settled, this was the one that took the most deciding. The way the calculation works, the value jumps by 171 each time, and the modulus ensures that it loops round when it’s greater than 360. Experimentation showed that the value of 171 gave a good change each episode, while not being too regular.

And that’s how the episode number dictates the background colour of the artwork.


Climbing The Flange Circus Family Tree

Remember those Rock Family Trees? Pete Frame drew those fantastic detailed diagrams of how bands changed their line-ups, swapped members with each other, and made up whole scenes. Prints were included in remastered albums, they spawned a John Peel-narrated TV series, you can buy books and posters of them, and someone even created a font from Frame’s distinctive hand-lettered text.

So when I interviewed Flange Circus and their parallel project Zirkus in Episode 18, it was clear that the relationships needed to be documented and diagrammed. I love a good diagram.

Frame’s charts are hand-drawn. That was out, obviously. Then I had the idea to try to use Graphviz to draw the chart. Graphviz is “open source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. The Graphviz layout programs take descriptions of graphs in a simple text language, and make diagrams in useful formats, such as images”. Basically you feed it a simple text description of how things are connected, and the program draws the diagram for you, with the boxes and lines drawn in the most tidy and efficient way.

You can have a play with Graphviz online here. Change the code, and see how the diagram changes.

I started writing the text file for the family tree, but it became clear quite quickly that with this amount of information, writing the text manually wasn’t going to work. Graphviz really shines when you generate the input file from another program, as shown in many of the examples in the gallery.

There are various GUIs for Graphviz, and while I was looking at those, I discovered yEd. I LOVE yEd. I use it for so many things now, at home and at work. yEd is not related to Graphviz, but it does perform a similar function. It’s a free Java app that will run anywhere, and it provides a nice graphical interface for drawing linked diagrams. But the most exciting feature is the automatic layout feature, which arranges your diagrams neatly depending on whether you’re drawing a flowchart, swimlane diagram, hierarchy or other style. you just hit the button, and it makes everything tidy – with some tweaking of settings, and a small amount of compromise (it is free, after all).

So I moved the diagram into yEd. I originally used the Pete Frame font mentioned above, but it didn’t look good at all – not the fonts fault, more that it needs a human touch to pack that amount of information into a diagram and make it look good.

Eventually, after much changing around, adding more branches, linking out to other projects, and emailing for more information, this is the result (click for big, or to download).

Good eh? If you have any further info, let me know. Obviously it’s a bit sparse compared to the dense narrative-packed Frame charts, but I think you should always keep a bit of mystery, don’t you agree?