Showing posts with label History. Show all posts
Showing posts with label History. Show all posts

Wednesday, November 10, 2010

Musical archaeology

I got my first PC (a 286) in the early 90s, and one of my favorite activities at the time was playing games. In particular, I loved playing the LucasArts and Sierra graphical adventures (like Secret of Monkey Island and the Space Quest series). At the time, PC hardware was expensive, and in particular a sound card was considered a luxury. Most of these games could play rudimentary music through the PC speaker, like this:


It turns out that these games were also able to play much, much better music if you had the right hardware in your PC. Here is the same game on a Roland MT-32:


Remember that this is the same exact game, that came on 3 floppy disks, running on the same 286! There was no CD with hundreds of megabytes of orchestral scores. And yet, the music is all there, amazingly rich, deep, and polyphonic. To understand how this all worked, a little bit of musical archaeology is necessary.

Throughout the 80s and early 90s, the next best thing to the PC speaker was an AdLib sound card:


This sound card was reasonably affordable, and generated music by a process called FM synthesis: mix certain frequencies, produced by independent generators, to produce music. If you mixed the frequencies in the right way, you could simulate various instruments. The music still sounded pretty synthetic, but it was a big step up from the PC speaker. One advantage of the AdLib card is that the music could encoded very efficiently -- the game would simply store the frequencies, durations, and volume for the notes that make up the music, and that's it. This is how a game like Secret of Monkey Island could have reasonably rich AdLib music and still fit on 3 floppies.

At around the same time, Creative Labs started to develop the Sound Blaster series:


These cards could also do FM synthesis (so they were "AdLib compatible"), but they also had a digital sound chip that could play WAV files, or recorded sounds. These sound a lot more realistic, after all they were recorded from real instruments! The sounds, however, took a lot more storage, since the compression was poor. Games that used WAV music sounded a lot better than AdLib, but also took a lot more storage.

Lost in all this is the incredibly rich and largely forgotten history of the Roland MIDI hardware, like the MT-32:


These modules used the MIDI protocol (Musical Instrument Digital Interface) to receive information about what notes to play, along with "hints" (like sustain, echo, and so on). Like in the case of the AdLib, the music was encoded very efficiently, so it could easily fit on a floppy. The reason this music sounded so incredible is that the Roland hardware had inside it hundreds of rich and detailed "samples" of the instruments it was asked to play. When the game instructed the Roland to play middle-C on a piano, the Roland could render this note by modulating its internal sample of a high-quality piano.

The downside of Roland's hardware is that it was expensive. While an AdLib or Sound Blaster card could be had for around $50, Roland's modules cost over $500 -- a small fortune at the time, so few could afford them. Ironically, the musicians at LucasArts and Sierra composed most of the game music on Roland hardware, and included it in the games, but then also shipped "downgraded" versions of it for the AdLib cards.

Creative Labs tried to compete with Roland by means of a technology called "wavetable synthesis". This was similar to the way the MIDI protocol works: the game would tell the card to play certain notes, and the card would have pre-recorded sounds for various instruments. An example of this is the Sound Blaster AWE32 card, which prominently featured the wavetable technology. The problem with this approach is that memory was still expensive, so in order to stay affordable, these cards shipped with limited storage for these sounds, and therefore had fewer instruments sampled at lower quality. Furthermore, the AWE32 protocol was not fully compatible with MIDI, so it was harder and somewhat more awkward to program.

The advent of cheap CDs, at around the same time, eventually rendered the whole issue moot: games could now afford to ship with an entire CD of pre-rendered, high-quality music, so there was no need for expensive MIDI hardware. Roland came out the loser in all of this: it stopped producing PC hardware entirely and today focuses exclusively on other segments of the market.

One nice side-effect of this struggle, that exists to this day is the advent of General MIDI or GM. This was a protocol that standardized the meaning of instruments so that when a program told the MIDI hardware to play instrument #4, everyone agreed that this would mean a saxophone, say. Most modern hardware today (including PCs and Macs) support General MIDI and have sets of instrument samples licensed from Roland for this exact purpose.

Another development related to this, is the advent of sound fonts. These are basically richer sets of instrument samples that can be used instead of the standard ones that come with General MIDI, and therefore can make the same MIDI hardware sound a lot better when playing the same tune.

Let's take a brief interlude and listen to the history of PC audio as told by Monkey Island:


Today you can still enjoy these adventure classics on emulators, such as the excellent ScummVM engine. In terms of sound emulation, here are your options in ScummVM:
  • PC speaker
  • AdLib (FM synthesis)
  • SoundBlaster (in FM synthesis mode, or to play WAV samples, if any)
  • MIDI
For the MIDI category, there are the following sub-options:
  • Use the General MIDI hardware in your PC, with the standard instruments.
  • Use MIDI with a sound-font, to significantly improve the quality of the music.
  • Use a Roland (or equivalent) MIDI hardware attached to your PC.
