470,815 Members | 1,284 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Jython/Python Programmers

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^
Apr 22 '06 #1
0 854

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Michael Chermside | last post: by
6 posts views Thread by Dave Benjamin | last post: by
4 posts views Thread by angel | last post: by
8 posts views Thread by George Jempty | last post: by
6 posts views Thread by Mike Wimpe | last post: by
4 posts views Thread by Nadeem Mohsin | last post: by
3 posts views Thread by Sloan.Kohler | last post: by
5 posts views Thread by sarup26 | last post: by
1 post views Thread by RC | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.