A-level Computing/AQA/Problem Solving, Programming, Data Representation and Practical Exercise/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
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:

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
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
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:

Why might a digital representation of a sound struggle to be a perfect representation? A sound wave is continuous data, whilst digital data is discrete and the representation is an approximation of the original

Why might you choose to have a lower sampling rate than a higher one for storing a song on your computer? The higher the sampling rate the more data is needed to be stored, meaning the larger the file size.

What is the sampling resolution? the number of bits assigned to each sample, affecting the range of volumes that can be stored in a sample

What is the equation to work out the bit rate of a song Sampling Rate * Sampling Resolution

For the following sound sample work out its size: Sample Rate = 16,000 Hz Sample Resolution = 8 bit Length of Sound = 10 seconds

16,000 * 8 * 10 = 1 280 000 Bits

Work out the sample rate of the following sound file: Sound File = 100,000 bits Sample Resolution = 10 bit Length of Sound = 5 seconds

100,000 / (10 * 5) = 2,000 Hz

Why might a song recorded with the following settings: Sample Rate = 22,000 Hz Sample Resolution = 16 bit Length of Sound = 10 seconds have a file size of 7,040,000 bits?

The file might be recorded in stereo, meaning twice the amount of data would have to be stored

Using the grid below, plot the following sample points for a sample resolution of 3 bits per sample: 000001100101100011100110111101



Sample the sound wave below and convert it into binary form:



101 101 101 011 001 000 001 001 100 100