# Fundamentals of data representation: Sounds

Sound is an oscillation of pressure transmitted through a solid, liquid, or gas (there is no sound in outer space as space is a vacuum and there is no solid, liquid or gas to transmit sound through!). A speaker works by moving its centre cone in and out, this causes the air particles to bunch together forming waves. These waves spread out from the speaker travelling at 340 m / s. If your ear is in the way, then the waves of sound particles will collide with your ear drum, vibrating it and sending a message to your brain. This is how you hear:

When you hear different volumes and pitches of sound all that is happening is that each sound wave varies in energy for the volume (larger energy waves, the louder the sound), or distance between sound waves which adjusts the pitch, (smaller distances between waves leads to higher pitched sound).

1 - base volume and frequency
2 - double volume and frequency
3 - same volume treble the frequency

Sound is often recorded for two channels, stereo, feeding a left and right speaker whose outputs may differ massively. Where one channel is used, this is called mono. 5.1 surround sound used in cinemas and home media set ups use 6 channels.

A computer representation of a stereo song, if you look carefully you'll see the volume of the song varying as you go through it

This section of the book will cover how we record, store and transmit sound using computers. Sound waves in nature are continuous, this means they have an almost infinite amount of detail that you could store for even the shortest sound. This makes them very difficult to record perfectly, as computers can only store discrete data, data that has a limited number of data points.

 Sound is a continuous set of data points formed by a wave. Computers sample this sound at discrete points to store a digital approximation The discrete approximations (in red) can be used to recreate the original sound (grey). However, due to limitations in the number of samples we take we are often unable to truly represent a sound wave, though we can get close enough for the human ear not to notice the difference.