Server swap

If you noticed that this site went down recently, that may be a sign you’re checking it too often.

I just swapped out the server that provides this website, and also serves as my apartment’s wireless access point. The old one, an HP Pavilion a800 graciously donated by my roommate Simon nearly three years ago, was failing increasingly hard and increasingly frequently. It weighed 38 pounds and had a volume of 1881 cubic inches.

The new one, an Asus EeeBox EB1007-B0200, weighs 2.6 pounds and has a volume of 67 cubic inches, so it’s 94-97% smaller. I bolted it to the back of the TV with the included mounting bracket, and it almost disappeared. The old one had two optical drives (CD-RW and DVD-ROM), and a floppy; the new one has nothing but an SD card slot.

This is the third time in a row that I’ve “upgraded” a machine to one with a lower clock speed. Hopefully it doesn’t make the site too sluggish.

I also switched from Gentoo to Debian, mostly on the theory that a single-core Atom was not going to be fun for running gcc. That forced me to learn a whole lot about debian, like how to back-install hostapd 0.7 from testing (the version in stable is too old for the EeeBox’s ath9k card), and how to set up an IP masquerade (I ended up with a distinctly worrying but seemingly function shorewall configuration).

One remaining worry: signal strength. The old server required an extra-large external SMA antenna to span the apartment. The new EeeBox had a similar-looking detachable antenna, but (with some help from Dad) I discovered that it was fake! Asus had used the external shell of an SMA connector, but just soldered a plain old wire to the motherboard and run it out through the hole.

Dear Comcast

Dear Comcast,

I would love to pay you my cable bill for the last two months. Unfortunately, your payment page says “We are unable to retrieve your billing information at this time.”, just like the last time I checked it. This means that the payment function is disabled, which is just as well since, without my account info, I have no idea how much I owe you.

Maybe you should think about fixing the part of your business where people give you the money.


An Auto-Aligner for PiTiVi

It’s rare to get exactly one recording of an a capella concert. Usually someone’s parents have a fancy but outdated camcorder, someone in the front row has a cell phone video with a great angle but terrible quality, and there’s a beautiful audio-only recording, maybe straight from the mixing board. All the recordings are independent, starting and stopping at different times. Some are only one song long, or are broken into many short pieces.

If you want to combine all these inputs into a video that anyone could watch, you’ll first have to line them up correctly in a video editor. This is a painful process of dragging clips around on the timeline with the mouse, trying to figure out if they’re in sync or not. The usual trick to making this achievable is to look at the audio waveform visualization, but even so, the process can be tedious and irritating.

This year, when I got three recordings from the VoiceLab spring concert, I resolved to solve the problem once and for all. I set about writing an automatic clip alignment algorithm as a patch to PiTiVi, a beautiful (if not mature) free software video editor written in Python.

Today, after about two months of nights and weekends, the result is ready for testing in PiTiVi mainline. Jean-Fran├žois Fortin Tam has a great writeup explaining how it works from a user’s perspective.

I hadn’t looked into it until after the fact, but of course this is not the first auto-alignment function in a video editor. Final Cut Pro appears to have a similar function built in, and there are also plug-ins such as “Plural Eyes” for many editors. However, to the best of my knowledge, this is the first free implementation, and the first available on Linux. Comparing features in PiTiVi vs. the proprietary giants, I think of this as “one down, 20,000 to go”.

I guess this is as good a place as any to talk about the algorithm, which is almost The Simplest Thing that could Possibly Work. Alignment works by analyzing the audio tracks, relying on every video camera to have a microphone of its own. The most direct approach might be to compute the cross-correlation of these audio tracks and look for the peak … but this could require storing multi-gigabyte audio files in memory, and performing impossibly large FFTs. On computers of today, the direct approach is technologically infeasible.

The algorithm I settled on resembles the method a human uses when looking at the waveform view. First, it breaks each input audio stream into 40 ms blocks and computes the mean absolute value of each block. The resulting 25 Hz signal is the “volume envelope”. The code subtracts the mean volume from each track’s envelope, then performs a cross-correlation between tracks and looks for the peak, which identifies the relative shift. To avoid performing N^2 cross-correlations, one clip is selected as the fixed reference, and all others are compared to it. The peak position is quantized to the block duration (creating an error of +/- 20ms), so to improve accuracy a parabolic fit is used to interpolate the true maximum. I don’t know the exact residual error, but I expect it’s typically less than 5 ms, which should be plenty good enough, seeing as sound travels about 1 foot per ms.

My original intent was to compensate for clock skew as well, because all these recording devices are using independent sample clocks that are running at slightly different rates due to manufacturing variation. There’s even code in the commit for a far more complex algorithm that can measure this clock skew. At the moment, this code is disused, for two reasons: none of our test clips actually showed appreciable skew, and PiTiVi doesn’t actually support changing the speed of clips, especially audio.

If you want to help, just stop by the PiTiVi mailing list or IRC channel. We can use more test clips, a real testing framework, a cancel button, UI improvements, conversion to C for speed, and all sorts of general bug squashing. For this feature, and throughout PiTiVi, there’s always more to be done. I’ve found the developer community to be extremely welcoming of new contributions … come and join us.


Played some Scrabble this afternoon, thankfully in the shade. A few photos are in order.

Just some people playing Scrabble in the Mem Drive median strip
Scrabble, and lemonade
This is my idea of an artsy photograph
Deep in thought

You may be able to guess from the photos which of us provided the set.

I had to leave in the final moments, so unfortunately I don’t know who won.


It was so hot last night that nobody wanted to go back to our unairconditioned apartments, so we met up at Meadhall and wound up playing Hearts (at which I was terrible) and Poker (at which I seemed to do pretty well).

I don’t think I’ve ever played Poker before, and certainly not all 5 variants we tried, but it was more fun than expected. I’m not sure why anyone would want to play with money, though, any more than one would play Monopoly with USD, or soccer with a ball of cash.

Apartment living

My window faces directly at the building next door. If an intruder entered my apartment, I could step out of my window right onto my neighbor’s ledge. If they stay up late I have to close my blinds to sleep, and whenever they cook dinner in the summer I know exactly which spices they are using.

Tonight they threw a party, and I overheard a conversation of the form

A: Oh, do you know <person that I also know/>?
B: Yeah, I know <person/>. Hey C, do you know her?
C: Well, of course I do.

For the next hour or so I tried yelling across to them periodically to let them know that we have a mutual friend, but even at the top of my lungs I was never heard. I guess yelling into the window of a hopping party is a bit like being on the dark side of a half-silvered interrogation mirror.

Oh well. They couldn’t have been that cool. I swear they were playing some remix of “I got a feeling” by the Black Eyed Peas on loop.


I found a great list of known carcinogens, along with an assessment of the amount of cancer they might induce. (I found it from Wikipedia, but it’s produced by Lawrence Berkeley National Labs.)

Highlights include: Beer, Wine, Coffee, Lettuce, Orange Juice, Tomatoes, Mushrooms, Apples, Celery, Cinnamon, Saccharin, Carrots, Bread, Potatoes, Nutmeg, Pears, Plums, Mangoes, Mustard, Toast, and Parsley.

Summing up the HERP(!) risk percentages for these items I get a 2.7% lifetime cancer risk from these items.

Of course, this calculation does not consider that any of these foods might also have compensating anti-carcinogenic effects … or indeed that humans might be anything other than very large Sprague-Dawley lab rats.