O Level Computer Science Notes
Topic: Text, Sound, and Images
1. Text Representation:
- Text data is represented using characters, with each character assigned a unique binary code.
- The two most common encoding schemes are ASCII and Unicode.
- ASCII (American Standard Code for Information Interchange) is a 7-bit encoding standard that
represents 128 characters, including letters, numbers, and control characters.
- Unicode is a more comprehensive encoding standard that can represent characters from almost
every language in the world.
- Text files are typically stored as plain text files (.txt), which contain only the encoded characters
without any formatting.
- Rich text files (.rtf) and HTML files (.html) allow text to include formatting (e.g., bold, italics, font
size) in addition to the characters.
2. Storage and Compression:
- Text files are usually compressed using algorithms like Huffman coding or run-length encoding to
reduce file size.
- Compression helps with storing and transmitting large text data efficiently.
3. Sound Representation:
- Sound in computers is represented as digital data, typically in the form of an audio file.
- The process of converting sound into digital form is called sampling.
- Sampling involves measuring the amplitude (loudness) of sound at regular intervals, called the
sample rate.
- Common sample rates include 44.1kHz (CD quality) and 22kHz for lower-quality audio.
- The greater the sample rate, the more accurately the sound is represented but at the cost of file
size.
- Sound files can be stored in different formats such as WAV (uncompressed), MP3 (compressed),
or OGG (compressed).
4. Sound Compression:
- Compression techniques like MP3 and AAC reduce the size of audio files while maintaining
acceptable sound quality.
- Lossy compression algorithms discard some audio data that is considered inaudible to the human
ear.
- Lossless compression algorithms (e.g., FLAC) preserve the original sound quality without losing
any data.
5. Image Representation:
- Images are represented as a grid of pixels (picture elements), where each pixel has a color value.
- Images are typically stored as bitmap or raster images, which are a collection of pixels arranged in
rows and columns.
- Each pixel can be represented by RGB values (Red, Green, Blue), where each color component is
usually an 8-bit value (ranging from 0 to 255).
- Image file formats include JPEG (compressed), PNG (lossless compression), and BMP
(uncompressed).
- The resolution of an image refers to the number of pixels it contains, usually described in terms of
width x height (e.g., 1920x1080 for Full HD resolution).
6. Image Compression:
- Compression techniques reduce the size of image files while maintaining quality.
- JPEG uses lossy compression, discarding some image data to reduce file size.
- PNG uses lossless compression, ensuring no image data is lost.