1/31/2008

01-31-08 - 2

Historically economies have always gone through boom & bust cycles. I guess it's an open question whether that's a fundamental characteristic of the system or if it's just a flaw we can fix. In any case, the US Fed in recent years has been on an unprecedented campaign to attempt to smooth out the down cycles in the economy. Certainly in theory if you have an economy that is going up and down but always trending slowly upwards, you should be able to reduce the swings and make it just a more stable rise. That, however, is not what we have been doing. Bernanke has specifically said that he doesn't think it's right for the Fed to try to prick bubbles or slow down overheated growth. On the other hand, any time we have a slow down we pull out all the stops to try to get the engine moving again.

Part of the reason for the subprime bubble was in fact the Fed's actions trying to get us out of the dot com bust, when they put the funds rate down to 1%, which pumps a shit load of cheap capital into the big banks, then the banks have to find instruments to put that capital in to get a profit. At some point you pump in so much cheap capital there just aren't enough good loans out there to make, so you start looking harder and harder to find somewhere to make a profit from that free money. I have no idea how this "zero recessions" philosophy will work out in the long run, nobody does because it's never been done before, we're in the middle of a big economic experiment.

01-31-08 - 1

This Salt-cured steak method looks interesting. The last steak I did I tried a quick refrigerator "dry age" ala Alton Brown or Jeff Steingarten ; it turned out pretty great but it's hard for me to tell how much of that was the drying. These methods don't really accomplish the aging part of the enriching of flavor, they just do some drying, which reduces water and thus concentrates the flavor of beefiness.

The RealThai Food Blog is what travel food blogs should be.

1/30/2008

01-30-08 - 3

Apartment search notes for myself. The little things to remember that you might forget.

A gas stove is crucial; a broiler is nice; a decent fume hood & vent is pretty important; a garbage disposal would be nice. Laundry in the building is a pretty big plus. Hard-wired smoke detectors are a disaster.

Quiet is important. Avoid street-side, especially first floor. Don't be adjacent to the building's main door or mail boxes - the mail boxes are surprisingly loud. Don't be adjacent to the laundry faccility, people will use it at all hours. Similarly don't be near the dumpster. Don't be adjacent to parking, especially if car head lights will shine in your windows. One thing you'd really like to test is how noisy people walking on the floor above you is, or you can avoid that by getting a top floor unit.

Insulation and heating. Those single unit gas heaters really suck, especially if there's no good air flow around the unit. Bottom floor units will have really cold floors, upper floor units will benefit from the neighbors' warmth.

A professional complex or management company is almost always a better landlord than an individual; they will follow all the laws, they will have a full time repair guy who will come quickly and fix anything, they will respond to complaints, etc.

Being south-facing the get lots of light is semi important to me.

In general the most important thing is what it's like to sleep there; good sleep is crucial, without it your whole life sucks. The second most important thing is location. Walking to bars & groceries is a big plus. The third most important is the kitchen because I love cooking. The least important is what the living rooms are like and what it looks like; these things make a big impression when you're touring apartments but don't actually matter too much, you can make do with whatever and can always decorate to hide problems.

Also for allergic people like me, the allergen character of a place is really important. I think that pretty much rules out old places. I love the architectural details and character of old buildings, but they are full of mystery allergen sources. In particular holes into the wall spaces are really bad, as are those gas room heater things that so many apartments in SF have. Carpet is really bad, especially the retarded places that have carpet in bathrooms or kitchens. Wood floors and tile and waterproof materials are much better. Curtains need to be washed often.

01-30-08 - 2

I need to get a job. If I could find something where I just write interesting code and don't have to manage or do meetings or any of that junk, that would be pretty sweet.

In the last year I've rediscovered my love for computers. I've gotten back to what I fell in love with originally - just writing little apps for myself. I think of some algorithm or project that I'd like to have for myself, and then I just go research it and write it, and FUCK YEAH I can make this little metal box full of electrons do what I want, it's so much fun.

01-30-08 - 1

