class_docstr: Trim or pad the audio to the specified length/duration in samples or seconds. If the
  input sound is longer than the target duration, pick a random offset and crop the
  sound to the target duration. If the input sound is shorter than the target
  duration, pad the sound so the duration matches the target duration.
class_docstr_tok: ["Trim","or","pad","the","audio","to","the","specified","length\/duration","in","samples","or","seconds",".","If","the","input","sound","is","longer","than","the","target","duration",",","pick","a","random","offset","and","crop","the","sound","to","the","target","duration",".","If","the","input","sound","is","shorter","than","the","target","duration",",","pad","the","sound","so","the","duration","matches","the","target","duration","."]
code: def apply(self, samples: NDArray[np.float32], sample_rate: int):
      target_samples = self.get_target_samples(sample_rate)
      sample_length = samples.shape[-1]
  
      if sample_length == target_samples:
          return samples
  
      elif sample_length > target_samples:
          start = np.random.randint(0, sample_length - target_samples)
          return samples[..., start : start + target_samples]
  
      elif sample_length < target_samples:
          padding_length = target_samples - sample_length
          if samples.ndim == 1:
              if self.padding_position == "start":
                  pad_width = (padding_length, 0)
              else:
                  pad_width = (0, padding_length)
          else:
              if self.padding_position == "start":
                  pad_width = ((0, 0), (padding_length, 0))
              else:
                  pad_width = ((0, 0), (0, padding_length))
          return np.pad(samples, pad_width, self.padding_mode)
  
imports: import numpy
  from numpy.typing import NDArray
  from audiomentations.core.transforms_interface import BaseWaveformTransform
label_desc: Use image node_id 2 for calling the AdjustDuration obj's underlying member method code with example usage: obj.apply(samples, sample_rate) and returns: samples, samples, np