Character Sets – ASCII Code and Unicode
A character set is a collection of characters (letters, digits, symbols, and control codes) that a computer can recognize and use for processing text.
ASCII also known as (American Standard Code for Information Interchange):
- Developed in the 1960s.
- Uses 7 bits to represent 128 characters (0–127).
- Includes English letters ( capital A to Z, small caps letter a to z), digits (0–9), punctuation marks, and control characters.
- Extended ASCII uses 8 bits to represent 256 characters, adding extra symbols and characters for some languages.
Limitation: Cannot represent all world languages.
Let’s talk about Unicode.
- Developed to overcome the limitations of the ASCII code.
- Provides a universal standard for representing characters from all writing systems.
- Uses different encoding schemes such as UTF-8, UTF-16, and UTF-32. which is used in mobile devices to show the keypad characters.
- Can represent over 1 million characters, including letters, digits, emojis, and special symbols.
Ensures global compatibility in communication and data exchange.
Representation of Sound – Frequency, Wavelength, and Amplitude.
Sound is a form of energy produced by vibrations and travels in the form of longitudinal waves through a medium such as air, water, or solids. It can be described using the following properties:
The first one is Frequency, known as (f):
- The number of sound wave vibrations per second.
- Measured in Hertz
- Determines the pitch of the sound:
- Higher frequency means higher pitch.
- Lower frequency means lower pitch,
Lets talk about the Wavelength (λ): which is the second one.
- The distance between two consecutive compressions (or rarefactions) in a sound wave.
- Measured in meters (m).
- Related to frequency and wave speed by the formula:
- 𝑣 = 𝑓 multiply with wave length
- where v = speed of sound.
The third one is Amplitude (A):
- The maximum displacement of particles in the medium from their rest position.
- Determines the loudness of the sound:
- Greater amplitude means louder sound.
- A smaller amplitude means a softer sound.
Lets do the Question:
A music file is recorded in stereo at a sample rate of 44,100 Hz.
- Each sample is stored using 16 bits.
- The clip lasts for 5 seconds.
- Calculate the file size in bytes.
Step 1: Formula.
File size (bits) equals to Sample rate multiply by the Bit depth multiply by the Number of channels multiply by the Duration.
so in Step 2 become: 44,100 × 16 × 2 × 5
Step 3: Let’s multiply it.
- 44,100 multiplied by 16 bits (by per sample) is equal to 705,600.
- Now we multiplied 705,600 by 2, the number of channels, which gives us 1,411,200.
- Now multiply 1,411,200 by 5 seconds, and now you are able to get 7,056,000 bits.
- To convert it to bytes, we will divide 7,056,000 by 8 to get 882,000 bytes
Representation of Bitmap Images.
A bitmap image is a picture made up of a grid of small dots called pixels (picture elements). Each pixel has a specific colour value, and together they form the complete image.
Pixel:
- When it comes to image, the first element is a pixel:
- The smallest unit of an image.
- More pixels means higher resolution and better image quality.
Resolution:
- The second one is Resolution.
- The number of pixels in an image (width × height).
- Higher resolution images require more storage space.
Colour Depth (Bit Depth)
Number of bits used to represent the colour of each pixel.
Common depths:
- 1-bit means 2 colors (black & white).
- 8-bit means 256 colors.
- 24-bit means over 16 million colors (true color).
Let’s do the file size calculation:
Image file size can be estimated as:
File Size = Resolution (pixels) multiply with Colour Depth (bits)
Question:
- An image has a resolution of 800 × 600 pixels.
- Each pixel is stored using a colour depth of 24 bits.
- Calculate the file size in bytes.
Step 1: Formula
File size in bits equals to Resolution, which is (width × height) multiplied by color depth
Step 2: Substitute values.
=(800×600)×24 = 480,000
=480,000×24
= 11,520,000 bits
Step 3: Convert bits into bytes.
11,520,000÷8=1,440,000 bytes.
Step 4: Convert bytes into KB (if needed)
1,440,000÷1024≈1,406 KB
