Insert_audio_clip

Kindly help me resolve this error:

TypeError Traceback (most recent call last)
in
16 print("\033[92m All tests passed!")
17
—> 18 insert_audio_clip_test(insert_audio_clip)

in insert_audio_clip_test(target)
2 def insert_audio_clip_test(target):
3 np.random.seed(5)
----> 4 audio_clip, segment_time = target(backgrounds[0], activates[0], [(0, 4400)])
5 duration = segment_time[1] - segment_time[0]
6 assert segment_time[0] > 4400, “Error: The audio clip is overlaping with the first segment”

in insert_audio_clip(background, audio_clip, previous_segments)
28 # we retry 5 times(≈ 2 lines)
29 retry = 5 # @KEEP
—> 30 while segment_time > segment_ms and retry >= 0:
31 segment_time = previous_segments
32 retry = retry - 1

TypeError: ‘>’ not supported between instances of ‘tuple’ and ‘int’

Your code for the while statement should use the is_overlapping() function. Its job is to compare the segment_time and the previous_segments. The is_overlapping() function returns a boolean.

You do also need the ‘and’ test for the retry counter.

Thanks a lot sir, Kindly vet my code as i am still getting some error;

while is_overlapping(segment_time, previous_segments) and retry >= 0:
segment_time = previous_segments
retry = retry - 1
### END CODE HERE ###
#print(segment_time)
# if last try is not overlaping, insert it to the background
if not is_overlapping(segment_time, previous_segments):
### START CODE HERE ###
# Step 3: Append the new segment_time to the list of previous_segments (≈ 1 line)
previous_segments.append(segment_time)
### END CODE HERE ###
# Step 4: Superpose audio segment and background
new_background = background.overlay(audio_clip, position = segment_time[0])
else:
#print(“Timeouted”)
new_background = background
segment_time = (10000, 10000)

return new_background, segment_time

Sorry, but I am off-duty this week. Please your question in a new thread, and do not post your code. That breaks the honor code.