CS101 Lecture 16: Digital Audio Aaron Stevens with special guest Wayne Snyder 28 February 2011 Some images from www.mediacollege.com, Wikipedia. 1 What You’ll Learn Today – How do we “hear” sounds? – How can audio information (sounds) be stored on a computer? – How to reproduce the sounds from the binary data? 2
Hearing We “hear” sound when a series of air compressions vibrate a membrane in our ear. The inner ear sends signals to our brain. The rate of this vibration is measured in Hertz, and the human ear can hear sounds in the range of roughly 20Hz - 20KHz. 3 Sound Wave Properties Wavelength: distance between waves (affects pitch -- high or low sounds) Amplitude: strength of power of waves (volume) Frequency: the number of times a wave occurs in a second. 4
Music Concepts Pitch refers to the human perception of sounds as musical notes. – Example: the note “A” above middle “C” on a piano has a frequency of 440 Hz. – The sounds at frequencies which are multiples of a given pitch are called harmonics. Human hearing is generally in the range of 20Hz - 20,000Hz. Microphones and Speakers Microphones convert acoustical energy (sound waves) into electrical energy (the audio signal). Speakers do the same thing in reverse: convert electrical energy into acoustical energy. 6
Audio Playback A stereo sends an electrical signal to a speaker to produce sound. This signal is an analog representation of the sound wave. The voltage in the signal varies in direct proportion to the sound wave. 7 Important Note about Electronic Signals An analog signal continually fluctuates in voltage up and down. A digital signal has only a high or low state, which we model as binary digits. 8
Recall: Digitizing an Image Sampling: Taking measurements (of color) at discrete locations within the image. Sampling rate: 16 samples per inch (in each direction) Recall: Digitizing an Image Sampling: Measure the color for each pixel, and record that color. 16 pixels per inch Quantization: determine a discrete value for each pixel.
Digitizing Audio Information How can we store this continuous information in a finite machine? Digitize the signal by sampling: –periodically measure the voltage –record the numeric value 11 Sampling Audio Information Sampling: periodically measure the voltage and record the numeric value. Some data is lost, but a reasonable sound is reproduced. 12
From Sound Wave to Sample In this case, we are measuring the amplitude of the sound wave with 3 bits of precision (8 possible values, Y axis), at a sampling rate determined along the X axis. We record the values for each sample. 13 Sampling: 3-bit depth For each sample, we need to select a discrete value for the amplitude. These values are recorded in 3 bits (right hand side). 14
From Sample to Sound Wave Using the recorded information, the computer must re-recreate the sound wave. Some of the original information was lost by the sampling process! 15 Increasing Quality To increate the quality of the recording, we can change 2 dimensions (independently): 1 - increase the sample rate (more points of measurement on X/time axis) 2 - increase the bit depth (more discrete levels of measurement on Y/amplitude 16 axis).
How Good is Good Enough? How would you determine the required: – Sampling rate – Bit depth (quantization of sound wave) to recreate the best sensory audio experience? Representing Audio Information Compact Disc audio is encoded by sampling: – 44,100 samples per second – 16 bits per sample per channel (2 channels) – thus: 44,100 * 16 * 2 = 1,411,200 bps – Or about 10,600,000 bytes per minute CD Audio uses about 10 megabytes of data per minute of audio. 18
What You Learned Today – Hearing – Sound waves – Sampling, Sampling Rates – Quantizing, Bit Depth – Data storage requirements 19 Announcements and To Do List –Readings: • Wong ch 4, pp 102-117 (today, Wednesday) • YouTube: History of Sony music technology http://www.youtube.com/watch?v=V5I41PdAK0Y (6 minutes) – Quiz 3 is on Friday 3/4 • Covers lectures 12, 13, 14, 15, 16 20
Recommend
More recommend