Like images, sound is made up of bits and stored on files on a computer. Or rather, digial sound is - the other type of sound, analogue, doesn't work with computers well, so it has to be turned into digital first
Sound is sampled and stored digitally
Sound is recorded by a microphone as an analogue signal. Analogue signals are pieces of data of continually changing data
Analogue signals need to be converted into digital data so that computers can read and store sound files. This is done by analogue to digital converters, which are found in most modern recording devices
The red line shows the analogue sound wave - it's one continuous piece of data which keeps changing
To convert the analogue recording to digital data, we sample the amplitude of the wave at regular intervals (shown by the blue dots on the graph). The amplitude can only take certain values depending on the bit depth
Once the device has sampled the recording, it creates the curve digitally like this:
Each block of data matches where each sample was taken. The digital data is about the same shape as the analogue wave, but it's not continuous. It's lost a lot of data
The digital data can be improved by taking samples more frequently - most music isn't sampled every second but every couple of miliseconds
Several factors affect the size and quality of sound files
Sample rate x bit depth is often called the bit rate
Sample rate (or sampling frequency) is how many samples you take in a second - it's usually measured in hertz (Hz) or kilohertz (kHz). E.g. a common sample rate is 44,100 samples per second (44,100 Hz or 44,100 kHz)
Bit depth is the number of bits available for each sample
You can calculate the size of a sound file using this formula:
File size (in bits) = sample rate (in Hz) x bit depth x length (in seconds)
E.g. if you were to sample 30 seconds of audio with a bit depth of 8 bits and a sample rate of 500 Hz, your file would be 500 x 8 x 30 = 120,000 bits
Increasing the sample rate means the analogue recording is sampled more often. The sampled sound will be better quality and will more closely match the original recording
Increasing the bit depth means the digital file picks up quieter sounds, even if they're happening at the same time as louder ones. This will also result in a sampled sound that is closer to the quality of the original recording. However, increasing the sample rate or bit depth will increase the file size