Category Archives: General

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.

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

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.

Use a Wii Balance Board with Linux

An interesting part of the Nintendo Wii design is that they rely on bluetooth for connecting their joysticks and (as it turns out) their Balance Board peripheral. This makes them pretty darned hackable. I’ve seen lots about using the “WiiMote” with computers, but this is the first I’ve seen that interfaces with the Balance Board. Nifty.

Use a Wii Balance Board with Linux
Use a Wii Balance Board with Linux

Factoring Large Numbers…

A few days ago, I mentioned that I was pondering the stages of Simon Singh’s Cipher Challenge that I didn’t complete “back in the day”. I was examining the DES portion, which still seems like it would take a while to solve, so I decided to skip ahead and figure out what the final stage was like. It seems to require the factoring of a 155 digit number. A bit of research reveals that such a number is still a pretty darned hard thing to factor. But while toying around, I downloaded YAFU, and tried to factor some numbers on my AMD machine. It took about an hour and a half to factor this 91 digit product of two primes:

14181042111046838458974412614836094249162520811
22341447307961894892019996002707152857987347 =
411268404095925771725738109950909913561283687 * 3448123407928803465744207062833069247853720181

This corresponds to about a 300 bit RSA key.

It can factor 60 digit products in about 10 seconds.

Breaking Stage 10 of the Challenge requires factoring this 155 digit
monstrosity:

10742 78829 12665 65907 17841 12799 42116 61266 39217 94753 29458
88778 17210 35546 41509 80121 87903 38329 26235 28109 07506 72083
50494 19964 33143 42555 83344 01855 80898 94268 92463

I should learn how this stuff works.

Looking back at Michael Jackson

Today came the news that Michael Jackson, the legendary King of Pop, died of cardiac arrest at age 50. Yes, I was a fan. Who wasn’t in the eighties? He was absolutely brilliant. He brought the combination of music, choreography, and film making together to completely change the landscape of pop music and television.

As I was driving home, I was listening to some of his songs on the radio, and I was remembering all the great video moments. The natural question was: what was his best video? It’s hard to argue with Thriller, but I think Black and White, Scream and Smooth Criminal are also good suggestions. Oh, and Billy Jean… Oh heck. I’m curious. What do you all think? Vote on your favorite below.

[poll=2]

Mmm… Cobbler

I like cooking. Well, eating really. Okay, eating and cooking. But in particular, I like what is generally called comfort food. The silly thing about most restaurants is that they don’t do a very good job of making comfort food. If you really want comfort food, the best way is to learn how to make it yourself.

When I was a kid, we used to pick blackberries and huckleberries, and my grandmother would turn them into delicious pies and my special favorite: cobbler. Oh, and strawberry rhubarb. Oooh, or apple cobbler. Served with creme. Or a scoop of good vanilla ice cream. Yum.

Why am I musing about this? Surfing while hungry…

Practical Alchemy: Cobbling Together a Cobbler – Video Game Podcast and Geek Culture Blog | The Weekly Geek

iPhone 3GS: My Early Experience

Well, my iPhone 3GS arrived on Friday, and I’ve had a couple of days of tinkering with it, so I thought I’d give my impressions about what’s cool.

First off, it’s a G3 phone (I previously had the first generation, EDGE only phone) so it’s networking is significantly faster. Combined with the processor speed increase, it’s really quite snappy. Email downloads faster, and displays faster. Google maps loads and updates quickly, zooming in and out nearly as fast as you can gesture. Even large webpages seem to load up nicely. Speed is nice.

The second thing I noticed immediately seems trivial: the screen is coated with an “oleophobic” coating, which means that it repels grease. It really works, and should be standard on all touch screen devices. My old iPhone was continually smudged by fingerprints, the new one looks great!

iPhone 3G owners have had the benefit of a true GPS for quite some time, but it was new to me, and works well. The iPhone 3GS is also augmented by a digital compass, which is frankly of little use to most of us, but might be useful in some later user applications.

It also has the iPhone 3.0 OS that was just recently released, so it now supports the advanced stereo Bluetooth headsets. Carmen has one for her Google phone, which I tested and it appears to work just fine.

The camera gets a nice upgrade to 3.2GS, and includes video capture, editing and upload to YouTube. That functionality all seems to work quite well (I’ll shoot some video shortly as well as some pictures as example). The camera also has autofocus, and can focus down to short distances. Both are nice improvements.

For me, the upgrade was a no-brainer really, and I’m quite pleased. I loved my old iPhone, and I love my new iPhone. The couple of gripes that I have are mostly with pricing. I was eligible for upgrading the phone for the $199 price (I got the 16gb model) which was good, but I ordered this through Apple which means I got hit with sales tax on the full price of the phone, resulting in a fifty something dollar sales tax. Ouch. And, of course AT&T slaps you with an $18 activation as well as an $18 upgrade fee, which seems like at least like they should waive one of those for customers who’ve been sending them substantial sums of money for the previous two years. So, it’s not cheap, but no smart phone is.

No early iPhone joy in Mudville

The blogosphere was atwitter with the news that many iPhone 3GSs seemed to have shipped early, and indeed might be delivered early. I checked mine, and found that it had indeed arrived in Anchorage yesterday afternoon, but alas, checking it’s status today online met me with the following screen on UPS’s website:

picture-2

So, it looks like mine will likely arrive on the 19th, just as they had originally claimed. Quel dommage.

Test of the HTML 5 video tag…

WARNING: If your browser is “lucky” enough to support the video tag (like certain beta Firefox 3 releases, or Safari) then there should be an image below. It might also slow the loading of the page a bit. Be patient. If you aren’t lucky, it should load really fast.

Finally, finally, HTML 5 is working toward implementing a VIDEO tag (similar to the all pervasive IMG tag) which just works, out of the box. Safari and certain beta versions of Firefox already implement this tag. If I read various news reports properly, the iPhone’s browswer will implement it too.

Wouldn’t it be swell if we could just skip all the plug in nonsense and display video on our webpages as easily as images?

Attempt at Lightning Photography

Some people have been using the CHDK firmware to do motion detection and capture pictures of lightning strikes. Despite the fact that lightning has been hitting Tampa all week, I didn’t get around to trying this until last night. I wasn’t entirely successful, but I did capture these two exposures:

This lightning strike hit almost directly overhead, and was really bright and loud.