Monthly Archives: July 2009

Variations on a Theme In Computer Graphics History

It was originally my intention to compare and contrast Loren Carpenter’s Vol Libre, a mile stone in computer animation, the first film to use fractal techniques with the second video, which is a 4KB demo contest winner, but sadly, I was unable to find Vol Libre on Youtube. So, instead, I’ll compare it to the Genesis effect sequence from Star Trek (what was I thinking? Thanks Robert!) II: Wrath of Khan. After all, Loren worked on that one too.


httpv://www.youtube.com/watch?v=QXbWCrzWJo4

httpv://www.youtube.com/watch?v=_YWMGuh15nE

What a difference a couple of decades of hardware makes, huh? I’ve managed to live through both of these periods. The field still amazes me some times.

Batting Stance Guy on Letterman

Thanks to Bob @ work for mentioning this to me. I think I appreciate this guy not just for his knowledge of batters and their stances, but for the self-deprecating way in which he presents his “least marketable skill”. That, my friends, is a baseball fan.

httpv://www.youtube.com/watch?v=4sPakL5On3Y

The Barrel-Ponics Manual

I’ve been interested in hydroponics for quite some time. It’s part of a growing interest that I have in sustainable and decentralized production of food and energy. At the Maker’s Faire, there was a display of a system which integrated both hydroponics and aquaculture: fish were grown in a tank, whose water circulated back to water some plants. This is called “aquaponics”. Digging around on the Internet this evening (hey, I was bored) yielded this excellent manual on a beginning system that uses a series of barrels. It seems very practical, and answers many interesting questions. The total amount of food produced is quite small, but the overall system is quite interesting. I’ll have to print it out and read up.

Faith and Sustainable Technology – The Barrel-Ponics Manual.

Addendum: Here’s a little Youtube video detailing a system built by an amateur. It uses goldfish and carp fingerlings, and he is growing tomatoes and other vegetables and flowers.



A new low, blogging about the weather…

I was up on the hill behind my house, moving a little antenna that I have, and was immediately struck by how blazing it was. Now that I am back inside, relaxing with the laptop, I did what every geek would: surf over to weather.com to find out how hot it was. This is what I got:

Picture 1

I don’t think so. All of the Bay Area temps on their site seem off. It seemed to me that their must be a network issue for them. I then recalled that there is an excellent network of user-supported weather stations called The Weather Underground. They reported a much more sensible temperature. Nifty.

Picture 2

Addendum: I thought I’d use my iPhone to find out what it thinks about the weather. Not surprisingly, the Weather Channel applet thinks the temperature is 69 degrees, just like their online page. The built-in iPhone weather app and the WeatherBug app both report the same temperature of 84 degrees, which I believe is the temperature as recorded at the Lawrence Hall of Science, but it is quite a bit warmer here. The Weather Underground app reports 92.3. Neat.

40th anniversary of Apollo 11 landing

201px-Apollo_11_insignia40 years ago today, Neil Armstrong and Buzz Aldrin became the first two astronauts to step out on the surface of the moon, as Michael Collins orbited the moon in the Command Module astronauts Armstrong, Aldrin and Collins launched aboard Apollo 11 on their way to the moon.

I was only five at the time, but NASA and the space program had a strong influence on me. Beyond just being captivated by the prospect of being able to travel into space, I was also fascinated in the math, science and engineering that sent rockets into space. I must admit to only dim memories of the event, but I do remember that the 20th was a Sunday, and that we rushed home from church to watch the coverage of the moon landing. I recall being very excited and impressed.
There are lots of great sites on the web. Start with Wikipedia and browse around.
Apollo 11 – Wikipedia, the free encyclopedia

Some basic footage:
httpv://www.youtube.com/watch?v=Kza-iTe2100

Downsample from 48khz to 8khz

I was tinkering. Wrote some code to low pass and downfilter a 48khz audio signal to only 8khz. Here’s some example output. It filters out audio above 2.7khz or so, and then downsamples to 8khz. The audio is just some test of Holst’s Mars, just meant to test.

#include <stdio.h>
#include <sndfile.h>

#define NTAPS   (55)
#define SKIP    6

