Jython/Python Programmers

Solar^ nospam at nospam.com
Sat Apr 22 11:06:55 EDT 2006


Greetings Group!
I'm trying to do a project for my CS class. I'm using this program
from Mark Guzdial Jython text:

def echoes(snd, delay, factor):
  sound1 = makeSound(snd)
  sndlen1 = getLength(sound1)
  sndlen2 = sndlen1 + (delay * factor)
  
  sound2 =decideLen(sound1, sndlen2) # this function return the length
# new sound canvas
  echoamp = 1.0   for echocount in range(1, factor + 1):
    echoamp = echoamp * 0.6
    for echoposition1 in range(1, sndlen1):
      echoposition2 = echoposition1 + (delay*echocount)
      value1 = getSampleValueAt(sound1, echoposition1) * echoamp
 #problem here#     value2 = getSampleValueAt(sound2, echoposition2)
setSampleValueAt(sound2, echoposition2, value1 + value2)
  play(sound2)
  return(sound2)  

def decideLen(snd1, len1):
  srate1 = getSamplingRate(snd1)
  time1 = len1/srate1
  time1 =int( ceil(time1))
  snd2 = makeEmptySound(time1)
  return snd2

The problem I'm having is that this program will work for a sampling 
rate of 22050, but not for the higher quality 44000 rate.
I keep getting an array out of bounds message where I marked it on the
program. Can't seem to find out why. Too much of a NewBe programmer I
guess. Any one help?
Regards,
Solar^



More information about the Python-list mailing list