Text, Sound And Images (Copy)
Representation of Text
- Why computers represent text in binary
- Computers process and store all data in binary form (0s and 1s).
- Every character (letter, number, punctuation, symbol) is assigned a unique binary code through a character set.
- Character sets map characters to numeric codes which can be converted to binary for processing.
Character Sets
- ASCII (American Standard Code for Information Interchange)
- 7-bit ASCII:
- Can represent 2⁷ = 128 characters.
- Includes:
- Uppercase letters (A–Z)
- Lowercase letters (a–z)
- Digits (0–9)
- Basic punctuation
- Control characters (e.g., carriage return, line feed).
- Example:
- ‘A’ = 65₁₀ → 1000001₂
- ‘a’ = 97₁₀ → 1100001₂
- 8-bit Extended ASCII:
- Uses 8 bits → 2⁸ = 256 characters.
- Adds extra symbols, graphical characters, and accented letters.
- 7-bit ASCII:
- Unicode
- Designed to represent characters from all writing systems (e.g., Latin, Greek, Arabic, Chinese, Hindi, emoji).
- Uses variable lengths:
- UTF-8 (1–4 bytes per character)
- UTF-16 (2 or 4 bytes per character)
- UTF-32 (4 bytes per character)
- Allows over a million unique characters.
- Example:
- ‘A’ = U+0041 in Unicode.
- Emoji 😀 = U+1F600 in Unicode.
- Comparison: ASCII vs Unicode
Feature ASCII Unicode Characters 128 or 256 1.1 million+ Bits per char 7 or 8 Variable (8–32 bits) Language scope English + limited symbols All languages, symbols, emoji
Representation of Sound
- How sound is converted to binary
- Sound is a continuous analogue wave in the real world.
- A microphone detects sound waves and converts them to analogue electrical signals.
- An Analogue-to-Digital Converter (ADC) samples the sound at regular intervals and converts each sample into binary.
- Sampling: Measuring the amplitude (loudness) of the sound wave at fixed time intervals.
Sample Rate
- The number of samples taken per second, measured in Hertz (Hz).
- Common values:
- 8,000 Hz – Telephone quality
- 44,100 Hz – CD quality
- 48,000 Hz – Professional audio
- Higher sample rate → closer to original sound, better quality, but larger file size.
Sample Resolution
- Number of bits per sample.
- Determines the precision of each measurement of amplitude.
- Example:
- 8-bit resolution: 2⁸ = 256 possible amplitude levels.
- 16-bit resolution: 2¹⁶ = 65,536 possible amplitude levels.
- Higher resolution → more accurate sound representation → larger file size.
File size for digital audio
- Formula:
File size (bits) = Sample rate × Sample resolution × Duration (seconds) × Number of channels - Example:
- Stereo recording (2 channels)
- 44,100 Hz sample rate
- 16-bit resolution
- 60 seconds duration:
- File size = 44,100 × 16 × 60 × 2 = 84,672,000 bits ≈ 10.08 MB.
Representation of Images
- Pixels:
- Short for “picture elements”.
- Smallest unit of an image, each with a colour value.
- An image is a grid of pixels stored in binary.
Resolution
- Number of pixels in an image.
- Expressed as:
- Width × Height (e.g., 1920×1080 pixels)
- Total pixel count.
- Higher resolution → more detail → larger file size.
Colour Depth
- Number of bits used to represent each pixel’s colour.
- Determines the number of possible colours:
- 1-bit colour depth: 2 colours (black & white)
- 8-bit colour depth: 256 colours
- 24-bit colour depth: 16.7 million colours (true colour)
- Formula for possible colours: 2^(colour depth).
File size for digital images
- Formula:
File size (bits) = Resolution (total pixels) × Colour depth - Example:
- 1920×1080 pixels
- 24-bit colour depth:
- File size = 1920 × 1080 × 24 = 49,766,400 bits ≈ 5.94 MB.
Impact on Quality and Storage
| Factor | Increase Effect |
|---|---|
| Resolution | Sharper detail, larger file size |
| Colour depth | More colour variety, larger file size |
