Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Jython Programmimg help

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.

Name: Anonymous 2011-10-26 16:46

1) Use code tags when posting code to /prog/
2) Did you try to figure out the problem yourself? What did you try?
3) Did you try to google your problem?

Name: Anonymous 2011-10-26 16:56

1) Oh ok, my bad. this is my 1st time on this board. Would they just be [code] yadda [/code?] (w/o the ? ovbiously)

2) Yes, I've been running it in JES, and the fadeOut program works fine. I thought that all one would need to do would be to change "curFactor + factor/numSamples" to curFactor - factor/numSamples. I tried that, and it made the first portion of the file louder, and then faded out at the end.

3) I also tried to Google it as well, but either they write codes that run with errors that i don't know how to fix, or they use functions that don't work properly.

Name: Anonymous 2011-10-26 17:11

>>1
Actually, it should have a higher curFactor at the beginning, and return to 1 at the end. Sorry about that.

Don't change these.
Name: Email:
Entire Thread Thread List