Fundamentals of data representation: Sampled sound
So we should know by now that sound waves are continuous and computers can only store discrete data. How exactly does an Analogue to Digital Converter convert a continuous sound wave into discrete digital data? To do this we need to look at how computers sample sound.
Sampling rate[edit | edit source]
To create digital music that sounds close to the real thing you need to look at the analogue sound waves and try to represent them digitally. This requires you to try to replicate the analogue (and continuous) waves as discrete values. The first step in doing this is deciding how often you should sample the sound wave, if you do it too little, the sample stored on a computer will sound very distant from the one being recorded. Sample too often and sound stored will resemble that being recorded but having to store each of the samples means you'll get very large file sizes. To decide how often you are going to sample the analogue signal is called the sampling rate. Take a look at the following example:
|Original Sound||High sample rate||1/2 high sample rate||1/3 high sample rate||1/4 high sample rate|
|original continuous sound wave||digital looks like original||digital loses sharpness||loss of peaks||poor resemblance to original!|
To create digital sound as close to the real thing as possible you need to take as many samples per second as you can. When recording MP3s you'll normally use a sampling rate between 32,000, 44,100 and 48,000 Hz (samples per second). That means that for a sampling rate of 44,100, sound waves will have been sampled 44,100 times per second! Recording the human voice requires a lower sampling rate, around 8,000 Hz. If you speak to someone on the phone it may sound perfectly acceptable, but try playing music down a telephone wire and see how bad it sounds.
Sampling resolution[edit | edit source]
As you saw earlier, different sounds can have different volumes. The sampling resolution allows you to set the range of volumes storable for each sample. If you have a low sampling resolution then the range of volumes will be very limited, if you have a high sampling resolution then the file size may become unfeasible. The sampling resolution for a CD is 16 bits used per sample.
File sizes[edit | edit source]
To work out the size of a sound sample requires the following equation:
File Size = Sample Rate * Sample Resolution * Length of sound
This is the same as saying:
File Size = Bit Rate * Length of sound
Let's look at an example:
If you wanted to record a 30-second voice message on your mobile phone you would use the following:
Sample Rate = 8,000 Hz Sample Resolution = 16 bit Length of Sound = 30 seconds
Therefore, the total file size would be:
8,000 * 16 * 30 = 3 840 000 Bits = 480 000 Bytes
If you are interested in sound editing you can start editing your own music using a program called Audacity. Using Audacity you can create your own sound samples with different sample rates and sample resolutions, listening to the difference between them and noting the different file sizes. Check out the following sound files recorded at different sampling rates:
A sound wave is continuous data, whilst digital data is discrete and the representation is an approximation of the original
The higher the sampling rate the more data is needed to be stored, meaning the larger the file size.
the number of bits assigned to each sample, effecting the range of volumes that can be stored in a sample
Sampling Rate * Sampling Resolution
16,000 * 8 * 10 = 1 280 000 Bits
100,000 / (10 * 5) = 2,000 Hz
The file might be recorded in stereo, meaning twice the amount of data would have to be stored