1. Text, Sound and Image
IGCSE Computer Science (0478)
  • Data Representation
    • Introduction
    • Why computers use binary (how binary represents data)
    • Number system
      • Introduction
      • Number Conversions
      • Addition of Binary Numbers
      • Logical binary shifts (positive 8-bit integers)
      • Two’s Complement (Signed: Positive and Negative Numbers)
      • Use of the Hexadecimal System
    • Text, Sound and Image
      • Text, Sound and Images
      • File Types
    • Data storage and File compression
      • Measurement of the Size of Computer Memories
      • Lossless and Lossy File Compression
  1. Text, Sound and Image

Text, Sound and Images

Understanding How Computers Store Text

1. The Basic Idea#

Computers only understand numbers! So every letter, number, and symbol needs a number code.

2. ASCII - The American Standard#

What is ASCII?#

Created in 1960s USA
Only 128 codes total
Made for old computers and typewriters

ASCII Conversion Chart#

UPPERCASE Letters:
A=65 B=66 C=67 D=68 E=69 F=70 G=71
H=72 I=73 J=74 K=75 L=76 M=77 N=78
O=79 P=80 Q=81 R=82 S=83 T=84 U=85
V=86 W=87 X=88 Y=89 Z=90
lowercase letters:
a=97 b=98 c=99 d=100 e=101 f=102 g=103
h=104 i=105 j=106 k=107 l=108 m=109 n=110
o=111 p=112 q=113 r=114 s=115 t=116 u=117
v=118 w=119 x=120 y=121 z=122
Numbers:
0=48 1=49 2=50 3=51 4=52
5=53 6=54 7=55 8=56 9=57
Common Symbols:
Space=32 !=33 @=64 #=35 $=36
%=37 &=38 *=42 +=43 -=45
/=47 :=58 ;=59 ?=63

ASCII (American Standard Code for Information Interchange)#

ASCII assigns a number to every letter, number, or symbol on a keyboard.
It uses 7 bits per character (sometimes 8 bits with a leading zero).
Uppercase and lowercase letters have different ASCII values.
Each next character’s ASCII value is 1 more than the previous one.

Example:#

'a' = 97
'b' = 98
ASCII uses one byte (8 bits) to store each character.

Example:#

The letter 'A' has ASCII value 65, which in binary is:
01000001

Word Conversion Examples#

"HELLO" = 72, 69, 76, 76, 79
H=72, E=69, L=76, L=76, O=79
"hello" = 104, 101, 108, 108, 111
h=104, e=101, l=108, l=108, o=111
"Code123" = 67, 111, 100, 101, 49, 50, 51
C=67, o=111, d=100, e=101, 1=49, 2=50, 3=51

3. Unicode - The Global Standard#

What is Unicode?#

Created for the whole world
Over 1 million codes (and growing!)
Includes all languages + emoji

How Unicode Works with ASCII#

Keeps the same codes for English letters (A=65, a=97, etc.)
Adds thousands more codes for other languages

Unicode Examples#

"A" = 65 (same as ASCII)
"ñ" = 241 (Spanish - NOT in ASCII)
"字" = 23383 (Chinese - NOT in ASCII)
"😂" = 128514 (emoji - NOT in ASCII)

4. Quick Comparison#

ASCIIUnicode
Size128 codes1,000,000+ codes
LanguagesEnglish onlyAll languages
Emoji❌ No✅ Yes
Modern UseRareEverywhere!

5. Practice Problems#

Convert to ASCII:#

1.
"MATH" = ______
2.
"book" = ______
3.
"A+100" = ______

What's Missing in ASCII?#

4.
Can ASCII handle "café"? Why? ______
5.
Can ASCII handle "😊"? Why? ______

Answers:#

1.
77, 65, 84, 72
2.
98, 111, 111, 107
3.
65, 43, 49, 48, 48
4.
No - "é" isn't in ASCII
5.
No - emoji aren't in ASCII

6. Key Points to Remember#

✅ ASCII = Small English-only code system
✅ Unicode = Huge global code system
✅ Your phone/computer uses Unicode to handle all languages and emoji
✅ ASCII codes are preserved in Unicode for English letters

Real-World Connection#

Why this matters:
Unicode lets you text in any language
Unicode makes emoji possible 😎
Websites can show content from any country
Your games can have special symbols and characters
Think of it like this:
ASCII = Only knowing English
Unicode = Knowing every language in the world!

Study Tip: Memorize A=65, a=97, 0=48 - you can figure out the rest from there! 🎯

Sound Representation#

Sound is an analogue wave — smooth and continuous.
To store sound digitally, the wave is sampled at regular time intervals.
Each sample measures the amplitude (height) of the wave.
The sampling rate is how many samples are taken per second (in Hertz).
The bit depth (sampling resolution) is how many bits store each sample.
Higher sampling rate and bit depth improve sound quality but increase file size.
Example:
CD quality audio: 44,100 samples/second at 16 bits per sample.

Sound File Size Calculation#

ParameterValue
Sample rate44,100 samples/second
Bit depth8 bits per sample
Channels2 (stereo)
Duration1 second
Formula:
File size (bits) = sample rate × bit depth × channels × duration
Calculation:
44,100 × 8 × 2 × 1 = 705,600 bits
Bytes = 705,600 ÷ 8 = 88,200 bytes
KiB = 88,200 ÷ 1024 ≈ 86.13 KiB

Image Representation (Bitmap)#

Images are made of tiny dots called pixels.
Each pixel is stored as a binary number.
Colour depth is the number of bits per pixel.
Colour DepthNumber of Colours
1 bit2 colours (black or white)
8 bits256 colours
24 bits16,777,216 colours (true color)
Image resolution = width × height in pixels (e.g., 1920 × 1080).
Higher resolution and colour depth mean better quality but larger file size.
File size formula:
File size (bits) = resolution × colour depth
Convert to bytes by dividing by 8.

Practice Questions#

1.
Find ASCII code for 'a' and write its 8-bit binary.
Answer: ASCII 97 → binary 01100001
2.
Why is Unicode better for world languages?
Answer: It supports many languages and symbols beyond English.
3.
Calculate file size for an 800 × 600 image with 24-bit colour in KiB.
Answer: (800 × 600 × 24) ÷ 8 = 1,440,000 bytes ≈ 1406.25 KiB
4.
What happens to file size if colour depth reduces from 24-bit to 8-bit?
Answer: File size becomes one-third, because fewer bits per pixel are used.
5.
Calculate bits needed for 1 second of stereo sound at 8-bit and 44,100 Hz.
Answer: 44,100 × 8 × 2 × 1 = 705,600 bits (~86.13 KiB)
Modified at 2025-11-11 09:37:52
Previous
Text, Sound and Image
Next
File Types
Built with