The world is full of simulators (part 2)

Very few people appreciate the magic that goes into the simulation, using an LCD screen, of all the infinite colors in the world. This magic is possible because all of the infinite colors in the world – each ‘color’ meaning a ‘spectrum’, of different intensities of different monochromatic components – are viewed (for us humans) through the filter of only three kinds of color receptors, or cones.

The top half of this picture shows how a squirrel would look to another squirrel. The bottom half shows how it looks to us humans.

Squirrels, that have only two kinds of cones (instead of the three that we have), therefore also have a correspondingly drab picture of the world. (Drab, that is, by our standards. I am sure squirrel aesthetics works very differently.)

So the eye distills all the colors in the world to three numbers (to combinations of three responsivity spectra corresponding to the three cones, actually, but that’s a technicality). Still, what magic allows us to recreate the world of color, the red-brown and white of squirrel fur, without actual red-brown-white fur, instead using only paint or phosphor?

As an aside: I remember as a kid, I (and many of my friends) were confused by the term ‘primary colors’. In physics, we learnt, the primary colors were red, blue and green. But we knew, from our experience, that if you mixed blue paint and yellow paint (watercolors worked best), you would get green – a ‘primary’ color. What was going on here? I learnt the answer much later. An ideal blue paint would absorb everything from white light except blue. But the blue that goes for blue paint in watercolor sets isn’t actually blue, it’s a kind of cyan, which is what you get when you subtract red from white. So the blue paint isn’t absorbing everything except blue; it’s absorbing red. An ideal yellow paint, likewise, absorbs blue – it’s what you get when you subtract blue light from white light. And when you mix ‘blue’ pigments and yellow pigments, you get white minus red minus blue, which is green. (Here is a very good introduction to the way color works:

But back to simulation: paint simulates color well, because white light falling on blue paint stimulates the three cones of the eye in pretty much the same way as blue light falling on the 3 cones.

Reasoning along the same lines also gave me a very beautiful a-ha moment in my study of sound. I did much of my thesis work in sound compression, and very early in my research, I discovered there were two vastly different means of compressing sound. The first is systems like MP3. These work (roughly speaking) by taking a sound signal, and changing parts of it subtly so that it still sounds the same. This subtly changed signal is vastly easier to compress than the original signal. This process is called psychoacoustic modeling of sound.

The second is systems like GSM, which is used in cell phones. These work (again, roughly speaking) by taking what is essentially ‘white noise’ and filtering it with mathematical systems that model something like hissing and popping sounds. The hissing and popping systems can be parametrized. In a cell-phone, speech is compressed by figuring out which noise-hiss-pop parameters best represent a small segment of speech, and transmitting those parameters alone. Counter-intuitively, this works very well, and just 50 sets of parameters per second will encode very good quality speech. This class of algorithms is called Linear Predictive Coding, or LPC.

I wondered, for a very long time, why there was this crazy dichotomy between MP3 and GSM – both compress sound, but there is no mathematics at all in common with the algorithms.

And then one day it dawned upon me: the algorithms behind MP3 simulate the way the ear hears music, dropping off everything from sound that is irrelevant to the ear. And the algorithms behind GSM simulate the way the mouth produces speech, dropping off everything from sound that cannot be produced by the mouth. That’s why they’re different!

This still remains one of the most beautiful insights I have ever had in Engineering.

(To be concluded, in Part 3[?] of my series on simulation.)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s