reverse a sound
# Reverse a sound
def reverseSound(sound):
seconds = getLength(sound)/getSamplingRate(sound)
reversed = makeEmptySound(int(seconds+1))
# Start at the beginning of the destination sound and go forward
destIndex = 1
# Start at the end of the source sound and go backward
for srcIndex in range(getLength(sound), 0, -1): # Three-argument range for increment
srcSample = getSampleValueAt(sound, srcIndex)
setSampleValueAt(reversed, destIndex, srcSample)
destIndex = destIndex + 1
# Reversed sound will start with up to 1 second of silence
return reversed
Link to this Page