code: def preemphasis(
      y: np.ndarray,
      *,
      coef: float = 0.97,
      zi: Optional[ArrayLike] = None,
      return_zf: bool = False,
  ) -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]:
      """Pre-emphasize an audio signal with a first-order differencing filter:
  
          y[n] -> y[n] - coef * y[n-1]
  
      Parameters
      ----------
      y : np.ndarray [shape=(..., n)]
          Audio signal. Multi-channel is supported.
  
      coef : positive number
          Pre-emphasis coefficient.  Typical values of ``coef`` are between 0 and 1.
  
          At the limit ``coef=0``, the signal is unchanged.
  
          At ``coef=1``, the result is the first-order difference of the signal.
  
          The default (0.97) matches the pre-emphasis filter used in the HTK
          implementation of MFCCs [#]_.
  
          .. [#] https://htk.eng.cam.ac.uk/
  
      zi : number
          Initial filter state.  When making successive calls to non-overlapping
          frames, this can be set to the ``zf`` returned from the previous call.
          (See example below.)
  
          By default ``zi`` is initialized as ``2*y[0] - y[1]``.
  
      return_zf : boolean
          If ``True``, return the final filter state.
          If ``False``, only return the pre-emphasized signal.
  
      Returns
      -------
      y_out : np.ndarray
          pre-emphasized signal
      zf : number
          if ``return_zf=True``, the final filter state is also returned
  
      Examples
      --------
      Apply a standard pre-emphasis filter
  
      >>> import matplotlib.pyplot as plt
      >>> y, sr = librosa.load(librosa.ex('trumpet'))
      >>> y_filt = librosa.effects.preemphasis(y)
      >>> # and plot the results for comparison
      >>> S_orig = librosa.amplitude_to_db(np.abs(librosa.stft(y)), ref=np.max, top_db=None)
      >>> S_preemph = librosa.amplitude_to_db(np.abs(librosa.stft(y_filt)), ref=np.max, top_db=None)
      >>> fig, ax = plt.subplots(nrows=2, sharex=True, sharey=True)
      >>> librosa.display.specshow(S_orig, y_axis='log', x_axis='time', ax=ax[0])
      >>> ax[0].set(title='Original signal')
      >>> ax[0].label_outer()
      >>> img = librosa.display.specshow(S_preemph, y_axis='log', x_axis='time', ax=ax[1])
      >>> ax[1].set(title='Pre-emphasized signal')
      >>> fig.colorbar(img, ax=ax, format="%+2.f dB")
  
      Apply pre-emphasis in pieces for block streaming.  Note that the second block
      initializes ``zi`` with the final state ``zf`` returned by the first call.
  
      >>> y_filt_1, zf = librosa.effects.preemphasis(y[:1000], return_zf=True)
      >>> y_filt_2, zf = librosa.effects.preemphasis(y[1000:], zi=zf, return_zf=True)
      >>> np.allclose(y_filt, np.concatenate([y_filt_1, y_filt_2]))
      True
  
      See Also
      --------
      deemphasis
      """
      b = np.asarray([1.0, -coef], dtype=y.dtype)
      a = np.asarray([1.0], dtype=y.dtype)
  
      if zi is None:
          # Initialize the filter to implement linear extrapolation
          zi = 2 * y[..., 0:1] - y[..., 1:2]
  
      zi = np.atleast_1d(zi)
  
      y_out: np.ndarray
      z_f: np.ndarray
  
      y_out, z_f = scipy.signal.lfilter(
          b, a, y, zi=np.asarray(zi, dtype=y.dtype)
      )
  
      if return_zf:
          return y_out, z_f
  
      return y_out
  
imports: import numpy
  import scipy.signal
  from .None import core
  from .None import decompose
  from .None import feature
  from .None import util
  from .util.exceptions import ParameterError
  from typing import Any, Callable, Iterable, Optional, Tuple, Union, overload
  from typing_extensions import Literal
  from numpy.typing import ArrayLike
label_desc: Use image node_id 13 for calling a global function with example usage: preemphasis(y) and returns: y_out, y_out,  z_f