A Media Computation Cookbook Manipulating Images and Sounds for Use in Alice Part 1: Image Manipulations Part 2: Advanced Image Manipulations, e.g., changing.

Slides:



Advertisements
Similar presentations
Georgia Institute of Technology Introduction to Processing Digital Sounds.
Advertisements

A Media Computation Cookbook Manipulating Images and Sounds for Use in Alice Part 1: Image Manipulations Part 2: Advanced Image Manipulations, e.g., changing.
Sound, Part 3. Multiple Echoes Here is a recipe to create multiple echoes: def echoes(sndfile, delay, num): s1 = makeSound(sndfile) ends1 = getLength(s1)
1 Rev 01/01/2015.  The main difference between analog and digital /discrete is that analog data is continuous and digital data is discrete.  We need.
SIMS-201 Characteristics of Audio Signals Sampling of Audio Signals Introduction to Audio Information.
IT-101 Section 001 Lecture #8 Introduction to Information Technology.
A Media Computation Cookbook Manipulating Images and Sounds for Use in Alice Part 1: Image Manipulations Part 2: Advanced Image Manipulations, e.g., changing.
Computer Science 101 Introduction to Programming with Sounds.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 6: Modifying Sounds Using Loops.
 Continuous sequence of vibrations of air  (Why no sound in space? Contrary to Star Wars etc.)  Abstraction of an audio wave:  Ear translates vibrations.
ESSENTIAL QUESTION - WHAT ARE SOUND WAVES AND LIGHT WAVES AND HOW DO THEY CARRY ENERGY DIFFERENTLY ? Waves pt 2 Sound vs Light Chapter 17 Chapter 19.
Introduction to Interactive Media 10: Audio in Interactive Digital Media.
Alice and Media Computation: Goals for this session Show interesting things you can do combining Alice and Media Computation. Provides a story-telling.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 7: Modifying Samples in a Range.
Lecture # 22 Audition, Audacity & Sound Editing Sound Representation.
CompSci Today’s topics Sound Upcoming ä Intellectual property ä Network analysis ä Security Reading.
Computing with Digital Media: A Study of Humans and Technology Mark Guzdial, School of Interactive Computing.
COMP Representing Sound in a ComputerSound Course book - pages
ITEC 109 Lecture 26 Sound (2). Sound Review Sound –How does it work in real life? –What are the different types of waves that represent sounds? –How are.
CSC361/661 Digital Media Spring 2002
Digital Media Dr. Jim Rowan ITEC Monday, August 27.
Digital Media Dr. Jim Rowan ITEC Monday, August 27.
CompSci Today’s topics Sound Upcoming ä Sound splicing ä Intellectual property ä Network analysis Reading Introduction to Computing & Programming.
Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.
Sound and audio. Table of Content 1.Introduction 2.Properties of sound 3.Characteristics of digital sound 4.Calculate audio data size 5.Benefits of using.
COSC 1P02 Introduction to Computer Science 4.1 Cosc 1P02 Week 4 Lecture slides “Programs are meant to be read by humans and only incidentally for computers.
Sound on the Web. Using Sound on a Web Site Conveying information  pronounce a word or describe a product Set a mood  music to match the web page scene.
Introduction to SOUND.
More Meaningful Jargon Or, All You Need to Know to Speak Like a Geek Sound.
Chapter 7: Modifying Samples in a Range. Chapter Objectives.
Georgia Institute of Technology Introduction to Processing Digital Sounds part 1 Barb Ericson Georgia Institute of Technology Sept 2005.
1 Introduction to Information Technology LECTURE 6 AUDIO AS INFORMATION IT 101 – Section 3 Spring, 2005.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 7: Modifying Samples in a Range.
Properties of Sound Making Waves. Sound Waves ■Sound is created by vibrations.
1 Rev 07/28/2015.  Describe: examples, definition,? 2.
CS 102 Computers In Context (Multimedia)‏ 03 / 30 / 2009 Instructor: Michael Eckmann.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 6: Modifying Sounds Using Loops.
Intro-Sound-part1 Introduction to Processing Digital Sounds part 1 Barb Ericson Georgia Institute of Technology Oct 2009.
CSCI-100 Introduction to Computing Hardware Part II.
CS1315: Introduction to Media Computation Sound Encoding and Manipulation.
Binary! Objectives How sound is stored in digital format What is meant by “sample interval” and how it affects quality The trade off between file size.
Chapter 8: Modifying Samples in a Range. Chapter Objectives.
A Media Computation Cookbook Manipulating Images and Sounds for Use in Alice Part 1: Image Manipulations Part 2: Advanced Image Manipulations, e.g., changing.
Sound. Sound Capture We capture, or record, sound by a process called sampling: “measuring” the sound some number of times per second. Sampling rate is.
Multimedia Sound. What is Sound? Sound, sound wave, acoustics Sound is a continuous wave that travels through a medium Sound wave: energy causes disturbance.
1 What is Multimedia? Multimedia can have a many definitions Multimedia means that computer information can be represented through media types: – Text.
 Speech  Narration—also called voice overlay or voice track  Dialogue—between two or more characters  Direct Address—talking straight at the.
