CS101 Lecture 14: Digital Audio
Aaron Stevens 18 February 2009 Some images from www.mediacollege.com, Wikipedia.
1
Overview/Questions
– How do we “hear” sounds? – How can audio information (sounds) be stored on a computer? – How come you get more music per compact disc in MP3 format than in CD audio format?
2
1 Analog and Digital Information
Computers are finite! How do we represent an infinite world?
We represent enough of the world to satisfy our computational needs and our senses of sight and sound.
3
Analog and Digital Information
We say that information can be represented in one of two ways: analog or digital.
Analog A continuous representation, analogous to the actual information it represents. Digital A discrete representation, breaking the information up into finite elements.
4
2 Analog Information
Example: Analog Thermometer
The mercury (or alcohol) rises continuously in direct proportion to the temperature.
What exactly is this reading?
5
Digital Information
Example: Digital Thermometer
This reading is discrete. Some detail is lost in converting to digital information.
What is the actual temperature?
6
3 Analog and Digital Information
Computers store information in a discrete form (binary). To represent analog information, we need to digitize the data.
Digitizing Creating a discrete representation of analog data, suitable for storage and manipulation by a digital computer.
7
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.
8
4 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 acounstical energy.
9
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.
10
5 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.
11
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.
12
6 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
13
Representing Audio Information
Sampling: periodically measure the voltage and record the numeric value.
Some data is lost, but a reasonable sound is reproduced.
14
7 Representing Audio Information
History of Sony’s music technology: http://www.youtube.com/watch?v=V5I41PdAK0Y (6 minutes) part 1: walkman, headphones invented part 2: digital audio: compact disc replaces vinyl and magnetic tape
15
Representing Audio Information
Digitize the signal by sampling – periodically measure the voltage – record the numeric value
How often should we sample?
A sampling rate of about 40,000 times per second is enough to create a reasonable sound reproduction
16
8 Representing Audio Information
Compact Discs store audio information digitally. On the surface of the CD are microscopic pits that represent binary digits.
A low intensity laser is pointed as the disc
The laser light reflects – strongly if the surface is smooth, and – poorly if the surface is pitted
17
CD Audio
http://electronics.howstuffworks.com/cd.htm A CD player reading binary information
18
9 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 per minute of audio.
19
Digital Audio Formats
Audio Formats – CDA, WAV, AU, AIFF, VQF, and MP3
MP3 (MPEG-2, audio layer 3 file) is dominant – analyzes the frequency spread and discards information that can’t be heard by humans. – bit stream is compressed using a form of Huffman encoding to achieve additional compression.
Is MP3 a lossy or lossless compression (or both)?
20
10 Representing Audio Information
MP3 is compressed audio – 128kbps ~ 128,000 bits per second – Or about 960,000 bytes per minute
Compare to CD Audio – 10,600,000 bytes per minute!
A CD holds about 700 MB (700,000,000 bytes) – About 70 minutes of CD audio format – Or about 700 minutes of MP3 audio format
21
Take-Away Points
– Hearing, sound waves – Sampling – CD audio, MP3 . Quality, storage requirements
22
11 Student To Dos
–Readings: . Reed ch 5, pp 90-95 (this week)
23
12