The Fugue Counterpoint by Hans Fugal


FFTW Wisdom

The Fastest Fourier Transform in the West has some internal parameters for fine tuning exactly how it performs the FFT. For optimal results, you measure the effect of these parameters directly to find the absolutely optimal way to do that transform, but this is overhead that usually takes longer than just doing the transform the "slow" way, so it is only worth doing when you will be doing a whole bunch of similar transforms (e.g. in a spectrogram, filter, etc.).

So FFTW uses different planners, e.g. "patient" and "estimate", the latter being the default. No matter which planner you use, FFTW gathers "wisdom" about plans and doesn't have to recalculate them in the same session. Additionally, this wisdom can be saved to disk (in /etc/fftw/wisdom).

FFTW ships with fftw-wisdom, a program to generate wisdom which you can save to disk for the benefit of all FFTW-using programs. You run it something like fftw-wisdom -c -v -o /etc/fftw/wisdom, which takes several hours. I did this, and I found that the generated wisdom refused to be read. Oops. So I have done something almost as good (and which takes much less time).

In my case, I usually use FFTW within Octave. I'm sure it's in use many other places (video and audio encoders/decoders, etc.) but when I care about the marginal speed gains it's usually in Octave. Octave gives you access to the wisdom and planners, so you can save the wisdom to disk. Set the planner to "patient" (or "exhaustive" even):

octave:1> fftw('planner','exhaustive');

Then we need to perform an FFT for each plan that we care to optimize. Octave (and MATLAB) only seem to do complex-to-complex transforms, first transforming real data to complex, so all we need to do is generate a vector and perform the FFT for the various sizes we care about. In my case (audio) this does the trick:

octave:2> x = rand(2^15,1);
octave:3> for i=1:15; fft(x,2^i); end
octave:4> fftw('dwisdom')
ans = (fftw-3.1.3 fftw_wisdom

Copy that answer string and stick it in /etc/fftw/wisdom. Test it by running fftw-wisdom from the command line. If you do transforms that aren't powers of 2, or are 2-dimensional, etc., the idea is the same. In the future, Octave will read and add to the wisdom already there, so you can build on it over time. If anyone knows a way to automatically save wisdom on exit from Octave (really, a way to automatically do arbitrary code on exit—the code to save the wisdom is simple enough), that would be a neat trick that I'd love to have.

Oh, and if anyone wants to write a patch for Octave to get it to use a real-to-complex transform when applicable that would be approximately a factor of 2 speedup. I might dive in someday, if the need arises.


Hipster Redux

I've talked about the Hipster PDA a few times. I finally stabilized on a system that works for me. I've been using it steadily for months with no major changes now, so I thought I'd share with you.

My brief foray into the hipmod was fun, but too restrictive and small in the end. I understand others enjoy it though, so I'm glad I did it.

I find the classic hipster with a few modifications works best. My biggest beef with the original hipster is that it falls apart and it's not very user-friendly. That binder clip had to go. So I got some binding rings (½" I think, but the exact size isn't critical) and use a standard 3-hole punch to punch 2 holes in the index cards, and bind it with 2 rings. This makes a more book-like planner, which nicely folds over on itself.

Now, those rings can be pesky to open and close so I decided not to. I snip a little cut from the edge of the cards I want to be removeable to the holes. They stay in but will come right out and go right in without struggle.

I also like to print some forms (as you've seen). These I just print on regular paper and trim to size with a guillotine then hole punch (no snips, that works best on cardstock).

I made front and back covers out of a cereal box and duct tape, and even a pen holder out of duct tape. I'll post a picture soon so you can see.

My planner consists of a few reference pages I printed out (including a circle of fifths, a few airport kneeboards, performance data for my favorite planes, and morse code… anything you can find a PDF for.), my weekly calendar/todo list pages, and a bunch of index cards that I use for notes, moments of inspiration, or whatever else they come in handy for. Oh, and a paperclip to mark the current week. I only have to reprint/refill the weekly pages about once every 3 months or so.

For printing things, I wrote a script that automates some of what I mentioned in previous posts.



When I was in grade school, I used to bring my homework from and to school folded up in my back pocket. Life was simpler then. I always knew exactly what I had on my plate at any moment by checking my back pocket.

Fast-forward to the era of planners, PDAs, and productivity software. I've gone through all the phases. None of them fit, but I took something away from each. These days I know what I want, and none of the traditional solutions come close.

I want something analog, very simple, compact, and easy to put together. When I came across the Hipster PDA I thought I had found it, but I soon found that even the hipster wasn't easy enough. I didn't like even the smallest binder clips or paperclips because they had to be removed to actually use it. Rings didn't suit my fancy either. Loose index cards are of course a disaster. The supply of index cards got almost as unwieldy as the hipster itself. To top it all off, blank index cards alone wasn't quite enough structure. So it fell into disuse.

Then I found the D*I*Y Planner, most notably their Hipster PDA edition. This added some structure and beauty, so I gave it a try. I soon decided that printing onto index cards is completely infeasible without special equipment. So that was out, alas.

The other day, I came across PocketMod. Here was something not entirely unlike the homework in my back pocket. It had some structure, it was easy and simple and cheap. It was perfect, except… I don't want to visit a website and run a flash app every time I want to print one. What if the website disappears? And what if I want to add custom pages? (There's a Windows app for that but I don't use Windows.) Also, the printouts generated by the flash app aren't quite right—the fold points aren't on the center and so the end result is a little sloppy-looking. I wish the US used A4 paper, but that's beyond my control at the moment (though I might consider ordering some online…). So the pocketmod flash applet had to be replaced.

So I decided to combine the D*I*Y Hipster and some scripting magic, and the result is hipmod. Thanks to the magic of Multivalent (I was going to use pdftk but it's segfaulting on my laptop for some reason) I can now create hipmods including whatever PDF of interest I find lying around. See the README for more information. Here's a screenshot:

2-week hipmod