23 July 2009

Perl and birdsong

Today, it is raining hard enough that I had to have a reading light on at noon. Though I will admit it isn't raining as hard as it was raining earlier, or might yet if we get the forecast risk of a thunderstorm turning into an actual thunderstorm. So not a day to go outside and take pictures.

Being an inside sort of day, I have a DVD with various bird songs on it, courtesy of it being an insert in a Smithsonian field guide. The problem is that there is no indication in the individual track what bird song this is; all of that information is in a combination of the directory (which has the full common name) and the file name (which has a cryptic abbreviation of the common name, and then an explanation of the call), which is fine if one is deliberately going through a list of references but not so fine if one wants to stick the lot on a portable music player and wander about the landscape acquiring bird-song knowledge by dint of osmosis and massive repetition.

So, I thought I could unwind the combo of directory name and file name into a text string, stuff the text string through a text-to-speech program, and glue the result of that on the front of the existing mp3 file.

It turns out I can; it also turns out to be much more interesting than I expected, what with:

  1. the various mp3 files are at different bit rates and frequencies; proper join requires the same bit rate and frequency
  2. inconsistent file name conventions, including the presence of apostrophes in the file names, which does awful things to quoting them during processing
  3. all of the mp3 files on the DVD have header issues; some of them have no headers at all, causing mp3 utils to choke
But it's done now. I've got things like:

there because there is one and only one file name that lists four source states (well, three, one twice) for the recording. I've learned way more than I thought I was going to need to about command line utilities for handling mp3s, too.

Next step -- create a playlist for Samsung's undocumented playlist format.

I haven't heard back about the prospective employment; that ought to comprise an adequate distraction.

No comments: