DOC PREVIEW
Introduction to Processing Digital Sounds

This preview shows page 1-2-22-23 out of 23 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Introduction to Processing Digital Sounds part 1Learning GoalsHow does Hearing Work?Acoustics, the physics of soundVolume and PitchTry ItSound Tools in SqueakDigitizing SoundNyquist TheoremSlide 10How does Recorded Sound Work?Why Digitize Sound?Playing a SoundPlay Sound ExerciseDigitizing Sound in the ComputerSound BasicsPlay and Explore a SoundThe Sound ExplorerGetting the Sound Sample ValuesExplore the Sound Sample ValuesArraysPrint the Sound Sample ValueSummaryIntro-Sound-part1Introduction to Processing Digital Soundspart 1Barb EricsonGeorgia Institute of TechnologyOct 2009Intro-Sound-part1Learning Goals•Learn about sounds –How do we hear?–How do we digitize sound?–Why do we digitize sound?–How is digitized sound represented?•How to play a sound in Java–How to create Sound objects–How to play them–How to explore themIntro-Sound-part1How does Hearing Work?•The outer ear “catches” sounds •The eardrum vibrates•The inner ear translates the vibrations to nerve impulses for the brain to interpretIntro-Sound-part1Acoustics, 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 waveIntro-Sound-part1Volume and Pitch•Our perception of volume is related (logarithmically) to changes in amplitude–If the amplitude doubles, it’s about a 3 decibel (dB) change.–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•Our perception of pitch is related (logarithmically) to changes in frequency–Higher frequencies are perceived as higher pitches–We can hear between 5 Hz and 20,000 Hz (20 kHz)–A above middle C is 440 HzIntro-Sound-part1Try It•Attach a microphone to your computer•Open the Windows-MediaTools folder•Drag the mediatools-v5-sa.image file and drop it on SqueakVM.exe•This will start Squeak with the media tools loaded•Click on the Sound Tools window–It will expand•Click on Record Viewer and Record–And do high and low sounds in the microphone•Notice that high sounds have more cycles per second •Click on Quit to exit SqueakIntro-Sound-part1Sound Tools in SqueakIntro-Sound-part1Digitizing Sound•In calculus you learn to estimate a curve by creating rectangles•We can 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?Intro-Sound-part1Nyquist 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•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 secondIntro-Sound-part1Try It•Call a friend on a phone and play some music over the phone–How does it sound?–Phones only transmit 8,000 samples per second–The highest frequency you can transmit by phone is 4000 Hz–This is fine for voice but what does it do to music?Intro-Sound-part1How does Recorded Sound Work?•Phonograph recordings capture sound continuously, as an analog signal•CDs and DVDs sample sounds and record numbers that represent the sound at the time of the sample–44,100 samples per secondIntro-Sound-part1Why Digitize Sound?•High fidelity –Reproduced sound is very similar to the original•Perfect reproduction –Sounds the same every time•Easy to transmit–Download as data•Easier to manipulate on a computer–Even though there are billions of bitsIntro-Sound-part1Playing a Sound•We can create a Sound object just as we created a Picture object–Get a file name and save a reference to it•String fileName = FileChooser.pickAFile();–Pick a file that ends in .wav–Create the sound object by asking the class to create a new Sound object and initialize it by reading data from the given file name•Sound sound1 = new Sound(fileName);–Play the Sound•sound1.play();Intro-Sound-part1Play Sound Exercise•Try creating a Sound object and playing it–You can do this all at once •Shown on top–Or you can name each part•Shown on bottom•How would you play the same sound twice?Intro-Sound-part1Digitizing Sound in the Computer•Each sample is stored as a number (two bytes)•What’s the range of available combinations?–16 bits, 216 = 65,536–But we want both positive and negative values•To indicate compressions and rarefactions.–What if we use one bit to indicate positive (0) or negative (1)?–That leaves us with 15 bits–15 bits, 215 = 32,768–One of those combinations will stand for zero•We’ll use a “positive” one, so that’s one less pattern for positives so the range is from -32,768 to 32,767Intro-Sound-part1Sound Basics•new Sound(fileName)–Will create a new Sound object from the data in the file with the passed file name•soundObj.play()–Will start the sound playing•soundObj.explore();–Will open a sound explorer on the object•soundObj.blockingPlay() –Will play the sound and wait to return until the sound is finished•soundObj.write(String fileName)–Will write out the sound to the specified fileIntro-Sound-part1Play and Explore a SoundSound ExplorerType hereIntro-Sound-part1The Sound Explorer•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 againIntro-Sound-part1Getting the Sound Sample Values•A Sound has many values in it–Numbers that represent the sound at that time in the sample•You can get an array of SoundSample objects–SoundSample[] sampleArray = sound1.getSamples();Intro-Sound-part1Explore the Sound Sample Values•Zoom in to see all the sound valuesClick here to go to the next indexType in an indexSee the valueClick here to pick an indexArrays•Store many items of the same type in memory in contiguous space•You can use an index value to access an item stored in the arrayIntro-Sound-part10 1 2Intro-Sound-part1Print the Sound Sample


Introduction to Processing Digital Sounds

Download Introduction to Processing Digital Sounds
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Introduction to Processing Digital Sounds and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction to Processing Digital Sounds 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?