Sound: Introduction Encoding and Simple Manipulation.

Post on 14-Jan-2016

223 views 2 download

Transcript of Sound: Introduction Encoding and Simple Manipulation.

Sound: Introduction

Encoding and Simple Manipulation

Sound is made when something vibrates

Air molecules oscillate back and forth from their equilibrium position, affecting their neighbors

Sound waves are pressure waves• As molecules oscillate back and forth, areas of high and low

pressure occur• Called compressions and rarefactions, respectively

Sound waves are longitudinal• Motion is parallel to

direction of energy transport

• Representation of sound by a sine wave is merely an attempt to illustrate the sinusoidal nature of the pressure-time fluctuations

Sound waves are longitudinal

• Plot pressure fluctuations over time encountered by a fixed detector

Properties of sound waves

• Frequency: cycles per second (Hz)

• Amplitude: distance from 0

Psychoacoustics: Human Perception of Sound

• Ear serves as transducer: coverts sound energy to mechanical energy to nerve impulse transmitted to brain

Psychoacoustics: Human Perception of Sound

• Pitch• Loudness• Timbre

Psychoacoustics: Human Perception of Sound

• Pitch – frequency• Loudness – amplitude• Timbre – combination of various frequencies

Pitch

• Humans hear frequencies between 20 Hz and 20,000 Hz • frequency = pitch

Pitch

• Humans hear frequencies between 20 Hz and 20,000 Hz • frequency = pitch

Hearing works on ratios for pitch…

We hear difference between 200 Hz and 400 Hz, the same as 500 Hz and 1000 Hz

Loudness• Perception of volume is related logarithmically to

changes in amplitude• amplitude = pitch

Loudness

If one sound is 10x times more intense than another sound, then it has a sound level which is 10*x more decibels than the less intense sound.

Intensity is very objective quantity; can be measured with sensitive instrumentation

Loudness is more subjective response; will vary with a number of factors (e.g. age, frequency)

Decibel is a logarithmic measure

• A decibel is a ratio between two intensities: 10 * log10(I1/I2)– As an absolute measure, it’s in comparison to

threshold of audibility– 0 dB can’t be heard. – Normal speech is 60 dB. – A shout is about 80 dB

Digitizing Sound• Analog-to-digital conversion: measure amplitude at an

instant as a number• Instantaneous measure is called a sample

Understanding how computers represent sound

• Consider how a film represents motion…– Movie is made by taking still photos in rapid

sequence at a constant rate, usually twenty-four frames per second

– When the photos are displayed in sequence at that same rate, it fools us into thinking we are seeing continuous motion, even though we are actually seeing twenty-four discrete images per second

http://music.arts.uci.edu/dobrian/digitalaudio.htm

http://en.wikipedia.org/wiki/Animation

A collection of still frames

How computers represent sound

• Digital recording of sound works on the same principle– We take many discrete samples of the sound

wave's instantaneous amplitude, store that information, then later reproduce those amplitudes at the same rate to create the illusion of a continuous wave

http://music.arts.uci.edu/dobrian/digitalaudio.htm

How often should we take samples?

• sampling rate: number of samples taken per second

• Nyquist Theorem: need to take twice as many samples as the highest frequency we wish to record– Sampling rate = 2 * max sound wave frequency

How often should we take samples?

• sampling rate: number of samples taken per second

• Nyquist Theorem: need to take twice as many samples as the highest frequency we wish to record– Sampling rate = 2 * max sound wave frequency

• CD quality is 44,100 samples per second– what is the max frequency a CD can represent?

Nyquist Theorem

• Consider a graph of a 4,000 Hz cosine wave, being sampled at a rate of 22,050 Hz

• Sample is taken every 0. 045 milliseconds

http://music.arts.uci.edu/dobrian/digitalaudio.htm

Nyquist Theorem

• Consider same 4,000 Hz cosine wave sampled at 6,000 Hz

• Sample is taken every 0. 167 milliseconds • Wave completes more than 1/2 cycle per sample

http://music.arts.uci.edu/dobrian/digitalaudio.htm

Digitizing sound with the computer: bit depth

• The range of possible sample values depends on the number of bits used to store each sample

• Common bit-depths: 8 and 16

http://music.arts.uci.edu/dobrian/digitalaudio.htm

16 bits per sample: +/- 32K

• Each sample can be between -32,768 and 32,767

Compare this to 0..255 for light intensity

(i.e. 8 bits or 1 byte giving us 256 different values)

Why such a bizarre number?

Because 32,768 + 32,767 + 1 = 216

i.e. 16 bits, or 2 bytes< 0 > 0 0

Properties of sound

Sound wave• Frequency• Amplitude• Wavelength• Period

Digitized sound• Sampling rate• Bit depth• Playback rate