For the purist, a Roland MT-32 can be obtained fairly easily on eBay for around $50 (you will need an external MIDI interface in your PC, however). If you enjoyed these games in the past, you owe it to yourself to try them again with a sound-font. I recommend Shan's excellent (and free!) sound font which is reasonably close to what you'd get out of a Roland. Here's how to use a sound-font in ScummVM:
  • First, you need a reasonably fast PC (at least 1GhZ; ScummVM uses software emulation for sound-fonts.)
  • Click on the "Options" button.
  • Select the "Audio" tab, and set the "Music Driver" to "FluidSynth".
  • Select the "MIDI" tab, and set the "SoundFont" path to your sound-font file.
  • Launch the game, and be amazed.
In closing, here are two more beautiful pieces from Loom and Space Quest 1, as rendered on the Roland:



References:

Thursday, September 03, 2009

Lead paint

Lead is a heavy metal with lots of industrial and commercial uses, ranging anywhere from batteries used in cars, to protecting nuclear physicists from radiation. One particularly colorful and sad chapter in the history of this otherwise boring metal is the use of lead in gasoline (tetraethyl lead) to prevent engine knock. Bill Bryson writes about it eloquently in his book A short history of nearly everything.

Another common use of lead is in household paint. The reason? It looks good: paint with lead in it is shiny and pleasing to the eye. It's also quite dangerous and poisonous. Lead also happens to be a neurotoxin, it likes to bind with neurons and prevents the normal formation of synapses, which is particularly bad for young children, who apparently can retain up to 100% of the lead that enters their system (adults, as it turns out, are better at eliminating the bad stuff, only about 20% of the lead that enters an adult body stays, the rest is eliminated).

The most common way for children to be exposed through lead is, you guessed it, household paint. Specifically, in older homes, the lead paint can naturally chip and fall on the floor, where a child can ingest it. One easy solution to this is to paint over the areas with lead paint therefore "trapping" the bad stuff and preventing it from flaking or otherwise getting off the walls. In general, good house keeping (cleaning, vacuuming, and in general maintaining the surfaces whether through washing or painting over) does a lot of good and cheaply.

San Francisco's housing stock is old, some of it built before 1900, and a lot of it built after the earthquake of 1906. There are few modern houses, and even fewer built after lead paint was made illegal. Ironically, the more expensive and "fancy" a house, the more likely it is to have lead paint in it; some of the highest concentration of lead paint in San Francisco is apparently in the fancy mansions of Pacific Heights. Besides paint, which is by far the most common place for lead, another relatively common place is glazing on tiles, for example shower tiles. A good rule of thumb is that -- if the paint or the tiles look nice and shiny, they're probably leaded.

It may be tempting to get very worried about lead paint and decide to "strip" it out. This is not only costly -- it involves sanding most surfaces that can contain lead paint -- but it also frees the stuff in the air and it can become a true nightmare to get it all out.

How would you know if you have lead paint in your house? You can hire someone to test it, or you can even do some of it yourself.

One kind of test involves taking flakes of paint and send them to a lab where they are analyzed. To cover the house, the technician has to take a sample from each wall, or at least each room, since some rooms may have been painted with lead paint, while some weren't. If this sounds like a pain, it is. You can also use a home lead-test kit in area where the paint is exposed. The lead-test kit is basically a "brush" that contains a reactant in it, you brush over the paint, and if there is lead present, it turns red. The test is controversial, and has a false-positive rate, but it can give you some idea.

Another kind of test is using an XRF gun. This gun fires off a stream of high-speed particles which only bounce back when they hit something dense ... like a lead atom. The gun approach is far easier to use since you can just take "readings" from all surfaces you care about and the results are instant.

As a side note, it is remarkable to what extent people have ignored common sense or made bad choices in the name of "looking good".

Monday, April 24, 2006

First Oil Refinery

The price of oil and gasoline has been raising steadily recently. The gasoline national average is almost $3.00 per gallon (and obviously over $3.00 in California). Besides the obvious increase in the price per barrel of oil, another oft cited reason is a reduction in refining capacity. This got me interested in reading about how a refinery works. Surprisingly, the world's first ever oil refinery was built at Ploiesti in Romania! The refinery was built with American financial support, only to be later bombed during WW2, and subsequently rebuilt. How the world turns ...

Friday, April 14, 2006

Guided by history

A nice blog with personal touches and interactive guides: Guided By History

From the ashes

This coming Tuesday, April 18th, is the 100 year celebration of the Great San Francisco Earthquake of 1906. The earthquake leveled large parts of the city, and what it didn't destroy subsequently burned in the many fires that erupted. Though it was a great tragedy, the city came out of it stronger and better.

I am looking forward to the many events the city has planned to commemorate this important historical event.

There are two particular events that stand out in my mind.

One is a gathering around 5am near Lotta's Fountain, at Market & 3rd: a place where people first gathered in the immediate aftermath of the earthquake.

The other is a gathering at 7am near the Little Giant at 20th and Church: one of the few (first?) hydrants found to be working immediately after the earthquake and provided water to quench the fires. Every year, children, survivors, firefighters, and others join in painting this hydrant in gold paint, as a strange but moving way to say thanks.

I feel very happy to be part of this important event in the life of this city. Although it commemorates a great disaster, I feel that it also highlights the incredible history and life that followed.