Digitized Sound

From iGeek
Jump to: navigation, search
DigitizedSound.gif

Digitized Sound: understanding samples, rates and digital audio is really pretty simple. Sound is nothing but pressure waves traveling through the air, and hitting your ear -- which your brain decodes as sound (from noise or music). Computers have two basic ways of recreating sound, one is Synthesized Sound (make a waveform and tone that matches the original), and the other is to digitize the sound (sample the pressure wave very quickly, and then recreate it later). This is on how sampling is done.

Pressure waves

DigitizedSound-1.jpeg

In space (a vacuum) no one can hear you scream because there is no medium (matter) to transmit the vibrations/pressure. Underwater, sound (and sonar) travels much further and better, because there is more medium (matter) to transmit those vibrations and pressure.

Let's look at digitized sounds.

Digitization is another word for sampling

What computers (and CD's, telephones, record players, etc.) do, is capture those pressure waves. They use a microphone to convert pressure (sound waves) to electrical current, then sample that current level many times each second. This is called sampling. It is also converting a sound wave into first an analog signal, and then converting that into digital form -- so it is also called Digitization.

Once a sound is sampled (or digitized) we can then send those same voltages out, at the same rate as they were brought in, using a speaker to convert electricity back to pressure waves (which vibrates a cone to push air). Viola, the same sound that came in, is reproduced and sent back out. A speaker is just a device that uses an electric current (and a magnet) to move in and out based on the voltage. This pushes air (accurately) to recreate the pressure waves (sounds). An amplifier is just a device that can power a speaker.

Technically many non-computer devices (phone, radio, tape player, etc.) don't "sample" at discrete points -- they capture the entire wave using "analog" techniques and record that. But these devices aren't perfect, and a little noise (errors in the signal) get introduced each time. Each generation of copy (analog) loses a little bit more quality -- while digitizing can recreate the exact same level every time, so does not lost quality.


DigitizedSound-2.jpeg

A sound wave is drawn as a two dimensional wave -- with pressure (y axis) over time (x axis). The pressure vibrates quickly, and has little peaks and valleys. From one peak to the next peak is the frequency of those sound waves.

The two key parameters in sampling are Sample Rate and Sample Size (resolution).

Sample Rate

The faster a sound is sampled (and played back at the same rate), the better the quality of the reproduced sound. Since the ear can only hear certain frequencies, it only makes sense to sample to a certain point.

Humans can hear sound frequencies from around 16hz (a wave that vibrates about 16 times a second) up to around 20Khz (a wave that vibrates 20,000 times per second). Women can usually hear slightly higher pitched sounds than men, but all people have different hearing.

To be able to reproduce a sound wave, you must sample that sound at least twice as fast as the frequency you are reproducing (so that you will get both a high point, and a low point on that wave). Computers and CD's sample sound at about 44Khz, or a little more than 2 times 20Khz (the highest frequency we can hear). At this sample rate, the computer can reproduce about any sound the human can hear.

Phones sample sounds at around 8 KHz, and humans can easily recognize voices and music across a phone line; but humans can also tell that it doesnít sound very good (they can hear the distortion and that there are parts missing).

To be real pedantic, older phones don't technically "sample" sounds digitally -- but they do chop up the sound (multiplex) it -- which is the analog equivalent of sampling. Same effect, only the process is a little different.


Sample Size

This is the quality of each sample we take. If each time we sample the sound we use 8 bits (256 levels), then that is pretty fine resolution -- but not enough for what we call "high fidelity". Compact Discs sample at 16 bits (65,536 levels) -- this is very good, and allows a sound wave to be a better reproduction.

Some PC cards use the term "32 bit sound card" -- they are NOT talking about the sample size, they are talking about the size of the path (I/O Bus) from the sound card to the rest of the computer. The sound quality is the exact same, it is just that the sound card can move the sound around faster, or with less overhead (time); leaving more for the game or other processing.

Sample Size not only affects the quality of the wave, it also determines the dynamic range of the recording; the difference between the quietest and the loudest sound. Eight bit sound provides approximately 48 decibels (dB) of dynamic range. Sixteen bit sound provides about 96 dB of dynamic range. Humans can hear up to 100 dB of dynamic range.

Conclusion

DigitizedSound-3.jpeg

There is a lot of different factors in the quality of the sound created by computers. Sample Rate and Sample Size are important -- but the recreated wave can almost never be an exact duplicate of the original. Notice, that in the following drawing, the original wave is sampled at discrete points. When the sound is recreated (by connecting the dots between the samples) we get a wave that looks similar to, but is not exactly like, the original.

Fortunately most of this loss (error) is out of the range of human hearing. Most of the loss is at the higher frequencies, and very small differences -- and the real differences are not usually as large as my example.

Sample Rate and Sample Size are fairly standardized -- at 44KHz, 16 bit, stereo; two channels, one for the left and one for the right in order to give us a sense of direction as to where the sound is coming from. Most of the difference remaining between sound on various computers, is the quality of the components used. The amplifiers, speakers, and protection against interference (shielding from other electronic components) is what makes up most of the perceivable difference.

There really isnít that much to understanding the basics of sound. In concept, it is very simple stuff. The complexity is that to accurately recreate sound, there are many variables, and learning the voodoo between making music, and making noise, is where all the art and science is.

Written: 2002.10.21

Tech | Programming : Anti-aliasingBasics of BASICBig or Little EndianBinary, OCTal, HEXadecimalCommand Line InterfaceDatabasesEnterprise ToolsFUDForward CompatibilityFree FeaturesHack, Crack or PhreakHiring ProgrammersHistory of Visual BasicHow does compression work?MHz or GHzRISC or CISCRaster ImagesSoftware ConsultantsSoftware Development Live CycleSynthesized SoundUNIXWhat is MP3?What is a WebApp?Why is software so buggy?