CS30 : Storing sounds

This lesson builds upon the contents of the previous lesson to include sound storage and sound reproduction methods.

We are learning ...
  • How sound is sampled and stored in computer systems
So that we can ...
  • Explain how sound is sampled;
  • Describe how the sampling interval (rate) and sampling resolution (bit depth) affects the size and quality of a sound file;
  • Explain the meaning of bit rate;
  • Calculate the size of sound files.

CGP The Revision GuidePage 74
CGP Exam Practice WorkbookPage 83

# Get Ready.png

Making sounds 
 O   A   E   W 

Sound is generated by movement of air particles caused by an object vibrating. The moving air particles generate a longitudinal wave (you might have studied this in Physics) with areas of high pressure (compression) and low pressure (rarefaction). These changes in sound pressure are detected by structures in the ear which convert them into nerve signals which are interpreted by the brain as 'sound'.


Task 1.1 Ruler music
Where we use a vibrating ruler to generate analogue sound

You would normally get told off for this, but I'm asking you to get some rulers and have a go at playing a song! Work in groups using 5 rulers each and try to create a 'keyboard' to play the first part of 'Baa, Baa, Black Sheep'. 

In your notebooks / on paper

Answer the following questions in your notebooks (in full sentences of course).
  1. How did you alter the pitch (note) of the ruler?
  2. What effect did this have on the speed with which the ruler vibrated?
  3. Which notes were harder to 'play' - the high notes or the low notes? Can you explain why?
  4. Perform your masterpiece to the rest of the class.

Describing sound 
 O   A   E   W 

Sound waves are described in terms of their frequency or pitch which is measured in cycles per second or hertz. The higher the frequency, the higher the pitch of the note we hear. We also sense the loudness of sound - the height or amplitude of the wave.  The higher the amplitude, the louder the sound.

Look carefully at the following pictures ...


Real sound do not look as simple as this when represented as a wave. A very small portion of a real sound might look like this.


Task 2.1 Inspecting a digital sound wave
Where we use a sound editor to 'inspect' a digital sound wave

Using a sound editor

Download and open the drumbeats.mp3 file with Audacity sound editor. Play the file, zoom in on the file and inspect the structure of the sound wave. Can you find loud and quiet parts?

Can you find parts with high and low pitch? 

In your notebooks / on paper

Write about what you have found out in your notebooks, on paper or using a word processed document. Add an image of part of the sound wave to illustrate your work.

 O   A   E   W 

To store an analogue sound wave on a computer, it needs to be converted to digital data (think binary). The structure of the analogue wave is stored by measuring the height of the sound wave at regular intervals and storing it's height as a binary number.
  • The number of samples of the height taken per second is called the sampling rate.
  • The number of values the height can be measured in is called the sampling resolution.

Task 3.1 Sampling exercise
Where we perform manual sampling of an analogue sound

Work on the task sheet

Either get a copy of the Sound Sampling Exercise worksheet from your teacher or print yourself a copy. This is quite complex stuff, so your teacher will need to show you what to do. Pay attention!

In your notebook / on paper

When you have done all the exercises you can, answer the following questions.
  1. What is the effect of increasing the rate of sound sampling on the accuracy of the sampled sound wave?

  2. What is the effect of increasing the number of values available to store the height of the sound wave (sampling resolution) on the accuracy of the sampled wave?

  3. What is the connection between the number of bits used to store the height of the sample and the number of values available to use for it's height? (Think binary!)

  4. How many different values would you have to store the height of a sample in ...
    - 6 bit sampling resolution
    - 7 bit sampling resolution
    - 8 bit sampling resolution
    - 16 bit sampling resolution
    - 24 bit sampling resolution
    - 32 bit sampling resolution

Task 3.2 Videos
Where you watch two videos and make some excellent notes

Make some quality notes

Get your headphones on, watch the videos and take some notes in your notebooks / on paper.

What is Sample Rate? : iZotope Pro Audio Essentials (3:29)

Music Technology 101 : Sampling Rate and Bit Depth Explained (9:23)

Task 3.3 Inspect sound files
Where we listen and evaluate the quality of sounds

The videos discussed the effect of altering the sampling rate and sampling resolution (bit depth) of a sound file.

Download and decompress the sound files

Download the zip file called quality.zip and decompress the zip file into your user space.

Listen to each file in turn and inspect it's properties

