1 / 17

Exploring the Physics of Sound: Digital Manipulation and Visual Comparison

Discover the principles of sound physics, digital sound manipulation, volume, pitch, and encoding techniques. Understand how sound waves are transformed and explore tools for sound analysis.

Download Presentation

Exploring the Physics of Sound: Digital Manipulation and Visual Comparison

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Session 18 The physics of sound and the manipulation of digital sounds

  2. Pictures vs. Sounds • Get in groups of 2 or 3 students. • Create a list (to be turned in) of all the modifications that we made to pictures. • Which of these modifications do you think have similar techniques with sound?

  3. How does Hearing Work? • The outer ear “catches” sounds • The eardrum vibrates • The inner ear translates the vibrations to nerve impulses for the brain to interpret

  4. Acoustics, the physics of sound • Sounds are waves of air pressure • Sound comes in cycles • The frequency of a wave is the number of cycles per second (cps), or Hertz • (Complex sounds have more than one frequency in them.) • The amplitude is the maximum height of the wave

  5. Volume and Pitch • We perceive volume as changes in amplitude • If the amplitude doubles, it’s about a 3 decibel (dB) change. • 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 • We perceive pitch as changes in frequency • Higher frequencies are perceived as higher pitches • We can hear between 5 Hz and 20,000 Hz (20 kHz)

  6. Logarithmic Scales • Human hearing works with ratios not differences: • The A above middle C is 440 Hz • The A above that has twice the frequency (880 Hz) • The A above that has twice the frequency of that (1760 Hz)

  7. Digitizing Sound • We can estimate a curve by creating rectangles • We’ll do the same to estimate the sound curve • Analog-to-digital conversion (ADC) will give us the amplitude at an instant as a number: a sample • How many samples do we need?

  8. Nyquist Theorem • We need twice as many samples as the maximum frequency in order to represent (and recreate, later) the original sound. • The number of samples recorded per second is the sampling rate • If we capture 8000 samples per second, the highest frequency we can capture is 4000 Hz (where human voices max out) • That’s how phones work • If we capture more than 44,000 samples per second, we capture everything that we can hear (max 22,000 Hz) • CD quality is 44,100 samples per second

  9. Encoding a Sound

  10. Given this information • How much memory is necessary to store 1 minute of CD quality stereo sound?

  11. Sound Basics makeSound(fileName) • Will create a new Sound object from the data in the file with the passed file name play(soundObj) • Will start the sound playing. Let’s you repeat immediately blockingPlay(soundObj) • Will play the complete sound before continuing openSoundTool(soundObj) • Will open a sound tool on the object (can do this from the menu too)

  12. The Sound Tool • Not all of the sound is shown when you explore a sound • Skips values to fit in the window • You can zoom in • To see all sample values • You can zoom out • To fit the sound in the window again

  13. Increase volume def increaseVolume(sound): for sample in getSamples(sound): value = getSampleValue(sample) setSampleValue(sample,value*2)

  14. More General Code def changeVolume(sound, factor): """ Changes the sound volume by a given factor with factor < 1 decreasing and factor > 1 increasing the volume """ for sampleNum in range(0, getLength(sound)): sample = getSampleObjectAt(sound, sampleNum) value = getSampleValue(sample) setSampleValue(sample, value * factor)

  15. Main Program """ Select a sound and repeatedly adjust its volume. """ def main(): print "Select the Media Folder" setMediaFolder() print "Select the sound (.wav) file to play repeatedly" fileName = pickAFile() sound = makeSound(fileName) volumeAdjustment = requestNumber("Enter factor to increase (>1) “ + \ “or decrease (<1) the volume.") for counter in range(10): blockingPlay(sound) changeVolume(sound, volumeAdjustment) print "Open Sound Tool to 'view' sound" openSoundTool(sound)

  16. But… • What happens if we increaseVolume() too many times? • Clipping

More Related