0% found this document useful (0 votes)
9 views

T.file Format

Uploaded by

z5mh2h8qyc
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

T.file Format

Uploaded by

z5mh2h8qyc
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

There are many different file formats used to store data in the form of text and

numbers, images, sound or video, in computer systems.


This chapter will consider how file compression is used to save memory when
storing different types of files.

File formats
There are many different file formats used to store data in the form of text
and numbers, images, sound or video, in computer systems.

Sound files:-
1. Musical Instrument Digital Interface (MIDI)

1. This system is always associated with the storage of music files.


2. What is it?
• MIDI file does NOT store sounds; it is a form of
communications protocol allowing electronic musical
instruments to interact with each other. It uses 8-bit serial
transmission with a start and stop bit (asynchronous).

3. What does it contain?


• MIDI files consist of lists of commands which instruct a device
(e.g. an electronic organ, sound card on computer or in a
mobile phone) how to produce musical note/sound; for NOTE
on/off or KEY PRESSURE, and so on.
• Also included would be pitch byte(which note to play) and
velocity byte(how loud to play).
4. Advantage:
• Since MIDI files don't contain actual audio tracks, their size is
relatively small.

5. Application:
• Their relatively smaller size makes them suitable for
sounds/music on devices with limited memory; for example,
storing ringtones on mobile phone.

• The same MIDI file can be played on different musical


instruments, with different effects to the original. The
electronic devices need MIDI interfaces to allow them to do so.
These types of files can be used in recording studio, in major
orchestras or musical scores in films to produce different lines
of a track using multiple instruments.

2. MP3 /MPEG-3 (MP3)


• What is it?
• technology known as AUDIO COMPRESSION to convert music
and other sounds into an MP3 format.
• This compression technology reduces the size of a normal
music file by about 90 per cent. For example, an 80 megabyte
music CD can be reduced to 8 megabytes using MP3
technology.

But how can the original music file be reduced by 90 per cent whilst still
retaining most of the music quality?
This is done using file compression algorithms which use PERCEPTUAL
MUSIC SHAPING; this essentially removes sounds that the human ear
can't hear properly.
For example, if two sounds are played at the same time, only the louder
one can be heard by the ear, so the softer sound is eliminated. This means
that certain parts of the music can be removed without affecting the
quality too much.

This is known to be a LOSSY FORMAT, since the original file can't be put
back together again after compression.

• Applications:
• Used in MP3 players, computers or mobile phones
• Files can be downloaded as MP3 from the internet
• CDs can be converted to MP3 format.
• MPEG- 4 (MP4)
• What is it?
• MP4 files are slightly different to MP3 files since they can store
multimedia rather than just sound. Music, videos, photos and
animation can all be stored in the MP4 format. e.g. streaming
of videos over the Internet using MP4 format

Image files:-

• JPEG
How images are stored?
• Bitmap images are made up of pixels (picture elements), that is, the
image is made up of a 2D matrix of pixels.

• Each pixel is represented as a binary number which defines the


colour information:
• A black and white image : can use 1 bit per pixel ( 1 for white
and 0 for black)
• A colour image generally uses 3 bytes (24 bits) for each pixel: 1
byte for each colour (red, blue, green)

• Image resolution refers to the number of pixels in the image


e.g. an image of 2048 x 1536 pixels has resolution of 3 145 728 pixels
• A raw bitmap (TIFF or BMP) image has the highest image resolution
thus, best image quality BUT also a too large file size.
• Large file sizes use up too much memory space on memory
cards and take much time to get transferred, uploaded or
downloaded.
• Therefore, it is necessary to compress them to jpeg format.

• How to compress?
• Joint Photographic Experts Group (JPEG) files
JPEG files use a lossy format file compression method. JPEG is
used to store photographs as a reduced file size. They rely on
certain properties of the human eye (e.g. its inability to detect
small brightness differences or colour hues).
• Thus, reducing the number of bits used per pixel (less
shades of colours) .

Text and number files:-

• Text is stored in ASCII format. Numbers can be stored as real, integer,


date, time, currency, and so on. Lossless format is used since
accuracy of data is very important.

• How to compress?
• Uses a complex algorithm that detects redundancy/repeated
sections of words
• Repeated words/sections are put in a data dictionary and
replaced by a code(usually numeric)
• When reading the file, it can be decompressed and the original file
can be reformed using the data dictionary.

Example:
Phrase : 'THIS SECTION SHOWS YOU HOW THIS WOULD WORK' contains 35
characters (ignoring spaces)

• Detect repeated words: 'THIS SECTION SHOWS YOU HOW THIS


WOULD WORK'
• Using a dictionary of 1 = THIS, 2 = HOW, 3 = OU to replace
repetitions, we obtain
'1 SECTION S2S Y3 2 1 W3LD WORK'
this compressed form has now 23 characters(ignoring spaces)
Compression = 12/35 * 100 = 34.2857 %
Lossless and lossy file compression
With lossless file compression, all the data bits from the original file are
reconstructed when the file is again uncompressed. Very important when
loss of data cannot be afforded e.g. in a spreadsheet file.

With lossy file compression, unnecessary bits of data are eliminated,


forming a file that can't be reconstructed to get back to the original file.

ACTIVITY:
• Give 2 differences between MIDI and MP3 files .

• A colour image is 1200 pixels by 1600 pixels. Calculate:


• total number of pixels in the original image
• Number of bytes occupied by this file
• file size in Megabyte
• File size if file is to be stored in Jpeg format (reduced by a
factor of 8)

• A CD is being used to store music. Each minute's worth of recording


takes up 12 megabytes.
• The CD contains nine tracks which are the following length (in
minutes): 3, 5, 6, 4, 5, 2, 7, 8, 8. How much memory would
these nine tracks occupy on the CD?
• If the CD was downloaded to a computer and then all the
tracks were put through an MP3 compression algorithm, how
much memory would the nine tracks now occupy (you may
assume a 90 per cent file reduction size)?
• Find the average size of each of the MP3 tracks, and then
estimate how many MP3 files could be stored on an 800
megabyte CD.

You might also like