Digital Media Lecture 2: SemesterOverview Georgia Gwinnett College School of Science and Technology Dr. Jim Rowan The Big Question: How do you take stuff found in the real world… Store it as numbers on a computer… So that it can be manipulated and shared? The answer: It depends on what it is you are trying to capture We will have to know about the nature of the real world – Some things can be counted – Some things need to be measured The details of this will come a bit later As previously seen using hexFiend: Text, audio, images and videos are all stored in a file as numbers on the computer Some of this is meant for human consumption (ASCII) Some of this is meant for program consumption (the header) Some is used by the program to save and represent the world http://wiki.ggc.edu/wiki/It%27sAllJustBitsITEC2110WikiTextJrowan1 Let’s get started: It’s all just bits! But first: Numbering systems! Which is correct? 5 + 5 = 10 1 + 1 = 10 1 + 7 = 10 1 + F = 10 But first: Numbering systems! Which is correct? The answer is: It depends! 5 + 5 = 10 (in decimal) 1 + 1 = 10 (in binary) 1 + 7 = 10 (in octal) 1 + F = 10 (in hexadecimal) But first: Numbering systems! In this class we deal with – Decimal – Binary – Hexadecimal We will not be converting We will not do math (a small lie) We will learn how to count http://wiki.ggc.edu/wiki/HowToCountLikeAnAlien Let’s get started: Counting like an alien! The process of counting is simple No matter which numbering system… – You count starting with the first digit – You continue to count through all the digits available to you – When you run out of digits, you go back to the first digit – Add 1 to the column to the left How many things can you count if you have 4 [ ]positions? your numbering system here In decimal: 0000 -> 9999 – You can count 1000 things In binary: 0000 -> 1111 – You can count 16 things In hexadecimal: 0000 -> FFFF – You can count 65,536 things How many things can you count if you have 4 [ ]positions? your numbering system here The formula is: – the number of digits in the numbering system raised to the power of the number of positions you are using – [#digits in the system] ** [# positions used together] In decimal: 0000 -> 9999 10 ** 4 = 1000 things In binary: 0000 -> 1111 2 ** 4 = 16 things In hexadecimal: 0000 -> FFFF 16 ** 4 = 65,536 things How do you convert stuff in the real world into numbers that can be placed on a computer? It depends… It depends on whether the thing is a discrete thing or a continuous thing Stuff (phenomena) in the real world… Can be discrete – These either ARE or ARE NOT – These can be counted • The number of cars in a parking lot • The number of beans in a jar Can be continuous – These have no breaks – These must be measured • The height of a wave • The atmospheric pressure Stuff (phenomena) in the real world… Discrete can be counted – 5 cars – 11,223 beans Continuous must be MEASURED – The height of a wave • 3.76 feet from crest to trough – The atmospheric pressure • 30.02 inches of mercury The problem is… Most of the interesting stuff is continuous! – Sound is continuous compression waves – Light is continuous electromagnetic waves To store continuous phenomena on a computer you must measure it and store the measurement Sampling: The process of converting continuous phenomena into discrete so that you can store it as a number on the computer But before we talk about sampling… What this stuff means: Bit: binary digit Byte: 8 Bits KB: kilo byte (1,000 bytes) MB: mega byte (1,000,000 bytes) GB: giga byte (1,000,000,000 bytes) TB: tera byte (1,000,000,000,000 bytes) KBPS: kilo (1,000) bits per second MBPS: mega (1,000,000) bits per second What this stuff means: Strictly speaking… In computing the meanings of K, M, G are powers of 2 K = 2 ** 10 = 1,024 not 1,000 M = 2 ** 20 = 1,048,576 not 1,000,000 G = 2 ** 30 = 1,073,710,825 not 1,000,000,000 But in this class, either will do What this stuff means: And finally… In some classes B and b when used in abbreviations mean Bytes and bits respectively This can be confusing For this class… – When abbreviating communication speeds the b (or B) means bits – When abbreviating file size the b (or B) means bytes What this stuff means: So… Since kbps (or KBPS) is a communication speed the b (or B) means bits Since mb (or MB) is a file size the b (or B) means bytes Network access Changing all the time Is getting faster and faster Is available in a variety of forms In this class we will discuss a few of them http://wiki.ggc.edu/wiki/NetworkingIssues Let’s get started: Networking issues Network access Can be symmetric – The speed into the network is the same as the speed out But now asymmetric is fairly common in the home – The speed out of the network is faster than the speed into the network Unless you are running a server – Servers usually have very high speed, symmetric connections to the network Network access ADSL example – Asymmetric Digital Subscriber Line • Speed in can be 640 kbps • Speed out can be 6.1 mbps Prehistoric example: dial up modem – Asymmetric • Speed in is 36,000 bps • Speed out as high as 56,000 bps Network access If you are running a commercial server (like you would have if you were running an online business) you may want faster service T1 and T3 are faster and symmetric – T1 can be 1.544 mbps – T3 can be 44.7 mbps And now… Sampling How many samples do you need to faithfully capture a continuous phenomena? The answer: – It depends! (of course!) What does it depend on? – It depends on the frequency of the continuous phenomena you are trying to capture http://wiki.ggc.edu/wiki/SoundInTheRealWorldAndSampling Capturing sound in the real world? Sampling!: Sound and Sampling Sampling sound Sound radiates out from the source like the waves created when you toss a stone into a pond In the air it travels at ~760 mph How many samples are needed? Now, an example to show how and why the Nyquist rate works Below is a note played on a violin and captured with an oscilloscope A note played on a violin Sampled at 625 samples per second A note played on a violin Sampled at 1250 samples per second A note played on a violin Sampled at 2500 samples per second A note played on a violin Sampled at 5000 samples per second A note played on a violin Sampled at 10,000 samples per second A note played on a violin Sampled at 20,000 samples per second How many samples are needed? If you take too few samples – the sound quality will degrade – but the file size will be small If you take too many samples – the sound quality will be excellent – but the file size can get HUGE! So… – Where’s the sweet spot? How many samples are needed? Nyquist states that you need to sample at twice the frequency of the highest frequency you want to capture and faithfully reproduce With humans – Since some of us can hear 20,000 cps – You would need to sample at 40,000 cps CD quality? (with a little wiggle room) – 44,100 samples per second An example: Fields of Gold We played Fields of Gold in class – CD quality is: • 44,100 samples per second • 16 bits (2 bytes) per sample – with 16 bits you can capture… – 2**16 = 65,636 different levels Looking at the file: – It is 4 minutes and 59 seconds – The file size is 1,201,173 bytes long Does this make sense? An example: Fields of Gold 4 minutes and 59 seconds = 4 x 60 + 59 = 299 seconds 299 seconds x 44,100 sps = 13,156,000 samples 13,156,000 samples x 2 bytes per sample = 26,371,800 bytes But this is stereo (two channels) so… 26,371,800 bytes x 2 channels… = 52,743,600 bytes… That’s ~52 MB… but we said that the music was 1.2 MB How is this possible? HMMMMMmmmm… An example: Fields of Gold Fields of Gold is an MP3… It’s compressed! If we had the original CD it would be ~52 MB in length Types of compressed files MP3 is lossy – What you get back after compressing the file is NOT exactly the same as the original – But… it’s close enough – Images and sound can use lossy compression techniques (more later) Zip is lossless – What you get back is EXACTLY what you started with – Applications must be losslessly compressed – All the 0s and 1s have to be exactly the same or the program will not run Further reading http://en.wikipedia.org/wiki/Nyquist_ra te http://en.wikipedia.org/wiki/Sampling_ %28signal_processing%29 http://en.wikipedia.org/wiki/Mp3 XXXXXXXXXXXXXXXX