Sunday, October 01, 2006

Just A Sample

I keep getting e-mails asking me what I'm up to. Well, I went to the assistant pastor's house today to have lunch and watch the Colts vs. Jets game. It really was a great game down to the last seconds. I've never seen anything like the final play: seven or eight lateral passes. It looked like a children's game of Keepaway. Hilarious, and very exciting.

I'm coming to grips with a lot of things, and realizing what my future does and does not contain. Life's doors are all ahead of me, with none behind left open. It feels tragic, but that's probably because I find comfort in predictability, and here there's none.

Other than that stuff, I'm studying like mad to pass next Friday's test. Since I learn things better when I prepare to teach them, I thought I'd write an essay on Sampling Rate, which contains many concepts I've had great difficulty in wrapping my brain around.

So, if you're interested, read on...

Sample Rate

A sample is a digitally recorded piece of audio. Samples are acquired by feeding audio signal into an analog to digital converter (A/D converter).

One of the biggest factors affecting the quality of the sample taken is the sampling rate. This is the number of times per second that the A/D converter captures the amplitude of the audio wave coming in. The faster the sampling rate is, the more accurate the digital representation of the audio wave will be. Increased sampling rates demand more processing speed and storage space while arguably offering no additional benefit, other than a higher frequency range.

Samples themselves do not carry frequency information. They merely capture the amplitude of a waveform at any given time. The rate at which the amplitude changes is what we hear as the frequency. It is analogous to the individual cells of a cartoon. None of them move, but as we are shown them one after the other, we perceive motion.

Since a human’s ear can only perceive frequencies up to about 20kHz (20,000 cycles per second), we really only have need to accurately sample up to that frequency. According to the Nyquist Theorem, the greatest frequency that can be captured is half of the sample rate. Therefore, an A/D converter operating at 44.1kHz will not be able to capture a frequency beyond 22.05kHz.

Any frequency above this which is fed into that A/D converter will begin to produce undesirable results, a problem referred to as “aliasing.” Therefore, it is necessary to filter out all frequencies above the Nyquist frequency.

This filtration is easier said than done. In a perfect world, we could have an audio filter that maintained perfect pass-through of every frequency below the Nyquist, and total rejection of every frequency above it. If this were possible, we would not need to extend the sampling rate of our A/D converters beyond 40kHz, twice the rate of human hearing. But because filters with gently sloping characteristics are much easier to create than filters with sharp cliffs, we utilize a higher standard of 44.1kHz. This is also why we have continued to extend sampling rates to 96kHz and even 192kHz.

Because sampling reads amplitude at moments in time rather than taking a continuous progression, we end up capturing a blocky, stair-step wave rather than a smooth, sinusoidal one like the original audio.

These tiny inaccuracies are eliminated when we turn the digital back into audio by using a reconstruction filter. This low-pass filter smooths the stair steps back into a continuous wave to reconstruct the original wave.

Note: This essay was edited a bit after consultation with my instructor.

Alrighty... Well, if you're still reading, you're either very technically-minded, or starved for decent reading material. I spared you the diatribe on bit depth. Maybe we'll cover that in a day or two... :)