Subtopic Notes

1.2 Text, sound and images

1. Data representation

Text

  • A character set generally includes upper & lower case letters, number digits, punctuation marks and other characters
  • Character sets use different binary representations for each character via character encoding
  • Value of A = 65, a = 97, 0 = 48
  • Character Encoding Standards:
ASCII1Extended ASCIIUnicode
Only English alphabets can be representedASCII’s extension - Also includes most European languages’ alphabetsSuperset for ASCII & extended ASCII - recognized by various global languages
Each character encoding takes up 7 bits, hence 128 possible charactersASCII extended to 8 bits, hence 256 possible characters.Greater range of characters, as it uses 2 or 4 bytes per character.
Takes less space2 or 4 times more space needed per character

Sound

  • Analogue data is continuous electrical signals whereas digital data is discrete electrical signals.
  • Sound signals are vibrations through a medium. Hence are analogue in nature as there can be infinite detail for sound.
  • Analogue signals converted (encoded) to digital signals by sampling:
    • Sound wave’s amplitude sampled at set time intervals
    • These samples are encoded as a binary number sequence
    • This provides a digital representation of the sound wave
  • Sampling Rate
    • Number of samples taken in a second
    • Unit: Hertz (Hz)
    • ↑ Sampling Rate = ↑ Accuracy = ↑ File size.
  • Sampling Resolution
    • Number of bits per sample
    • ↑ Sampling Resolution = ↑ Accuracy = ↑ File size
  • Bit Rate
    • Number of bits for storing 1 second of sound
    • Bit Rate = Sampling Rate x Sampling Resolution
  • File Size = Bitrate x Length of Sound
    For Stereo sound (sound with two channels) file, multiply results by two
  • File Formats:
    • Musical Instrument Digital Format - MIDI (.mid): Stores musical performance data, such as notes, timings, and control signals, without including actual audio, allowing instruments or software to reproduce the composition
    • WAV (.wav), FLAC (.flac) - Uncompressed, High-quality
    • MP3 (.mp3) - Compressed format with lossy audio quality

Images

  • Pixel: Smallest picture element whose color can be accurately represented by binary
  • Data for a bitmapped image is encoded by assigning a solid color to each pixel, i.e., through bit patterns.
  • Bit patterns are generated by considering each grid row as a series of binary color codes corresponding to each pixel’s color.
  • These bit patterns are ‘mapped’ onto the main memory.
  • File Header: Stores the metadata of bitmap file; image size, color depth
  • Image Resolution
    • Number of pixels in an image
    • Image Resolution = width × height; E.g. 1920 × 1080 pixels
    • Image resolution ↑ = sharper/more detailed image = ↑ File Size
  • Screen Resolution
    • Number of pixels which can be viewed horizontally & vertically on the device’s screen
    • Number of pixels = width × height; E.g. 1680 × 1080 pixels
  • Color depth: Number of bits used to represent each color
    • An image with n bits has 2n colors per pixel
    • E.g. 16-color bitmap has 4 bits per pixel ∵ 24 = 16
    • Color Depth ↑ = Color Quality ↑ = File Size ↑
  • File Size = Number of Pixels (Image Resolution) × Colour depth
  • Formats:
    • JPEG (.jpg or .jpeg) - Compressed format with lossy quality
    • PNG (.png) - Lossless format supporting transparency
    • GIF (.gif), BMP (.bmp), PSD (.psd), HEIF (.heic or .heif), ICO (.ico)
  • Applications: Scanned images and general computer usage

Footnotes

  1. ASCII: American standard code for information interchange