Monday 14 February 2011

Sound storing/playing

Sound is either analog or digital. Analog has an infinite possibility of values whereas digital has to be a single value at a time depending on how accurately your measuring it. We speak in analog but computers can only read digital signals so we must first convert our analog voices into digital signals if we want to store/play them throgh a computer. We use a transducer to do this which could be a microphone.
We use a microphone to pick up the analog sound then a ADC converts it to digital signals using the lower part of the possible frequencires it could be. The computer then uses a DAC to play it back through a speaker.
The two factors that influence the quality of the sound are the sampling rate which is how often per second you take a sample of the sound and the sound resalution which is the number of bits availiable to encode each sample you take.
We must sample the frequency of the sound at least twice the frequency of the highest part of the sample; so if the frequency is 200hz - 2khz then we should sample it at 4khz per second and store it using 16, 32,64 bits for each sample.
We use mpeg files to store sound and they discard any sound/frequency that we can't here so the file size is about 10% the size of the original WAV file type.
Digital sound is easier to mix because it can only be certain values and this can help music companies and djs.
To synthesis sound using MIDI we store the instructions to make the sound not the sound itself, this is like storing drawing instructions for vector graphics.

Bitmaps and Vectors

Bitmaps use pixels to display an image. Today we use 24bits per pixel so we can create around 16 million different colours, this is called true colour and is as many colours as we can see with our eyes. The problem with bitmaps is if we use less pixels the images quality gets dramatically worse, so the less pixels we use the worse the resolution is if its the same screen size. Bitmap graphics also take up more memory compared to vector graphics and suffer scaling problems which vector graphics do not.
Vector graphics do not suffer from scaling problems because they are made from a drawing list, this is the geometric information and properties needed to recreate the image. Vector graphics are no good for photos from cameras etc because the camera can't see the image being drawn so has no drawing lists.
Because they use drawing lists instead of pixels the file size of a vector graphic is very small in comparison to a bitmap. This also helps them to load faster from storage.
Lossless compression is a method of reducing the file size but not loosing any information and little quality. This includes telling the computer the number of blocks that are the same colour and grouping them together rather than writing the information for each individually. This is called RUN LENGTH ENCODING (RLE).
The other method is called lossy compression which is removing bits of an image that we won't notice are missing.