CS 102 Computers In Context (Multimedia) 04 / 08 / 2009 Instructor: Michael Eckmann
Michael Eckmann - Skidmore College - CS Spring 2009 Today’s Topics Questions/comments? Let's talk about the overall structure of the program you are working on. Chapter 7 –Sound Processing only some range of the samples Splicing sounds
Michael Eckmann - Skidmore College - CS Spring 2009 Processing a range of samples Let's make the first half of a sound be louder and the second half be quieter. When we make part of the sound louder, we need to make sure the sample's value isn't outside of the range (-32768, 32767). How do we get access to only the first half of the sound? How about the second half of the sound?
Michael Eckmann - Skidmore College - CS Spring 2009 Processing a range of samples # first half: for i in range(1, (getLength(sound)/2) + 1): value = getSampleValueAt(sample, i) # second half: for i in range((getLength(sound)/2 + 1), getLength(sound) + 1): value = getSampleValueAt(sample, i)
Michael Eckmann - Skidmore College - CS Spring 2009 Splicing sounds We can copy certain samples from different sounds and place them next to each other in a new sound. Let's look at page 172.