Name: Anonymous 2011-10-26 16:43
Okay, so I have this program that will take a .wav sound file, and make it fade out
def fadeOut(factor):
source=makeSound(pickAFile())
canvas=makeEmptySound(getLength(source))
curFactor=1.0
numSamples=getNumSamples(source)
for sourceIndex in range(0, getLength(source)):
val=getSampleValueAt(source, sourceIndex)
setSampleValueAt(canvas, sourceIndex, val/curFactor)
curFactor=curFactor + factor/numSamples
return canvas
now what would i have to change to make a fade in function, that is, the sound starts with a higher curFactor and by the end of it, it returns to one.
def fadeOut(factor):
source=makeSound(pickAFile())
canvas=makeEmptySound(getLength(source))
curFactor=1.0
numSamples=getNumSamples(source)
for sourceIndex in range(0, getLength(source)):
val=getSampleValueAt(source, sourceIndex)
setSampleValueAt(canvas, sourceIndex, val/curFactor)
curFactor=curFactor + factor/numSamples
return canvas
now what would i have to change to make a fade in function, that is, the sound starts with a higher curFactor and by the end of it, it returns to one.