Followers

Saturday 12 February 2011

Representing Sound

Sound
- Sound is an air pressure wave that is sensed by our ears.
- Can either be analogue or digital.
- Analogue sounds are when pressure waves are captured by a transducer and produces an electrical current which varies with the sound pressure.
- The electrical signal produced can be transmitted by telephone, over the radio and can be preserved on magnetic tape.
- At the other end when being broadcasted or transmitted by telephone the electrical signal is used to re-create sound via vibrations.
- The higher the pitch of the sound the more rapid the vibration.
- A pure tone is a regular sine wave, but when two waves get put together they superpose meaning you then get a pulsating tone.
- Today most sound systems are digital.
- The electrical signal from the transducer is converted in to a digital signal meaning it is represented by binary (1's and 0's)

Analogue to Digital Conversion (ADC) and Digital to Analogue (DAC)
- Converts an anologue signal into an equivalent digital signal.
- A computer may be used to record sound, but first the sound must be converted into digital form.
- The analogue signal is sampled.
- Sampling is when a wave is measured at regular time intervals and then rounded to the nearest binary value.
- To play back sound the signal must be converted back to analogue.
- The technique to do this is called pulse code modulation.

Pulse Code Modulation (PCM)
- Samples of the analogue signal are taken at regular intervals of time.
- The sampling frequency or rate must be at least twice the highest frequency in the anologue signal.
- These samples are represented as narrow pulses of height which are proportional to the value of the original signal.
- This process is known as Pulse Amplitude Modulation (PAM)
- To produce PCM data, the PAM samples are quantised, meaning they are rounded to the nearest whole number.

Nyquist's Theorem
- We Must Sample At A Frequency At Least Twice The Rate Of The Highest Frequency In The Sampled Signal.

Storing Sound In Files
- One of the most notable sound formats is WAV (supported by most Operating Systems)
- WAV requires 2.5 MB of memory for one minute of sound.
- WAV is commonly used when storing music and sound to CDs.
- Most common nowadays is the MPEG format, this can be mp2, mp3 or mp4.
- MPEG compresses the sound file by 10% of what WAV does.
- 1 min in WAV = 2.5 MB   -   1 min of mp3 = 0.25 MB
- MPEG also removes frequencies that the ear and brain cannot detect.

Editing Sound
- When sound is stored digitally on a computer for example, the sound can be modified allowing the user to mix multiple sources and add effects.
- When a sound is edited it can be saved as a single sound file.

Synthesising Sound
- Musical Information Digital Interface does not store sound waves but stores a digital representation of the sound.
- It takes note of the notes to be played, the instrument being played and how long a note and intrument is played for.
- The resulting form is that it is very compact.
- It can easily be transposed and played on different instruments.
- Musical Information Digital Interface is also known as MIDI.

Streaming Audio
- When you stream audio the server sends it bit by bit.
- The client buffers it and plays it when it has enough bits to keep on playing and buffering at the same time.
- Advantages - No need to download the file
                     - Saves harddrive space
                     - Makes copying harder
Disadvantages - Cannot listen when disconnected
                       - Can be affected by bandwidth

Tuesday 1 February 2011

Representing Images

Bitmapped Graphics
- An image is divided into a grid of pixels.
- Each pixel in a grid cell is sampled and is then assigned a Binary Code to represent the average colour of the grid cell.
- The Binary Codes are then used to produce a copy of the original image.

Memory Bitmaps
- The Binary Codes of each pixel are stored in memory when an image is scanned.
- The image is displayed on a Visual Display Unit by transferring the Binary Codes back into the memory.
- Bitmap is used because the pixels of an image are mapped to specific positions in memory

Resolution
- The resolution of a Visual Display Unit is usually expressed by the # of pixels per row x # of pixels per column
- It is not the number of pixels that determines the sharpness of the image but the size of the pixels.
- For a sharper image the pixels need to be smaller.
- A small image size containing a high number of pixels is going to produce the sharpest image.

Colour Depth
- The number of bits used to represent the greyscale value of a pixel is called the image depth.
- The colour of a pixel can be coded using the RGB colour model.
- The RGB model mixes Red, Green and Blue to produce a specific colour.

1-Bit Colour
- A black and white image is known as a monochrome image.
- One bit is allocated to each pixel
- To get a white pixel the binary value is 1
- To get a black pixel the binary value is 0

12-Bit Colour
- 4 bits are allocated to each RGB components
- As 4 bits are allowed then 4096 different colours are available.
- This coulour depth is used most often when there is little colour needed, such as on a mobile phone

True Colour
- 24-Bit true colour images use 8 bits for each RGB component
- Having 8 bits for each component there are 256 different alternate colours
- When the colours are combined they give a total of over 16 million different colours

Vector Graphics
- Instead of dividing a graphic image into pixels a vector graphic identifies the objects that make up the image.
- Vector Graphics record information about these objects to define the image.
- Vector drawing software uses the commands that create objects as the source of information needed to describe the graphic.

Comparing Bitmaps and Vectors
- When a bitmap is scaled it is enlarged.
- As the magnification increases the vixels become more visible.
- Vector graphics avoid distortion because scaling is applied to a line's endpoint.
- Vector graphics do not deal with pixels.
- You do not lose resolution when you enlarge a true vector drawing.

Advantages and Disadvantages
- Geometric images require fewer bytes in vector graphic format than in a bitmap format.
- Images that have continuous areas of colour (such as photographs) take up fewer bytes in bitmap format than in vector.
- Geometric images load faster from secondary storage and download faster over the internet in a vectot graphic format.
- Vector graphics scale without distortion whereas bitmap does.

Compression
Run Length Encoding
-Single Compression technique that takes into account the fact that some images have long runs of pixels.
-If three or more consecutive cells have the same bit pattern then a run of cells has been found and can be encoded by two bytes.
-First byte stores the number of consecutive memory cell bytes and second byte stores the colour code.
-It is a loseless compression technique.
-Decompressing the Run Length Recording image produces an exact original image.

Lossy Compression
-Discards information that is not necessary such as a background scene.
-Decompressing an image with the Lossy technique produces a different image compared to the original.
-As the human eye is not so good at recognising exact strengths of brightness variation allowing it to be possible to highly reduce the information of the high frequency components.