code: def delta(
      data: np.ndarray,
      *,
      width: int = 9,
      order: int = 1,
      axis: int = -1,
      mode: str = "interp",
      **kwargs: Any,
  ) -> np.ndarray:
      r"""Compute delta features: local estimate of the derivative
      of the input data along the selected axis.
  
      Delta features are computed Savitsky-Golay filtering.
  
      Parameters
      ----------
      data : np.ndarray
          the input data matrix (eg, spectrogram)
  
      width : int, positive, odd [scalar]
          Number of frames over which to compute the delta features.
          Cannot exceed the length of ``data`` along the specified axis.
  
          If ``mode='interp'``, then ``width`` must be at least ``data.shape[axis]``.
  
      order : int > 0 [scalar]
          the order of the difference operator.
          1 for first derivative, 2 for second, etc.
  
      axis : int [scalar]
          the axis along which to compute deltas.
          Default is -1 (columns).
  
      mode : str, {'interp', 'nearest', 'mirror', 'constant', 'wrap'}
          Padding mode for estimating differences at the boundaries.
  
      **kwargs : additional keyword arguments
          See `scipy.signal.savgol_filter`
  
      Returns
      -------
      delta_data : np.ndarray [shape=(..., t)]
          delta matrix of ``data`` at specified order
  
      Notes
      -----
      This function caches at level 40.
  
      See Also
      --------
      scipy.signal.savgol_filter
  
      Examples
      --------
      Compute MFCC deltas, delta-deltas
  
      >>> y, sr = librosa.load(librosa.ex('libri1'), duration=5)
      >>> mfcc = librosa.feature.mfcc(y=y, sr=sr)
      >>> mfcc_delta = librosa.feature.delta(mfcc)
      >>> mfcc_delta
      array([[-5.713e+02, -5.697e+02, ..., -1.522e+02, -1.224e+02],
             [ 1.104e+01,  1.330e+01, ...,  2.089e+02,  1.698e+02],
             ...,
             [ 2.829e+00,  1.933e+00, ..., -3.149e+00,  2.294e-01],
             [ 2.890e+00,  2.187e+00, ...,  6.959e+00, -1.039e+00]],
            dtype=float32)
  
      >>> mfcc_delta2 = librosa.feature.delta(mfcc, order=2)
      >>> mfcc_delta2
      array([[-1.195, -1.195, ..., -4.328, -4.328],
             [-1.566, -1.566, ..., -9.949, -9.949],
             ...,
             [ 0.707,  0.707, ...,  2.287,  2.287],
             [ 0.655,  0.655, ..., -1.719, -1.719]], dtype=float32)
  
      >>> import matplotlib.pyplot as plt
      >>> fig, ax = plt.subplots(nrows=3, sharex=True, sharey=True)
      >>> img1 = librosa.display.specshow(mfcc, ax=ax[0], x_axis='time')
      >>> ax[0].set(title='MFCC')
      >>> ax[0].label_outer()
      >>> img2 = librosa.display.specshow(mfcc_delta, ax=ax[1], x_axis='time')
      >>> ax[1].set(title=r'MFCC-$\Delta$')
      >>> ax[1].label_outer()
      >>> img3 = librosa.display.specshow(mfcc_delta2, ax=ax[2], x_axis='time')
      >>> ax[2].set(title=r'MFCC-$\Delta^2$')
      >>> fig.colorbar(img1, ax=[ax[0]])
      >>> fig.colorbar(img2, ax=[ax[1]])
      >>> fig.colorbar(img3, ax=[ax[2]])
      """
      data = np.atleast_1d(data)
  
      if mode == "interp" and width > data.shape[axis]:
          raise ParameterError(
              f"when mode='interp', width={width} "
              f"cannot exceed data.shape[axis]={data.shape[axis]}"
          )
  
      if width < 3 or np.mod(width, 2) != 1:
          raise ParameterError("width must be an odd integer >= 3")
  
      if order <= 0 or not isinstance(order, (int, np.integer)):
          raise ParameterError("order must be a positive integer")
  
      kwargs.pop("deriv", None)
      kwargs.setdefault("polyorder", order)
      result: np.ndarray = scipy.signal.savgol_filter(
          data, width, deriv=order, axis=axis, mode=mode, **kwargs
      )
      return result
  
file_path: librosa/librosa/feature/utils.py
imports: import numpy
  import scipy.signal
  from numba import jit
  from .._cache import cache
  from ..util.exceptions import ParameterError
  from typing import Any
label_desc: Use image node_id 1 for calling a global function with example usage: delta(data) and returns: result