code: def load(
      path: Union[
          str,
          int,
          os.PathLike[Any],
          sf.SoundFile,
          audioread.AudioFile,
          BinaryIO,
      ],
      *,
      sr: Optional[float] = 22050,
      mono: bool = True,
      offset: float = 0.0,
      duration: Optional[float] = None,
      dtype: DTypeLike = np.float32,
      res_type: str = "soxr_hq",
  ) -> Tuple[np.ndarray, Union[int, float]]:
      """Load an audio file as a floating point time series.
  
      Audio will be automatically resampled to the given rate
      (default ``sr=22050``).
  
      To preserve the native sampling rate of the file, use ``sr=None``.
  
      Parameters
      ----------
      path : string, int, pathlib.Path, soundfile.SoundFile, audioread object, or file-like object
          path to the input file.
  
          Any codec supported by `soundfile` or `audioread` will work.
  
          Any string file paths, or any object implementing Python's
          file interface (e.g. `pathlib.Path`) are supported as `path`.
  
          If the codec is supported by `soundfile`, then `path` can also be
          an open file descriptor (int) or an existing `soundfile.SoundFile` object.
  
          Pre-constructed audioread decoders are also supported here, see the example
          below.  This can be used, for example, to force a specific decoder rather
          than relying upon audioread to select one for you.
  
          .. warning:: audioread support is deprecated as of version 0.10.0.
              audioread support be removed in version 1.0.
  
      sr : number > 0 [scalar]
          target sampling rate
  
          'None' uses the native sampling rate
  
      mono : bool
          convert signal to mono
  
      offset : float
          start reading after this time (in seconds)
  
      duration : float
          only load up to this much audio (in seconds)
  
      dtype : numeric type
          data type of ``y``
  
      res_type : str
          resample type (see note)
  
          .. note::
              By default, this uses `soxr`'s high-quality mode ('HQ').
  
              For alternative resampling modes, see `resample`
  
          .. note::
             `audioread` may truncate the precision of the audio data to 16 bits.
  
             See :ref:`ioformats` for alternate loading methods.
  
      Returns
      -------
      y : np.ndarray [shape=(n,) or (..., n)]
          audio time series. Multi-channel is supported.
      sr : number > 0 [scalar]
          sampling rate of ``y``
  
      Examples
      --------
      >>> # Load an ogg vorbis file
      >>> filename = librosa.ex('trumpet')
      >>> y, sr = librosa.load(filename)
      >>> y
      array([-1.407e-03, -4.461e-04, ..., -3.042e-05,  1.277e-05],
            dtype=float32)
      >>> sr
      22050
  
      >>> # Load a file and resample to 11 KHz
      >>> filename = librosa.ex('trumpet')
      >>> y, sr = librosa.load(filename, sr=11025)
      >>> y
      array([-8.746e-04, -3.363e-04, ..., -1.301e-05,  0.000e+00],
            dtype=float32)
      >>> sr
      11025
  
      >>> # Load 5 seconds of a file, starting 15 seconds in
      >>> filename = librosa.ex('brahms')
      >>> y, sr = librosa.load(filename, offset=15.0, duration=5.0)
      >>> y
      array([0.146, 0.144, ..., 0.128, 0.015], dtype=float32)
      >>> sr
      22050
  
      >>> # Load using an already open SoundFile object
      >>> import soundfile
      >>> sfo = soundfile.SoundFile(librosa.ex('brahms'))
      >>> y, sr = librosa.load(sfo)
  
      >>> # Load using an already open audioread object
      >>> import audioread.ffdec  # Use ffmpeg decoder
      >>> aro = audioread.ffdec.FFmpegAudioFile(librosa.ex('brahms'))
      >>> y, sr = librosa.load(aro)
      """
      if isinstance(path, tuple(audioread.available_backends())):
          # Force the audioread loader if we have a reader object already
          y, sr_native = __audioread_load(path, offset, duration, dtype)
      else:
          # Otherwise try soundfile first, and then fall back if necessary
          try:
              y, sr_native = __soundfile_load(
                  path, offset, duration, dtype
              )
  
          except sf.SoundFileRuntimeError as exc:
              # If soundfile failed, try audioread instead
              if isinstance(path, (str, pathlib.PurePath)):
                  warnings.warn(
                      "PySoundFile failed. Trying audioread instead.",
                      stacklevel=2,
                  )
                  y, sr_native = __audioread_load(
                      path, offset, duration, dtype
                  )
              else:
                  raise exc
  
      # Final cleanup for dtype and contiguity
      if mono:
          y = to_mono(y)
  
      if sr is not None:
          y = resample(
              y, orig_sr=sr_native, target_sr=sr, res_type=res_type
          )
  
      else:
          sr = sr_native
  
      return y, sr
  
imports: from __future__ import annotations
  import os
  import pathlib
  import warnings
  import soundfile
  import audioread
  import numpy
  import scipy.signal
  import soxr
  import lazy_loader
  from numba import jit, stencil, guvectorize
  from .fft import get_fftlib
  from .convert import frames_to_samples, time_to_samples
  from .._cache import cache
  from ..None import util
  from ..util.exceptions import ParameterError
  from ..util.decorators import deprecated
  from ..util.deprecation import Deprecated, rename_kw
  from .._typing import _FloatLike_co, _IntLike_co, _SequenceLike
  from typing import Any, BinaryIO, Callable, Generator, Optional, Tuple, Union, List
  from numpy.typing import DTypeLike, ArrayLike
label_desc: Use image node_id 1 for calling a global function with example usage: load(path) and returns: y,  sr