Data Storage - Part 2

advertisement
Data Storage – Part 2
CS 1 Introduction to Computers and Computer
Technology
Rick Graziani
Fall 2014
Digitizing Text
• Earliest uses of PandA (Presence and Absence) was to digitize text
•
•
(keyboard characters).
We will look at digitizing images and video later.
Assigning Symbols in United States:
– 26 upper case letters
– 26 lower case letters
– 10 numerals
– 20 punctuation characters
– 10 typical arithmetic characters
– 3 non-printable characters (enter, tab, backspace)
– 95 symbols needed
Rick Graziani graziani@cabrillo.edu
2
ASCII-7
• In the early days, a 7 bit
code was used, with 128
combinations of 0’s and 1’s,
enough for a typical
keyboard.
• The standard was developed
by ASCII (American
Standard Code for
Information Interchange)
• Each group of 7 bits was
mapped to a single keyboard
character.
0 = 0000000
1 = 0000001
2 = 0000010
3 = 0000011
… 127 = 1111111
Rick Graziani graziani@cabrillo.edu
3
Byte
Byte = A collection of bits (usually 7 or 8 bits) which
represents a character, a number, or other information.
• More common: 8 bits = 1 byte
• Abbreviation: B
Rick Graziani graziani@cabrillo.edu
4
Bytes
1 byte (B)
Kilobyte (KB) = 1,024 bytes (210)
• “one thousand bytes”
1,024 = 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2
Megabyte (MB) = 1,048,576 bytes (220)
• “one million bytes”
Gigabyte (GB) = 1,073,741,824 bytes (230)
• “one billion bytes”
Rick Graziani graziani@cabrillo.edu
5
Wikipedia
Rick Graziani graziani@cabrillo.edu
6
ASCII-8
• IBM later extended the
•
•
standard, using 8 bits per
byte.
This was known as
Extended ASCII or ASCII-8
This gave 256 unique
combinations of 0’s and 1’s.
1
0 = 00000000
1 = 00000001
2 = 00000010
3 = 00000011
… 255 = 11111111
Rick Graziani graziani@cabrillo.edu
7
ASCII-8
Rick Graziani graziani@cabrillo.edu
8
Try it!
1
• Write out Cabrillo College (Upper and Lower case) in bits (binary)
using the chart above.
0100 0011
C
0110 0001
a
Rick Graziani graziani@cabrillo.edu
…
9
The answer!
0100 0011
C
0110 1100
l
0110 1100
l
0110 0001
a
0110 1111
o
0110 0101
e
Rick Graziani graziani@cabrillo.edu
1
0110 0010
b
0010 0000
space
0110 0111
g
0111 0010
r
0100 0011
C
0110 0101
e
0110 1001
i
0110 1111
o
0110 1100
l
0110 1100
l
10
Unicode
• Although ASCII works fine for English, many other languages need
•
•
•
more than 256 characters, including numbers and punctuation.
Unicode uses a 16 bit representation, with 65,536 possible symbols.
Unicode can handle all languages.
www.unicode.org
Rick Graziani graziani@cabrillo.edu
11
Non-text Files:
Representing Images and Sound
Rick Graziani graziani@cabrillo.edu
13
Rick Graziani graziani@cabrillo.edu
14
Pixels
• A monitors screen is divided into a grid of small unit called
•
•
picture elements or pixels.
The more pixels per inch the better the resolution, the
sharper the image.
All colors on the screen are a combination of red, green
and blue (RGB), just at various intensities.
Rick Graziani graziani@cabrillo.edu
15
Rick Graziani graziani@cabrillo.edu
16
• Each Color intensity of red, green and blue represented as a
•
•
•
•
•
quantity from 0 through 255.
Higher the number the more intense the color.
Black has no intensity or no color and has the value (0, 0, 0)
White is full intensity and has the value (255, 255, 255)
Between these extremes is a whole range of colors and intensities.
Grey is somewhere in between (127, 127, 127)
Rick Graziani graziani@cabrillo.edu
17
RGB Colors and Binary Representation
• You can use your favorite program that allows you to choose colors to
view these various red, green and blue values.
Rick Graziani graziani@cabrillo.edu
18
RGB Colors and Binary Representation
• Let’s convert these colors from Decimal to Binary!
Purple:
Gold:
Rick Graziani graziani@cabrillo.edu
Red
172
253
Green
73
249
Blue
185
88
19
RGB Colors and Binary Representation
Red
172
253
Green
73
249
Purple:
Gold:
Number of:
27
26
25
24
128’s 64’s 32’s 16’s
Dec.
172
73
185
Blue
185
88
23
22
21
20
8’s 4’s 2’s 1’s
253
249
88
Rick Graziani graziani@cabrillo.edu
20
RGB Colors and Binary Representation
Red
172
253
Green
73
249
Blue
185
88
Purple:
Gold:
Number of:
27
26
25
24
23
22
21
20
128’s 64’s 32’s 16’s 8’s 4’s 2’s 1’s
Dec.
172
1
0
1
0
1
1
0
0
73
0
1
0
0
1
0
0
1
185
1
0
1
1
1
0
0
1
253
249
88
1
1
0
Rick Graziani graziani@cabrillo.edu
1
1
1
1
1
0
1
1
1
1
1
1
1
0
0
0
0
0
1
1
0
21
RGB Colors and Binary Representation
• We have now converted these colors from Decimal to Binary!
Red
172
Purple:
10101100
Gold:
253
11111101
•
Green
73
01001001
249
11111001
Blue
185
10111001
88
01011000
Why does this matter?
Rick Graziani graziani@cabrillo.edu
22
First a word about Pixels Per Inch
1600 pixels
1600 pixels /300 ppi = 5.3 inches
1200 pixels/300 ppi = 4 inches
1200
pixels
graphicssoft.about.com
• PPI stands for pixels per inch.
• PPI is a measurement of image resolution that defines the
size an image will print.
• The higher the PPI value, the better quality print you will
get--but only up to a point.
• 300ppi is generally considered the point of diminishing
returns when it comes to ink jet printing of digital photos.
Rick Graziani graziani@cabrillo.edu
23
First a word about Pixels Per Inch
•
The higher the PPI value,
the better quality print you
will get--but only up to a
point.
Rick Graziani graziani@cabrillo.edu
24
RGB Colors and Binary Representation
Red
172
Purple:
10101100
Green
73
01001001
Blue
185
10111001
24 bits for one pixel!
• “True color” systems require 3 bytes or 24 bits per pixel.
• There is 8 bit and 16 bit color, which gives you less of a color palette.
Rick Graziani graziani@cabrillo.edu
25
RGB Colors and Binary Representation
8 inches or
2,400 pixels
Red
172
Purple:
10101100
10 inches or
3,000 pixels
Green
73
01001001
Blue
185
10101111
= 24 bits per pixel
• An 8 inch by 10 inch image scanned in at 300 pixels per inch:
– 8 x 300 = 2,400 pixels 10 x 300 = 3,000 pixels
– 2,400 pixels by 3,000 pixels = 7,200,000 pixels or 7.2 megapixels
– At 24 bits per pixel (7,200,000 x 24)
• = 172,800,000 bits or 21,600,000 bytes (21.6 megabytes)
• RAM memory, video memory, disk space, bandwidth,…
Rick Graziani graziani@cabrillo.edu
26
File Compression
• Typical computer screen only has
•
•
•
about 100 pixels per inch, not
300.
Images still require a lot of
memory and disk space, not to
mention transferring images over
the network or Internet.
Compression – A means to
change the representation to use
fewer bits to store or transmit
information.
Information sent via a fax is either
black or white, long strings of 0’s
or long strings of 1’s.
Rick Graziani graziani@cabrillo.edu
27
Run-length encoding
• Many fax machines use run-length
•
•
•
encoding.
Run-length encoding uses binary
numbers to specify how long the
first sequence (run) of 0’s is, then
how long the following sequence of
1’s is, then how long the following
sequence of 0’s is, and so on.
Fewer bits needed than sending
100 0’s, then 373 1’s etc.
Run-length encoding is a lossless
compression scheme, meaning
that the original representation of
0’s and 1’s can be reconstructed
exactly.
Rick Graziani graziani@cabrillo.edu
28
JPEG
Compression
• JPEG – Joint Photographic Experts Group
• JPEG is a common standard for compressing and storing still images.
• Our eyes are not very sensitive to small changes in hue (chrominance),
•
•
but we are sensitive to brightness (luminance).
This means we can store less accurate description of the hue of the
picture (fewer bits) and our eyes will not notice it.
This is a lossy compression scheme, because we have lost some
the original representation of the image and it cannot be reconstructed
exactly.
Rick Graziani graziani@cabrillo.edu
29
JPEG Compression Scheme
• With JPEG we can get 20:1 compression ratio or more, without being
•
•
able to see a difference.
There are large areas of similar hues in pictures that can be lumped
together without our noticing.
Because of this, when Run-length compression is used there is more
compression because there is less variations in the hue.
Rick Graziani graziani@cabrillo.edu
30
MPEG Compression Scheme
• MPEG (Motion Pictures Experts Group)
• MPEG compression is similar to JPEG, but applied to movies.
– JPEG compression is applied to each frame.
– Then interframe coherency is used, which only records and
transmits the “differences” between frames.
Rick Graziani graziani@cabrillo.edu
31
Hexadecimal Number System
<tr>
<td rowspan="2" bgcolor="#cccc99"> </td>
<td height="30" bgcolor="#999966"><div id="mainnav">
Rick Graziani graziani@cabrillo.edu
33
Rick Graziani graziani@cabrillo.edu
34
Pixels
• A monitors screen is divided into a grid of small unit called
•
•
picture elements or pixels.
The more pixels per inch the better the resolution, the
sharper the image.
All colors on the screen are a combination of red, green
and blue (RGB), just at various intensities.
Rick Graziani graziani@cabrillo.edu
35
Rick Graziani graziani@cabrillo.edu
36
Dreamweaver
Rick Graziani graziani@cabrillo.edu
37
<tr>
<td rowspan="2" bgcolor="#cccc99"> </td>
<td height="30" bgcolor="#999966"><div id="mainnav">
•
Hexadecimal Number
With web applications like HTML (Hypertext Markup
Language), colors are sometime described using their RGB
color specification in hexadecimal.
Rick Graziani graziani@cabrillo.edu
38
Hexadecimal RED GREEN BLUE
<td rowspan="2" bgcolor="#cccc99"> </td>
Red
cc
Green
cc
Blue
99
<td height="30" bgcolor="#999966"><div id="mainnav">
Red
99
Green
99
Blue
66
# means hexadecimal in web applications
Rick Graziani graziani@cabrillo.edu
39
Hexadecimal Numbers
•
•
What are they?
Why do these people use them?
– web designers
– digital medial creators
– computer scientists
– networking professionals
Rick Graziani graziani@cabrillo.edu
40
Rick’s Number System Rules
•
•
•
•
All digits start with 0
A Base-n number system has n number of digits:
– Decimal: Base-10 has 10 digits
– Binary: Base-2 has 2 digits
– Hexadecimal: Base-16 has 16 digits
The first column is always the number of 1’s
Each of the following columns is n times the previous
column (n = Base-n)
– Base 10: 10,000
1,000
100
10
1
– Base 2:
16
8
4
2
1
– Base 16: 65,536
4,096
256
16
1
Rick Graziani graziani@cabrillo.edu
41
Hexadecimal Digits
Hexadecimal: 16 digits
Dec
0
1
2
3
4
5
6
7
Hex
0
1
2
3
4
5
6
7
Rick Graziani graziani@cabrillo.edu
Dec
8
9
10
11
12
13
14
15
Hex
8
9
A
B
C
D
E
F
42
0, 1, 2, 3, 4, 5, 6, 7 ,8, 9, A, B, C, D, E, F
Decimal
8
9
10
14
15
16
Rick Graziani graziani@cabrillo.edu
Hexadecimal
16’s
1’s
8
9
A
E
F
1
0
43
0, 1, 2, 3, 4, 5, 6, 7 ,8, 9, A, B, C, D, E, F
Decimal
17
20
21
26
12
29
Rick Graziani graziani@cabrillo.edu
Hexadecimal
16’s
1’s
1
1
1
4
1
5
1
A
C
1
D
44
0, 1, 2, 3, 4, 5, 6, 7 ,8, 9, A, B, C, D, E, F
Decimal
30
31
32
33
50
60
Rick Graziani graziani@cabrillo.edu
Hexadecimal
16’s
1’s
1
E
1
F
2
0
2
1
3
2
3
C
45
Question…
• Luigi went into a bar and ordered a beer. The bartender ask Luigi for
his ID to make sure he was old enough to order a beer (21). After
looking at Luigi’s ID the bartender told Luigi he was not at least 21.
Luigi answered, “I’m sorry but you are wrong. I am exactly 21. My ID
shows my age in Hexadecimal.”
What age is on McLuigi’s ID in Hexadecimal?
Decimal
21
Rick Graziani graziani@cabrillo.edu
16’s
1
16
1’s
5
+
5
46
Don’t forget why we are doing this!
<tr>
<td rowspan="2" bgcolor="#cccc99"> </td>
<td height="30" bgcolor="#999966"><div id="mainnav">
Hexadecimal Number
Rick Graziani graziani@cabrillo.edu
47
Why Hexadecimal?
•
•
•
•
Hexadecimal is perfect for matching 4 bits.
Every combination of 4 bits can be matched with
one hex number.
4 bits can be represented by 1 Hex value
8 bits can be represented by 2 Hex values
Rick Graziani graziani@cabrillo.edu
48
Hexadecimal Digits
4 bits can be represented by 1 Hex value
Hexadecimal: 16 digits
Dec
0
1
2
3
4
5
6
7
Hex
0
1
2
3
4
5
6
7
Rick Graziani graziani@cabrillo.edu
Binary
8421
0000
0001
0010
0011
0100
0101
0110
0111
Dec
8
9
10
11
12
13
14
15
Hex
8
9
A
B
C
D
E
F
Binary
8421
1000
1001
1010
1011
1100
1101
1110
1111
49
Hexadecimal Digits
4 bits can be represented by 1 Hex value
•
•
•
•
Hexadecimal is perfect for matching 4 bits.
Every combination of 4 bits can be matched with one hex number.
4 bits can be represented by 1 Hex value
8 bits can be represented by 2 Hex values
Dec.
0
1
2
3
4
5
6
7
Hex.
0
1
2
3
4
5
6
7
Rick Graziani graziani@cabrillo.edu
Binary
0000
0001
0010
0011
0100
0101
0110
0111
Dec.
8
9
10
11
12
13
14
15
Hex.
8
9
A
B
C
D
E
F
Binary
1000
1001
1010
1011
1100
1101
1110
1111
50
Converting Decimal, Hex, and Binary
Dec.
Hex.
Binary
Dec.
Hex.
Binary
0
0
0000
8
8
1000
1
1
0001
9
9
1001
2
2
0010
10
A
1010
3
3
0011
11
B
1011
4
4
0100
12
C
1100
5
5
0101
13
D
1101
6
6
0110
14
E
1110
7
7
0111
15
F
1111
-----------------------------------------------------
Dec. Hex
0
F
A
C
Binary
Rick Graziani graziani@cabrillo.edu
Dec. Hex
Binary
0010
1110
0000
0010
Dec. Hex Binary
10
12
5
1000
51
Converting Decimal, Hex, and Binary
Dec.
Hex.
Binary
Dec.
Hex.
Binary
0
0
0000
8
8
1000
1
1
0001
9
9
1001
2
2
0010
10
A
1010
3
3
0011
11
B
1011
4
4
0100
12
C
1100
5
5
0101
13
D
1101
6
6
0110
14
E
1110
7
7
0111
15
F
1111
-----------------------------------------------------
Dec. Hex
0
0
15
F
10
A
12
C
Binary
0000
1111
1010
1100
Rick Graziani graziani@cabrillo.edu
Dec. Hex
2
2
14
E
0
0
2
2
Binary
0010
1110
0000
0010
Dec. Hex Binary
10
A 1010
12
C 1100
5
5 0101
8
8 1000
52
What about 8 bits?
Dec.
Hex.
Binary
Dec.
Hex.
Binary
0
0
0000
8
8
1000
1
1
0001
9
9
1001
2
2
0010
10
A
1010
3
3
0011
11
B
1011
4
4
0100
12
C
1100
5
5
0101
13
D
1101
6
6
0110
14
E
1110
7
7
0111
15
F
1111
-----------------------------------------------------
HEX
2 4
Rick Graziani graziani@cabrillo.edu
BINARY
?
53
What about 8 bits?
Dec.
Hex.
Binary
Dec.
Hex.
Binary
0
0
0000
8
8
1000
1
1
0001
9
9
1001
2
2
0010
10
A
1010
3
3
0011
11
B
1011
4
4
0100
12
C
1100
5
5
0101
13
D
1101
6
6
0110
14
E
1110
7
7
0111
15
F
1111
-----------------------------------------------------
HEX
2 4
Rick Graziani graziani@cabrillo.edu
BINARY
0010 0100
54
Using Hex for 8 bits
Dec.
Hex.
Binary
Dec.
Hex.
Binary
0
0
0000
8
8
1000
1
1
0001
9
9
1001
2
2
0010
10
A
1010
3
3
0011
11
B
1011
4
4
0100
12
C
1100
5
5
0101
13
D
1101
6
6
0110
14
E
1110
7
7
0111
15
F
1111
-----------------------------------------------------
Hex
12
AB
02
Binary
0001 0010
0111 0111
0000 0010
Rick Graziani graziani@cabrillo.edu
Hex
3C
1A
B4
Binary
1000 1111
1100 1001
Hex
99
00
7D
Binary
1111 1111
0101 1100
55
Using Hex for 8 bits
Dec.
Hex.
Binary
Dec.
Hex.
Binary
0
0
0000
8
8
1000
1
1
0001
9
9
1001
2
2
0010
10
A
1010
3
3
0011
11
B
1011
4
4
0100
12
C
1100
5
5
0101
13
D
1101
6
6
0110
14
E
1110
7
7
0111
15
F
1111
-----------------------------------------------------
Hex
12
AB
02
77
02
Binary
0001 0010
1010 1011
0000 0010
0111 0111
0000 0010
Rick Graziani graziani@cabrillo.edu
Hex
3C
1A
B4
8F
C9
Binary
0011 1100
0001 1010
1011 0100
1000 1111
1100 1001
Hex
99
00
7D
FF
5C
Binary
1001 1001
0000 0000
0111 1101
1111 1111
0101 1100
56
So why is Rick torturing us?
<tr>
<td rowspan="2" bgcolor="#cccc99"> </td>
<td height="30" bgcolor="#999966"><div id="mainnav">
Hexadecimal Number
Rick Graziani graziani@cabrillo.edu
57
How much RED GREEN BLUE ?
<td rowspan="2" bgcolor="#cccc99"> </td>
Red
Green
Blue
cc
cc
99
<td height="30"bgcolor="#999966"><divid…>
Red
Green
Blue
99
99
66
Rick Graziani graziani@cabrillo.edu
58
Hexadecimal # RED GREEN BLUE
<td rowspan="2" bgcolor="#cccc99"> </td>
Red
Green
Blue
cc
cc
99
Convert to Binary
Red
Hex
cc
Bin
1100 1100
Green
cc
1100 1100
Blue
99
1001 1001
24 bits represent a single color
Rick Graziani graziani@cabrillo.edu
59
Hex
Bin
Red
cc
1100 1100
Green
cc
1100 1100
Blue
99
1001 1001
24 bits represent a single color
Rick Graziani graziani@cabrillo.edu
60
Hex
Red
00->FF
Green
00->FF
Blue
00->FF
Bin
0000 0000
thru
1111 1111
0000 0000
thru
1111 1111
0000 0000
thru
1111 1111
Dec
0 -> 255
0 -> 255
0 -> 255
255
255
?
0
Rick Graziani graziani@cabrillo.edu
255
?
0
?
0
61
255
?
0
255
?
0
255
?
0
Rick Graziani graziani@cabrillo.edu
How Much?
0 to 255
62
Hex
Bin
Red
cc
1100 1100
Decimal
204
Rick Graziani graziani@cabrillo.edu
Green
cc
1100 1100
Blue
99
1001 1001
Hexadecimal
16’s
1’s
c
c
or
12
12
(12x16) (12x1)
= 192 +
12
63
Hex
Bin
Dec
Red
cc
1100 1100
204
Rick Graziani graziani@cabrillo.edu
Green
cc
1100 1100
204
Blue
99
1001 1001
153
64
255
204
0
255
204
0
255
153
0
Rick Graziani graziani@cabrillo.edu
65
<td rowspan="2" bgcolor="#cccc99"> </td>
Rick Graziani graziani@cabrillo.edu
66
FF
255
0
00
0
FF
255
0
00
Dec
Hex
Bin
Red
0
00
0000 0000
0
Decimal
FF
Green
0
00
0000 0000
Blue
255
FF
1111 1111
Hexadecimal
16’s
1’s
255
255
00
0
Rick Graziani graziani@cabrillo.edu
67
FF
255
200
00
0
FF
255
48
00
Dec
Hex
Bin
Red
200
c8
1100 1000
0
Decimal
FF
Green
48
30
0011 0000
Blue
127
7F
0111 1111
Hexadecimal
16’s
1’s
255
127
00
0
Rick Graziani graziani@cabrillo.edu
68
FF
255
74
00
0
FF
255
132
00
Dec
Hex
Bin
Red
74
4A
0100 1010
0
Decimal
FF
Green
132
84
1000 0100
Blue
40
28
0010 1000
Hexadecimal
16’s
1’s
255
40
00
0
Rick Graziani graziani@cabrillo.edu
69
FF
255
255
00
0
FF
255
255
00
Dec
Hex
Bin
Red
255
FF
1111 1111
0
Decimal
FF
Green
255
FF
1111 1111
Blue
255
FF
1111 1111
Hexadecimal
16’s
1’s
255
255
00
0
Rick Graziani graziani@cabrillo.edu
70
FF
255
50
00
0
FF
255
128
00
Dec
Hex
Bin
Red
50
32
0011 0010
0
Decimal
FF
Green
128
80
1000 0000
Blue
60
3C
0011 1100
Hexadecimal
16’s
1’s
255
60
00
0
Rick Graziani graziani@cabrillo.edu
71
CMYK - Cyan-Magenta-Yellow-Black
From Wikipedia:
• The CMYK color model (process color, four color) is used in color printing.
• Comparisons between RGB displays and CMYK prints can be difficult, since
the color reproduction technologies and properties are so different.
• A computer monitor mixes shades of red, green, and blue to create color
pictures.
• There is no simple or general conversion formula that converts between them.
• Conversions are generally done through color management systems.
• Nevertheless, the conversions cannot be exact.
Rick Graziani graziani@cabrillo.edu
72
Color Codes
Rick Graziani graziani@cabrillo.edu
73
Digitizing Sound
Theme from Shaft
Rick Graziani graziani@cabrillo.edu
75
Digitizing Sound
• Many definitions of analog.
• (Our definition) analog wave is a wave form analogous to the human
•
voice.
The telephone systems uses an analog wave to transmit your voice
over the telephone line to their Central Office.
Rick Graziani graziani@cabrillo.edu
76
Digitizing Sound
Rick Graziani graziani@cabrillo.edu
77
Digitizing Sound
• Many definitions of analog.
• (Our definition) analog wave is a wave form analogous to the human
•
voice.
The telephone systems uses an analog wave to transmit your voice
over the telephone line to their Central Office.
Rick Graziani graziani@cabrillo.edu
78
Digitizing Sound
• Two parts of the wave:
•
– Amplitude – Height of the wave which equates to volume.
– Frequency – Number of waves per second, which equates to pitch.
Computers are digital devices, so the analog wave needs to be
converted to a digital format.
Rick Graziani graziani@cabrillo.edu
79
Digitizing Sound
• Converting Analog to Digital requires three steps:
1. Sampling
2. Quantifying
3. Coding
Rick Graziani graziani@cabrillo.edu
80
Digitizing Sound
• Sampling – To take measurements at regular intervals.
• The more samples you take, the more accurately you represent the
original wave, and the more accurately you can reproduce the original
wave.
Rick Graziani graziani@cabrillo.edu
81
Digitizing Sound
1 second, 40,000 samples
• Nyquist’s Theorem which states that a sampling of two times the
•
•
•
highest allowable frequency is sufficient for reconstructing an analog
wave into a digital data.
Human can hear frequencies up to about 20,000 Hz or 20,000
frequencies per second.
Using Nyquist’s Theorem, this means we need to sample each analog
wave at 40,000 times per second of sound.
In other words, each one second of sound gets sample 40,000 times.
(Actually, 44,100 times per second.)
Rick Graziani graziani@cabrillo.edu
82
Sampling – Quantifying - Coding
•
•
A digital audio processor is used to sample the analogue
audio wave 44,100 times a second.
This means, at every tick (44,100 times per second), the
digital audio processor (sampling):
– Determines the amplitude of the original very complex
audio wave.
– It records it as a 16 bit value (quantifying)
– This means there are 65,536 possible values for this
amplitude (coding):
• 32,767 values above zero
• 32,767 values below zero.
– It does this sampling for the two channels of stereo as
well.
Rick Graziani graziani@cabrillo.edu
83
Rick Graziani graziani@cabrillo.edu
84
6
5
4
3
2
1
0
If we sample at too low a
rate, we may miss some
peaks and troughs in the
original audio and so the
resulting waveform may
sound completely different
and muddy
-1
-2
-3
-4
-5
-6
Rick Graziani graziani@cabrillo.edu
85
2
Here we've got a fairly high
sample rate, but the
measurements of the
amplitude are pretty coarse.
1
0
-1
-2
Rick Graziani graziani@cabrillo.edu
86
Digitizing Sound
• Quantifying – This is the process of giving a value to each of the
•
samples taken.
The larger the range of numbers, the more detailed or specific you can
be in your quantifying.
Rick Graziani graziani@cabrillo.edu
87
Digitizing Sound
• Coding – This is the process taking the value quantified and
•
•
•
•
•
representing it as a binary number.
Audio CDs use 16 bits for coding.
16 bits gives a range from 0 to 65,536.
Actually:
– 15 bits are used for the range of numbers
– 1 bit is used for + (positive) or – (negative)
32,768 positive values and 32,768 negative values
How many bits does it take to record one minute of digital audio?
Rick Graziani graziani@cabrillo.edu
88
Digitizing Sound
•
•
•
•
How many bits does it take to record one minute of digital audio?
1 minute = 60 seconds
44,100 samples per second
This equals 2,646,000 samples.
• Each sample requires 16 bits.
• 2,646,000 samples times 16 bits per sample equals 42,336,000 bits.
• 42,336,000 bits times 2 for stereo equals 84,672,000 bits for 1 minute
of audio.
• 84,672,000 bits divided by 8 bits per byte equals 10,584,000 bytes for
1 minute of audio. (More than 10 megabytes!)
• One hour of audio equals 635,040,000 bytes or 635 MB (megabytes)!
Rick Graziani graziani@cabrillo.edu
89
MP3 Compression
• Compressing digital audio means to reduce the number of bits needed
•
•
•
to represent the information.
There are many sounds, frequencies, that the human ear cannot hear,
some too high, some too low.
These waves can be removed without impacting the quality of the
audio.
MP3 uses this sort of compression for a typical compression ratio of
10:1, so a one minute of MP3 music takes 1 megabyte instead of 10
megabytes.
Rick Graziani graziani@cabrillo.edu
90
Advantage of Digitizing Information
•
A key advantage to digital representation of information,
images and sounds, is that the it can be reproduced
without losing a “bit” of the quality.
Rick exactly
Graziani graziani@cabrillo.edu
91
Data Storage – Part 2
CS 1 Introduction to Computers and Computer
Technology
Rick Graziani
Download