I bought an Ab Wheel so I can work up to an ab wheel rollout . OMG it's harder than I expected. I'd love to be able to do an "L-Seat" too but hamstring flexibility is gonna be my limiting factor with that for the forseeable future. That site (Beast Skills) is great, and I find it a fun motivating factor to pick some cool bodyweight move and work up to that. I would absolutely love to be able to do a "flag", but I need to get a handstand pushup first, and before I even start that I need to do more shoulder rehab :(

I should emphasize that the Ab Wheel and pretty much everything on Beast Skills is a super-advanced physical exploit and should be not be attempted by beginners and should never be done without proper warmup and technique. Now of course I'll probably go ahead and ignore my own advice and hurt myself, but you've been warned.

1/29/2008

01-29-08 - 1

My bud Drew finished his XBLA game "Poker Smash"; it's an idea he had when we were working at Oddworld. We used to play Tetris Attack on an old SNES to burn off steam (ba-kak!), and we were all totally into poker and thinking about capitalizing on the poker boom, Drew had the idea that it would be cool to do like a Tetris Attack but where you have cards coming down instead of just colors so you can make straights and flushes and stuff, not just match-three. So Drew actually took the dive and went indie, and against everyone's expectations he actually finished! Along the way it became a lot more than that simple idea, the bombs and freezes and stuff actually make the gameplay really different. Anyhoo, help the man out and Digg Drew's Game ; more at Void Star website

1/27/2008

01-27-08 - 2

So this interesting dude Bret sent me some audio help and I checked out his site : WorryDream ; there's a lot of entertaining stuff there, but the "Bio" section is one of the coolest geekisms ever.

Jammin Power / James A. Moorer has a bunch of cool articles from the infancy of digital music processing (the scanned older papers are the good ones); they're both amusing for the historical context, and also because the technical content is quite clear.

01-27-08 - 1

Okay I put up the binary of the guitar tuner app

It's a little ugly but I think it's pretty functional. There are more things I could do on it for sure but I'm gonna try not to waste any more time on it.

This was built on the IGJ4 sound engine which is really cool and should really be cleaned up and released to the public domain some day. There's no IGJ4 web page, but it was made by Atman Binstock so I'll link to him.

My references :

YMEC software - Introduction to simple sound measurement using a notebook computer
The Scientist and Engineer's Guide to Digital Signal Processing
Tartini - The Real-Time Music Analysis Tool
SWA Services Page
Ron Nicholson's Digital Signal Processing Page
PARSHL An AnalysisSynthesis Program for Non-Harmonic Sounds Based on a Sinusoidal Representation1
Music Technology Group - News
Music 147 Final Exam Preparation
James A. Moorer's Published Articles Page
Introduction to Pitch Detection
Introduction To Filters
High-Speed Analog-to-Digital Conversion - Google Book Search
Harmonic oscillator - Wikipedia, the free encyclopedia
Guitar tunings - Wikipedia, the free encyclopedia
Goertzel algorithm - Wikipedia, the free encyclopedia
DiscreteTFDs -- Time-Frequency Analysis Software
Digital filter - Wikipedia, the free encyclopedia
Butterworth C
biquad filter cookbook
Biquad C

1/26/2008

01-26-08 - 3

Some pitch detection followup :

I'm curious how those little hand held electric guitar tuner things work. I can't really find a description on the net, if anyone knows gimme a shout. They might use oscillators tuned to the notes and do some kind of interference thing? You certainly could make a pretty simple DSP thing using Goertzel response filters; you only need to track 2 filter responses, one on each side of the target frequency.

Paper : "A Smarter Way to Find Pitch" : this is basically just autocorrelation. They normalize in a slightly funny way, what they're doing is :

< x * y > / ( sdev(x) + sdev(y) )/2

That is, dividing the raw correlation by the average of the two variances. The true mathematical correlation measure is :

< x * y > / ( rmse(x) * rmse(y) )

Which is a geometric average of the variances rather than a linear average. It's unclear to me why you would choose one or the other, both are correlations in -1 to 1, but the latter is more well justified as a true measure of correlation.

I also went ahead and did fractional bilinear bin indexing for autocorrelation, but the fact is it's just too noisy for that to be worth anything (also the parabolic interpolation is probably a better way to do the same thing).

Paper : "YIN, a fundamental frequency estimator for speech and music" by Cheveigne and Kawahara. The "YIN" method is autocorrelation with lots of heuristic improvements. One good idea there is that rather than sampling fractional bins you can just use parabolic fit of the autocor results to give you sub-bin accuracy. Another good idea is searching around trying different offsets for your autocor (sliding the phase of the autocor window) in addition to searching for different periods. In theory different offsets shouldn't matter but with noise and transients finding the best offset might help a lot. At the end they talk about noise and very ways to address it but it's all very nasty. This is one of those messes where it's hack piled on top of hack you just know this can't be the right way to approach the problem.

Paper : "Accurate and Efficient Fundamental Frequency Determination from Precise Partial Estimates" : goes over mostly the same material I went over and is a pretty well written paper.

Most of the modern papers on the subject are about second level topics, like finding the fundamental frequency from a harmonic spectrum, or tracking pitches through time. There are lots of these, but the most elegant that I've found is "Maximum a Posteriori Pitch Tracking" which is quite solidly built. For their basic pitch likelihood they use the true autocorrelation.

There are some quite strange things with sound and pitch and human hearing. Especially with voice and some stringed instruments, the fundamental frequency, what we actually hear as "the pitch" can actually be very quiet. eg. you perceive the sound to be of pitch "F" , but the actual peak at F might be tiny, and instead there are peaks at 2F and 3F. Which is another weird thing, the sound at 3F is actually a different note (unlike 2F and 4F which are the same note at different octaves), but you don't really hear it as a different note, it's perceived as part of the timbre of the instrument. Over time as a string sounds, the intensity of the various harmonics can rise and fall; the fundamental might sound strongly at some point but may be totally quiet at other points; the funny thing is that we just sort of hear this as a pleasant variation of the sound, we don't hear the "pitch" changing at all. With a guitar the magnitude of the various harmonics can be very strongly effected by where exactly on the string you pluck it. If you pluck right in the middle of the string you will get more of just the fundamental. The sort of normal place to pluck is about 1/4 of the way along the string which gives you F and 2F very strongly, but quite often 2F is much stronger and we still perceive the pitch as F. I'm way out of my element on this stuff but it's interesting.

Okay, so 3F is the "Fifth" ; Wikipedia has a good page on Equal temperament . So like, when you play a "C" , often the fifth harmonic (a "G") is very strong at 3F, but if you play a "G", you won't hear a spike at "C", the fifth from "G" is a "D" , so hearing C+G = C with fifth , while hearing G+D = G with fifth, etc.

Also I found this research app : Tartini which is pretty sweet in theory ; it tracks pitches over time and makes nice graphs and can output musical scores and all that, it's got a nice useable GUI. Unfortunately they use a pretty ass pitch detection method, it's super noisy and not useable on my setup. If you had a professional mic and a sound booth and all that stuff it might be pretty nice.

01-26-08 - 2

This pitch detection play has got me thinking about two general algorithm/programming things that have been running around my head for a while.

One is how nice it is to work on things that humans do better than computers. Humans are just AMAZING at pitch detection. We can pick out the pitches of individual instruments or voices even in the middle of massive amounts of noise. Obviously there are tons of other things humans still do better than computers - play poker, compress text, recognize images, etc.

There are a few advantages to working on these things. For one thing, it lets you know for sure that there does exist a solution that's within practical reach. The human brain is complex but it's not many orders of magnitude beyond what a computer can do these days, so you know that if a human can do it, you could teach a computer to do it and actually get an algorithm that runs fast enough. If you didn't have that proof of feasability, you might spend a long time working on a problem and find out it just can't be practically done. The other big advantage is that you can sort of ask yourself how you do it. Copying the way that humans approach the problem isn't always the best algorithm for computers, but it is an interesting reference and lets you sort of get a personal closeness to the problem. It also gives you a really good sanity check, when some retard says "I've got this image recognition algorithm and it's state of the art nyah" you can just go "look dude, any human can do better so obviously there's a lot of room for improvement". It lets you know that it's worth still exploring, which is one of the most useful pieces of information to have; you don't want to spend a long time researching a better way to do something if there might not be a much better way - know how close you are to optimal is very valuable information. eg. the great ability of humans to predict text tells us that state of the art text compressors are still missing some crucial and it's worthwhile to explore further in that field. If you just looked at the way they've been asymptotically improving you might think they were near a dead end.

The other general topic I've been thinking about is the "physics way" of exploring new algorithms. In physics when you're trying to write down the equations of motion (you usually want to write a Hamiltonian or a Lagrangian), if you don't know exactly what they should be, you take guidance from the units and the symmetries of the system. Weinberg does this beautifully in his QFT book, but Feynman does it all the time in Lectures, and actually it's a really common trick in fluid dynamics.

Just as an example, say you want to write the Hamiltonian for a harmonic oscillator and you don't know what it is. You know you have a mass M and a frequency W to work with. Of course you also have the momentum and position, P and X. Your H has units of energy, so what can you write down that has units of energy? Well, PP/M is one. You can also make a fake momentum Q = M*X/W , so QQ/M is one too, which is M*X^2/W^2 , which is in fact the right term. But, there's more. You can also make a unitless number from (P/Q). Any time you can make a unitless number you can stick it anywhere you want. If we were in 3d you would require symmetry under rotations; eg. if I rotate my coordinates H shouldn't change, which would mean that only terms in X dot X and P dot P would be allowed, but I could still make a unitless number from (PP/QQ) and screw around with that, though these terms have poles so we can guess they're not the system that we want.

The point of view in physics is that any equations of motion that you can write down which have the right units and symmetry are perfectly valid physical systems which might exist somewhere or model some real physical thing. If you want to model some specific physical system, you have to find the one of those possibilities that matches your situation. Typically we want to start with the simplest possible model and see what kind of behavior that gives us; adding more terms is certainly allowed but generally models some more complex system.

I use this same kind of thinking to explore algorithms. Say you're trying to write a correlation between two vectors X and Y. You want the output to be unitless, so it's independent of the units or overall scale of the inputs. You want it to be independent of the length of the vectors (in a simple linear sense, obviously it will be effected, but if you just repeat all the same values twice it should be unaffected). So, there are various things you can write down that make sense. The numerator should be something like < X * Y > or < X - Y >. To make it unitless and unaffected by overall scale you need to divide by something like ( < X^2 > + < Y^2 > ) or < X^2 > * < Y^2 >. You want symmetry in swapping labels X <-> Y so other forms are no good. All of these possibilities that are allowed by symmetry and units are perfectly viable candidates. There's something else which is totally an option which is subtracting off the average of each vector. Using the physics/symmetry point of view, we should consider all of these to be possibilities. Fortunately in computers we can easily just try them all and see what's best.

There's a few things that should raise your spidey senses. Whenever somebody writes an equation which doesn't have the right symmetries or units or invariances. Like anything that's not immune to scale and bias in general should make you wonder why the units and zero-point have become crucial parts of your problem. The other thing is when someone is trying to write down an equation and just pulls some terms out, and you see that there are lots of other possibilities which are perfectly valid. Why was one chosen over the other? Often there is no good reason and you should consider the other possibilities.

A common example is averaging. You can take an arithmetic average : (X+Y)/2 , or a geometric average : sqrt(X*Y) , or a pythagorean average : sqrt( X*X + Y*Y ). All are perfectly valid depending on your problem - and in fact you can take the ratios of them to make unitless numbers which you can stick anywhere you want.

01-26-08 - 1

BTW if anybody has good links to highpass/lowpass/bandpass filter info, drop me a line. I've read some articles about generating filter coefficients, and it's all very complicated. I found some Java applets to give you coefficients, but they take the frequency as numeric parameter which is horrible, I want functions of the frequency. I have some code from Jeff which appears to be a biquad filter. Biquad filters are 2nd order discretizations of the traditional analog filters; biquad filters are a general class which can be gauranteed to be stable, unlike other filters which can blow up badly at poles (not all biquad filters are stable but the ones you want are). The site "MusicDSP" has this cool BiQuad Filter Cookbook . Actually there's a lot of fun stuff at MusicDSP. Their other code section has a lot of random contributed code snippets, some of which are intended as optimizations and are totally retarded, some of which are interesting.

Well, all these biquad ones I've looked at are just junk because they're so low order. Low order means they introduce very little delay which is nice, but they're like super low-order shape approximations of what you want. Just playing around it seems like need to get to like order 20 or more to get decent filter response that actually looks like what you want, eg. in my case a highpass with a very narrow transition band and a very quiet stop band. Also sort of an odd thing but it seems hugely preferable to filter in non-real-time. That is, instead of only filtering using past data, which is asymmetric and introduces a big delay, it would be better to filter time-centered on offline data.

1/24/2008

01-24-08 - 1

Some notes on accurate pitch detection in sounds :

You have a sound buffer in time space buf[i]. You captured the last N samples. Obviously using more samples gives you more precision, but longer latency (less time resolution). This is like the Heisenberg uncertainty principle kind of thing. For accurate pitch detection, you have to eat some temporal delay, around 1 second, and use 16k-32k samples. (pitch resolution will be like 1/N - but if your sounds are shorter than N using too long of a buffer will give you lots of nasty noise from partials)

Obviously an FFT is the first place to start. If you have N samples, there will be N/2 frequencies in the spectrum. The bottom frequency is 0, and the top frequency is (samples per second)/2. The resolution is thus (samples per second)/N Hz. So for example if you have a 44k sample data and you do an FFT with 44k bins, your resolution is 1 Hz. That sucks bad so obviously we need to do more. Note that you're doing an FFT of only a portion of the sound, which is technically a "Short Time Fourier Transform" (STFT).

Before you FFT you want to apply a window to the buffer. The reason is that if you just FFT a raw sine wave, if it happens to line up exactly on one of the FFT bins you will get a nice single peak, but if it's between two bins, it will spread out in this evil spectrum. If you multiply the data by a window, then the spectrum will be the *convolution* of the original spectrum by the spectrum of the window. Nice smooth windows have fourier transforms that are like sinc functions, which act to sharpen the result around the true peak. In any case a "Hann" window (simple 0-1 cosine) works great.

Once you have the FFT you create a power spectrum with the square of the real and imaginary parts. You now have N/2 power samples.

Another note on the FFT. Your input buffer had N samples, but there's a funny thing you can do to get more resolution. Do your FFT with M samples (M > N) and just pad the buffer up with (M-N) zeros. Since you windowed your buffer it already goes to zero on the edges, so you can just tack on a bunch of zeros. This effectively improves your FFT res to 1/M instead of 1/N. There's some weirdism here I don't quite get; you're not really improving your resolution at all, you're just getting more bins in the FFT and the FFT of the zero-padded data is really just some interpolation of the non-padded data. Also the PARSHL guys do this thing where they shift the buffer so the zeros are in the middle; I'm not really sure why you would do that, applying a constant shift to the buffer before FFT is equivalent to applying a constant phase shift to the output of the FFT. Anyhoo.

A practical issue you're going to have to address is noise. Normal computer mics are just awful. I found that the noise is primarily low frequency. There are two hacky things you can do. One is set a treshold intensity for the power spectrum; anything below that is treated as zero. Another is a threshold frequency, any values below that are treated as zero (more generally you could set a region of interest, and ignore all entries outside that region). A more general thing that I found to work nicely is just to sample the noise; tell the user to shut up and read the mic for a while and average those readings. Then scale that up by 1.5 and set that as your noise base. Subtract that noise base off all future power spectrums.

So, now you can just find the peaks in the power spectrum and those are your principal frequencies. I'm working on pretty clean sounds so I have a simple heuristic (just find the one sample of highest intensity). The audio compression algorithms have complicated heuristics to track peaks coherently across frames.

Once you have a peak bin index you can refine its location. You want to try to make a guess at where the true center of the peak is, which may not be at an integer bin location. Since we windowed, we know that a pure sine will turn into a sinc, so we want to just fit a sinc near the peak and use the location of the sinc. In practice, you want to only use a few samples near the peak so that you don't run into other peaks when you do the fit. Also in practice you don't need to actually fit a sinc, you can fit anything with a smooth peak, such a quadratic or a gaussian. Finding the center of a gaussian fit is super easy. For an array of data[] the center of the Gaussian fit is Sum{ i * data[i] } / Sum{ data[i] }

Okay, the next thing you need to deal with are the harmonics. Most sounds have harmonics, which means if the fundamental frequency is at F, there will also be peaks at 2F and 4F etc. There are a few issues here. One is that with naive peak tracking the peak could jump around between the harmonics. That's easy to deal with by treating your frequencies in "octaveless" space, that is treat frequency as a toroidal value where 2F is equivalent to F. The other is a little more subtle, which is that the spacing between the harmonics can actually be more reliable than the frequencies of the haronics themselves. Some of the frequency algorithms use the FFT of the FFT, which will give you the spacing between the harmonics, there's this whole cepstrum thing, bleh I don't do any of that.

I should take a second to remind you that musical notes are geometrically related. Octave frequencies are 2* apart, and each of the 12 notes are *(2^(1/12)) from each other. Standard A is 110 Hz and all other notes you can find from there. You can put a frequency into "note space" by doing 12*log2( freq / 110 ). That will be 0-11 in the fundamental octave, or you can do a mod(12).

One thing you can do with the harmonics is wrap your FFT to improve accuracy. For one thing, the higher harmonics have more frequency accuracy. If you divide your spectrum up into octaves, each octave gets twice as many bins as the one below it. The bottom octaves only get 1-2 bins so you can't really measure notes at all there. The top octave gets roughly half the bins of the whole FFT. Actually this is one of the really shitty properties of the FFT, that most of your resolution is wasted up in super high frequency land where nothing good happens. Most music and voice is in the 100 - 1000 Hz range. Anyway, to take advantage of this you want to use the highest harmonic you can. The other thing is to take the highest octave in the FFT spectrum, and bilinear filter from the lower octaves and add them onto the highest octave. By adding them up the little errors in each harmonic average out and you get more accuracy.

Okay, at this point we should already have a really nice pitch estimate, but now that we have a really good estimate we can refine it. We've been working on the spectrum but now we're going to go back and work on the time-sampled wave data. A peak of frequency F in the spectrum means that the samples have a periodic component of period P = (samples per second) / F. (P is an integer number of samples). (one quick note : you can improve accuracy here by resampling your input buffer to give more samples per second; that's equivalent to working with fractional number of samples; in theory it would be best to make all your code work with non-integer bin sampling).

So we have a good estimate of the period of the data (P) which came from the frequency spectrum work. Now we can search around to see if there's a better P by trying P+1,P-1, etc. There are two standard ways to measure the period of the samples. Note that these measures go nuts if you allow P to roam globally (because it's garbage for small P and also the periodicity is itself periodic in P), so you need this very good seed value to start the search, then you just look for a local max.

1. Autocorrelation. This is the linear correlation of samples[t] with samples[t-P]. You're basically shifting and multiplying by yourself. Find the P with highest correlation. This thing sucks balls. The problem is that it is very highly affected by noise or other signals at lower frequencies. Basically for it to work ok, you need the autocorrelation of samples[t] with samples[t-2*P] and samples[t-3*P] to all be very similar. In fact they are not if there are big low frequency waves running through the data. Now in theory you should be able to fix this by running a high pass filter over your data with a frequency that's like F/2 to get rid of all the low frequencies and just leave the stuff near F. Hell maybe you could just do a bandpass around F and then autocorrelate on that. But there's no point to muck around here cuz there's a better way :

2. Noll "Maximum Likelihood". I prefer to call this "Coherent Average". Basically what we want to do is to look at the waveform in a periodic window of length P. You put your waveform in this window by wrapping on the period and averaging all the values that go in the periodic window. Any components which are periodic at length P will add up coherently; all other components will add destructively. This is actually a cool way to look at your waveform too. It's sort of like a tuned oscilloscope. If you have your oscilloscope tuned to the right frequency, the waveform will appear to stand still. If you tune it out of phase the waveform on the scope will move; here it will destructively add and go to zero. To find the best P, select the periodic window with the highest rmse.

There's another approach to doing this refinement on the frequency, and that's to use some kind of bandpass filter response. What we want to do is take the sample array and apply a bandpass centered on some probe frequency F. We then measure the total power output by the bandpass and that tells us how close to are to tuned to the actual frequency in the sound. Then you can search around with F using a binary search or whatever to maximize the power output and thus find your true frequency. The nice thing is we can explore fractional F without writing a bunch of code to do correct non-integer bin sampling.

The coolest bandpass for this purpose is the "Goertzel algorithm" which is a really fast simple filter nicely peaked at the probe. One page that actually talks about Goertzel as a bandpass . I dunno maybe there are actually more appropriate bandpass filters for this purpose, you want one that is kind of like Gaussian shaped or something with a single point max, not a flat top one.

BTW I like to think of this is as a damped resonant harmonic oscillator; you're banging it with a bunch of forces, and then you measure how much its moving at the end. It will only really get moving if you're banging it on resonance, so then you tune it to go searching around to find the resonance where it responds most. Looking at it this way it's really also just like a radio receiver. You're tuning your radio oscillator around the frequency that you think you should get a signal and you look at how much power you're receiving, and tune to maximize the output.

With these methods you should be able to measure a pitch to around 0.01 Hz (@ 110 Hz).

BTW there are more things you can do using frame-to-frame information, such as tracking how the peak is moving from frame to frame with phase information (see the "phase vocoder"). That could theoretically give you even more accuracy but I'm not yet doing any of that. When we converted to a power spectrum we threw away all the phase information in the FFT which is good information that we could use. Basically if you measured a peak at frequency F1 and phase P1 in the first frame, and then you see F2 and P2 in the following frame, you can figure out that that's one wave of a linearly varying frequency F + dF*t with a single phase.

Another note : frequency-space pitch detection is very accurate & robust for high frequencies, but breaks down badly for low frequencies. Really any octave below a guitar's low E at 82 Hz gets pretty ugly because the spacing between notes becomes close to or smaller than one FFT bin. On the other hand, time-domain pitch detection is really ugly for very high frequencies, because the period is only a few samples which means that the quantization due to the sampling rate becomes very hard to deal with and the period is very inaccurate and sensitive to noise, but conversely time-domain detection is quite good for low frequency pitches (as long as the frequency isn't so low that you have too few periods in your buffer; if you have a 1 second buffer you can't really work below 8 Hz or so).

There are other obvious things you could do that I'm not bothering with. One is dynamic resolution. When you detect that you have a nice long run at a steady pitch (when a string is sounding) you can use a big window which will give you better pitch resolution. If you use a big window all the time though it would give you horrible latency and bad noise from the transients and attack. So if you detect that the signal is highly varying in the big buffer you shrink your buffer down so that during times of rapid change you can still respond quickly, and you just have less accuracy during that time.

1/23/2008

01-23-08 - 1

It's funny that the limitting factor in human success is generally "energy". Everyone could do anything they want so much better if they just work at it and hustle. The real advantage of things like assistants isn't that they save you so much time or they do things you couldn't do yourself, it's that they let you save your get-it-done energy for the things that are important. The funny thing is that there's no reason why we shouldn't all have infinite energy to do everything we need to do. All the hustling and studying doesn't really burn a resource that we can't replenish easily enough with some food and sleep.

1/22/2008

01-22-08 - 1

I'm making Chicken Pot Pie right now. Frozen pie crust is fine. Thicken with a roux. Toss in whatever pleases you. Fennel and leeks make it hoity toity. Such good soothing cold weather food. The best reference recipe I could find was at this food blog : Miche Mache . There are a lot of great food blogs out there, but there needs to be some kind of recipe aggregator that points to them and rates them or something. On the flip side, there are these recipe aggregator sites like "cooks.com" but all their recipes are like "use a can of chicken soup and put pillsbury biscuits on top for the crust" and then the retards give it 5 stars.

I've given up on my master poker project. I was bored and aimless for a few days, but now I'm working a quick realtime sound play app in the igj4 framework. It started because I wanted a guitar tuner helper app and I downloaded and installed like literally 20 of them and every single one of them sucked absolute donkey balls. I'm about two days in now and it's looking quite promising, I should have something to post soon. In the mean time you can scope out some of my reference material :

YMEC software - Introduction to simple sound measurement using a notebook computer
Ron Nicholson's Digital Signal Processing Page
Introduction to Pitch Detection
High-Speed Analog-to-Digital Conversion - Google Book Search
Guitar tunings - Wikipedia, the free encyclopedia
DiscreteTFDs -- Time-Frequency Analysis Software
Digital filter - Wikipedia, the free encyclopedia

1/20/2008

01-20-08 - 2

"Free Lunch: How The Wealthiest Americans Enrich Themselves At Government Expense (and Stick you With the Bill)" looks like a pretty solid book with lots of specific case evidence. There are two good interviews online from rather different sides : on Democracy Now and Reason magazine (libertarian) .

One thing we should understand is that "selective libertarianism" actually makes markets less free and less competetive. There's a wing of the Republican party that supports any tax cut or reduction of regulation. They claim to be supporting the goal of free markets and libertarianism - lower taxes, less regulation, smaller government. That goal is understandable and reasonable in theory, however in practices we rarely actually get an across the board reduction of regulation. Instead taxes are lowered for some specific thing, or regulation is reduced on one specific thing. This is what I call "selective libertarianism" and it's actually worse for the competitive environment than just leaving the higher taxes and regulation that was more even. The supporters claim they are opening up the market for business, but in reality they are supporting one specific business or one specific practice, which is highly distorting of the market.

Low unemployment is often trotted out these days as a sign that economy is basically healthy. There are a lot of ways those numbers are questionable, but even aside from that I'm skeptical that unemployment actually means much. You can have low unemployment (eg. China or India) and still have people in abject poverty because the jobs are just awful. You can have very high unemployment (like much of Europe) and yet still have a high standard of living because the welfare is so generous (which is what causes the high unemployment, people won't take the shitty jobs because they don't have to).

01-20-08 - 1

We went hiking yesterday off Bon Tempe lake near Mount Tam; it was probably the nicest hike we've done in the whole area. In particular the Kent Trail along Alpine Lake is just gorgeous, lots of variety, not too steep, good mix of trees and open spaces, some redwoods, views, plenty of sun. It was perfect. It's a little crowded on the weekend but I bet it's nice and empty during the weekdays. I also enjoy checking out the dams and pipes and pumpstations and all that stuff too. I also finally found a good trail map of the whole area. You can figure out whatever loops you want of whatever length.

1/18/2008

01-18-08 - 1

Economists who argue that there is no disadvantage to job losses caused by free trade are being intentionally dense, and it's frustrating. The debate is centered on the affects on the US in terms of outsourcing - we lose some manufacturing jobs to 3rd world countries, and in exchange we get cheaper goods to buy. Basically their argument says the net benefit from the cheaper goods is greater than the loss of someone's job. They argue that someone losing their job because it's no longer as cost effective as overseas is nothing to be bothered by, and the types of jobs we do will wind up being more efficient and profitable.

This is all sort of true, but it's also very naive and "1st level" discussion. It's the background that everyone should already know that gets us started talking about the more subtle issues.

1. risk/stability of jobs : Every economist should know that making a "trade" (in this case giving up a manufacturing job for cheaper goods) is not necessarilly good just because it's +EV - you need to look at the risk you're accepting as well. Manufacturing jobs provide a powerful stabilizing base to an economy. It provides a certain number of jobs at a factory which you know with relatively high certainty will be there, because the company needs to keep the factory pumping. Having a stable job base like that has value far beyond its basic income level, because it smooths out economic bumps and it provides a reliable job for people in a certain location. Different types of job are more or less fluid. Jobs that require little specific training and low cost or time to set up are very fluid (call center operators is one example). Some jobs are very non-fluid, which brings us to :

2. industrial inertia and economic fluctuations : Having an economy based entirely on fluid jobs is very dangerous, because it means that those jobs can quickly leave for more suitable places if economic conditions change. Having an economy based on very non-fluid jobs such as manufacturing is very stable in the sense that even if it becomes more desirable to have those jobs elsewhere, it will still take a lot of startup money and time to get them set up there. The problem is that once you lose those manufacturing jobs, you are now in the position of having difficulty getting them back. Say the world economic conditions swing the other way and suddenly it would be best for you to get back into manufacturing. Because it's not a fluid job, you can't just do that, you don't have the trained people, the facilities, the infrastructure, and you may go through a very long recession before you can get back into manufacturing. BTW this is why there is some value to producing your own food and extracting your own natural resources even if it's not the cheapest place to do it, just to keep the capacity domestic so that you have some stability in case you need it.

3. nonlinear value of money : When a worker loses a job and we get cheaper goods, our economy may have a net benefit, but who gets that benefit? It's generally everyone but the workers who lost their jobs, even if they get other jobs the median salary of the new jobs is much lower. It maybe +EV in terms of total dollars in the economy, but it's unclear if it's +EV for the median (not the mean). In particular we'd like to judge using a nonlinear measure of value. Providing slightly cheaper goods to rich people is of very little benefit to the economic health of the society. Providing a slightly higher wage to the lower/middle class is of much greater benefit. Basically dollars should be valued at something like log(dollars) per person.

4. individual difficulty of job change : In general, there are a lot of people who say "if your employer is rotten, get a different job" ; they treat jobs as if they are a fluid thing where someone can just jump to the most suitable job, and thus the system will shake out so that the appropriate jobs go to the appropriate people. The reality is that job change is very difficult and of very high cost (both monetary and non-monetary cost). For example, someone who loses a manufacturing job may need years of expensive training to find an equivalent job; that's not only high cost, it's high risk since they don't know if that job will be there when they're done. They may have to move to a different part of the country; again that's high cost and high risk and has very high non-monetary cost, they may have various reasons they want to stay where they are in their home with family/friends etc.

Now, what should we actually do about it? Then we can get into interesting tradeoffs. Protectionism is very bad in a lot of ways; certainly the extreme French-style protectionism is very harmful. The US has long practiced (and still does) protectionism through subsidy and tarriff. On the other hand, contending that losing stable manufacturing jobs is not a bad thing at all puts us back on level 0 where we can't even start an interesting discussion because we're arguing about what the problem is.

This has been a brilliant tactic for scuttling progress on a myriad of issues. The most obvious is global warming, where instead of having a mature discussion about what we should try to do about global warming and what the costs would be, instead we're mired in this ridiculous farce of a debate over whether it even exists.

Let's be clear, free trade on the whole is generally good (though what we have now is really a complex set of rules that distort the system far too much to be called "free"). The benefits on the whole are too good to pass up, but that doesn't mean we should ignore the downsides. If we can make some small policy tweaks to shift the economics so that good quality stable jobs are viable in our country, that's clearly a good thing.

1/17/2008

01-17-08 - 2

I'm a big Ken Loach fan; he's a master of capturing little everyday slices of life (usually lower class life in the middle of England). He certainly doesn't romanticize his subjects, his camera looks on with a quiet sadness. I really like the style of the movies; they're not quite false-documentary style but they're extremely simplified, always on location with natural lighting.

01-17-08 - 1

My TIPS are finally doing well. It seems to me we have a pretty high probability of going through the "theoretically impossible" (actually rare) phenomenon of recession and inflation. The domestic US economy is far weaker than it might seem by just looking at the S&P, because large US corporations are doing very well on the international market. The inflation will be driven partly by the extended period of low interest rates and tax cuts, and partly by the low value of the dollar which drives up the price of international goods in terms of dollars (oil is most significant but all commodities are sky high in terms of the US dollar). One might argue that inflation is being kept artifically low by the flood of cheap goods from China which is pegged to the dollar.

1/16/2008

01-16-08 - 2

There's been some recent popular press on MRSA outbreaks in San Francisco and Boston. It's unfortunate that they're painting it as a "gay disease" like they did with AIDS, that makes the majority of Americans think that they aren't part of the problem. MRSA is Methicillin-resistant Staphylococcus aureus, a horrible bacterium resistant to common antibiotics. The fact is MRSA is booming all over the US; it mainly comes from hospitals, where workers are horribly lax about proper cleanliness and hand washing. Several outbreaks have happened recently at schools around the US. Ironically parents respond by giving their kids antibiotic hand creams.

There are many drug resistant bacteria out there, but normally they would be rare. They only thrive in areas that have been cleansed of non-resistant bacteria through use of antibiotic cleansers. When the microbial population is wiped out like that, the resistant bacteria step into the empty space and thrive.

We've been pouring antibiotics into everything for the past 20 years - livestock feed, household cleansers, treatment of viral colds, etc. It's only a matter of time before this leads us to new antibiotic resistant pathogens.

What makes matters worse is that bacteria don't evolve in the same way as other species. In normal evolution, each bacterium would have to evolve drug resistance on its own. Bacteria, however, can share genes through "lateral gene transfer" (most often mediated by bacteriophages which grab snippets of bacterial DNA and take it over to other bacteria). The result is that drug resistance in one species can be transfered to a completely unrelated species. So if even one bacterium develops a certain resistance, that can spread all over the bacterial spectrum.

The media needs to stop painting this as another "gay disease" and start raising awareness of how everyone's overuse of antibiotics could bring a horrible plague upon us all.

01-16-08 - 1

The honest encyclopedia entry on David Brooks

1/15/2008

01-15-08 - 1

Wesley Snipes has accomplished something very impressive : making the scientologists look sane. He tried to establish a military training facility for Nuwaubians

1/12/2008

01-12-08 - 4

Mavericks big wave surf contest is going off right now. You can watch it live.

01-12-08 - 3

I'm reading "Banco" the followup to "Papillon". It's obviously a shitty concocted followup to make a buck after the first one did well, but I'm still enjoying it. While I'm reading I feel energized, like "this is the way to live!" and "I could be like this guy" just running around and having adventures. Unfortunately that feeling goes away quickly when I stop reading.

What can we learn from Papillon? Don't overthink decisions. Just make up your mind quick, don't really worry about the pros and cons and long term effects and everything, just do something and do it 100%. But don't stick to it either, if it's not working out, abandon it and do something else. Always have a goal. Papillon admires people who are "full of life" which means ready to charge head-on into anything at a moment's notice. Don't worry too much about failures, just put them behind you and move on to the next challenge.

01-12-08 - 2

Perfect roast chicken used to be one of those benchmarks for whether you could execute well in the kitchen. These days with digital probe thermometers that you can just leave in, it's really trivial. If you can't do it now you're really just incompetent.

01-12-08 - 1

Choosing Voluntary Simplicity is a good manifesto for how I've been living & wanted to live for some time now. Anything you make yourself is better than the fanciest junk you can buy. A smile is a better gift than money. Doing anything (making something, doing a chore) is better than watching anything. Fixing something or making do is better than replacing. Relaxing is better than being busy. The beauties of nature are better than anything man can make. The pleasures of our senses are the greatest pleasures we have. Not wanting physical things or status is the path to freedom. There's a ton of good self-helpy stuff on that site, but also some silly nonsense.

1/11/2008

01-11-08 - 3

Countrywide took imprudent risks based on bogus finance, passed the risk on to others, paid its CEO at least $500 million, and has now been rescued. What a great gig.

01-11-08 - 2

I suspect there's a very high correlation between people who can cook and people who are good in the sack. They're very similar skills. Really both are very easy. You need just a basic level of dexterity to be able to move your body around deftly and not hurt yourself. You need enough memory to remember what you've tried in the past and how it turned out, so that you can tweak things slightly when you try again. Then the process is simply using your senses to judge what you did, using trial and error to improve your technique, and practicing enough to be able to execute.

01-11-08 - 1

Some things I now know better about my shoulder injury :

In the very early phases I should've tried to move it around more even though it was hella painful. Even using tons of painkiller and ice to be able to just have someone else passively move it around through full range of motion would have helped a lot.

In the recovery phase I think I tried to get back too quickly. I should have spent more time doing just physical therapy to build the stabilizers and stay away from other exercise, like 3-6 months of nothing but really serious therapy exercises.

Most of all, I should have taken HGH and steroids. Low doses in an adult have very little negative effect, and they massively improve your injury recovery. Every injured professional athlete uses them. Your injured tissues heal up faster and more fully, and it's far easier to restore the stabilizer muscle you lost. If I ever get something like an ACL tear, I'll definitely use HGH+juice to recover.

Doctors were pretty much useless. I saw orthopedic surgeons who were shoulder specialists, and physical therapists at some of the top sports recovery clinics, and none of them told me anything I couldn't pretty much find on the internet on my own.

Addendum : I just rewrote this as advice to Brian. Here's the new version :

Go see doctor right away; he won't do anything at all but it will make you stop worrying about whether you should've seen a doctor sooner.

In the first month, keep the shoulder mobile but don't put any stress on it. Move it around while lying on the floor, if possible get in a swimming pool and move it around (but don't actually swim). Move it using your other arm (passive range of motion). The goal here is avoid the shortening of ligaments and tightening of the shoulder capsule that will happen if you keep it too immobile. Try not to keep it in a sling for very long at all. Use lots of ice and NSAID to keep swelling down in this phase even if you aren't really in much pain; the swelling will make the shoulder move incorrectly which will cause the tissues to heal in the wrong location.