1 CS 177 Week 8 Recitation Slides JES Sound functions and Modifying Sounds Increasing/Decreasing Volume Maximizing (Normalizing) Splicing Reversing Mirroring.
Session 18 The physics of sound and the manipulation of digital sounds.
1 CS 177 Week 7 Recitation Slides Modifying Sounds using Loops + Discussion of some Exam Questions.
Information Systems Design and Development Media Types Computing Science.
Working with Sounds Barb Ericson College of Computing Georgia Institute of Technology
Sound / Audio.
The Physics of Sound.
Learning Objectives Be able to explain how sound can be sampled and stored in digital form. Understand how sampling rate affects digital audio quality.
Multimedia: Digitised Sound Data
Lesson Objectives Explain how sound can be sampled and stored in digital form Explain how sampling intervals and other considerations affect the size of.
Processing Sound Ranges part 3
How sound is stored in digital format
Chapter 6: Modifying Sounds Using Loops
Data Representation Keywords Sound
Chapter 7: Modifying Samples in a Range
Multimedia Fundamentals(continued)
A Media Computation Cookbook
How sound works: Acoustics, the physics of sound
Chapter 7: Modifying Samples in a Range
COMS 161 Introduction to Computing
ITEC2110, Digital Media Chapter 1 Background & Fundamentals
CS1315: Introduction to Media Computation
Presentation transcript:

A Media Computation Cookbook Manipulating Images and Sounds for Use in Alice Part 1: Image Manipulations Part 2: Advanced Image Manipulations, e.g., changing colors in an area Part 3: Chromakey for digital video effects Part 4: Manipulated Alice images Part 5: Sound manipulations Part 6: Manipulated sounds in Alice

How sound works: 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 The amplitude of the sound determines the volume. The frequency of the sound determines the

Live demos here! See real sounds, and real musical instruments

Digitizing Sound: How do we get that into numbers? We take the height of the wave at regular intervals. ◦ That’s called the Sampling Rate. ◦ Each sample is between and ◦ How many samples do we need? Nyquist Theorem: ◦ We need twice as many samples as the maximum frequency in the sound in order to represent (and recreate, later) the original sound. Phones capture 8,000 samples per second (8 Kilohertz, Khz). Highest sound humans can hear is 22 Khz. CD quality sound is 44,100 samples per second 500, 1000, 1250, 1312, 1475,…

Loading sounds from WAV files >>> sound = makeSound(pickAFile()) >>> explore(sound)

Where to get sounds? Any.WAV file from anywhere on the Internet. Speech.zip on teach/43 teach/43 ◦ Expand it and put it in your media folder. Musicsounds.zip on same page.

How do you increase volume? >>> increaseVolume(sound) >>> explore(sound) def increaseVolume(sound): for s in getSamples(sound): value = getSampleValue(s) setSampleValue(s, ???)

