def increaseVolume (sound): for sample in getSamples (sound): ampl = getSample (sample) setSample (sample, ampl *2) def driver1(): file = pickAFile() s = makeSound (file) increaseVolume (s) play (s) writeSoundTo (s, pickAFile() ) def driver2(): file = pickAFile() s = makeSound (file) play (s) return s def normalize(sound): largest = 0 for s in getSamples(sound): largest = max(largest, abs(getSample(s)) ) #Notice the abs! multiplier = 32767.0 / largest print "Largest sample value in original sound was", largest print "Multiplier is", multiplier for s in getSamples(sound): louder = multiplier * getSample(s) setSample(s,louder) def driver3(): file = pickAFile() s = makeSound (file) normalize (s) play (s) writeSoundTo (s, pickAFile() )