Dear Mentor.
retry = 5 # @KEEP
while segment_time or is_overlapping and retry >= 0:
segment_time = get_random_time_segment(segment_ms)
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
The next cell the build one is executing rather stick in infinite loops.