230 likes | 491 Views
Sound. Sound?. Continuous sequence of vibrations (waves, cycles) of air (Why no sound in space?) E.g. Piano key causes a vibration in the air, which we interpret as sound Abstraction of an audio wave: Ear translates into sound Speaker/ ear drum: out: crest/in :trough. Speakers.
E N D
Sound? • Continuous sequence of vibrations (waves, cycles) of air • (Why no sound in space?) • E.g. Piano key causes a vibration in the air, which we interpret as sound • Abstraction of an audio wave: • Ear translates into sound • Speaker/ ear drum: out: • crest/in :trough
Speakers • If you create a sound that vibrates 200 times/second • Send to a speaker • Speaker vibrates 200 times (in/out)
Frequency • The number of vibrations (waves), usually per second • Measure: Hertz • Example: • Assume 2 second interval • Vibration of 1,000 times • Cycles/second in Hz? • i.e. how many vibrations in one second?
Cycles: Example of Two Hz Assume 1 second
Hz? • What is the frequency in Hz?
Wave to Digital • Pulse Code Modulation…pcm • Sample the wave at a specified rate • Sample Rate • Determine the associated amplitude at each sample • Sample value • Store the binary value of the amplitude (sample value)
Example • Assume one second, one Hz
Sample Data • Sample Rate = 72 ( 72 x-axis tick marks) • Sample Size: 4 bits (2^4 = 16 possible values) • So: Every 1/72 of a second, determine amplitude using 4 bits and save as binary
PCM Example… Sample Values: 7,9,11,12,13,14,14,15 etc. Binary nibbles: 0111, 1001, 1011,1100 etc.
Common Ranges • Humans Hearing: 20Hz to 20k Hz • Dogs hearing: 40 Hz to 40k Hz • Voice range 80 Hz to about 4 kHz ( 4,000 Hz) • Note: I believe land line phones can only carry up to 4 kHz…any sounds above are not sent
Frequency and sampling • Nyquist’s theorem (revisited): • For best pcm result • Sample at 2 x highest frequency • What did we say was the highest frequency of human hearing? • So, what should be the sample rate? • Actually we add 4,100 cycles • So final sample rate?
CDs • Sample rate: 44,100/second • Sample size: 16 bits • What is the highest possible sample value? • Sample size for DVDs is usually 24 bits • And 5 channels, not two • Sample rate 96,000 Hz, not the 44,100 as for CD
Storage of 1 minute stereo music on a CD • Sample rate: 44,100 Hz • Bit depth ( sample size) 16 bits/sample • Allows for 2^16 sample values • Stereo : two channels
Total number of Samples (for 60 seconds) • 60 seconds x 44,100 samples/second • = 2,646,000 samples • Number of bits to store • 2,646,000 samples x 16 bits/sample = • 42,336,000 bits • That’s for one channel • For two channels: • 42,336,000 x 2 = 84,672,000 bits
Size…continued • How many bytes? • 84,672,000 bits/(8 bits/byte)= • 10,584,000 bytes • Kilobytes (KB)? • 10,584,000 bytes (1024 bytes/KB)= • 10,336 KB • MB? • 10,336/(1024 KB/MB) = • 10 MB
Compression • Save space • Are Lossless and lossy compression • Some uncompressed audio formats: • WAV, FLAC ( Use wav as master, use mp3 for deployment ) • Phone (iphone and Android) format is compressed, lossless (.m4a) • Lossy compressed: mp3 • Eliminates sounds we supposedly can’t hear or don’t want to hear • High quality
More audio formats • aiff : non-compressed, pcm • au: compressed, lossy, used by sun, unix, java • wma Windows Media Audio: lossy, compressed
Audio and Web • Html 4 • Used embed, object, plug-ins, etc. Very messy • Html 5: • Wav • Mp3 • Ogg (vorbis … professional, compressed format)
Web Streaming versus downloading • Three ways to listen to sounds: • Download and play • Stream • Progressive download • Methods 2 and 3 above yield same results, different technologies • With progressive you end up with a (temp) file • YouTube streams • iTunes uses progressive
Streaming • If you listen to a radio station online, you will stream the music, since you're listening live and couldn't download all the songs that they play. • Instead, your computer connects to the radio station and receives an ongoing audio feed, or stream, with the radio station's programming. • It begins to play when a sufficient amount is playable. While you listen, more audio is being streamed. • When you stream a file, you will get to listen to or watch it, but won't have the file on your computer to do things with later