float coef[55] = {
 1.06012E-04,  2.57396E-04,  4.39093E-04,  5.24290E-04,  3.41603E-04,
-2.52071E-04, -1.25563E-03, -2.42069E-03, -3.23354E-03, -3.03919E-03,
-1.31274E-03,  1.99613E-03,  6.19226E-03,  9.80711E-03,  1.09302E-02,
 7.88736E-03,  8.59963E-05, -1.12812E-02, -2.30159E-02, -3.04057E-02,
-2.84214E-02, -1.33337E-02,  1.57597E-02,  5.60551E-02,  1.01222E-01,
 1.42716E-01,  1.71912E-01,  1.82477E-01,  1.71912E-01,  1.42716E-01,
 1.01222E-01,  5.60551E-02,  1.57597E-02, -1.33337E-02, -2.84214E-02,
-3.04057E-02, -2.30159E-02, -1.12812E-02,  8.59963E-05,  7.88736E-03,
 1.09302E-02,  9.80711E-03,  6.19226E-03,  1.99613E-03, -1.31274E-03,
-3.03919E-03, -3.23354E-03, -2.42069E-03, -1.25563E-03, -2.52071E-04,
 3.41603E-04,  5.24290E-04,  4.39093E-04,  2.57396E-04,  1.06012E-04,
} ;

float input[NTAPS] ;

main()
{
    SNDFILE *inp, *out ;
    SF_INFO inpinfo ;
    SF_INFO outinfo ;
    int i, j ;
    float sum ;

    inp = sf_open("input.wav", SFM_READ, &inpinfo) ;

    outinfo.samplerate = 8000 ;
    outinfo.channels = 1 ;
    outinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 ;
    out = sf_open("output.wav", SFM_WRITE, &outinfo) ;

    fprintf(stderr, "%d samples/second file, %d seconds\n", 
        inpinfo.samplerate,
        inpinfo.frames / inpinfo.samplerate) ;
    
    for (i=0; i+SKIP < inpinfo.frames; i += SKIP) {
        sf_read_float(inp, input+NTAPS-SKIP, SKIP) ;
        sum = 0.0 ;
        for (j=0; j<NTAPS; j++)
            sum += coef[j] * input[j] ;
        sf_write_float(out, &sum, 1) ;

        for (j=0; j+SKIP<NTAPS; j++)
            input[j] = input[j+SKIP] ;
    }
    sf_close(inp) ; sf_close(out) ;
}

Addendum: Alan wanted to know how I computed the filter coefficients. Excellent question! I used Ken Steiglitz’s METEOR program. Here’s the input file:

          55          55     smallest and largest length
c
left     direction of pushed specs
           2     number of specs pushed
           3           4     specs pushed
         500     number of grid points
limit spec
+     upper limit
arithmetic interpolation
not hugged spec
 0.00000E+00 5.62500E-02     band edges
 1.00100E+00 1.00100E+00     bounds
limit spec
-     lower limit
arithmetic interpolation
not hugged spec
 0.00000E+00 5.65200E-02     band edges
 9.99000E-01 9.99000E-01     bounds
limit spec
+     upper limit
arithmetic interpolation
not hugged spec
 2.50000E-01 5.00000E-01     band edges
 1.00000E-04 1.00000E-04     bounds
limit spec
-     lower limit
arithmetic interpolation
not hugged spec
 2.50000E-01 5.00000E-01     band edges
 0.00000E+00 0.00000E+00     bounds
end

The file is a little odd, but basically i set up unity gain on the interval running from 0 to 0.05625 (which is 0 to 2.7khz at a sampling rate of 48khz), and then I set the response from .25 to .5 (12khz to 24kz) to less than -40db. I then set the filter length, and told the design program to “push” the edge of constraints 3 and 4 to the left. Here’s the resulting spectrum in linear scale and then log scale:

linear

log

Staring at this now, I realize that this probably isn’t quite working the way I intended. I need to trim all freqs above 4khz to sample at 8khz. This still has significant frequency content at 5khz, which could result in significant aliasing. Increasing the size of the filter to length 95, I ended up with the following log response.

newlog

Still not quite good enough. I’ll have to work on this some more.

Google Chrome OS? Yes, please!

Last week, Google announced that they were developing an OS, originally targeted toward netbooks. I think it is a great idea. If there is one lesson that our cell phones are teaching us is that we want Internet connectivity, video and audio on our devices, and that we pay a huge tax in performance and weight to when we use laptops and desktops and conventional operating systems like Windows (or even to a certain extent MacOS X and Linux). We should expect that our computers are available and immediate. We should expect that our computers are secure from viruses and spam. And we should suspect that the cost of our software (and associated maintenance) aren’t a huge fraction of the total cost of our computing systems.

