Write a function to reverse part of the passed sound just between the passed start and end index.

In order to reverse part of the passed in sound, and not a copy of the sound, we need to copy out the entirety of the non-reverse section in order to avoid overwriting half of it as we reverse.

```
def reverseBetween(sound, startIndex, endIndex):
soundSamples = getSamples(sound)
target = makeEmptySound(endIndex-startIndex)
targetSamples = getSamples(target)

for index in range(startIndex, endIndex):
sourceValue = getSampleValue(soundSamples[index])
setSampleValue(targetSamples[index-startIndex], sourceValue)

for index in range(startIndex, endIndex):
sourceValue = getSampleValue(targetSamples[index-startIndex])
setSampleValue(soundSamples[endIndex-1-(index-startIndex)], sourceValue)
```

Computer Science & Information Technology

You might also like to view...

A(n) ________ file extension means the sound file is not compressed

Fill in the blank(s) with correct word

Computer Science & Information Technology

Which of the following is NOT a typical way to add audio to a PowerPoint presentation?

A) Record audio B) Insert audio directly from a Web page C) Insert audio from a file D) Insert from the Clip Art pane

Computer Science & Information Technology