Random thoughts: note lines

Postscript is fun.

A few months ago, I needed a piece of paper containing just some empty musical barlines -- computers are nice, but some things are better done with a piece of paper and a piano. Since the preprinted ones I had were all used, and since this was on a sunday (when shops are closed), I tried to get this out of a printer. So, I started looking for an application that could do such a thing.

That was easier said than done. Software enough to print out musical bars with notes on them, but none that would do empty pages. It took me almost an hour of looking before it occurred to me:

This is so easy in postscript. After all, it's just a bunch of lines—draw five lines above eachother, move a bit along the vertical axis, rinse, repeat.

It took me five minutes to come up with the following, which I still regularly use today:

%!PS
50 75 moveto
1 1 13 {
  1 1 5 {
    500 0 rlineto
    -500 5 rmoveto
  } for
  0 30 rmoveto
} for
stroke
showpage

That's A4 only, folks; but I guess changing the numbers to make it fit on letter or something else shouldn't be hard. And it spares me from having to buy preprinted note bar paper, which is quite expensive...