As the pain goes away and you can move it around more on its own - do NOT resume sports activities. Don't do anything that puts strain on the shoulder that's hard for you to control, like throwing a ball, yoga, rock climbing, weight lifting ,etc. I know you'll want to get back to normal activities to recover but don't do it. Do start working the shoulder muscles to restore function and strength of the stabilizer muscles, but only in easy to control low weight high-rep movements. You can find plenty of the weird little moves on the internet that will stress the stabilizers, or see a PT. Buy a set of resistance bands to have at home and just play with them all the time.

As you get tempted to resume normal sports activity, ease in very slowly, be careful, and again avoid dynamic moves like throwing a ball or tackling or cartwheels or anything that will apply sudden shocks to the area. Make sure that the stabilizer muscles are leading the way and are strong enough. You absolutely are going to lose some general fitness and muscle during this phase and that is fine, suck it up and let yourself lose some pec muscle, just focus on the shoulder stabilizers.

There are several complications you can pick up from any shoulder injury and your goal is to really avoid them. They are "frozen shoulder", "shoulder instability" and "sick scapula".

1/10/2008

01-10-08 - 1

When coding, I often want to have some random event happen roughly once per mean interval T. There are a few ways to do this.

1. Store the next time the event should happen. When that time passes, fire the event and generate a new time. The new time should be a function of the event time, not the frame time, which could differ by the duration of the frame. This method gives you the most flexibility since you can generate the new time from whatever spectrum you want. For example it could just be a constant probability across some interval, or it could be a Gaussian centered on the mean time.