Get some headphones on and then double click each sound file in turn and 'listen' to the quality of the sound. Inspect the properties of each file in turn and make a note of it's file size and the bit rate (kbps). We'll learn about bit rate shortly.

In your notebook / on paper

Write down your findings in your notebooks. You may wish to use a table (hint).

Task 3.4 Complete the sentences
Where we learn how sample rate affects file size and quality

In your notebook / on paper

Complete the following sentences but choosing the correct word from the pair. When you write your answer, make sure you underline the word you have chosen so it's easy for me to check!
  1. When sound is sampled at a lower rate, [less / more] samples per second are taken, the quality of the sound stored is [higher / lower] and the file takes up [less / more] storage space on the computer.

  2. When sound is sampled at a higher rate[less more] samples per second are taken, the quality of the sound stored is [higher lower] and the file takes up [less more] storage space on the computer.

  3. When sound is sampled at a lower resolution, the sound wave is sampled [less / more] accurately resulting in [lower / higher] quality sound and a [smaller / larger] file size.

  4. When sound is sampled at a higher resolution, the sound wave is sampled [less more] accurately resulting in [lower higher] quality sound and a [smaller larger] file size.

Calculating file size
 O   A   E   W 

As you should have seen, the size of sound file is related to the both the sampling rate and the sampling resolution. To calculate the file size of a sound file, use the following (super easy) formula ...

Wow - how many terms are there in that formula?

Task 4.1 Uncompressed file size
Where we learn to calculate the uncompressed file size of a sound file

In your notebook / on paper

Calculate the approximate, uncompressed file size in the most appropriate unit, for the following sound files (notice the capital 'B' which stands for 'bytes', not 'bits'). Be careful - your answer to the initial calculation will be in bits.
  1. 16 bit sampling resolution, 16,000 Hz sampling rate, 12 seconds long, stereo.
  2. 8 bit sampling resolution, 8,000 Hz sampling rate, 1m 5s long, mono.
  3. 24 bit sampling resolution, 44,100 Hz sampling rate, 4m 28s long, stereo.

Describing sound quality
 O   A   E   W 

Since songs tend to vary in length, often bitrate is used to compare the quality of sound files, especially in streaming music services.

Bit rate is given by the following, slightly simpler, formula ...

Notice that there is no metadata included in this calculation because the file is streamed and does not have the same format as a physical file. The bitrate is normally quoted in kilobits per second (kbps). Notice the lower case 'b' which stands for 'bits'. To convert bits per second (bps) to kilobits per second (kbps), simply divide the answer by 1024.

Task 5.1 Calculating bitrate
Where we learn to calculate the bitrate of a sound file

In your notebook / on paper

Calculate the bit rate in kbps for the following sound files.
  1. 16 bit sampling resolution, 16,000 Hz sampling rate, mono sound stream;
  2. 8 bit sampling resolution, 8,000 Hz sampling rate, stereo sound stream;
  3. 24 bit sampling resolution, 44,100 Hz sampling rate, stereo sound stream.

Assessment Task (Homework)

Using Audacity (or another sound editor which is as good, if you can find one), record a podcast about the contents of this lesson. You can download some free audio tracks to use as intro / outro, effects and background music from the following websites ...
You will need a suitable microphone / headphone combo as well.

Grading rubric

MASTER : You wrote a detailed script and have created a fantastic Podcast in MP3 format which you could distribute to your friends for revision. You've used sound effects and music tracks to enhance your podcast.
APPRENTICE You wrote a simple script and have recorded your own voice, but may not have added much in the way of incidental music or sound effects. It might be a bit boring to listen to.
NOVICE : You messed about listening to sound effects and half finished a script.

Click to download revision cards
Remember to print them single sided

# Flash cards.png
Click to load key word list to help you make your own flash cards 

Try to get 5/5!

Hungry for more?

Tone generator

Visit the Online Tone Generator website and investigate some of the features. I would not recommend you use headphones for this - some of the sounds can be very loud.

MIDI Extension

MIDI stands for 'Musical Instrument Digital Interface' and is a way of creating pure digital sounds using a keyboard or other compatible musical instrument. Download and install a copy of MidiEditor, download the 'chopsticks.mid' file from the lesson resources and do a little experimentation. If you hear no sound from MidiEditor, make sure you choose 'Midi > Settings' and then select 'Microsoft GS Wavetable Synth' from the 'Midi I/O' section.