It’s hard for me to see how Microsoft’s product plan is working to address these kinds of concerns. Windows 7 seems to be the the natural evolution of Microsoft’s “one size fits all” product strategy, with the pricing to match. Google has the opportunity to change the game with a disruptive technology. I’ll be interested in seeing what happens when more details become available.

Google Blog Announcement of Chrome OS

Saturday’s Double Rainbow

Well, everyone in the area seems to have blogged or facebooked this already, but here’s my view. We were heading out for some last mnute shopping around 8:00PM on Saturday, and encountered a beautiful, vibrant double rainbow opposite the setting sun. The iPhone video doesn’t really do it justice, but it was pretty awesome looking:

httpv://www.youtube.com/watch?v=7YVnRMnPjwY

Downloadable Book on High Altitude Amateur Balloon Launches

Big big thanks to Bill Meara of the Soldersmoke blog for calling my attention to the following link. Even bigger thanks to author Paul Verhage, for putting together this huge collection of useful information about balloon launches. My own high altitude balloon launch ideas have stalled a bit, but this book is excellent inspiration.

Near Space Exploration with the BASIC Stamp by Paul Verhage

Progress Report on ASUS WL-520GU/OpenWRT

Well, i’ve had a couple of days to muck around with the ASUS WL-520G (hereafter revered to as “the ASUS” or “the router”) and OpenWRT. I have had a modicum of success, as well as a modicum of failure, so I thought I’d give an update.

For my beacon transmitter, it is important that the router maintain a fairly accurate clock, because WSPR beacon transmissions occur at the beginning of even number minutes. So, I thought the first thing that I should be do is to get ntp running on the router, to make sure that the clock timing was good. There is a minimal ntp client called, quite appropriately, ntpclient, which I added to the configuration. I also thought that it would be good to add a slightly more capable HTTP server, rather than the minimal one built into busybox. I recompiled and installed.

And immediately found out that ntpclient didn’t work. It set the clock initially, but the clock was immediately sliding away from synchronization. I killed ntpclient, and it was still slipping sharply, losing about 11 seconds every minute. I knew that there were limits to how big a drift that ntp could correct, so I did some careful googling.

It appears that there is some lingering problem with this particular device. Without getting too far into it, there is code in the sbmips.c file which claims that the clock rate for this box is 240Mhz, but in reality, it appears to be 200Mhz. Changing this number and recompiling results in a clock which is reasonably accurate, and which ntpclient can easily correct, but also appears to cause a problems with the flash memory “mtd” driver. I’m currently trying to work that out.

Addendum: Hmm. I shifted to the “trunk” instead of the stable 8.09 release, and this problem seems to have gone away. I still needed to patch sbmips.c, but it seems to work fine now.

Scrappy

One year ago today, we found out that Scrappy, our formerly feral cat had FIV, the feline immunodeficiency virus. The good news is, he’s alive and healthy!

Scrappy’s early years are shrouded in mystery. I’m not certain whether he really was a feral cat, or whether he might have been an escaped cat. When he first showed up in our back yard, he was essentially starving, and very, very timid. He wouldn’t even come inside our back patio door to get fed, and wouldn’t tolerate being picked up (although he would just squirm, he wouldn’t scratch). Over a period of weeks and months, I slowly gained his trust, and he would begin to tolerate brief, and finally increasing amounts of time inside. We took him to the vet and found that he was neutered. It’s not uncommon for strays to be captured, neutered, and have their ears notched and re-released (Scrappy has a notch in his right ear). But he remained an outdoor cat for the most time. He would very nearly hyperventilate when put into a cat carrier.

But he was a fighter (hence the name “Scrappy”). Once or twice a year he’d get in a squabble with some other cat, and end up with bites on his face or front legs, and scratches, and I’d have to give him antibiotics, and occasionally keep him inside (where he’d squawk incessantly, and climb walls and get very upset). After one of these episodes, he had a persistent skin infection, and I took him to a different vet, where he was tested for FIV. He came back positive.

I was very sad, since I’m very partial to Scrappy.

I was told that I shouldn’t allow him outside, both for his own protection and to prevent the spread of the disease. FIV leaves him susceptible to infections, and the best way was to isolate him from any of the dangers that he normally is exposed to.

Well, housebreaking him was a challenge. First was teaching him to use a litterbox. We placed one in the upstairs bathroom, and would periodically place his paws in it. He would immediately squirm and bolt. He cried at the door to be let out. No, strike that. He’d wail. He’d howl. He’d beg. He’d cry. That went on for three days.