2. Store a probability accumulator. When the accumulator goes over 1.0, fire the event. When the event fires, subtract off 1.0 The way you step the accumulator has some flexibility, but roughly it should be proportional to the frame duration and randomized as you see fit. The advantage of this over #1 comes if your events aren't always random, and for example if two or three events suddenly fire off, you want them to delay longer until they happen again. For single events this isn't very interesting, but for multi-choice events it provides a way of flipping a coin and reducing the chance of repeats.

3. Use a memoryless random event. This is the only way to do it without any side storage. You have some spot in code where you just want to generate a random event with a certain mean interval and you don't want to have to add another state variable. The only random generator that does this is a Poisson Process with rate lambda = 1/T.

Basically the probability rate lambda is the probability of an event per unit time. But you can only use that linearly over an infinitesimal time slice. For a finite frame length, to be properly framerate independent, you should look at the chance of an event happening over the course of the frame. For a frame of length "dt" the probability of any event happening is :

P = 1 - e^(-dt/T)

Of course technically you need to allow 2 or more events to happen per frame, but if we assume dt << T that chance is tiny and we don't care about it anyway.

So, to check whether you should generate a random event you just do :

if ( frandunit() < 1 - e^(-dt/T) )

You may be familiar with doing

if ( frandunit() < (dt/T) )

