The world of digital audio is opening up to many consumers as PC’s become more powerful at lower costs. Programs like Max/MSP (with Max for Live also available) are allowing anyone with the slightest interest in digital audio to really get down to manipulating sound at a sample level.
With my colleague Matthew Weiss’ article on the basics of digital audio, I thought I’d provide a more detailed explanation of Aliasing, something that is important to understand when dealing with any digital audio.
Eight Bits is a Byte, Four Bits is a Nibble
As stated in Matthew’s article, all digital audio is mathematically represented; you don’t need to understand binary to appreciate that the audio being digitized is being turned into a number for the computer.
The Audio-Digital Converter (ADC) is essentially receiving a graph. It may help to think of it as a camera taking pictures rapidly, and each picture showing a tiny portion of the wave ready to be reconstructed at a later date.
A video camera may take 25 pictures a second, but an example for audio would be 44100 pictures (samples) a second; this is your sampling rate. The information the sample actually contains is the voltage of the wave at the point the samples taken, a little like a co-ordinate for a map.
So for a wave going up you may 0.001v followed by the next sample with 0.002v. All of the samples are then put together to create the digital representation of the waves we’re used to seeing in our DAWs. Aliasing is caused by the sample rate not being high enough t accurately recreate the wave.
How to Lose friends and Alias People
Imagine you have been presented with the values of all the samples taken from a wave you know nothing about, and are asked to use some graph paper to draw out a single cycle of the wave, using those samples.
(click to enlarge)
With a nice high sample rate you would hope to see something like the picture at right. A lot of samples would allow you to accurately reproduce the wave. It would look (or more accurately sound) very much like the original analog wave.
If you read up on Aliasing you will no doubt come across something called the Nyquist Theorem or Frequency. This is the very minimum sampling rate you can use to accurately recreate the sound.
With a point at the Peak and Trough of the wave, you could just about recreate the correct wave (though you would need to interpolate to get the curved edges and not a triangle wave). The Nyquist Frequency is double the audio information you want in your sound file.
So for your music, you want the human’s full hearing range up to 20 kHz (though how many of us can actually hear that figure is debatable). As such, the Nyquist Frequency (and therefore sampling rate would be 40 kHz).
CDs add a little but more lee-way and go for 44.1 or 48 kHz. Remember that sampling rate is very relative to the frequency of the audio it’s sampling. A 20 kHz signal with a 40 kHz would get two samples a cycle (just enough) but a 10 kHz signal with the same sampling frequency would get 4 samples, and so on down the frequencies.