code: def compute_segments(
      name: str,
      src_duration: float,
      dst_duration: float,
      metadata: List[Dict[str, Any]],
      **kwargs,
  ) -> Tuple[List[Segment], List[Segment]]:
      speed_factor = 1.0
      if not metadata:
          src_segments = [Segment(0.0, src_duration)]
          dst_segments = [Segment(0.0, src_duration)]
      else:
          src_segments = [
              Segment(segment_dict["start"], segment_dict["end"])
              for segment_dict in metadata[-1]["src_segments"]
          ]
          dst_segments = [
              Segment(segment_dict["start"], segment_dict["end"])
              for segment_dict in metadata[-1]["dst_segments"]
          ]
          for meta in metadata:
              if meta["name"] in ["speed", "tempo"]:
                  speed_factor *= meta["factor"]
              if meta["name"] == "time_stretch":
                  speed_factor *= meta["rate"]
  
      if name in [
          "insert_in_background",
          "clip",
          "speed",
          "tempo",
          "time_stretch",
          "fft_convolve",
      ]:
          return compute_changed_segments(
              name,
              src_segments,
              dst_segments,
              src_duration,
              dst_duration,
              speed_factor,
              **kwargs,
          )
      else:
          return src_segments, 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 6 for calling a global function with example usage: compute_segments(name, src_duration, dst_duration, metadata) and returns: compute_changed_segments, src_segments,  dst_segments