which is the non-framerate-independent version that sort of works okay for fast frames and long intervals.

Generally this Poisson random is not generally a good looking random event for graphical events, but is a really nice way to do periodic things without a state variable.

1/08/2008

01-08-08 - 2

Moral sacrifice comes from giving up personal good for the benefit of others. The highest level comes from giving to those who are very unlike yourself, very far away, and very needy, because helping them provides very little reward to you, but provides a huge cost-benefit approach. The very lowest level comes from giving to your own direct family; while it is slightly more admirable than just being 100% selfish, it is not really a big sacrifice because anything you give to your family is still very much benefiting you, even if it's only in terms of love, grandchildren, etc. To admire someone for being a "good family man" is very thin admiration indeed. It's a classic stereotype that even some of the great immoral or psychopathic people can still be very good "family men".

There are various ways to acheive long term happiness (as opposed to short-term acts of "fun" which can't really be strung together to create happiness). The easiest way is probably through having a goal, something to "live for". Whether or not that goal is actually important, if you believe it is and it motivates you, the constant pursuit and minor successes along the way provide a sense of purpose and a way to occupy your time which equals "happiness". For some people this goal is the pursuit of money (money itself doesn't help happiness that much, but the successful pursuit of money can make you happy), for others it's some more rarified goal such as a research discovery or trying to benefit the world. Probably the most common goal which people use to occupy themselves, however, is their family. They will say they "did it all for their family". It lets them go to a horrible job they would hate, if they believe it is a sacrifice to get money for their kids. It gives them an overall purpose, raising these kids, which gives them an overall long term happiness. Again, this is not particularly admirable, in fact it means they are rather weak and unambitious. Everyone needs some goal to live for. More dynamic people choose difficult and interesting goals. People who have no abilities or are afraid or lazy still need some goal to pretend that they live for, and these people generally choose "family".

