Question: Try rewriting Program 100 so that you have a linear increase in volume to halfway through the sound, then linearly decrease the volume down to

Try rewriting Program 100 so that you have a linear increase in volume to halfway through the sound, then linearly decrease the volume down to zero in the second half.


Data from Program 100

def increaseAndDecrease (sound) : for sampleIndex in range (0,getLength (sound)/2): value = getSampleValueAt (sound, sampleIndex) setSampleValueAt(sound, sampleIndex,value * 2) for sampleIndex in range (getLength(sound)/2, getLength(sound)): value = getSampleValueAt (sound, sampleIndex) setSampleValueAt (sound, sampleIndex, value * 0.2)

def increaseAndDecrease (sound) : for sampleIndex in range (0,getLength (sound)/2): value = getSampleValueAt (sound, sampleIndex) setSampleValueAt(sound, sampleIndex,value * 2) for sampleIndex in range (getLength(sound)/2, getLength(sound)): value = getSampleValueAt (sound, sampleIndex) setSampleValueAt (sound, sampleIndex, value * 0.2)

Step by Step Solution

3.33 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

def increase AndDecrease5sound for sampleIndex in range0getLengthsound05 ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction to Computing and Programming in Pytho Questions!