Computing in the Modern World Data Representation Wayne

















































- Slides: 49
Computing in the Modern World Data Representation Wayne Summers STEM Honors Camp June 8, 2012
Data Representation NUMBERS
Essential Questions: How can the two-state nature of transistors be used to represent information? How are decimal numbers converted to binary numbers and vice versa? What is the 8 -bit ASCII code?
There are 10 kinds of people in the world: those who understand binary and those who don’t.
Pre-exercises • Magic trick (parity bits) : tack board with colored cards • Representing numbers : Binary digit counting cards (1, 2, 4, 8, 16, 32) • Decimal, Binary, Hexadecimal
Decimal Binary Hexadecimal 1 0000 0001 1 2 0000 0010 2 3 0000 0011 3 4 0000 0100 4 5 0000 0101 5 6 0000 0110 6 7 0000 0111 7 8 0000 1000 8 9 0000 1001 9 10 0000 1010 A 11 0000 1011 B 12 0000 1100 C 13 0000 1101 D 14 0000 1110 E 15 0000 1111 F 16 0001 0000 10
Data Representation LETTERS
Representing letters : Letter card & some words
Data Representation IMAGES
Essential Questions: How is the binary system used to represent images? What is a pixel? How is a pixel used to represent images?
a. Describe how a picture is digitized and represented in a computer.
Examples • http: //www. printactivities. com/Hidden. Pictur es/004_Sun. And. Tree. html (paint by number picture per student) • What's the secret code for talking to spacecraft? - http: //spaceplace. nasa. gov/binarycode/redirected/ (build poster) • RGB Hexadecimal / Decimal Converter - http: //www. psyclops. com/tools/rgb/
Data Representation SOUNDS
Essential Questions: How is the binary system used to represent sound? What is a sound sample? What is amplitude? How is a sound sample used to represent a sound?
Sound Representation • Analog • Digital
Characteristics of Sound • • Amplitude Wavelength (w) Frequency ( ) Timbre • v = f * • Hearing: [20 Hz – 20 KHz] • Speech: [200 Hz – 8 KHz]
Digital Representation of Audio • Must convert wave form to digital – sample – quantize
Sampling (in time) • Measure amplitude at regular intervals • How many times should we sample? CS 414 - Spring 2009
Example • Suppose we have a sound wave with a frequency of 1 cycle per second CS 414 - Spring 2009
Example • If we sample at one cycle per second, where would the sample points fall? CS 414 - Spring 2009
Example • If we sample at 1. 5 cycles per second, where will the sample points fall?
Sampling - Example • If we sample at two cycles per second, where do the sample points fall?
Nyquist Theorem For lossless digitization, the sampling rate should be at least twice the maximum frequency response. • In mathematical terms: fs > 2*fm • where fs is sampling frequency and fm is the maximum frequency in the signal
Quantization
3 -bit Quantization A 3 -bit binary (base 2) number has 23 = 8 values. 7 6 Amplitude 5 4 3 2 1 0 Time — measure amp. at each tick of sample clock
4 -bit Quantization A 4 -bit binary number has 24 = 16 values. 14 12 Amplitude 10 8 6 4 2 0 Time — measure amp. at each tick of sample clock A
The Digital Audio Stream It’s just a series of sample numbers, to be interpreted as instantaneous amplitudes: one for every tick of the sample clock. Previous example: 11 13 15 13 10 9 6 1 4 9 15 11 13 9 This is what appears in a sound file, along with a header that indicates the sampling rate, bit depth and other things.
Common Sampling Resolutions Word length Uses 8 -bit integer Low-res web audio 16 -bit integer CD, DAT, DV, sound files 24 -bit integer DVD-Video, DVD-Audio 32 -bit floating point Software (usually only for internal representation)
16 -bit Sample Word Length A 16 -bit integer can represent 216, or 65, 536, values (amplitude points). We typically use signed 16 -bit integers, and center the 65, 536 values around 0. 32, 767 0 -32, 768
Audio File Size CD characteristics… - Sampling rate: 44, 100 samples per second (44. 1 k. Hz) - Sample word length: 16 bits (i. e. , 2 bytes) per sample - Number of channels: 2 (stereo) - Examples - http: //x 2. i-dat. org/~csem/UNESCO/1/index. html#se How big is a 5 -minute CD-quality sound file?
b. Describe how a sound/song is digitized and represented in a computer. • An audio file format is a container format for storing audio data on a computer system. They can be divided in three basic groups: – uncompressed audio file formats, – lossless compression audio formats and – lossy compression audio file formats.
uncompressed audio file formats • The most used and known uncompressed audio file format is PCM (Pulse-code modulation) • usually stored as a. wav on Windows or as. aiff on MAC. • flexible file formats designed to store more or less any combination of sampling rates or bitrates. • CD-quality sound files in uncompressed PCM format are large in size - around 10 MB per minute.
lossless compression audio formats • require more processing for the same time recorded, • more efficient in terms of disk space used, • FLAC (Free Lossless Audio Codec) - audio format similar to MP 3, • audio information is compressed file without any loss in its audio quality (similar to how Zip works)
lossy compression audio file formats • most used audio format today • best known is MP 3 (MPEG-1 Audio Layer 3) • patented digital audio encoding format • common audio format for consumer audio storage, de facto standard of digital audio compression for the transfer and playback of music on digital audio players.
Sound links • The Digital Representation of Sound, Part One: Sound and Timbre • Part Two: Playing by the Numbers
Data Representation MULTIMEDIA
Multimedia • combination of several media types: – audio stream, – moving images (movie/video), – audio+video, – animation, – interactive animation
Sample-based Digital Video • Video is represented in discrete units called frames – Frame: Similar to a still image – Video has a frame rate; unit: frames/second (fps) • E. g. , 15 frames/second • Time-dependent medium – Illusion of motion depends on frame rate • Don’t perceive motion below about 15 fps 40
Video Frames • Each frame has a resolution (w=width by h= height)-- typically the same resolution for all the frames in video h w 41
Frame Rates • Movies fps = 24 • American TV (NTSC)fps = 30 • European TV (PAL) fps = 25 • Peter Jackson's The Hobbit fps = 48 (5120 -by-2700 cameras) 42
Video and multimedia files • contain digitally capturing, recording, processing, storing, transmitting, and reconstructing a sequence of still images representing scenes in motion and of course captured or recorded audio. • basically data container formats, that are used for audio-with-video playback.
video file formats • AVI (Audio Video Interleave) developed by Microsoft. Audio or video content can be compressed with a wide variety of video or audio and video codecs • MPG (MPEG), developed by Moving Picture Experts Group. ISO standard used by many multimedia devices (DVD players, Blu-RAY, portable players, computers).
video file formats • MP 4, MPEG-4 multimedia file format, contains encoded video and advanced audio coding (AAC)-encoded audio content. • MOV, a Apple Quick. Time multimedia container format that can store one or more tracks of data such as video, audio, text, and effects.
Video Compression • How compression works – http: //www. youtube. com/watch? feature=player _embedded&v=kyzt. Yavf. FMs • Codecs – http: //www. youtube. com/watch? v=_13 PCNDO -p. E&feature=player_embedded
Data Representation SOFTWARE
Assembly Language: Start: . org $8020 SEI LDA #$80 STA $0315 LDA #$2 D STA $0314 CLI RTS INC $D 020 JMP $EA 31 Machine Code: 8020 78 0111 1000 8021 A 9 80 1010 1001 1000 0000 8023 8 D 15 03 8026 A 9 2 D 8028 8 D 14 03 802 B 58 802 C 60 802 D EE 20 D 0 8030 4 C 31 EA
QUESTIONS? ? ? http: //cs. Columbus. State. edu cs@Columbus. State. edu wsummers@Columbus. State. edu