I've been thinking about why Mike Huckabee gives me the creeps. Obviously some part of it is prejudice on my part against people like him, but I've been trying to force that out of my head to see what else is in there.

One problem with Huckabee obviously is his complete lack of political thought. He doesn't seem to have any policies whatsoever. Certainly he didn't when he started running, but he has cooked a few up. One of the few unique things he pushes is this "fair tax", a national sales tax proposal, which is just one of the most insane things any major candidate has supported in recent memory. Not only is it insane in the sense that it's a political non-starter, it has no chance of going anywhere, but it would also be a huge disaster for the economy. To support the government with no income tax, the sales tax would have to be absolutely huge, prices would shoot through the roof, spending would go way down, there would be a huge black market of people avoiding taxes, and it would be very very regressive.

Okay, aside from the lack of policies, I'm really bothered by someone running a campaign primarily on the basis that he's a good Christian and a nice guy and a family man. For one thing, none of those are really related to the skills you need to run the US. But even more than that, the idea that you would tout your homey Christianity as something to admire is something that I find deplorable. Now, I have no problem with someone being a Christian, or whatever, obviously most of our presidents have been very religious and that's fine, but to be a man who is a Christian running for president is different than being a Christian running for president. It implies an exclusiveness, that we should vote for people of our own type, and it's us against them in the world (combined with all the rhetoric from various candidates about the evil of Islam, the message certainly is being sent that it's our faith against theirs). To me running with your Christianity as a selling point is not that different than running with your Caucasian-ness as a selling point.

01-08-08 - 1

I wanna go ski but I really don't wanna go up on the fucking weekend when everyone from SF goes. I'm unemployed dammit, I wanna go for a Tue-Thurs trip, but Dan can't go, and going up by myself doesn't sound like fun. :(

1/07/2008

01-07-08 - 1

I like to follow the news and politics, but I just can't stand all this election nonsense. I know it's hugely important, the excuse for apathy that "they're all the same" is pure garbage, but the whole US campaign system has become so shallow. The press coverage is almost all about who's ahead in the polls, or trivia about the campaign, who's their press guy, what kind of bus do they have, which state's babies are they kissing now. The actual interviews and speeches are targetted at the retarded press and special interest groups. God forbid you actually ever talk seriously about an issue and admit that it's complicated and you might not stick with the party line, you'd be destroyed.

A parliamentary system would be far better. The American public has no qualifications to choose a leader. We'd do better just voting for a party, and then letting the party choose a leader, presumably they actually have some idea of other politicians's abilities and who would actually make a good leader. Also the kind of political in-fighting that you need to get ahead in a parliamentary system is the same skill that's needed to be a good leader. This is in contrast to a public election, where the ability to win the popular vote is a completely different skill which favors actors and false bumpkins. It's sort of inherently obvious that you should have a selection system in which survival of the fittest produces a victor that is well suited for the job. You wouldn't use an IQ test to pick candidates for World's Strongest Man.

1/04/2008

01-04-08 - 3

Huge rainstorm here today. I'm expecting the power to go out any minute now. Either that or for water to start gushing through these shitty walls.

01-04-08 - 2

The real problem with C++, for my money, is with medium-sized repeated patterns. For major chunks of complicated operation, you can bundle it up in a class or a library or whatever and that works okay for sharing code, because the pain of wiring and complying with the interface is very small compared to the savings. The problem is that the majority of code is made up of these little tiny patterns that you use over and over, but they're too small to bundle up with the weight of C++. That is, the pain of wiring is too great, you would write almost as much nasty possibly-buggy code to do the wiring as you would to just dupe the tiny little snippet.

01-04-08 - 1

Gah, Firefox is so retarded. I Adblock and then I randomly click in the whitespace on my browser and get taken to god knows where.

1/03/2008

01-03-08 - 1

One of the hard things about dating as a way to find your mate is that people are such phonies for the first year. I don't mean they necessarilly even intentionally lie, but everyone tries to show their good side when they're dating, you hide your insecurity and your baggage and your criticism and just try to impress the other person and get along and do things together. Of course it goes well, you're going out to restaurants, you're travelling, it's so easy to get along and like each other in that mode. It's not for perhaps a year when you move in together and start seeing all of each others' sides that you know what a person would be like to marry. Now if you find you don't really like them, you've put a year in to find that out.

Many people get around this by just hurrying up and getting married during the initial easy phase. Then after marriage they find out what they're really like to live with and either make it work or get divorced. That's not a horrible way to go about it. I've always been in the "trying living together and make sure you like it first" camp, but I think people in that camp basically just never get married.

Of course I'm one of the worst about this. When I'm dating I can be charming, talkative, social, I go out and do things and all that. Eventually that just becomes too exhausting for me and I give up and go back to being a grouchy hermit, and my girlfriends are left wondering what happened to the man they fell in love with. It's not even that I'm trying to fool them, it's more that I'm trying to fool myself. Each new relationship I tell myself is a chance to start fresh and be a better person; that this new girl doesn't know what a dork I am and I can just play a new role and live a new kind of life.

1/02/2008

01-02-08 - 6

Software linkies :

DS Software has lots of cool tiny little techy apps, mostly encryption stuff and crc's but also just some little utilities. Good and functional programmer-ware.

tinyapps.org is a huge site full of lots of great tiny useful apps.

Anandtech Freeware list is a good aggregation of downloads.

01-02-08 - 5

Michael Pollan is one of the masters of the modern trend of turning a completely obvious 1-sentence throwaway into a whole book.

01-02-08 - 4

Over Christmas I ran a sprint against my littlest brother. He beat me (barely), but the real insult and injury was that I pulled my hamstring in the process. My middle brother beat me in a sprint a few summers ago, so I am now officially dethroned. It sucks getting old, I'm more and more injury prone all the time, and all my little core disfunctions keep compounding and have become systemic. Things like camping or backpacking are becoming more and more impractical for me.

I've always thought it was ironic that my skills are primarily mental, but the things I enjoy are physical. It's not so simple as some Psych 101 nonsense that I want to prove I can do the things I'm not so good at, the things the jocks used to lord over me in school. No, the pleasures I take in physical activity are the purely chemical pleasures of endorphins, the engorgement of the pump and testosterone, the zen meditative monotony of a bicycle pedal's cadence, the smell of the air and the constant variety of hiking in nature.

In the bigger picture of life, the one thing I've constantly really wanted since I was 16 or so has been to find the right woman, settle down, have a house and kids, be a dad, play with the family, cook, garden, all that stuff. It's sort of a similar irony that that is the exact thing I'm completely not wired to do. I'm a mean bastard and I suck at relationships, I shut people out and make them feel shitty. I would be really really good at being the single bachelor guy who works a lot and makes money and hustles around, that is what my skills are made for, but that disgusts me, I have no desire for that life.

01-02-08 - 3

I think Dick Wolf should sue the creator of "House". "House" is a direct rip-off of Law & Order with just the setting changed. Every episode starts with the cheezy exposure of the crime/medical problem. Then the detectives (House's assitants) look into it, usually screwing up a few things. Then they call in the D.A. / House for advice. They start with one suspect and file a first arrest / make an initial diagnosis and try a treatment. That never works, so they send the detectives for more clues, and some key piece of evidence always miraculously pops up (this is the funniest part - on "House" the assistants actually go and gather evidence from the patient's homes, they couldn't think of any substitution for this part of Law & Order). Finally with the last bit of evidence Jack McCoy makes a brilliant diagnosis and saves the patient's life - though he often has to confront a moral dilemma of his own which brings up characters from his past.

It also is sort of bizarre to me that people who seem to be pretty smart, like Sam Waterston and Hugh Laurie, would choose to spend year after year doing such formulaic dreck.

01-02-08 - 2

I was thinking Google would be way better if they provided a simple Thumbs Up / Thumbs Down mechanism on search results. Then people can look at the links and provide feedback on how well the results matched the search. That feedback can be used to train the search. People love their Google and would be willing to put a lot of time into this. The problem of course is that it would be abused by all the search-rank-boosting jackasses. There are various heuristics you could use to counteract that (like any user that puts in too many signals just gets ignored), but the best soltuion of all is of course a Network of Trust. That way each user is only affected by the thumbs up/down of their neighbors in the trust network (aka their "friends"), so that the spammers would have a minimal effect on the populace since presumably most people would not "trust" them.

01-02-08 - 1

Today I watched the "No Reservations" about Beirut, where Tony goes to make a food show and winds up trapped in an evacuation from the Israeili bombardment. It inspired me to go buy some Arak, the Lebanese anise alcohol. Mmmm, yeah, it's pretty much identical to Ouzo, I can't really tell any difference, and it's also equal to Pastis but without the extra herby notes. Anyway, the show reminded me of that sick episode of recent history that was so little covered here in the US. Lebanon was sort of making some decent progress towards democracy and getting out from under the thumb of Syria, then some nutters on the border kidnapped two Israeli army guys, and in response the Israelis bombed the holy living fuck out of the entire country. Real smart, guys. I'm sure that's not going to further radicalize the country at all. Hard line reprisals have worked great against terrorists for the last 50 years, right?

old rants