Then, he figured it out.

His skin cleared up. He added about a pound. We tried to make sure he had lots of toys and physical contact to make sure that he remained stimulated and not bored. He went through a brief period of time where he would howl in the middle of the night, but I got a small squirt gun and a couple of nights of that, and he got the hint. Now, he wakes us up at around 7:30 every morning (not too bad).

He’s healthy and happy. Now that the weather is improving, I’m taking him out into our back yard for a bit of supervised grass sniffing. He isn’t actively trying to get out most of the time: we’ve left doors open accidently, only to find him sitting on his chair or on our staircase when we search for him.

I’m beginning to wonder if I should have him tested again: his health has been so remarkably good I’m wondering about the possibility of a false positive. But then again, we’ve been treating him as if he is, and there is nothing else we could do, so maybe it doesn’t matter. The only real change I would consider if he wasn’t FIV is maybe getting a second cat to serve as a companion for him. But my outdoor stray has become an indoor “lap fungus”. And we are very fond of our furball.

Hope the next year for Scrappy goes just as well.

I’ve now continued the long tradition of blogging about our pets.

A New Project: OpenWRT on an ASUS WL-520GU

asus-wl520guPeople who read this blog might have noticed that I have a love of devices that have firmware that can be subverted for other purposes. I have a Canon SD1100 that runs the CHDK firmware. I have a couple of Linksys WRT54G routers. I have an old NSLU2 that I haven’t goofed around with in a while. I experimented with an old Linksys VOIP adapter. I’m kind of a nut.

During the Makers Faire, I noted this cool project, which converted an ASUS WL-520GU into a Wifi Internet Radio. I thought it was particularly interesting because the router hardware was cheap (only $35 after rebate from newegg.com) and because it included a USB port, meaning that it could conceivably be hooked to other interesting devices (the mightyohm project uses it to control a sound card).

How could I resist? I bought one!

And then, I created a custom distribution of OpenWRT. And, if you follow the next link, you’ll get served a webpage which is served on the router.

A webpage served from the ASUS WL-520GU

More developments coming soon.

Build Your own “Bag End”

A topic which interests me greatly is the idea of sustainable housing, especially durable housing that can be constructed by relatively unskilled labor using readily available local materials. Courtesy of the Maker’s blog this morning, I found this excellent web page which showed how an individual constructed a small woodland home using strawbale construction in Wales. The overall effect is very similar to what I imagine “Bag End” might have looked like from J.R.R. Tolkein’s The Hobbit:

A Low Impact Woodland Home

There is a certain philosophy associated with this kind of project that has appeal for me. This gentlemen and his wife wanted to be full time parents, and adjusted his life to fit that reality. The “stress and strain” of building a straw bale house was deemed much less stressful than the stress and strain of making mortgage payments every month. I can empathize.

Factoring Machines

I’ve blogged about D. H. Lehmer’s factoring machines before. It’s fairly hard to convince those who aren’t pathologically interested in rather quirky bits of mathematics and computing that this collection of bicycle chains and sprockets is worthy of study, but I didn’t have much difficulty convincing my typical lunchtime companion Tom that they were interesting, so we were discussing it a bit yesterday.

In the current era of ubiquitous computing, it’s hard to imagine that there was a time when computation wasn’t automated or mechanized, but back in the 1920s and 1930s, it truly was revolutionary stuff. An actual theory of computation was still on the horizon through the work of Church and Turing. The Bombe and Colossus code breaking machines of WWII were still in the future. Tom and I were musing that the revolutionary work of Lehmer and Lehmer were all the more revolutionary because they were without precedent. We also wondered how their work might have influenced code breaking machinery in WWII. Were the gents at Bletchley Park aware of the work that the father/son duo were doing, and did it serve as some inspiration?

Well, I still don’t know. I’m going to go back and dig through some of my references later, but I did find a couple of interesting things.

According to Knuth (Semi-Numerical Algorithms, pg. 390) the Lehmers were not the first to propose a mechanical device for automating the sieving task. In 1896, Frederick Lawrence wrote a paper entitled “Factorisation of Numbers” which inspired three different prototypes. The first successful factoring machine was built by Carrisan in 1919, which you can read more about here. Very neat device.

While trying to dig up online references, I found Eran Tromer’s annotated taxonomy of special purpose cryptographic machines. Lots of very good references and insights that might help me understand the historical context of these computing devices.