Code for sounds makeSound(file) – makes a sound explore(sound) – look at and plaly sounds getSamples(sound) – returns a list of samples. getSampleValue(sample)/ setSampleValue(sample, – gets and changes samples getSampleValueAt(sound,inde x)/setSampleValueAt(sound,in dex,value) getLength(sound) – returns number of samples in sound. makeEmptySound(len) – makes a new sound with # of samples. writeSoundTo(sound, filename) – writes out the sound (end filename with “.wav”)

What if you set all the samples as big as you can? def maximize(sound): for s in getSamples(sound): value = getSampleValue(s) if value >= 0: setSampleValue(s,32768) if value < 0: setSampleValue(s,-32767) Can you make out what sound this is?!? >>> maximize(sound) >>> explore(sound)

Splicing sounds together >>> setMediaPath() 'D:\\WorkingDocs-Copy\\Glitch-MediaComp\\musicsounds\\' >>> guzdial = makeSound(getMediaPath("guzdial.wav")) >>> issnd = makeSound(getMediaPath("is.wav")) >>> inside = makeSound(getMediaPath("inside.wav")) >>> guzdialis = makeSplice(guzdial, issnd) >>> play(guzdialis) >>> guzdialisinside = makeSplice(guzdialis,inside) >>> explore(guzdialisinside)

Code for makeSplice def makeSplice(sound1,sound2): newSound = makeEmptySound(getLength(sound1)+getLength(sound2)) index = 0 for s in getSamples(sound1): setSampleValueAt(newSound,index,getSampleValue(s)) index = index + 1 for s in getSamples(sound2): setSampleValueAt(newSound,index,getSampleValue(s)) index = index + 1 return newSound

Mixing sounds to make a chord def makeChord(): notec = makeSound(getMediaPath("brass-c4.wav")) notee = makeSound(getMediaPath("brass-e4.wav")) noteg = makeSound(getMediaPath("brass-g4.wav")) mixce = makeMix(notec,notee) play(mixce) mixceg = makeMix(mixce,noteg) play(mixceg) return mixceg >>> chord=makeChord() >>> explore(chord)

Mixing sounds in different amounts def makeChord(): notec = makeSound(getMediaPath("brass-c4.wav")) notee = makeSound(getMediaPath("brass-e4.wav")) noteg = makeSound(getMediaPath("brass-g4.wav")) mixce = makeMix(notec,notee) play(mixce) mixceg = makeMix(mixce,noteg,0.75,0.25) play(mixceg) return(mixceg) >>> chord=makeChord() >>> explore(chord)

Making an Echo >>> always = makeSound(getMediaPath(“always.wav")) >>> explore(always) >>> echo = makeEcho(always) >>> explore(echo)

How the echo code works def makeEcho(sound,spacing=10000,repeat=5): newSound = makeEmptySound(getLength(sound)+spacing*repeat) #Put the initial sound in index = 0 for s in getSamples(sound): setSampleValueAt(newSound,index,getSampleValue(s)) index = index + 1 #Now put the echoes in for echoes in range(1,repeat): echoSound = makeEmptySound(getLength(sound)+spacing*repeat) index = echoes * spacing for s in getSamples(sound): setSampleValueAt(echoSound,index,getSampleValue(s)) index = index + 1 newSound = makeMix(newSound,echoSound,0.9,0.1) return newSound

Grabbing part of a sound >>> this = makeSound(getMediaPath("thisisatest.wav")) >>> explore(this) >>> testSound = makePartSound(this,47000,58100) >>> explore(testSound)

Code for grabbing part of a sound def makePartSound(sound,start,finish): newSound = makeEmptySound(finish+start) index = 0 for src in range(start,finish): value = getSampleValueAt(sound,src) setSampleValueAt(newSound,index,value) index = index + 1 return newSound

Making sounds lower or higher >>> shorter = makeScaleSound(this,0.5) >>> explore(shorter) >>> longer = makeScaleSound(this,2.0) >>> explore(longer) >>> same = makeScaleSound(this,1.0)

How we make sounds higher or lower def makeScaleSound(sound,factor): newLength = int(getLength(sound)*factor) newSound = makeEmptySound(newLength) src = 0 for index in range(0,newLength): value = getSampleValueAt(sound,int(src)) setSampleValueAt(newSound,index,value) src = src + 1.0/factor return(newSound)

Scaling is always the same def makeScaleSound(sound,factor): newLength = int(getLength(sound)*factor) newSound = makeEmptySound(newLength) src = 0 for index in range(0,newLength): value = getSampleValueAt(sound,int(src)) setSampleValueAt(newSound,index,value) src = src + 1.0/factor return(newSound) def scale(picture,factor): newHeight = int(factor*getHeight(picture))+1 newWidth = int(factor*getWidth(picture))+1 returnPic = makeEmptyPicture(int(newWidth),int(new Height)) sx = 0 for tx in range(0,newWidth): sy = 0 for ty in range(0,newHeight): if (int(sx) < getWidth(picture)) and (int(sy) < getHeight(picture)): sp = getPixel(picture,int(sx),int(sy)) tp = getPixel(returnPic,tx,ty) setColor(tp,getColor(sp)) sy = sy + (1/factor) sx = sx + (1/factor) return returnPic

Try it! Make a function to decrease volume Make a sentence by splicing words together, or make a song by splicing notes in a series. Make a recording of yourself saying something, then make it ECHO…