Sound

From TRCCompSci - AQA Computer Science
Revision as of 09:58, 14 November 2017 by LealWilliams (talk | contribs) (Leal)
Jump to: navigation, search

Converting Analogue to Digital Sound

The following image demonstrates how sound files are created when they are inputted through devices such as a microphone:

600px-Analogue Digital Conversion.png

Representing Sound

To store sound, a digitizer is needed to convert the analogue sound into digital sound. An analogue to digital converter carries out these conversions. 16 bit ADC is enough for CD quality sound. For High-Res audio, you can get audio files that are at 24 bit.

Sound Samples.gif

Sampling Rate

The sampling rate or frequency is the number of samples taken per second. It is measured in hertz (Hz)?. The higher the sampling rate the more accurate the representation of the sound. But the higher the sampling rate, the bigger the file size will be as there will be more data the is being stored

Sound SamplingRate.jpg

Sampling Resolution

The sampling resolution is the number of bits assigned to each sample. The number of bits assigned allows for a wider range of sounds to be displayed. For example, if only one bit is used it can only be either 1 or 0, giving an option of only two different sounds, where as if 8 bits are used there are a possible 255 different sounds that can be recorded and then replayed. In a way, your PC bleeper speaker is one bit as it only produces one tone when there is a error on your computer and then your actual speakers that you listen to music to will be 8 bit sound as you can play 255 different sounds on it.

Calculating File Size

A sound is sampled at 5Khz (5000Hz) and the sample resolution is 16 bits:

  1. There is 5000 samples per second & each sample is 2 byte (16 bits)
  2. 1 second of sound will be 5000 x 2 = 10,000 Bytes
  3. 10 seconds of sound will be 5000 x 20 = 100,000 Bytes

Sampling Process

Pulse Amplitude Modulation (PAM) is the process which samples analogue signals and produces electrical pulses of height proportional to the signal's original amplitude.

Pulse Code Modulation (PCM) is the process of coding sampled analogue signals by recording the height of each sample in binary. PCM pulses can then be encoded in binary form.

Nyquist's Theorem

In 1928 Harry Nyquist found that in order to sample any sound at a similar quality to how it is in real life, you must use a sampling rate at double the frequency of the original sound. The result will be the closest possible to the original sound, because recording at double the frequency allows for all of the changes in the sound such as pitch to be captured digitally at a high quality.

MIDI Data

Patrick's Heading

MIDI stands for Musical Instrument Digital Interface.

MIDI does a completely different approach to other sound recording methods. Instead of recording sound and then storing it in a digital format, It actually writes out a set of instructions which can be used to synthesize the sound that is listened to. This relies solely on pre-recorded digital samples and synthesized samples of sounds created by different instruments.

The advantages of using MIDI instead of conventional recording methods is that firstly, it is a fraction of the size of a digital recorded version, it is easily edited or manipulated and notes can be passed to a different instrument and so the attributes of each note can be altered.

Audio Compression

Audio compression is used to lower the space that a digital sound file takes up by removing sounds that humans won't be able to pick up listening to it. For example, in a song with guitar and drums, when there is a drum hit, the guitar will drown out in the background and become inaudible, so this data is removed to save memory, which is useful for devices like phones with a limited memory.

Audio Streaming

Audio streaming is a way in which audio/sound is broadcast to a user. It allows a user to listen to an audio file or watch a video without downloading the whole file, they only download a bit at a time... Which is the buffer.

Audio Streaming has a delayed start in order to allow it to buffer, it also plays sound from the buffer and has seamless play unless connection to the host is lost. Audio Streaming saves space on the hard drive since the file is no longer required to be downloaded on the device for it be viewed, Which also means piracy is reduced.

Audio streaming is so widely used and respected because of its usefulness. Before Audio Streaming was around, it could take you quite a while to listen to music/sound since you would have to download the whole file. Whereas Audio Streaming simply gives you the data that you need at that specific time and downloads the next when you need it. It does this simply by holding the data in the buffer.

Synthesising Sound

Sound can be synthesised with MIDI (Musical Instrument Digital Interface), which records information about each note - such as duration, pitch, tempo, instrument and volume - and recreates that note when played. When using MIDI it is hard to replecate the proper soud as it would have to be played through note by note and would be a synthetic sound, in some cases it's good like in pop music but in other cases usually not. A MIDI link can hold up to 16 channels of information which can be routed to a seperate device for each channel.


Revision Questions

1. How many bits is enough for CD quality audio?

16 bit
Correct, you only need 16 bits to achieve CD quality audio.
24 bit
Incorrect, you only need 16 bits to achieve CD quality audio.
32 bit
Incorrect, you only need 16 bits to achieve CD quality audio.
64 bit
Incorrect, you only need 16 bits to achieve CD quality audio.

2. According to Nyquist's Theorem, what should our sampling rate be?

Half the original rate.
Incorrect, sampling at double the rate of the original audio will achieve the closest match.
The same as the original rate.
Incorrect, sampling at double the rate of the original audio will achieve the closest match.
Double the original rate.
Correct, sampling at double the rate of the original audio will achieve the closest match.
Triple the original rate.
Incorrect, sampling at double the rate of the original audio will achieve the closest match.

3. Which of the following are examples of audio file formats?

.mp3
Correct, mp3 represents MPEG-1 or MPEG-2 Audio Layer III audio file format.
.wav
Correct, wav represents Waveform Audio File Format.
.bmp
Incorrect, bmp represents Bitmap Image File, which is an image file format.
.smf
Incorrect, smf represents Standard MIDI Format, which is used to store MIDI information.

4. How many information channels can a MIDI link hold?

8
Incorrect, a MIDI link can hold 16 channels of information.
16
Correct, a MIDI link can hold 16 channels of information.
32
Incorrect, a MIDI link can hold 16 channels of information.
64
Incorrect, a MIDI link can hold 16 channels of information.

5. If the audio you want to sample is at 44hz, what frequency should you sample at?

hz.

Your score is 0 / 0


Ian

1. What does MIDI stand for?

Musical Intelligent Dialogue Interface
Musical Instrument Digital Interface
Muselk Instrument Digital Interface
Muselk is an overwatch youtuber subscribe at https://www.youtube.com/channel/UCd534c_ehOvrLVL2v7Nl61w
Musical Instrument Detection Interface

2. Does this sample rate give a good representation of the wave?

Sample rate.png

Yes
No

Your score is 0 / 0


Leal

1. A sound is sampled at 3KHz with a sample resolution of 8 bits. How many bytes will be used for 5 seconds of sound?

120000
That is the amount of bits used
24000
That is only for 1 second, and in bits
15000
Correct answer
1875
Incorrect!
How to calculate
Number of bits / Number of bits in a byte, 8/8 = 1
Samples = sample rate in hertz, 3*1000 = 3000
5 seconds of sound
3000 * 1 * 5 = 15000

2. A sound is sampled at 6KHz with a sample resolution of 12 bits. How many bytes will be used for 3 seconds of sound?

216000
That is the amount of bits used
27000
Correct answer
18000
You ignored the sample resolution
9000
That is only for 1 second
How to calculate
Number of bits / Number of bits in a byte, 12/8 = 1.5
Samples = sample rate in hertz, 6*1000 = 6000
3 seconds of sound
6000 * 1.5 * 3 = 27000

Your score is 0 / 0