210 likes | 232 Views
Computer. Some basic concepts. Binary number. Why binary? Look at a decimal number: 3511 Look at a binary number: 1011 counting. Binary number. Maximum possible 8 bits: 40 bits: N bits: What is the number after 10111?. Hexadecimal. Decimal: base 10 Binary: base 2
E N D
Computer Some basic concepts
Binary number • Why binary? • Look at a decimal number: 3511 • Look at a binary number: 1011 • counting
Binary number • Maximum possible • 8 bits: • 40 bits: • N bits: • What is the number after 10111?
Hexadecimal • Decimal: base 10 • Binary: base 2 • Hexadecimal: base 16 • But works the same way • Translate F1C: • Where do you see it?
decimal binary hexadecimal 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F
Size • 1 byte = 8 bits • 1KB = 2^10 bytes • 1MB = 2^20 bytes • 1GB = 2^30 bytes • 1TB = 2^40 bytes
ASCII • ASCII (American Standard Code for Information Interchange) • How to represent a keyboard character as a number? • Assigns a unique number (0-127) to each keyboard character. • Examples: • a - 97 • A to Z: 65-90 • a to z: 97-122 • 0 to 9: 48-57
Unicode • 127 is not enough • Other languages • Same principle • More characters
Example: Digitizing Sound • An object creates sound by vibrating in a medium such as air • Vibrations push the air • Pressure waves emanate from the object and vibrate our eardrums • The force, or intensity of the push determines the volume • The frequency (number of waves per second) is the pitch
Analog to Digital • To convert continuous information, convert it to bits • From zero line on graph, record with binary number the amount by which the wave is above or below it (positive or negative sound pressure) • At what points do we measure? We can't record every position of the wave
Sampling • Take measurements at regular intervals • Number of samples in a second is the sampling rate • The faster the rate, the more accurate the recording
How Fast to Sample? • Sampling rate should be related to the wave's frequency • Too slow rate could allow waves to fit between the samples; we'd miss segments of sound • Guideline is Nyquist Rule: Sampling rate must be at least twice as fast as the fastest frequency • Human perception can hear sound up to 20,000 Hz, so 40,000 Hz sampling rate is enough. • Standard for digital audio is 44,100 Hz
How Many Bits per Sample? • How accurate must the samples be? • Bits must represent both positive and negative values • The more bits, the more accurate the measurement • The digital representation of audio CDs uses 16 bits (records 65,536 levels, half above and half below the zero line)
How large is one-minute music? • One-minute digital audio? • 60 seconds • 44,100 samples • 16 bits each • Times 2 for stereo • 60*44,100*2(Bytes)*2=10.5 MB! • An hour is 635MB!
ADC, DAC • Digitizing Process: • Sound is picked up by a microphone (called a transducer) • The signal is fed into an analog-to-digital converter (ADC), which samples it at regular intervals and outputs binary numbers to memory • To play the sound, the process is reversed • Numbers are read from memory into digital-to-analog converter (DAC), which creates an electrical wave by filling in between the digital values • Electrical signal is output to speaker, which converts it to a sound wave
Advantages of Digital Sound • (MP3) Compression • One computation is to compress the digital audio (reduce number of bits needed) • Remove waves that are outside range of human hearing • Teen-only ringtone • MP3 usually gets a compression rate of 10:1 • Lower bandwidth requirements, popular for Internet transmission • Reproducing the Sound Recording • Bit file can be copied without losing any information • Original and copy are exactly the same • Vinyl recording is analog, it wears out. • Easy “transportation” • We can compute the representation • Enhance, manipulate • Synthetic voice