code: def __soundfile_load(path, offset, duration, dtype):
      """Load an audio buffer using soundfile."""
      if isinstance(path, sf.SoundFile):
          # If the user passed an existing soundfile object,
          # we can use it directly
          context = path
      else:
          # Otherwise, create the soundfile object
          context = sf.SoundFile(path)
  
      with context as sf_desc:
          sr_native = sf_desc.samplerate
          if offset:
              # Seek to the start of the target read
              sf_desc.seek(int(offset * sr_native))
          if duration is not None:
              frame_duration = int(duration * sr_native)
          else:
              frame_duration = -1
  
          # Load the target number of frames, and transpose to match librosa form
          y = sf_desc.read(
              frames=frame_duration, dtype=dtype, always_2d=False
          ).T
  
      return y, sr_native
  
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 2 for calling a global function with example usage: __soundfile_load(path, offset, duration, dtype) and returns: y,  sr_native