#This function requires the 'clip' and 'copy' functions to work.
# Interleaves 2 sounds until the shortest of
# the 2 sounds is done. Takes an integer to designate how long intervals
# should occur.
def interleave(sound, sound2):
samplelength = input ("Please enter an integer to designate how long intervals should occur: ")
minLength = min(getLength(sound1) ,getLength(sound2))
newSound = makeEmptySound(minLength*2)
numSegments = minLength / sampleLength
for segment in range (0, numSegments):
segment1 = clip (sound1, segment*sampleLength, (segment + 1)*samplelength)
segment2 = clip (sound2, segment*samplelength, (segment + 1)*samplelength)
copy (segment1, newSound, segment*s(amplelength*2))
copy (segment2, newSound, segment*(samplelength*2) + samplelength)
return newSound
# Interleaves 2 sounds until the shortest of
# the 2 sounds is done. Takes an integer to designate how long intervals
# should occur.
def interleave(sound, sound2):
samplelength = input ("Please enter an integer to designate how long intervals should occur: ")
minLength = min(getLength(sound1) ,getLength(sound2))
newSound = makeEmptySound(minLength*2)
numSegments = minLength / sampleLength
for segment in range (0, numSegments):
segment1 = clip (sound1, segment*sampleLength, (segment + 1)*samplelength)
segment2 = clip (sound2, segment*samplelength, (segment + 1)*samplelength)
copy (segment1, newSound, segment*s(amplelength*2))
copy (segment2, newSound, segment*(samplelength*2) + samplelength)
return newSound
No comments:
Post a Comment