code: def compute_changed_segments(
      name: str,
      src_segments: List[Segment],
      dst_segments: List[Segment],
      src_duration: float,
      dst_duration: float,
      speed_factor: float,
      **kwargs,
  ) -> Tuple[List[Segment], List[Segment]]:
      """
      This function performs the logic of computing the new matching segments based
      on the old ones, for the set of transforms that temporally change the video.
  
      Returns the lists of new src segments & dst segments, respectively.
      """
      new_src_segments, new_dst_segments = [], []
      for src_segment, dst_segment in zip(src_segments, dst_segments):
          if name == "insert_in_background":
              offset = (
                  kwargs["offset_factor"]
                  * kwargs["background_duration"]
              )
              # The matching segments are just offset in the dst audio by the amount
              # of background video inserted before the src video.
              new_src_segments.append(src_segment)
              new_dst_segments.append(dst_segment.delta(offset, offset))
          elif name == "clip":
              crop_start = kwargs["offset_factor"] * src_duration
              crop_end = (
                  crop_start + kwargs["duration_factor"] * src_duration
              )
              utils.compute_time_crop_segments(
                  src_segment,
                  dst_segment,
                  speed_factor,
                  crop_start,
                  crop_end,
                  new_src_segments,
                  new_dst_segments,
              )
          elif name == "fft_convolve":
              new_src_segments.append(src_segment)
              new_dst_segments.append(
                  Segment(dst_segment.start, dst_duration)
              )
          elif name in [
              "speed",
              "tempo",
              "time_stretch",
          ]:
              # speed_factor > 1 if speedup, < 1 if slow down
              speed_factor = src_duration / dst_duration
              new_src_segments.append(src_segment)
              new_dst_segments.append(
                  Segment(
                      dst_segment.start / speed_factor,
                      dst_segment.end / speed_factor,
                  )
              )
      return new_src_segments, new_dst_segments
  
file_path: AugLy/augly/audio/utils.py
imports: import numbers
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from augly import utils
  from augly.audio import intensity
  from augly.utils.libsndfile import install_libsndfile
  import librosa
  import soundfile
  import torchaudio
label_desc: Use image node_id 5 for calling a global function with example usage: compute_changed_segments(name, src_segments, dst_segments, src_duration, dst_duration, speed_factor) and returns: new_src_segments,  new_dst_segments