code: def chirp(
      *,
      fmin: _FloatLike_co,
      fmax: _FloatLike_co,
      sr: float = 22050,
      length: Optional[int] = None,
      duration: Optional[float] = None,
      linear: bool = False,
      phi: Optional[float] = None,
  ) -> np.ndarray:
      """Construct a "chirp" or "sine-sweep" signal.
  
      The chirp sweeps from frequency ``fmin`` to ``fmax`` (in Hz).
  
      Parameters
      ----------
      fmin : float > 0
          initial frequency
  
      fmax : float > 0
          final frequency
  
      sr : number > 0
          desired sampling rate of the output signal
  
      length : int > 0
          desired number of samples in the output signal.
          When both ``duration`` and ``length`` are defined,
          ``length`` takes priority.
  
      duration : float > 0
          desired duration in seconds.
          When both ``duration`` and ``length`` are defined,
          ``length`` takes priority.
  
      linear : boolean
          - If ``True``, use a linear sweep, i.e., frequency changes linearly with time
          - If ``False``, use a exponential sweep.
  
          Default is ``False``.
  
      phi : float or None
          phase offset, in radians.
          If unspecified, defaults to ``-np.pi * 0.5``.
  
      Returns
      -------
      chirp_signal : np.ndarray [shape=(length,), dtype=float64]
          Synthesized chirp signal
  
      Raises
      ------
      ParameterError
          - If either ``fmin`` or ``fmax`` are not provided.
          - If neither ``length`` nor ``duration`` are provided.
  
      See Also
      --------
      scipy.signal.chirp
  
      Examples
      --------
      Generate a exponential chirp from A2 to A8
  
      >>> exponential_chirp = librosa.chirp(fmin=110, fmax=110*64, duration=1)
  
      Or generate the same signal using ``length``
  
      >>> exponential_chirp = librosa.chirp(fmin=110, fmax=110*64, sr=22050, length=22050)
  
      Or generate a linear chirp instead
  
      >>> linear_chirp = librosa.chirp(fmin=110, fmax=110*64, duration=1, linear=True)
  
      Display spectrogram for both exponential and linear chirps.
  
      >>> import matplotlib.pyplot as plt
      >>> fig, ax = plt.subplots(nrows=2, sharex=True, sharey=True)
      >>> S_exponential = np.abs(librosa.stft(y=exponential_chirp))
      >>> librosa.display.specshow(librosa.amplitude_to_db(S_exponential, ref=np.max),
      ...                          x_axis='time', y_axis='linear', ax=ax[0])
      >>> ax[0].set(title='Exponential chirp', xlabel=None)
      >>> ax[0].label_outer()
      >>> S_linear = np.abs(librosa.stft(y=linear_chirp))
      >>> librosa.display.specshow(librosa.amplitude_to_db(S_linear, ref=np.max),
      ...                          x_axis='time', y_axis='linear', ax=ax[1])
      >>> ax[1].set(title='Linear chirp')
      """
      if fmin is None or fmax is None:
          raise ParameterError(
              'both "fmin" and "fmax" must be provided'
          )
  
      # Compute signal duration
      period = 1.0 / sr
      if length is None:
          if duration is None:
              raise ParameterError(
                  'either "length" or "duration" must be provided'
              )
      else:
          duration = period * length
  
      if phi is None:
          phi = -np.pi * 0.5
  
      method = "linear" if linear else "logarithmic"
      y: np.ndarray = scipy.signal.chirp(
          np.arange(int(duration * sr)) / sr,
          fmin,
          duration,
          fmax,
          method=method,
          phi=phi
          / np.pi
          * 180,  # scipy.signal.chirp uses degrees for phase offset
      )
      return y
  
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 17 for calling a global function with example usage: chirp() and returns: y