- Created by: thomasmay98
- Created on: 29-04-15 08:40
What is sound?
When an object vibrates, it causes air molecules around it to vibrate. These vibrating molecules carry sound through the air to the receiver.
In terms of a person, the sound would go through the ear and then be converted into electrical impulses so our brain can understand.
Pure tone and Superposition
Sound in a computer is generated in two different ways:
- Microphone input
- Synthesise Sound
A pure tone is sound represented by a single frequency. It is a regular sine wave.
A superposition is just a more complicated version of a pure tone.
A vinyl record takes the shape of a sound wave by having spiral grooves across the surface of the record.
When playing the record, a fine needle will run along the grooves and create an electrical signal, depending on the changes of the groove.
To process analogue data, it must be sensed then converted into an electrical form.
The electrical equivalent id called analogue signal. An analogue signal varies in a continuous manner.
A transducer converts one type of energy to another. An example of a transducer is a microphone.
It converts sound pressure to electrical signals.
Each voltage level encodes a single item of binary data. The most significant binary digit is a bit sign:
- 0 represents +
- 1 represents –
However, this leads to two binary patterns for 0.
You can use two voltage levels, 0 volts and 5 volts, making the digital signal into a binary digital signal.
How a Soundcard Works
The soundcard receives a continuous analogue signal from the microphone. The analogue signals received vary in amplitude and frequency.
The mixed analogue signal is processed in real-time by an ADC, creating a digital signal using two voltage levels.
The digital signal from the ADC flows into the DSP. The DSP compresses the digital output and sends it to the PC (usually as a WAV file).
Listening to a file
To listen to a file, the process is simply reversed.
The digital data is routed to the DSP, where the data is uncompressed.
The data then goes to the DAC where it is converted back to sound and outputted through the speakers.
Sampled Sound – The sampling rate defines the number of samples taken per second when digitising a continuous signal. Measured in Hertz (Hz).
Sampled Resolutions – Number of bits assigned to each sample. A more accurate representation
Nyquist states that we must sample at a frequency at least twice the rate of the highest frequency in the sampled signal.
Basically, we need to sample at least two times higher so we include both positive and negative sound inputs.
To sample more accurately, we use more bits per second to give us an accurate representation of the signal wave.
The more frequent samples are taken, the more disk space will be needed to store it.
Storing sound files
The main save is a WAV file, as this supports all windows OS. One minute of WAV takes up 2.5mb of disk space. This way is also used for CD’s.
Another format is MPEG which uses the extensions .mp2, .mpa, .mp3 and .mp4. MPEG is a compression format; however can still be used for playing audio.
Lossless: Compresses original sound into algorithm then uses another algorithm to convert back.
Lossy: Lossy file conversion results in lost data and quality from the original version. Lossy compression is typically associated with images, but can be used for audio. Lossy removes information that is in a frequency that humans cannot hear, meaning it doesn’t matter if we remove it.
Calculating Sample Rate
Number of samples / Amount of time (Seconds)
E.g. 8 samples / 0.01 seconds = 800Hz
8 bits in each sample = 1 byte
16 bits in each sample = 2 bytes
24 bits in each sample = 3 bytes
32 bits in each sample = 4 bytes etc.
Calculating File Size
Sample rate x Sample resolution x Length of sound
The file might have been recorded using a stereo setting, so twice the amount of data must be stored
Sample rate = 8000Hz
Sample Resolution = 16 bit
Length of sound = 30 Seconds
8000 x 16 x 30 = 3840000 = 375B
5,120,000 bits = 640000B = 625Kb
Digital Data – Data that takes the form of discrete values.
Digital signal – An electrical signal with voltage changes that are abrupt or in discrete steps.
Analogue Data – Data that varies in a continuous manner.
Analogue Signal – An electrical signal that varies in a continuous manner.
Digital Signal processor (DSP) – Handles most computations
Digital-Analogue Converter (DAC) – For audio leaving the PC
Analogue-Digital Converter (ADC) – For audio entering the PC
Pulse Code Modulation (PCM) – Coding sample analogue signals
Pulse amplitude modulation (PAM) - Samples analogue signals