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.

What will be an ideal response?


```
def increaseAndDecrease5(sound):
for sampleIndex in range(0,getLength(sound)*0.5):
value = getSampleValueAt(sound ,sampleIndex)
setSampleValueAt(sound ,sampleIndex ,value *
(2*sampleIndex/(getLength(sound)*0.5)))
for sampleIndex in range(getLength(sound)*0.5,getLength(sound)):
value = getSampleValueAt(sound , sampleIndex)
setSampleValueAt(sound ,sampleIndex ,value * (1.0-(sampleIndex
getLength(sound)*0.5)/(getLength(sound)*0.5)))
```

Computer Science & Information Technology

You might also like to view...

Three different forms of repetition statements are provided in C++: while, ____, and do while.

a. for b. if-else c. switch d. if-else chain

Computer Science & Information Technology

Which of the following enables a computer or device that does not have built-in networking capability to access a network?

A. hub B. packet C. NIC D. router

Computer Science & Information Technology

An array with two index values for each element is a(n) ____ array.

A. multi-index B. evaluated C. two-dimensional D. dynamic

Computer Science & Information Technology

Which of the following is not a standard measure of algorithm efficiency?

A. logarithmic B. linear C. quadratic D. factorial E. linear quadratic

Computer Science & Information Technology