code: def sample_clip_indices(filename, n_samples, sr, rng):
      """Calculate the indices at which to sample a fragment of audio from a file.
  
      Parameters
      ----------
      filename : str
          Path to the input file
  
      n_samples : int > 0
          The number of samples to load
  
      sr : int > 0
          The target sampling rate
  
      rng : np.random.RandomState
          The random number generator object
  
      Returns
      -------
      start : int
          The sample index from `filename` at which the audio fragment starts
      stop : int
          The sample index from `filename` at which the audio fragment stops (e.g. y = audio[start:stop])
      """
  
      with psf.SoundFile(str(filename), mode="r") as soundf:
          # Measure required length of fragment
          n_target = int(
              np.ceil(n_samples * soundf.samplerate / float(sr))
          )
  
          # Raise exception if source is too short
          if len(soundf) < n_target:
              raise RuntimeError(
                  "Source {} (length={})".format(filename, len(soundf))
                  + " must be at least the length of the input ({})".format(
                      n_target
                  )
              )
  
          # Draw a starting point at random in the background waveform
          start = rng.randint(0, 1 + len(soundf) - n_target)
          stop = start + n_target
  
          return start, stop
  
file_path: muda/muda/deformers/background.py
imports: import soundfile
  import librosa
  import numpy
  import os
  import six
  from ..base import BaseTransformer, _get_rng
label_desc: Use image node_id 1 for calling a global function with example usage: sample_clip_indices(filename, n_samples, sr, rng) and returns: start,  stop