class_docstr: An abstract class for manipulating audio signal.
class_docstr_tok: ["An","abstract","class","for","manipulating","audio","signal","."]
docstr: Load the audio and convert it to a tensorflow waveform.
  
  Parameters:
      audio_descriptor (Any):
          Describe song to load, in case of file based audio adapter,
          such descriptor would be a file path.
      offset (float):
          (Optional) Start offset to load from in seconds.
      duration (float):
          (Optional) Duration to load in seconds.
      sample_rate (float):
          (Optional) Sample rate to load audio with.
      dtype (bytes):
          (Optional) Data type to use, default to `b'float32'`.
      waveform_name (str):
          (Optional) Name of the key in output dict, default to
          `'waveform'`.
  
  Returns:
      Dict[str, Any]:
          TF output dict with waveform as `(T x chan numpy array)`
          and a boolean that tells whether there were an error while
          trying to load the waveform.
docstr_tok: ["Load","the","audio","and","convert","it","to","a","tensorflow","waveform",".","Parameters",":","audio_descriptor","(","Any",")",":","Describe","song","to","load",",","in","case","of","file","based","audio","adapter",",","such","descriptor","would","be","a","file","path",".","offset","(","float",")",":","(","Optional",")","Start","offset","to","load","from","in","seconds",".","duration","(","float",")",":","(","Optional",")","Duration","to","load","in","seconds",".","sample_rate","(","float",")",":","(","Optional",")","Sample","rate","to","load","audio","with",".","dtype","(","bytes",")",":","(","Optional",")","Data","type","to","use",",","default","to","`","b'float32","'","`",".","waveform_name","(","str",")",":","(","Optional",")","Name","of","the","key","in","output","dict",",","default","to","`","'waveform","'","`",".","Returns",":","Dict","[","str",",","Any","]",":","TF","output","dict","with","waveform","as","`","(","T","x","chan","numpy","array",")","`","and","a","boolean","that","tells","whether","there","were","an","error","while","trying","to","load","the","waveform","."]
code: def load_waveform(
      self,
      audio_descriptor,
      offset: float = 0.0,
      duration: float = 1800.0,
      sample_rate: int = 44100,
      dtype: bytes = b"float32",
      waveform_name: str = "waveform",
  ) -> Dict[str, Any]:
      """
      Load the audio and convert it to a tensorflow waveform.
  
      Parameters:
          audio_descriptor (Any):
              Describe song to load, in case of file based audio adapter,
              such descriptor would be a file path.
          offset (float):
              (Optional) Start offset to load from in seconds.
          duration (float):
              (Optional) Duration to load in seconds.
          sample_rate (float):
              (Optional) Sample rate to load audio with.
          dtype (bytes):
              (Optional) Data type to use, default to `b'float32'`.
          waveform_name (str):
              (Optional) Name of the key in output dict, default to
              `'waveform'`.
  
      Returns:
          Dict[str, Any]:
              TF output dict with waveform as `(T x chan numpy array)`
              and a boolean that tells whether there were an error while
              trying to load the waveform.
      """
      # Cast parameters to TF format.
      offset = tf.cast(offset, tf.float64)
      duration = tf.cast(duration, tf.float64)
  
      # Defined safe loading function.
      def safe_load(path, offset, duration, sample_rate, dtype):
          logger.info(
              f"Loading audio {path} from {offset} to {offset + duration}"
          )
          try:
              (data, _) = self.load(
                  path.numpy(),
                  offset.numpy(),
                  duration.numpy(),
                  sample_rate.numpy(),
                  dtype=dtype.numpy(),
              )
              logger.info("Audio data loaded successfully")
              return (data, False)
          except Exception as e:
              logger.exception(
                  "An error occurs while loading audio", exc_info=e
              )
          return (np.float32(-1.0), True)
  
      # Execute function and format results.
      results = (
          tf.py_function(
              safe_load,
              [audio_descriptor, offset, duration, sample_rate, dtype],
              (tf.float32, tf.bool),
          ),
      )
      waveform, error = results[0]
      return {waveform_name: waveform, f"{waveform_name}_error": error}
  
file_path: spleeter/spleeter/audio/adapter.py
imports: from abc import ABC, abstractmethod
  from importlib import import_module
  from pathlib import Path
  from typing import Any, Dict, List, Optional, Union
  import numpy
  import tensorflow
  from spleeter.audio import Codec
  from ..None import SpleeterError
  from ..types import AudioDescriptor, Signal
  from ..utils.logging import logger
label_desc: Use image node_id 2 for calling the AudioAdapter obj's underlying member method code with example usage: obj.load_waveform(audio_descriptor, offset, duration, sample_rate, dtype, waveform_name) and returns: dict, np,  True, data,  False