Audio compression compared…

I’ve been interested in compression technology of all kinds for what seems like forever. Saturday I did some informal testing of the Ogg Vorbis codec, and the new speech only codec Speex.

I compress all my music (small collection that it is) using Ogg Vorbis. I’ve found that 96kbps Ogg is either indistinguishable or slightly better than 128kbps MP3 files, and I like the idea that I’m using an open codec to store my music. Ogg Vorbis is well supported on all the platforms I have (via plugins for WinAmp and XMMS), and just seems like a good choice.

I’ve noticed that even 64kbps Ogg files sound pretty good, certainly good enough to encode old time radio shows and the like. Lately I’ve been hearing a great deal about Speex, an ogg codec designed especially for encoding speech. It is tuned for either 8, 16 or 32khz audio. So I decided to try to use Speex to encode some material, and compare it to the normal Ogg Vorbis at 64khz.

For my source material, I used Rayzur’s Edge Star Wars: Second Strike, Act I. My original source material is the MP3 download, which is 30.5 megabytes, and is encoded with joint stereo at 128kbps. I used the venerable mpg123 to convert it back into a 547 megabyte wav file, ready for recompression. (Yes, I know this isn’t really a good test, since I used compressed audio source material. Sue me.)

First I tried recompressing the the audio directly into Ogg Vorbis, specifying a 64khz average bitrate. The resulting file is 21 megabytes, and has a bitrate of roughly 53kbps. I was expecting something in the 15 megabyte range, but it appears that the original doesn’t really use 128kbps even though that’s its nominal compression. Since this is and “old time radio” like program, there are probably many places where silence supression can be used, and this reduces the overall bitrate considerably.

I then set out to encode it with speex. Speex wants audio at either 8khz, 16khz, or 32khz, so I had to resample it. I used the venerable sox utility at its highest quality setting, which was slow, but got the job done. When I
downsampled the audio to 16khz, I noticed considerable popping, which was caused by audio clipping, so I had to reduce the overall range of the audio to prevent clipping. Once I did that, I encoded the result in speex’s wideband mode. The resulting file was 8.5 megabytes, over a factor of three reduction from the original mp3. Unfortunately, the audio wasn’t really of acceptable quality. I could detect occasional squawks, and levels seemed to shift occasionally at the beginning and end of words as if some kind of silence detector got fooled.

I then retried the result in ultrawide band mode. The result was considerably better, not quite as nice as the ogg version, but I found it entirely acceptable. The good news is that the resulting file was only 9.5 megabytes, barefly bigger than the wideband mode version, and still less than half the size of the ogg version.

Using speex in ultra wideband mode, you can get about sixty hours of audio onto a single CD with entirely reasonable quality. Recently I purchased Douglas Adam’s Dirk Gentley’s Holistic Detective Agency and Long Dark Teatime of the Soul in audio book form. Both books would easily fit in a single 128M Compact Flash Card.

I’ll have to experiment with this some more.

It’s a Small, Stick Figure World…


When I was probably eight or ten years old, I remember going to the Book Vault, our local bookstore and seeing Ed Emberley’s Drawing Book: Make a World.
I remember asking my mom to buy it for me, but somehow I forgot about it, even though I thought it was a really cool book. Well, some thirty years later, I now own a copy. It’s a terrific little book on how to doodle interesting little stick figures. I find the bright colors, playful images and subject matter to be oddly intriguing as I near the end of my fourth decade on the planet. If you are caught in a dull meeting, this book will inspire you to doodle in new ways.


Mpeg Mandelbrot Madness


Well, I was working on some software to do panoramic image stitching over the weekend. Several hours of work yielded some phase correlation code that seems to work well about 50% of the time, and fail tragically 50% of the time. My brain wasn’t up to the task of further analysis, so I decided to waste some time making an mpeg or two of the Mandelbrot set. I modified an old .signature program I had to dump a whole bunch of pgm files, and then used a program I call ppmtocmap to extract interesting colormaps from photographs to color them. A few more command line utilities, and voila, an MPEG1 and MPEG2 zoom into the Mandelbrot set.

Panoramic Images

I’ve been interested in using digital cameras to capture panoramas, and
yesterday I had my cheapy $50 digital camera with me, so I shot 19 handheld shots that whirled around me as I stood outside my place of business. This is the result:

I deleted the applet, it made loading my main page too slow. If you want, you can download your own copy of the Panaview applet and set this up yourself.

If you don’t have java, you can just look at the panorama by clicking on
the tiny thumbnail below:

Reinventing the weblog wheel

I’m fairly happy with Movable Type, but I am constantly on the lookout for new weblogging software. During one of my surf sessions, I ran accross blosxom, a very simple weblog written in seven pages of perl. It’s a very cute system, and has some terrific ideas.

Inspired by its brevity and power, I’ve set up the beginnings of a similar system written in Python that I am calling Pylon. It’s only 140 lines of Python so far, but I was able to write a simple Python script to import all of the entries from brainwagon into it.
Check it out.

Eventually the code will be available here under my .signature license.

Journalist fired for altering photo…

Los Angeles Times – Editor’s Note details the dismissal of Brian Walksi, former photographer for the LA Times. He produced an altered photograph of a British soldier directing Iraqi citizens to take cover by montaging two photos taken several seconds apart. The trouble is, some people appear in the resulting montage twice. Oops!

The L.A. Times has a policy that forbids the alteration of news photos, but one has to wonder just how much of this stuff slips by.

On a slightly lighter note, some some lighter uses of Photoshop can be found on the web.