def Func(arg_0, arg_1, arg_2=None):
    """Phase vocoder.  Given an STFT matrix D, speed up by a factor of `rate`

    Based on the implementation provided by [1]_.

    .. [1] Ellis, D. P. W. "A phase vocoder in Matlab."
        Columbia University, 2002.
        http://www.ee.columbia.edu/~dpwe/resources/matlab/pvoc/

    Examples
    --------
    >>> # Play at double speed
    >>> y, sr   = librosa.load(librosa.util.example_audio_file())
    >>> D       = librosa.stft(y, n_fft=2048, hop_length=512)
    >>> D_fast  = librosa.Func(D, 2.0, hop_length=512)
    >>> y_fast  = librosa.istft(D_fast, hop_length=512)

    >>> # Or play at 1/3 speed
    >>> y, sr   = librosa.load(librosa.util.example_audio_file())
    >>> D       = librosa.stft(y, n_fft=2048, hop_length=512)
    >>> D_slow  = librosa.Func(D, 1./3, hop_length=512)
    >>> y_slow  = librosa.istft(D_slow, hop_length=512)

    Parameters
    ----------
    D : np.ndarray [shape=(d, t), dtype=complex]
        STFT matrix

    rate :  float > 0 [scalar]
        Speed-up factor: `rate > 1` is faster, `rate < 1` is slower.

    hop_length : int > 0 [scalar] or None
        The number of samples between successive columns of `D`.

        If None, defaults to `n_fft/4 = (D.shape[0]-1)/2`

    Returns
    -------
    D_stretched : np.ndarray [shape=(d, t / rate), dtype=complex]
        time-stretched STFT
    """

    arg_3 = 2 * (arg_0.shape[0] - 1)

    if arg_2 is None:
        arg_2 = int(arg_3 // 4)

    arg_4 = np.arange(0, arg_0.shape[1], arg_1, dtype=np.float)

    # Create an empty output array
    arg_5 = np.zeros((arg_0.shape[0], len(arg_4)), arg_0.dtype, order='F')

    # Expected phase advance in each bin
    arg_6 = np.linspace(0, np.pi * arg_2, arg_0.shape[0])

    # Phase accumulator; initialize to the first sample
    arg_7 = np.angle(arg_0[:, 0])

    # Pad 0 columns to simplify boundary logic
    arg_0 = np.pad(arg_0, [(0, 0), (0, 2)], mode='constant')

    for (arg_8, arg_9) in enumerate(arg_4):

        arg_10 = arg_0[:, int(arg_9):int(arg_9 + 2)]

        # Weighting for linear magnitude interpolation
        arg_11 = np.mod(arg_9, 1.0)
        arg_12 = ((1.0 - arg_11) * np.abs(arg_10[:, 0])
               + arg_11 * np.abs(arg_10[:, 1]))

        # Store to output array
        arg_5[:, arg_8] = arg_12 * np.exp(1.j * arg_7)

        # Compute phase advance
        arg_13 = (np.angle(arg_10[:, 1])
                  - np.angle(arg_10[:, 0])
                  - arg_6)

        # Wrap to -pi:pi range
        arg_13 = arg_13 - 2.0 * np.pi * np.round(arg_13 / (2.0 * np.pi))

        # Accumulate phase
        arg_7 += arg_6 + arg_13

    return arg_5


def Func(arg_0, arg_1=1.0, arg_2=1e-5, arg_3=80.0):
    '''Convert an amplitude spectrogram to dB-scaled spectrogram.

    This is equivalent to ``power_to_db(S**2)``, but is provided for convenience.

    Parameters
    ----------
    S : np.ndarray
        input amplitude

    ref : scalar or callable
        If scalar, the amplitude `abs(S)` is scaled relative to `ref`:
        `20 * log10(S / ref)`.
        Zeros in the output correspond to positions where `S == ref`.

        If callable, the reference value is computed as `ref(S)`.

    amin : float > 0 [scalar]
        minimum threshold for `S` and `ref`

    top_db : float >= 0 [scalar]
        threshold the output at `top_db` below the peak:
        ``max(20 * log10(S)) - top_db``

    Returns
    -------
    S_db : np.ndarray
        ``S`` measured in dB

    See Also
    --------
    power_to_db, db_to_amplitude

    Notes
    -----
    This function caches at level 30.
    '''

    arg_0 = np.asarray(arg_0)

    if np.issubdtype(arg_0.dtype, np.complexfloating):
        warnings.warn('Func was called on complex input so phase '
                      'information will be discarded. To suppress this warning, '
                      'call Func(np.abs(S)) instead.')

    arg_4 = np.abs(arg_0)

    if six.callable(arg_1):
        # User supplied a function to calculate reference power
        arg_5 = arg_1(arg_4)
    else:
        arg_5 = np.abs(arg_1)

    arg_6 = np.square(arg_4, out=arg_4)

    return power_to_db(arg_6, arg_1=arg_5**2, arg_2=arg_2**2,
                       arg_3=arg_3)


def Func(arg_0=None, arg_1=None, arg_2=2048, arg_3=512, arg_4=1,
                 arg_5=None, arg_6='hann', arg_7=True, arg_8='reflect'):
    '''Helper function to retrieve a magnitude spectrogram.

    This is primarily used in feature extraction functions that can operate on
    either audio time-series or spectrogram input.

    Parameters
    ----------
    y : None or np.ndarray [ndim=1]
        If provided, an audio time series

    S : None or np.ndarray
        Spectrogram input, optional

    n_fft : int > 0
        STFT window size

    hop_length : int > 0
        STFT hop length

    power : float > 0
        Exponent for the magnitude spectrogram,
        e.g., 1 for energy, 2 for power, etc.

    win_length : int <= n_fft [scalar]
        Each frame of audio is windowed by `window()`.
        The window will be of length `win_length` and then padded
        with zeros to match `n_fft`.

        If unspecified, defaults to ``win_length = n_fft``.

    window : string, tuple, number, function, or np.ndarray [shape=(n_fft,)]
        - a window specification (string, tuple, or number);
          see `scipy.signal.get_window`
        - a window function, such as `scipy.signal.hanning`
        - a vector or array of length `n_fft`

        .. see also:: `filters.get_window`

    center : boolean
        - If `True`, the signal `y` is padded so that frame
          `t` is centered at `y[t * hop_length]`.
        - If `False`, then frame `t` begins at `y[t * hop_length]`

    pad_mode : string
        If `center=True`, the padding mode to use at the edges of the signal.
        By default, STFT uses reflection padding.

    Returns
    -------
    S_out : np.ndarray [dtype=np.float32]
        - If `S` is provided as input, then `S_out == S`
        - Else, `S_out = |stft(y, ...)|**power`

    n_fft : int > 0
        - If `S` is provided, then `n_fft` is inferred from `S`
        - Else, copied from input
    '''

    if arg_1 is not None:
        # Infer n_fft from spectrogram shape
        arg_2 = 2 * (arg_1.shape[0] - 1)
    else:
        # Otherwise, compute a magnitude spectrogram from input
        arg_1 = np.abs(stft(arg_0, arg_2=arg_2, arg_3=arg_3,
                        arg_5=arg_5, arg_7=arg_7,
                        arg_6=arg_6, arg_8=arg_8))**arg_4

    return arg_1, arg_2


def Func(arg_0, arg_1):
    '''HPSS beat tracking

    :parameters:
      - input_file : str
          Path to input audio file (wav, mp3, m4a, flac, etc.)

      - output_file : str
          Path to save beat event timestamps as a CSV file
    '''

    # Load the file
    print('Loading  ', arg_0)
    arg_2, arg_3 = librosa.load(arg_0)

    # Do HPSS
    print('Harmonic-percussive separation ... ')
    arg_2 = librosa.effects.percussive(arg_2)

    # Construct onset envelope from percussive component
    print('Tracking beats on percussive component')
    arg_4 = librosa.onset.onset_strength(arg_2=arg_2,
                                             arg_3=arg_3,
                                             hop_length=HOP_LENGTH,
                                             n_fft=N_FFT,
                                             aggregate=np.median)

    # Track the beats
    arg_5, arg_6 = librosa.beat.beat_track(onset_envelope=arg_4,
                                           arg_3=arg_3,
                                           hop_length=HOP_LENGTH)

    arg_7 = librosa.frames_to_time(arg_6,
                                        arg_3=arg_3,
                                        hop_length=HOP_LENGTH)

    # Save the output
    print('Saving beats to ', arg_1)
    librosa.output.times_csv(arg_1, arg_7)


def Func(arg_0, arg_1=None, arg_2=None, arg_3=-1, **arg_4):
    '''Filtering by nearest-neighbors.

    Each data point (e.g, spectrogram column) is replaced
    by aggregating its nearest neighbors in feature space.

    This can be useful for de-noising a spectrogram or feature matrix.

    The non-local means method [1]_ can be recovered by providing a
    weighted recurrence matrix as input and specifying `aggregate=np.average`.

    Similarly, setting `aggregate=np.median` produces sparse de-noising
    as in REPET-SIM [2]_.

    .. [1] Buades, A., Coll, B., & Morel, J. M.
        (2005, June). A non-local algorithm for image denoising.
        In Computer Vision and Pattern Recognition, 2005.
        CVPR 2005. IEEE Computer Society Conference on (Vol. 2, pp. 60-65). IEEE.

    .. [2] Rafii, Z., & Pardo, B.
        (2012, October).  "Music/Voice Separation Using the Similarity Matrix."
        International Society for Music Information Retrieval Conference, 2012.

    Parameters
    ----------
    S : np.ndarray
        The input data (spectrogram) to filter

    rec : (optional) scipy.sparse.spmatrix or np.ndarray
        Optionally, a pre-computed nearest-neighbor matrix
        as provided by `librosa.segment.recurrence_matrix`

    aggregate : function
        aggregation function (default: `np.mean`)

        If `aggregate=np.average`, then a weighted average is
        computed according to the (per-row) weights in `rec`.

        For all other aggregation functions, all neighbors
        are treated equally.

    axis : int
        The axis along which to filter (by default, columns)

    kwargs
        Additional keyword arguments provided to
        `librosa.segment.recurrence_matrix` if `rec` is not provided

    Returns
    -------
    S_filtered : np.ndarray
        The filtered data

    Raises
    ------
    ParameterError
        if `rec` is provided and its shape is incompatible with `S`.

    See also
    --------
    decompose
    hpss
    librosa.segment.recurrence_matrix

    Notes
    -----
    This function caches at level 30.

    Examples
    --------

    De-noise a chromagram by non-local median filtering.
    By default this would use euclidean distance to select neighbors,
    but this can be overridden directly by setting the `metric` parameter.

    >>> y, sr = librosa.load(librosa.util.example_audio_file(),
    ...                      offset=30, duration=10)
    >>> chroma = librosa.feature.chroma_cqt(y=y, sr=sr)
    >>> chroma_med = librosa.decompose.Func(chroma,
    ...                                          aggregate=np.median,
    ...                                          metric='cosine')

    To use non-local means, provide an affinity matrix and `aggregate=np.average`.

    >>> rec = librosa.segment.recurrence_matrix(chroma, mode='affinity',
    ...                                         metric='cosine', sparse=True)
    >>> chroma_nlm = librosa.decompose.Func(chroma, rec=rec,
    ...                                          aggregate=np.average)

    >>> import matplotlib.pyplot as plt
    >>> plt.figure(figsize=(10, 8))
    >>> plt.subplot(5, 1, 1)
    >>> librosa.display.specshow(chroma, y_axis='chroma')
    >>> plt.colorbar()
    >>> plt.title('Unfiltered')
    >>> plt.subplot(5, 1, 2)
    >>> librosa.display.specshow(chroma_med, y_axis='chroma')
    >>> plt.colorbar()
    >>> plt.title('Median-filtered')
    >>> plt.subplot(5, 1, 3)
    >>> librosa.display.specshow(chroma_nlm, y_axis='chroma')
    >>> plt.colorbar()
    >>> plt.title('Non-local means')
    >>> plt.subplot(5, 1, 4)
    >>> librosa.display.specshow(chroma - chroma_med,
    ...                          y_axis='chroma')
    >>> plt.colorbar()
    >>> plt.title('Original - median')
    >>> plt.subplot(5, 1, 5)
    >>> librosa.display.specshow(chroma - chroma_nlm,
    ...                          y_axis='chroma', x_axis='time')
    >>> plt.colorbar()
    >>> plt.title('Original - NLM')
    >>> plt.tight_layout()
    '''
    if arg_2 is None:
        arg_2 = np.mean

    if arg_1 is None:
        arg_4 = dict(arg_4)
        arg_4['sparse'] = True
        arg_1 = segment.recurrence_matrix(arg_0, arg_3=arg_3, **arg_4)
    elif not scipy.sparse.issparse(arg_1):
        arg_1 = scipy.sparse.csr_matrix(arg_1)

    if arg_1.shape[0] != arg_0.shape[arg_3] or arg_1.shape[0] != arg_1.shape[1]:
        raise ParameterError('Invalid self-similarity matrix shape '
                             'rec.shape={} for S.shape={}'.format(arg_1.shape,
                                                                  arg_0.shape))

    return __Func_helper(arg_1.data, arg_1.indices, arg_1.indptr,
                              arg_0.swapaxes(0, arg_3), arg_2).swapaxes(0, arg_3)


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    '''Nearest-neighbor filter helper function.

    This is an internal function, not for use outside of the decompose module.

    It applies the nearest-neighbor filter to S, assuming that the first index
    corresponds to observations.

    Parameters
    ----------
    R_data, R_indices, R_ptr : np.ndarrays
        The `data`, `indices`, and `indptr` of a scipy.sparse matrix

    S : np.ndarray
        The observation data to filter

    aggregate : callable
        The aggregation operator

    Returns
    -------
    S_out : np.ndarray like S
        The filtered data array
    '''
    arg_5 = np.empty_like(arg_3)

    for arg_6 in range(len(arg_2)-1):

        # Get the non-zeros out of the recurrence matrix
        arg_7 = arg_1[arg_2[arg_6]:arg_2[arg_6+1]]

        if not len(arg_7):
            arg_5[arg_6] = arg_3[arg_6]
            continue

        arg_8 = np.take(arg_3, arg_7, axis=0)

        if arg_4 is np.average:
            arg_9 = arg_0[arg_2[arg_6]:arg_2[arg_6+1]]
            arg_5[arg_6] = arg_4(arg_8, axis=0, arg_9=arg_9)
        else:
            arg_5[arg_6] = arg_4(arg_8, axis=0)

    return arg_5


def Func(arg_0, arg_1, arg_2=128, arg_3=0.0, arg_4=None, arg_5=False,
        arg_6=1, arg_7=arg_8.float32):
    """Create a Filterbank matrix to combine FFT bins into Mel-frequency bins

    Parameters
    ----------
    sr        : number > 0 [scalar]
        sampling rate of the incoming signal

    n_fft     : int > 0 [scalar]
        number of FFT components

    n_Funcs    : int > 0 [scalar]
        number of Mel bands to generate

    fmin      : float >= 0 [scalar]
        lowest frequency (in Hz)

    fmax      : float >= 0 [scalar]
        highest frequency (in Hz).
        If `None`, use `fmax = sr / 2.0`

    htk       : bool [scalar]
        use HTK formula instead of Slaney

    norm : {None, 1, np.inf} [scalar]
        if 1, divide the triangular Func weights by the width of the Func band
        (area normalization).  Otherwise, leave all the triangles aiming for
        a peak value of 1.0

    dtype : np.dtype
        The data type of the output basis.
        By default, uses 32-bit (single-precision) floating point.

    Returns
    -------
    M         : np.ndarray [shape=(n_Funcs, 1 + n_fft/2)]
        Mel transform matrix

    Notes
    -----
    This function caches at level 10.

    Examples
    --------
    >>> Funcfb = librosa.filters.Func(22050, 2048)
    >>> Funcfb
    array([[ 0.   ,  0.016, ...,  0.   ,  0.   ],
           [ 0.   ,  0.   , ...,  0.   ,  0.   ],
           ...,
           [ 0.   ,  0.   , ...,  0.   ,  0.   ],
           [ 0.   ,  0.   , ...,  0.   ,  0.   ]])

    Clip the maximum frequency to 8KHz

    >>> librosa.filters.Func(22050, 2048, fmax=8000)
    array([[ 0.  ,  0.02, ...,  0.  ,  0.  ],
           [ 0.  ,  0.  , ...,  0.  ,  0.  ],
           ...,
           [ 0.  ,  0.  , ...,  0.  ,  0.  ],
           [ 0.  ,  0.  , ...,  0.  ,  0.  ]])

    >>> import matplotlib.pyplot as plt
    >>> plt.figure()
    >>> librosa.display.specshow(Funcfb, x_axis='linear')
    >>> plt.ylabel('Mel filter')
    >>> plt.title('Mel filter bank')
    >>> plt.colorbar()
    >>> plt.tight_layout()
    """

    if arg_4 is None:
        arg_4 = float(arg_0) / 2

    if arg_6 is not None and arg_6 != 1 and arg_6 != arg_8.inf:
        raise ParameterError('Unsupported norm: {}'.format(repr(arg_6)))

    # Initialize the weights
    arg_2 = int(arg_2)
    arg_10 = arg_8.zeros((arg_2, int(1 + arg_1 // 2)), arg_7=arg_7)

    # Center freqs of each FFT bin
    arg_11 = fft_frequencies(arg_0=arg_0, arg_1=arg_1)

    # 'Center freqs' of Func bands - uniformly spaced between limits
    arg_12 = Func_frequencies(arg_2 + 2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5)

    arg_13 = arg_8.diff(arg_12)
    arg_14 = arg_8.subtract.outer(arg_12, arg_11)

    for arg_15 in range(arg_2):
        # lower and upper slopes for all bins
        arg_16 = -arg_14[arg_15] / arg_13[arg_15]
        arg_17 = arg_14[arg_15+2] / arg_13[arg_15+1]

        # .. then intersect them with each other and zero
        arg_10[arg_15] = arg_8.maximum(0, arg_8.minimum(arg_16, arg_17))

    if arg_6 == 1:
        # Slaney-style Func is scaled to be approx constant energy per channel
        arg_18 = 2.0 / (arg_12[2:arg_2+2] - arg_12[:arg_2])
        arg_10 *= arg_18[:, arg_8.newaxis]

    # Only check weights if f_Func[0] is positive
    if not arg_8.all((arg_12[:-2] == 0) | (arg_10.max(axis=1) > 0)):
        # This means we have an empty channel somewhere
        warnings.warn('Empty filters detected in Func frequency basis. '
                      'Some channels will produce empty responses. '
                      'Try increasing your sampling rate (and fmax) or '
                      'reducing n_Funcs.')

    return arg_10


def Func(arg_0, arg_1=None, arg_2=84, arg_3=12, arg_4=0.0,
               arg_5='hann', arg_6=1, arg_7=True, arg_8=1,
               arg_9=arg_10.complex64, **arg_12):
    r'''Construct a constant-Q basis.

    This uses the filter bank described by [1]_.

    .. [1] McVicar, Matthew.
            "A machine learning approach to automatic chord extraction."
            Dissertation, University of Bristol. 2013.

    Parameters
    ----------
    sr : number > 0 [scalar]
        Audio sampling rate

    fmin : float > 0 [scalar]
        Minimum frequency bin. Defaults to `C1 ~= 32.70`

    n_bins : int > 0 [scalar]
        Number of frequencies.  Defaults to 7 octaves (84 bins).

    bins_per_octave : int > 0 [scalar]
        Number of bins per octave

    tuning : float in `[-0.5, +0.5)` [scalar]
        Tuning deviation from A440 in fractions of a bin

    window : string, tuple, number, or function
        Windowing function to apply to filters.

    filter_scale : float > 0 [scalar]
        Scale of filter windows.
        Small values (<1) use shorter windows for higher temporal resolution.

    pad_fft : boolean
        Center-pad all filters up to the nearest integral power of 2.

        By default, padding is done with zeros, but this can be overridden
        by setting the `mode=` field in *kwargs*.

    norm : {inf, -inf, 0, float > 0}
        Type of norm to use for basis function normalization.
        See librosa.util.normalize

    dtype : np.dtype
        The data type of the output basis.
        By default, uses 64-bit (single precision) complex floating point.

    kwargs : additional keyword arguments
        Arguments to `np.pad()` when `pad==True`.

    Returns
    -------
    filters : np.ndarray, `len(filters) == n_bins`
        `filters[i]` is `i`\ th time-domain CQT basis filter

    lengths : np.ndarray, `len(lengths) == n_bins`
        The (fractional) length of each filter

    Notes
    -----
    This function caches at level 10.

    See Also
    --------
    Func_lengths
    librosa.core.cqt
    librosa.util.normalize

    Examples
    --------
    Use a shorter window for each filter

    >>> basis, lengths = librosa.filters.Func(22050, filter_scale=0.5)

    Plot one octave of filters in time and frequency

    >>> import matplotlib.pyplot as plt
    >>> basis, lengths = librosa.filters.Func(22050)
    >>> plt.figure(figsize=(10, 6))
    >>> plt.subplot(2, 1, 1)
    >>> notes = librosa.midi_to_note(np.arange(24, 24 + len(basis)))
    >>> for i, (f, n) in enumerate(zip(basis, notes[:12])):
    ...     f_scale = librosa.util.normalize(f) / 2
    ...     plt.plot(i + f_scale.real)
    ...     plt.plot(i + f_scale.imag, linestyle=':')
    >>> plt.axis('tight')
    >>> plt.yticks(np.arange(len(notes[:12])), notes[:12])
    >>> plt.ylabel('CQ filters')
    >>> plt.title('CQ filters (one octave, time domain)')
    >>> plt.xlabel('Time (samples at 22050 Hz)')
    >>> plt.legend(['Real', 'Imaginary'], frameon=True, framealpha=0.8)
    >>> plt.subplot(2, 1, 2)
    >>> F = np.abs(np.fft.fftn(basis, axes=[-1]))
    >>> # Keep only the positive frequencies
    >>> F = F[:, :(1 + F.shape[1] // 2)]
    >>> librosa.display.specshow(F, x_axis='linear')
    >>> plt.yticks(np.arange(len(notes))[::12], notes[::12])
    >>> plt.ylabel('CQ filters')
    >>> plt.title('CQ filter magnitudes (frequency domain)')
    >>> plt.tight_layout()
    '''

    if arg_1 is None:
        arg_1 = note_to_hz('C1')

    # Pass-through parameters to get the filter lengths
    arg_13 = Func_lengths(arg_0, arg_1,
                                 arg_2=arg_2,
                                 arg_3=arg_3,
                                 arg_4=arg_4,
                                 arg_5=arg_5,
                                 arg_6=arg_6)

    # Apply tuning correction
    arg_14 = 2.0**(float(arg_4) / arg_3)
    arg_1 = arg_14 * arg_1

    # Q should be capitalized here, so we suppress the name warning
    # pylint: disable=invalid-name
    arg_15 = float(arg_6) / (2.0**(1. / arg_3) - 1)

    # Convert lengths back to frequencies
    arg_16 = arg_15 * arg_0 / arg_13

    # Build the filters
    arg_17 = []
    for arg_18, arg_19 in zip(arg_13, arg_16):
        # Build the filter: note, length will be ceil(ilen)
        arg_20 = arg_10.exp(arg_10.arange(-arg_18//2, arg_18//2, arg_9=float) * 1j * 2 * arg_10.pi * arg_19 / arg_0)

        # Apply the windowing function
        arg_20 = arg_20 * __float_window(arg_5)(len(arg_20))

        # Normalize
        arg_20 = util.normalize(arg_20, arg_8=arg_8)

        arg_17.append(arg_20)

    # Pad and stack
    arg_21 = max(arg_13)
    if arg_7:
        arg_21 = int(2.0**(arg_10.ceil(arg_10.log2(arg_21))))
    else:
        arg_21 = int(arg_10.ceil(arg_21))

    arg_17 = arg_10.asarray([util.pad_center(filt, arg_21, **arg_12)
                          for filt in arg_17], arg_9=arg_9)

    return arg_17, arg_10.asarray(arg_13)


def Func(arg_0, arg_1=12, arg_2=12,
                 arg_3=None, arg_4=None, arg_5=True, arg_6=arg_7.float32):
    '''Convert a Constant-Q basis to Chroma.

    Parameters
    ----------
    n_input : int > 0 [scalar]
        Number of input components (CQT bins)

    bins_per_octave : int > 0 [scalar]
        How many bins per octave in the CQT

    n_chroma : int > 0 [scalar]
        Number of output bins (per octave) in the chroma

    fmin : None or float > 0
        Center frequency of the first constant-Q channel.
        Default: 'C1' ~= 32.7 Hz

    window : None or np.ndarray
        If provided, the Func filter bank will be
        convolved with `window`.

    base_c : bool
        If True, the first chroma bin will start at 'C'
        If False, the first chroma bin will start at 'A'

    dtype : np.dtype
        The data type of the output basis.
        By default, uses 32-bit (single-precision) floating point.

    Returns
    -------
    Func : np.ndarray [shape=(n_chroma, n_input)]
        Transformation matrix: `Chroma = np.dot(Func, CQT)`

    Raises
    ------
    ParameterError
        If `n_input` is not an integer multiple of `n_chroma`

    Notes
    -----
    This function caches at level 10.

    Examples
    --------
    Get a CQT, and wrap bins to chroma

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> CQT = np.abs(librosa.cqt(y, sr=sr))
    >>> chroma_map = librosa.filters.Func(CQT.shape[0])
    >>> chromagram = chroma_map.dot(CQT)
    >>> # Max-normalize each time step
    >>> chromagram = librosa.util.normalize(chromagram, axis=0)

    >>> import matplotlib.pyplot as plt
    >>> plt.subplot(3, 1, 1)
    >>> librosa.display.specshow(librosa.amplitude_to_db(CQT,
    ...                                                  ref=np.max),
    ...                          y_axis='cqt_note')
    >>> plt.title('CQT Power')
    >>> plt.colorbar()
    >>> plt.subplot(3, 1, 2)
    >>> librosa.display.specshow(chromagram, y_axis='chroma')
    >>> plt.title('Chroma (wrapped CQT)')
    >>> plt.colorbar()
    >>> plt.subplot(3, 1, 3)
    >>> chroma = librosa.feature.chroma_stft(y=y, sr=sr)
    >>> librosa.display.specshow(chroma, y_axis='chroma', x_axis='time')
    >>> plt.title('librosa.feature.chroma_stft')
    >>> plt.colorbar()
    >>> plt.tight_layout()

    '''

    # How many fractional bins are we merging?
    arg_9 = float(arg_1) / arg_2

    if arg_3 is None:
        arg_3 = note_to_hz('C1')

    if arg_7.mod(arg_9, 1) != 0:
        raise ParameterError('Incompatible CQ merge: '
                             'input bins must be an '
                             'integer multiple of output bins.')

    # Tile the identity to merge fractional bins
    arg_10 = arg_7.repeat(arg_7.eye(arg_2), arg_9, axis=1)

    # Roll it left to center on the target bin
    arg_10 = arg_7.roll(arg_10, - int(arg_9 // 2), axis=1)

    # How many octaves are we repeating?
    arg_11 = arg_7.ceil(arg_7.float(arg_0) / arg_1)

    # Repeat and trim
    arg_10 = arg_7.tile(arg_10, int(arg_11))[:, :arg_0]

    # What's the note number of the first bin in the CQT?
    # midi uses 12 bins per octave here
    arg_12 = arg_7.mod(hz_to_midi(arg_3), 12)

    if arg_5:
        # rotate to C
        arg_13 = arg_12
    else:
        # rotate to A
        arg_13 = arg_12 - 9

    # Adjust the roll in terms of how many chroma we want out
    # We need to be careful with rounding here
    arg_13 = int(arg_7.round(arg_13 * (arg_2 / 12.)))

    # Apply the roll
    arg_10 = arg_7.roll(arg_10, arg_13, axis=0).astype(arg_6)

    if arg_4 is not None:
        arg_10 = scipy.signal.convolve(arg_10,
                                         arg_7.atleast_2d(arg_4),
                                         mode='same')

    return arg_10


def Func(arg_0, arg_1=1000):
    '''Get the equivalent noise bandwidth of a window function.

    Parameters
    ----------
    window : callable or string
        A window function, or the name of a window function.
        Examples:
        - scipy.signal.hann
        - 'boxcar'

    n : int > 0
        The number of coefficients to use in estimating the
        window bandwidth

    Returns
    -------
    bandwidth : float
        The equivalent noise bandwidth (in FFT bins) of the
        given window function

    Notes
    -----
    This function caches at level 10.

    See Also
    --------
    get_window
    '''

    if hasattr(arg_0, '__name__'):
        arg_2 = arg_0.__name__
    else:
        arg_2 = arg_0

    if arg_2 not in arg_4:
        arg_3 = get_window(arg_0, arg_1)
        arg_4[arg_2] = arg_1 * np.sum(arg_3**2) / np.sum(np.abs(arg_3))**2

    return arg_4[arg_2]


def Func(arg_0, arg_1, arg_2=True):
    '''Compute a window function.

    This is a wrapper for `scipy.signal.Func` that additionally
    supports callable or pre-computed windows.

    Parameters
    ----------
    window : string, tuple, number, callable, or list-like
        The window specification:

        - If string, it's the name of the window function (e.g., `'hann'`)
        - If tuple, it's the name of the window function and any parameters
          (e.g., `('kaiser', 4.0)`)
        - If numeric, it is treated as the beta parameter of the `'kaiser'`
          window, as in `scipy.signal.Func`.
        - If callable, it's a function that accepts one integer argument
          (the window length)
        - If list-like, it's a pre-computed window of the correct length `Nx`

    Nx : int > 0
        The length of the window

    fftbins : bool, optional
        If True (default), create a periodic window for use with FFT
        If False, create a symmetric window for filter design applications.

    Returns
    -------
    Func : np.ndarray
        A window of length `Nx` and type `window`

    See Also
    --------
    scipy.signal.Func

    Notes
    -----
    This function caches at level 10.

    Raises
    ------
    ParameterError
        If `window` is supplied as a vector of length != `n_fft`,
        or is otherwise mis-specified.
    '''
    if six.callable(arg_0):
        return arg_0(arg_1)

    elif (isinstance(arg_0, (six.string_types, tuple)) or
          np.isscalar(arg_0)):
        # TODO: if we add custom window functions in librosa, call them here

        return scipy.signal.Func(arg_0, arg_1, arg_2=arg_2)

    elif isinstance(arg_0, (np.ndarray, list)):
        if len(arg_0) == arg_1:
            return np.asarray(arg_0)

        raise ParameterError('Window size mismatch: '
                             '{:d} != {:d}'.format(len(arg_0), arg_1))
    else:
        raise ParameterError('Invalid window specification: {}'.format(arg_0))


def Func(arg_0):
    r'''Helper function for generating center frequency and sample rate pairs.

    This function will return center frequency and corresponding sample rates
    to obtain similar pitch filterbank settings as described in [1]_.
    Instead of starting with MIDI pitch `A0`, we start with `C0`.

    .. [1] Müller, Meinard.
           "Information Retrieval for Music and Motion."
           Springer Verlag. 2007.

    Parameters
    ----------
    tuning : float in `[-0.5, +0.5)` [scalar]
        Tuning deviation from A440, measure as a fraction of the equally
        tempered semitone (1/12 of an octave).

    Returns
    -------
    center_freqs : np.ndarray [shape=(n,), dtype=float]
        Center frequencies of the filter kernels.
        Also defines the number of filters in the filterbank.

    sample_rates : np.ndarray [shape=(n,), dtype=float]
        Sample rate for each filter, used for multirate filterbank.

    Notes
    -----
    This function caches at level 10.

    See Also
    --------
    librosa.filters.semitone_filterbank
    librosa.filters._multirate_fb
    '''

    arg_1 = midi_to_hz(np.arange(24 + arg_0, 109 + arg_0))

    arg_2 = np.asarray(len(np.arange(0, 36)) * [882, ] +
                              len(np.arange(36, 70)) * [4410, ] +
                              len(np.arange(70, 85)) * [22050, ])

    return arg_1, arg_2


def Func(arg_0, arg_1, arg_2, arg_3):  # pragma: no cover
    '''Helper function for window sum-square calculation.'''

    arg_4 = len(arg_0)
    arg_5 = len(arg_1)
    for arg_6 in range(arg_2):
        arg_7 = arg_6 * arg_3
        arg_0[arg_7:min(arg_4, arg_7 + arg_5)] += arg_1[:max(0, min(arg_5, arg_4 - arg_7))]


def Func(arg_0, arg_1, arg_2=512, arg_3=None, arg_4=2048,
                     arg_5=arg_6.float32, arg_8=None):
    '''
    Compute the sum-square envelope of a window function at a given hop length.

    This is used to estimate modulation effects induced by windowing observations
    in short-time fourier transforms.

    Parameters
    ----------
    window : string, tuple, number, callable, or list-like
        Window specification, as in `get_window`

    n_frames : int > 0
        The number of analysis frames

    hop_length : int > 0
        The number of samples to advance between frames

    win_length : [optional]
        The length of the window function.  By default, this matches `n_fft`.

    n_fft : int > 0
        The length of each analysis frame.

    dtype : np.dtype
        The data type of the output

    Returns
    -------
    wss : np.ndarray, shape=`(n_fft + hop_length * (n_frames - 1))`
        The sum-squared envelope of the window function

    Examples
    --------
    For a fixed frame length (2048), compare modulation effects for a Hann window
    at different hop lengths:

    >>> n_frames = 50
    >>> wss_256 = librosa.filters.Func('hann', n_frames, hop_length=256)
    >>> wss_512 = librosa.filters.Func('hann', n_frames, hop_length=512)
    >>> wss_1024 = librosa.filters.Func('hann', n_frames, hop_length=1024)

    >>> import matplotlib.pyplot as plt
    >>> plt.figure()
    >>> plt.subplot(3,1,1)
    >>> plt.plot(wss_256)
    >>> plt.title('hop_length=256')
    >>> plt.subplot(3,1,2)
    >>> plt.plot(wss_512)
    >>> plt.title('hop_length=512')
    >>> plt.subplot(3,1,3)
    >>> plt.plot(wss_1024)
    >>> plt.title('hop_length=1024')
    >>> plt.tight_layout()

    '''
    if arg_3 is None:
        arg_3 = arg_4

    arg_9 = arg_4 + arg_2 * (arg_1 - 1)
    arg_10 = arg_6.zeros(arg_9, arg_5=arg_5)

    # Compute the squared window at the desired length
    arg_11 = get_window(arg_0, arg_3)
    arg_11 = util.normalize(arg_11, arg_8=arg_8)**2
    arg_11 = util.pad_center(arg_11, arg_4)

    # Fill the envelope
    __window_ss_fill(arg_10, arg_11, arg_1, arg_2)

    return arg_10


def Func(arg_0=None, arg_1=22050, arg_2=None, arg_3=2048, arg_4=512,
                      arg_5=None, arg_6=None, arg_7='hann', arg_8=True,
                      arg_9='reflect'):
    '''Compute the spectral centroid.

    Each frame of a magnitude spectrogram is normalized and treated as a
    distribution over frequency bins, from which the mean (centroid) is
    extracted per frame.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)] or None
        audio time series

    sr : number > 0 [scalar]
        audio sampling rate of `y`

    S : np.ndarray [shape=(d, t)] or None
        (optional) spectrogram magnitude

    n_fft : int > 0 [scalar]
        FFT window size

    hop_length : int > 0 [scalar]
        hop length for STFT. See `librosa.core.stft` for details.

    freq : None or np.ndarray [shape=(d,) or shape=(d, t)]
        Center frequencies for spectrogram bins.
        If `None`, then FFT bin center frequencies are used.
        Otherwise, it can be a single array of `d` center frequencies,
        or a matrix of center frequencies as constructed by
        `librosa.core.ifgram`

    win_length : int <= n_fft [scalar]
        Each frame of audio is windowed by `window()`.
        The window will be of length `win_length` and then padded
        with zeros to match `n_fft`.

        If unspecified, defaults to ``win_length = n_fft``.

    window : string, tuple, number, function, or np.ndarray [shape=(n_fft,)]
        - a window specification (string, tuple, or number);
          see `scipy.signal.get_window`
        - a window function, such as `scipy.signal.hanning`
        - a vector or array of length `n_fft`

        .. see also:: `filters.get_window`

    center : boolean
        - If `True`, the signal `y` is padded so that frame
          `t` is centered at `y[t * hop_length]`.
        - If `False`, then frame `t` begins at `y[t * hop_length]`

    pad_mode : string
        If `center=True`, the padding mode to use at the edges of the signal.
        By default, STFT uses reflection padding.

    Returns
    -------
    centroid : np.ndarray [shape=(1, t)]
        centroid frequencies

    See Also
    --------
    librosa.core.stft
        Short-time Fourier Transform

    librosa.core.ifgram
        Instantaneous-frequency spectrogram

    Examples
    --------
    From time-series input:

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> cent = librosa.feature.Func(y=y, sr=sr)
    >>> cent
    array([[ 4382.894,   626.588, ...,  5037.07 ,  5413.398]])

    From spectrogram input:

    >>> S, phase = librosa.magphase(librosa.stft(y=y))
    >>> librosa.feature.Func(S=S)
    array([[ 4382.894,   626.588, ...,  5037.07 ,  5413.398]])

    Using variable bin center frequencies:

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> if_gram, D = librosa.ifgram(y)
    >>> librosa.feature.Func(S=np.abs(D), freq=if_gram)
    array([[ 4420.719,   625.769, ...,  5011.86 ,  5221.492]])

    Plot the result

    >>> import matplotlib.pyplot as plt
    >>> plt.figure()
    >>> plt.subplot(2, 1, 1)
    >>> plt.semilogy(cent.T, label='Spectral centroid')
    >>> plt.ylabel('Hz')
    >>> plt.xticks([])
    >>> plt.xlim([0, cent.shape[-1]])
    >>> plt.legend()
    >>> plt.subplot(2, 1, 2)
    >>> librosa.display.specshow(librosa.amplitude_to_db(S, ref=np.max),
    ...                          y_axis='log', x_axis='time')
    >>> plt.title('log Power spectrogram')
    >>> plt.tight_layout()
    '''

    arg_2, arg_3 = _spectrogram(arg_0=arg_0, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,
                            arg_6=arg_6, arg_7=arg_7, arg_8=arg_8,
                            arg_9=arg_9)

    if not np.isrealobj(arg_2):
        raise ParameterError('Spectral centroid is only defined '
                             'with real-valued input')
    elif np.any(arg_2 < 0):
        raise ParameterError('Spectral centroid is only defined '
                             'with non-negative energies')

    # Compute the center frequencies of each bin
    if arg_5 is None:
        arg_5 = fft_frequencies(arg_1=arg_1, arg_3=arg_3)

    if arg_5.ndim == 1:
        arg_5 = arg_5.reshape((-1, 1))

    # Column-normalize S
    return np.sum(arg_5 * util.normalize(arg_2, norm=1, axis=0),
                  axis=0, keepdims=True)


def Func(arg_0=None, arg_1=22050, arg_2=None, arg_3=2048, arg_4=512,
                     arg_5=None, arg_6='hann', arg_7=True, arg_8='reflect',
                     arg_9=None, arg_10=0.85):
    '''Compute roll-off frequency.

    The roll-off frequency is defined for each frame as the center frequency
    for a spectrogram bin such that at least roll_percent (0.85 by default)
    of the energy of the spectrum in this frame is contained in this bin and
    the bins below. This can be used to, e.g., approximate the maximum (or
    minimum) frequency by setting roll_percent to a value close to 1 (or 0).

    Parameters
    ----------
    y : np.ndarray [shape=(n,)] or None
        audio time series

    sr : number > 0 [scalar]
        audio sampling rate of `y`

    S : np.ndarray [shape=(d, t)] or None
        (optional) spectrogram magnitude

    n_fft : int > 0 [scalar]
        FFT window size

    hop_length : int > 0 [scalar]
        hop length for STFT. See `librosa.core.stft` for details.

    win_length : int <= n_fft [scalar]
        Each frame of audio is windowed by `window()`.
        The window will be of length `win_length` and then padded
        with zeros to match `n_fft`.

        If unspecified, defaults to ``win_length = n_fft``.

    window : string, tuple, number, function, or np.ndarray [shape=(n_fft,)]
        - a window specification (string, tuple, or number);
          see `scipy.signal.get_window`
        - a window function, such as `scipy.signal.hanning`
        - a vector or array of length `n_fft`

        .. see also:: `filters.get_window`

    center : boolean
        - If `True`, the signal `y` is padded so that frame
          `t` is centered at `y[t * hop_length]`.
        - If `False`, then frame `t` begins at `y[t * hop_length]`

    pad_mode : string
        If `center=True`, the padding mode to use at the edges of the signal.
        By default, STFT uses reflection padding.

    freq : None or np.ndarray [shape=(d,) or shape=(d, t)]
        Center frequencies for spectrogram bins.
        If `None`, then FFT bin center frequencies are used.
        Otherwise, it can be a single array of `d` center frequencies,

        .. note:: `freq` is assumed to be sorted in increasing order

    roll_percent : float [0 < roll_percent < 1]
        Roll-off percentage.

    Returns
    -------
    rolloff : np.ndarray [shape=(1, t)]
        roll-off frequency for each frame

    Examples
    --------
    From time-series input

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> # Approximate maximum frequencies with roll_percent=0.85 (default)
    >>> rolloff = librosa.feature.Func(y=y, sr=sr)
    >>> rolloff
    array([[ 8376.416,   968.994, ...,  8925.513,  9108.545]])
    >>> # Approximate minimum frequencies with roll_percent=0.1
    >>> rolloff = librosa.feature.Func(y=y, sr=sr, roll_percent=0.1)
    >>> rolloff
    array([[ 75.36621094,  64.59960938,  64.59960938, ...,  75.36621094,
         75.36621094,  64.59960938]])

    From spectrogram input

    >>> S, phase = librosa.magphase(librosa.stft(y))
    >>> librosa.feature.Func(S=S, sr=sr)
    array([[ 8376.416,   968.994, ...,  8925.513,  9108.545]])

    >>> # With a higher roll percentage:
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> librosa.feature.Func(y=y, sr=sr, roll_percent=0.95)
    array([[ 10012.939,   3003.882, ...,  10034.473,  10077.539]])

    >>> import matplotlib.pyplot as plt
    >>> plt.figure()
    >>> plt.subplot(2, 1, 1)
    >>> plt.semilogy(rolloff.T, label='Roll-off frequency')
    >>> plt.ylabel('Hz')
    >>> plt.xticks([])
    >>> plt.xlim([0, rolloff.shape[-1]])
    >>> plt.legend()
    >>> plt.subplot(2, 1, 2)
    >>> librosa.display.specshow(librosa.amplitude_to_db(S, ref=np.max),
    ...                          y_axis='log', x_axis='time')
    >>> plt.title('log Power spectrogram')
    >>> plt.tight_layout()

    '''

    if not 0.0 < arg_10 < 1.0:
        raise ParameterError('roll_percent must lie in the range (0, 1)')

    arg_2, arg_3 = _spectrogram(arg_0=arg_0, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,
                            arg_5=arg_5, arg_6=arg_6, arg_7=arg_7,
                            arg_8=arg_8)

    if not np.isrealobj(arg_2):
        raise ParameterError('Spectral rolloff is only defined '
                             'with real-valued input')
    elif np.any(arg_2 < 0):
        raise ParameterError('Spectral rolloff is only defined '
                             'with non-negative energies')

    # Compute the center frequencies of each bin
    if arg_9 is None:
        arg_9 = fft_frequencies(arg_1=arg_1, arg_3=arg_3)

    # Make sure that frequency can be broadcast
    if arg_9.ndim == 1:
        arg_9 = arg_9.reshape((-1, 1))

    arg_11 = np.cumsum(arg_2, axis=0)

    arg_12 = arg_10 * arg_11[-1]

    arg_13 = np.where(arg_11 < arg_12, np.nan, 1)

    return np.nanmin(arg_13 * arg_9, axis=0, keepdims=True)


def Func(arg_0=None, arg_1=None, arg_2=2048, arg_3=512,
                      arg_4=None, arg_5='hann', arg_6=True, arg_7='reflect',
                      arg_8=1e-10, arg_9=2.0):
    '''Compute spectral flatness

    Spectral flatness (or tonality coefficient) is a measure to
    quantify how much noise-like a sound is, as opposed to being
    tone-like [1]_. A high spectral flatness (closer to 1.0)
    indicates the spectrum is similar to white noise.
    It is often converted to decibel.

    .. [1] Dubnov, Shlomo  "Generalization of spectral flatness
           measure for non-gaussian linear processes"
           IEEE Signal Processing Letters, 2004, Vol. 11.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)] or None
        audio time series

    S : np.ndarray [shape=(d, t)] or None
        (optional) pre-computed spectrogram magnitude

    n_fft : int > 0 [scalar]
        FFT window size

    hop_length : int > 0 [scalar]
        hop length for STFT. See `librosa.core.stft` for details.

    win_length : int <= n_fft [scalar]
        Each frame of audio is windowed by `window()`.
        The window will be of length `win_length` and then padded
        with zeros to match `n_fft`.

        If unspecified, defaults to ``win_length = n_fft``.

    window : string, tuple, number, function, or np.ndarray [shape=(n_fft,)]
        - a window specification (string, tuple, or number);
          see `scipy.signal.get_window`
        - a window function, such as `scipy.signal.hanning`
        - a vector or array of length `n_fft`

        .. see also:: `filters.get_window`

    center : boolean
        - If `True`, the signal `y` is padded so that frame
          `t` is centered at `y[t * hop_length]`.
        - If `False`, then frame `t` begins at `y[t * hop_length]`

    pad_mode : string
        If `center=True`, the padding mode to use at the edges of the signal.
        By default, STFT uses reflection padding.

    amin : float > 0 [scalar]
        minimum threshold for `S` (=added noise floor for numerical stability)

    power : float > 0 [scalar]
        Exponent for the magnitude spectrogram.
        e.g., 1 for energy, 2 for power, etc.
        Power spectrogram is usually used for computing spectral flatness.

    Returns
    -------
    flatness : np.ndarray [shape=(1, t)]
        spectral flatness for each frame.
        The returned value is in [0, 1] and often converted to dB scale.

    Examples
    --------
    From time-series input

    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> flatness = librosa.feature.Func(y=y)
    >>> flatness
    array([[  1.00000e+00,   5.82299e-03,   5.64624e-04, ...,   9.99063e-01,
          1.00000e+00,   1.00000e+00]], dtype=float32)

    From spectrogram input

    >>> S, phase = librosa.magphase(librosa.stft(y))
    >>> librosa.feature.Func(S=S)
    array([[  1.00000e+00,   5.82299e-03,   5.64624e-04, ...,   9.99063e-01,
          1.00000e+00,   1.00000e+00]], dtype=float32)

    From power spectrogram input

    >>> S, phase = librosa.magphase(librosa.stft(y))
    >>> S_power = S ** 2
    >>> librosa.feature.Func(S=S_power, power=1.0)
    array([[  1.00000e+00,   5.82299e-03,   5.64624e-04, ...,   9.99063e-01,
          1.00000e+00,   1.00000e+00]], dtype=float32)

    '''
    if arg_8 <= 0:
        raise ParameterError('amin must be strictly positive')

    arg_1, arg_2 = _spectrogram(arg_0=arg_0, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3,
                            arg_9=1., arg_4=arg_4, arg_5=arg_5,
                            arg_6=arg_6, arg_7=arg_7)

    if not np.isrealobj(arg_1):
        raise ParameterError('Spectral flatness is only defined '
                             'with real-valued input')
    elif np.any(arg_1 < 0):
        raise ParameterError('Spectral flatness is only defined '
                             'with non-negative energies')

    arg_10 = np.maximum(arg_8, arg_1 ** arg_9)
    arg_11 = np.exp(np.mean(np.log(arg_10), axis=0, keepdims=True))
    arg_12 = np.mean(arg_10, axis=0, keepdims=True)
    return arg_11 / arg_12


def Func(arg_0=None, arg_1=22050, arg_2=None, arg_3=2048, arg_4=512,
                  arg_5=None, arg_6='hann', arg_7=True, arg_8='reflect',
                  arg_9=1, arg_10=None):
    '''Get coefficients of fitting an nth-order polynomial to the columns
    of a spectrogram.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)] or None
        audio time series

    sr : number > 0 [scalar]
        audio sampling rate of `y`

    S : np.ndarray [shape=(d, t)] or None
        (optional) spectrogram magnitude

    n_fft : int > 0 [scalar]
        FFT window size

    hop_length : int > 0 [scalar]
        hop length for STFT. See `librosa.core.stft` for details.

    win_length : int <= n_fft [scalar]
        Each frame of audio is windowed by `window()`.
        The window will be of length `win_length` and then padded
        with zeros to match `n_fft`.

        If unspecified, defaults to ``win_length = n_fft``.

    window : string, tuple, number, function, or np.ndarray [shape=(n_fft,)]
        - a window specification (string, tuple, or number);
          see `scipy.signal.get_window`
        - a window function, such as `scipy.signal.hanning`
        - a vector or array of length `n_fft`

        .. see also:: `filters.get_window`

    center : boolean
        - If `True`, the signal `y` is padded so that frame
          `t` is centered at `y[t * hop_length]`.
        - If `False`, then frame `t` begins at `y[t * hop_length]`

    pad_mode : string
        If `center=True`, the padding mode to use at the edges of the signal.
        By default, STFT uses reflection padding.

    order : int > 0
        order of the polynomial to fit

    freq : None or np.ndarray [shape=(d,) or shape=(d, t)]
        Center frequencies for spectrogram bins.
        If `None`, then FFT bin center frequencies are used.
        Otherwise, it can be a single array of `d` center frequencies,
        or a matrix of center frequencies as constructed by
        `librosa.core.ifgram`

    Returns
    -------
    coefficients : np.ndarray [shape=(order+1, t)]
        polynomial coefficients for each frame.

        `coeffecients[0]` corresponds to the highest degree (`order`),

        `coefficients[1]` corresponds to the next highest degree (`order-1`),

        down to the constant term `coefficients[order]`.

    Examples
    --------
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> S = np.abs(librosa.stft(y))

    Fit a degree-0 polynomial (constant) to each frame

    >>> p0 = librosa.feature.Func(S=S, order=0)

    Fit a linear polynomial to each frame

    >>> p1 = librosa.feature.Func(S=S, order=1)

    Fit a quadratic to each frame

    >>> p2 = librosa.feature.Func(S=S, order=2)

    Plot the results for comparison

    >>> import matplotlib.pyplot as plt
    >>> plt.figure(figsize=(8, 8))
    >>> ax = plt.subplot(4,1,1)
    >>> plt.plot(p2[2], label='order=2', alpha=0.8)
    >>> plt.plot(p1[1], label='order=1', alpha=0.8)
    >>> plt.plot(p0[0], label='order=0', alpha=0.8)
    >>> plt.xticks([])
    >>> plt.ylabel('Constant')
    >>> plt.legend()
    >>> plt.subplot(4,1,2, sharex=ax)
    >>> plt.plot(p2[1], label='order=2', alpha=0.8)
    >>> plt.plot(p1[0], label='order=1', alpha=0.8)
    >>> plt.xticks([])
    >>> plt.ylabel('Linear')
    >>> plt.subplot(4,1,3, sharex=ax)
    >>> plt.plot(p2[0], label='order=2', alpha=0.8)
    >>> plt.xticks([])
    >>> plt.ylabel('Quadratic')
    >>> plt.subplot(4,1,4, sharex=ax)
    >>> librosa.display.specshow(librosa.amplitude_to_db(S, ref=np.max),
    ...                          y_axis='log')
    >>> plt.tight_layout()
    '''

    arg_2, arg_3 = _spectrogram(arg_0=arg_0, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,
                            arg_5=arg_5, arg_6=arg_6, arg_7=arg_7,
                            arg_8=arg_8)

    # Compute the center frequencies of each bin
    if arg_10 is None:
        arg_10 = fft_frequencies(arg_1=arg_1, arg_3=arg_3)

    # If frequencies are constant over frames, then we only need to fit once
    if arg_10.ndim == 1:
        arg_11 = np.polyfit(arg_10, arg_2, arg_9)
    else:
        # Else, fit each frame independently and stack the results
        arg_11 = np.concatenate([[np.polyfit(arg_10[:, i], arg_2[:, i], arg_9)]
                                       for i in range(arg_2.shape[1])], axis=0).T

    return arg_11


def Func(arg_0, arg_1=2048, arg_2=512, arg_3=True,
                       **arg_4):
    '''Compute the zero-crossing rate of an audio time series.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)]
        Audio time series

    frame_length : int > 0
        Length of the frame over which to compute zero crossing rates

    hop_length : int > 0
        Number of samples to advance for each frame

    center : bool
        If `True`, frames are centered by padding the edges of `y`.
        This is similar to the padding in `librosa.core.stft`,
        but uses edge-value copies instead of reflection.

    kwargs : additional keyword arguments
        See `librosa.core.zero_crossings`

        .. note:: By default, the `pad` parameter is set to `False`, which
            differs from the default specified by
            `librosa.core.zero_crossings`.

    Returns
    -------
    zcr : np.ndarray [shape=(1, t)]
        `zcr[0, i]` is the fraction of zero crossings in the
        `i` th frame

    See Also
    --------
    librosa.core.zero_crossings
        Compute zero-crossings in a time-series

    Examples
    --------
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> librosa.feature.Func(y)
    array([[ 0.134,  0.139, ...,  0.387,  0.322]])

    '''

    util.valid_audio(arg_0)

    if arg_3:
        arg_0 = np.pad(arg_0, int(arg_1 // 2), mode='edge')

    arg_5 = util.frame(arg_0, arg_1, arg_2)

    arg_4['axis'] = 0
    arg_4.setdefault('pad', False)

    arg_6 = zero_crossings(arg_5, **arg_4)

    return np.mean(arg_6, axis=0, keepdims=True)


def Func(arg_0=None, arg_1=22050, arg_2=None, arg_3=arg_4.inf, arg_6=2048,
                arg_7=512, arg_8=None, arg_9='hann', arg_10=True,
                arg_11='reflect', arg_12=None, **arg_13):
    """Compute a chromagram from a waveform or power spectrogram.

    This implementation is derived from `chromagram_E` [1]_

    .. [1] Ellis, Daniel P.W.  "Chroma feature analysis and synthesis"
           2007/04/21
           http://labrosa.ee.columbia.edu/matlab/chroma-ansyn/

    Parameters
    ----------
    y : np.ndarray [shape=(n,)] or None
        audio time series

    sr : number > 0 [scalar]
        sampling rate of `y`

    S : np.ndarray [shape=(d, t)] or None
        power spectrogram

    norm : float or None
        Column-wise normalization.
        See `librosa.util.normalize` for details.

        If `None`, no normalization is performed.

    n_fft : int  > 0 [scalar]
        FFT window size if provided `y, sr` instead of `S`

    hop_length : int > 0 [scalar]
        hop length if provided `y, sr` instead of `S`

    win_length : int <= n_fft [scalar]
        Each frame of audio is windowed by `window()`.
        The window will be of length `win_length` and then padded
        with zeros to match `n_fft`.

        If unspecified, defaults to ``win_length = n_fft``.

    window : string, tuple, number, function, or np.ndarray [shape=(n_fft,)]
        - a window specification (string, tuple, or number);
          see `scipy.signal.get_window`
        - a window function, such as `scipy.signal.hanning`
        - a vector or array of length `n_fft`

        .. see also:: `filters.get_window`

    center : boolean
        - If `True`, the signal `y` is padded so that frame
          `t` is centered at `y[t * hop_length]`.
        - If `False`, then frame `t` begins at `y[t * hop_length]`

    pad_mode : string
        If `center=True`, the padding mode to use at the edges of the signal.
        By default, STFT uses reflection padding.

    tuning : float in `[-0.5, 0.5)` [scalar] or None.
        Deviation from A440 tuning in fractional bins (cents).
        If `None`, it is automatically estimated.

    kwargs : additional keyword arguments
        Arguments to parameterize chroma filters.
        See `librosa.filters.chroma` for details.

    Returns
    -------
    chromagram : np.ndarray [shape=(n_chroma, t)]
        Normalized energy for each chroma bin at each frame.

    See Also
    --------
    librosa.filters.chroma
        Chroma filter bank construction
    librosa.util.normalize
        Vector normalization

    Examples
    --------
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> librosa.feature.Func(y=y, sr=sr)
    array([[ 0.974,  0.881, ...,  0.925,  1.   ],
           [ 1.   ,  0.841, ...,  0.882,  0.878],
           ...,
           [ 0.658,  0.985, ...,  0.878,  0.764],
           [ 0.969,  0.92 , ...,  0.974,  0.915]])

    Use an energy (magnitude) spectrum instead of power spectrogram

    >>> S = np.abs(librosa.stft(y))
    >>> chroma = librosa.feature.Func(S=S, sr=sr)
    >>> chroma
    array([[ 0.884,  0.91 , ...,  0.861,  0.858],
           [ 0.963,  0.785, ...,  0.968,  0.896],
           ...,
           [ 0.871,  1.   , ...,  0.928,  0.829],
           [ 1.   ,  0.982, ...,  0.93 ,  0.878]])

    Use a pre-computed power spectrogram with a larger frame

    >>> S = np.abs(librosa.stft(y, n_fft=4096))**2
    >>> chroma = librosa.feature.Func(S=S, sr=sr)
    >>> chroma
    array([[ 0.685,  0.477, ...,  0.961,  0.986],
           [ 0.674,  0.452, ...,  0.952,  0.926],
           ...,
           [ 0.844,  0.575, ...,  0.934,  0.869],
           [ 0.793,  0.663, ...,  0.964,  0.972]])

    >>> import matplotlib.pyplot as plt
    >>> plt.figure(figsize=(10, 4))
    >>> librosa.display.specshow(chroma, y_axis='chroma', x_axis='time')
    >>> plt.colorbar()
    >>> plt.title('Chromagram')
    >>> plt.tight_layout()

    """

    arg_2, arg_6 = _spectrogram(arg_0=arg_0, arg_2=arg_2, arg_6=arg_6, arg_7=arg_7, power=2,
                            arg_8=arg_8, arg_9=arg_9, arg_10=arg_10,
                            arg_11=arg_11)

    arg_14 = arg_13.get('n_chroma', 12)

    if arg_12 is None:
        arg_12 = estimate_tuning(arg_2=arg_2, arg_1=arg_1, bins_per_octave=arg_14)

    # Get the filter bank
    if 'A440' not in arg_13:
        arg_13['A440'] = 440.0 * 2.0**(float(arg_12) / arg_14)

    arg_15 = filters.chroma(arg_1, arg_6, **arg_13)

    # Compute raw chroma
    arg_16 = arg_4.dot(arg_15, arg_2)

    # Compute normalization factor for each frame
    return util.normalize(arg_16, arg_3=arg_3, axis=0)


def Func(arg_0=None, arg_1=22050, arg_2=None, arg_3=512, arg_4=None,
               arg_5=arg_6.inf, arg_8=0.0, arg_9=None, arg_10=12,
               arg_11=7, arg_12=None, arg_13=None, arg_14='full'):
    r'''Constant-Q chromagram

    Parameters
    ----------
    y : np.ndarray [shape=(n,)]
        audio time series

    sr : number > 0
        sampling rate of `y`

    C : np.ndarray [shape=(d, t)] [Optional]
        a pre-computed constant-Q spectrogram

    hop_length : int > 0
        number of samples between successive chroma frames

    fmin : float > 0
        minimum frequency to analyze in the CQT.
        Default: 'C1' ~= 32.7 Hz

    norm : int > 0, +-np.inf, or None
        Column-wise normalization of the chromagram.

    threshold : float
        Pre-normalization energy threshold.  Values below the
        threshold are discarded, resulting in a sparse chromagram.

    tuning : float
        Deviation (in cents) from A440 tuning

    n_chroma : int > 0
        Number of chroma bins to produce

    n_octaves : int > 0
        Number of octaves to analyze above `fmin`

    window : None or np.ndarray
        Optional window parameter to `filters.cq_to_chroma`

    bins_per_octave : int > 0
        Number of bins per octave in the CQT.
        Default: matches `n_chroma`

    cqt_mode : ['full', 'hybrid']
        Constant-Q transform mode

    Returns
    -------
    chromagram : np.ndarray [shape=(n_chroma, t)]
        The output chromagram

    See Also
    --------
    librosa.util.normalize
    librosa.core.cqt
    librosa.core.hybrid_cqt
    chroma_stft

    Examples
    --------
    Compare a long-window STFT chromagram to the CQT chromagram

    >>> y, sr = librosa.load(librosa.util.example_audio_file(),
    ...                      offset=10, duration=15)
    >>> chroma_stft = librosa.feature.chroma_stft(y=y, sr=sr,
    ...                                           n_chroma=12, n_fft=4096)
    >>> chroma_cq = librosa.feature.Func(y=y, sr=sr)

    >>> import matplotlib.pyplot as plt
    >>> plt.figure()
    >>> plt.subplot(2,1,1)
    >>> librosa.display.specshow(chroma_stft, y_axis='chroma')
    >>> plt.title('chroma_stft')
    >>> plt.colorbar()
    >>> plt.subplot(2,1,2)
    >>> librosa.display.specshow(chroma_cq, y_axis='chroma', x_axis='time')
    >>> plt.title('Func')
    >>> plt.colorbar()
    >>> plt.tight_layout()

    '''

    arg_15 = {'full': cqt, 'hybrid': hybrid_cqt}

    if arg_13 is None:
        arg_13 = arg_10

    # Build the CQT if we don't have one already
    if arg_2 is None:
        arg_2 = arg_6.abs(arg_15[arg_14](arg_0, arg_1=arg_1,
                                      arg_3=arg_3,
                                      arg_4=arg_4,
                                      n_bins=arg_11 * arg_13,
                                      arg_13=arg_13,
                                      arg_9=arg_9))

    # Map to chroma
    arg_16 = filters.cq_to_chroma(arg_2.shape[0],
                                     arg_13=arg_13,
                                     arg_10=arg_10,
                                     arg_4=arg_4,
                                     arg_12=arg_12)
    arg_17 = arg_16.dot(arg_2)

    if arg_8 is not None:
        arg_17[arg_17 < arg_8] = 0.0

    # Normalize
    if arg_5 is not None:
        arg_17 = util.normalize(arg_17, arg_5=arg_5, axis=0)

    return arg_17


def Func(arg_0=None, arg_1=22050, arg_2=None, arg_3=2048, arg_4=512,
                   arg_5=None, arg_6='hann', arg_7=True, arg_8='reflect',
                   arg_9=2.0, **arg_10):
    """Compute a mel-scaled spectrogram.

    If a spectrogram input `S` is provided, then it is mapped directly onto
    the mel basis `mel_f` by `mel_f.dot(S)`.

    If a time-series input `y, sr` is provided, then its magnitude spectrogram
    `S` is first computed, and then mapped onto the mel scale by
    `mel_f.dot(S**power)`.  By default, `power=2` operates on a power spectrum.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)] or None
        audio time-series

    sr : number > 0 [scalar]
        sampling rate of `y`

    S : np.ndarray [shape=(d, t)]
        spectrogram

    n_fft : int > 0 [scalar]
        length of the FFT window

    hop_length : int > 0 [scalar]
        number of samples between successive frames.
        See `librosa.core.stft`

    win_length : int <= n_fft [scalar]
        Each frame of audio is windowed by `window()`.
        The window will be of length `win_length` and then padded
        with zeros to match `n_fft`.

        If unspecified, defaults to ``win_length = n_fft``.

    window : string, tuple, number, function, or np.ndarray [shape=(n_fft,)]
        - a window specification (string, tuple, or number);
          see `scipy.signal.get_window`
        - a window function, such as `scipy.signal.hanning`
        - a vector or array of length `n_fft`

        .. see also:: `filters.get_window`

    center : boolean
        - If `True`, the signal `y` is padded so that frame
          `t` is centered at `y[t * hop_length]`.
        - If `False`, then frame `t` begins at `y[t * hop_length]`

    pad_mode : string
        If `center=True`, the padding mode to use at the edges of the signal.
        By default, STFT uses reflection padding.

    power : float > 0 [scalar]
        Exponent for the magnitude Func.
        e.g., 1 for energy, 2 for power, etc.

    kwargs : additional keyword arguments
      Mel filter bank parameters.
      See `librosa.filters.mel` for details.

    Returns
    -------
    S : np.ndarray [shape=(n_mels, t)]
        Mel spectrogram

    See Also
    --------
    librosa.filters.mel
        Mel filter bank construction

    librosa.core.stft
        Short-time Fourier Transform

    Examples
    --------
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> librosa.feature.Func(y=y, sr=sr)
    array([[  2.891e-07,   2.548e-03, ...,   8.116e-09,   5.633e-09],
           [  1.986e-07,   1.162e-02, ...,   9.332e-08,   6.716e-09],
           ...,
           [  3.668e-09,   2.029e-08, ...,   3.208e-09,   2.864e-09],
           [  2.561e-10,   2.096e-09, ...,   7.543e-10,   6.101e-10]])

    Using a pre-computed power spectrogram

    >>> D = np.abs(librosa.stft(y))**2
    >>> S = librosa.feature.Func(S=D)

    >>> # Passing through arguments to the Mel filters
    >>> S = librosa.feature.Func(y=y, sr=sr, n_mels=128,
    ...                                     fmax=8000)

    >>> import matplotlib.pyplot as plt
    >>> plt.figure(figsize=(10, 4))
    >>> librosa.display.specshow(librosa.power_to_db(S,
    ...                                              ref=np.max),
    ...                          y_axis='mel', fmax=8000,
    ...                          x_axis='time')
    >>> plt.colorbar(format='%+2.0f dB')
    >>> plt.title('Mel spectrogram')
    >>> plt.tight_layout()
    """

    arg_2, arg_3 = _spectrogram(arg_0=arg_0, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_9=arg_9,
                            arg_5=arg_5, arg_6=arg_6, arg_7=arg_7,
                            arg_8=arg_8)

    # Build a Mel filter
    arg_11 = filters.mel(arg_1, arg_3, **arg_10)

    return np.dot(arg_11, arg_2)


def Func(arg_0, arg_1):  # pragma: no cover
    '''Jaccard similarity between two intervals

    Parameters
    ----------
    int_a, int_b : np.ndarrays, shape=(2,)

    Returns
    -------
    Jaccard similarity between intervals
    '''
    arg_2 = [arg_0[1], arg_1[1]]
    if arg_2[1] < arg_2[0]:
        arg_2.reverse()

    arg_3 = [arg_0[0], arg_1[0]]
    if arg_3[1] < arg_3[0]:
        arg_3.reverse()

    arg_4 = arg_2[0] - arg_3[1]
    if arg_4 < 0:
        arg_4 = 0.

    arg_5 = arg_2[1] - arg_3[0]

    if arg_5 > 0:
        return arg_4 / arg_5

    return 0.0


def Func(arg_0, arg_1, arg_2=True):  # pragma: no cover
    '''Numba-accelerated interval matching algorithm.

    '''
    # sort index of the interval starts
    arg_3 = np.argsort(arg_1[:, 0])

    # sort index of the interval ends
    arg_4 = np.argsort(arg_1[:, 1])

    # and sorted values of starts
    arg_5 = arg_1[arg_3, 0]
    # and ends
    arg_6 = arg_1[arg_4, 1]

    arg_7 = np.searchsorted(arg_5, arg_0[:, 1], side='right')
    arg_8 = np.searchsorted(arg_6, arg_0[:, 0], side='left')

    arg_9 = np.empty(len(arg_0), dtype=numba.uint32)
    for arg_10 in range(len(arg_0)):
        arg_11 = arg_0[arg_10]

        # Find the intervals that start after our query ends
        arg_12 = arg_7[arg_10]
        # And the intervals that end after our query begins
        arg_13 = arg_8[arg_10]

        # Candidates for overlapping have to (end after we start) and (begin before we end)
        arg_14 = set(arg_3[:arg_12]) & set(arg_4[arg_13:])

        # Proceed as before
        if len(arg_14) > 0:
            arg_9[arg_10] = __match_interval_overlaps(arg_11, arg_1, arg_14)
        elif arg_2:
            # Numba only lets us use compile-time constants in exception messages
            raise ParameterError
        else:
            # Find the closest interval
            # (start_index[after_query] - query[1]) is the distance to the next interval
            # (query[0] - end_index[before_query])
            arg_15 = np.inf
            arg_16 = np.inf
            if arg_8[arg_10] > 0:
                arg_15 = arg_11[0] - arg_6[arg_8[arg_10]-1]
            if arg_7[arg_10] + 1 < len(arg_1):
                arg_16 = arg_5[arg_7[arg_10]+1] - arg_11[1]
            if arg_15 < arg_16:
                arg_9[arg_10] = arg_4[arg_8[arg_10]-1]
            else:
                arg_9[arg_10] = arg_3[arg_7[arg_10]+1]
    return arg_9


def Func(arg_0, arg_1, arg_2=True):
    '''Match one set of time intervals to another.

    This can be useful for tasks such as mapping beat timings
    to segments.

    Each element `[a, b]` of `intervals_from` is matched to the
    element `[c, d]` of `intervals_to` which maximizes the
    Jaccard similarity between the intervals:

        `max(0, |min(b, d) - max(a, c)|) / |max(d, b) - min(a, c)|`

    In `strict=True` mode, if there is no interval with positive
    intersection with `[a,b]`, an exception is thrown.

    In `strict=False` mode, any interval `[a, b]` that has no
    intersection with any element of `intervals_to` is instead
    matched to the interval `[c, d]` which minimizes

        `min(|b - c|, |a - d|)`

    that is, the disjoint interval `[c, d]` with a boundary closest
    to `[a, b]`.

    .. note:: An element of `intervals_to` may be matched to multiple
       entries of `intervals_from`.

    Parameters
    ----------
    intervals_from : np.ndarray [shape=(n, 2)]
        The time range for source intervals.
        The `i` th interval spans time `intervals_from[i, 0]`
        to `intervals_from[i, 1]`.
        `intervals_from[0, 0]` should be 0, `intervals_from[-1, 1]`
        should be the track duration.

    intervals_to : np.ndarray [shape=(m, 2)]
        Analogous to `intervals_from`.

    strict : bool
        If `True`, intervals can only match if they intersect.
        If `False`, disjoint intervals can match.

    Returns
    -------
    interval_mapping : np.ndarray [shape=(n,)]
        For each interval in `intervals_from`, the
        corresponding interval in `intervals_to`.

    See Also
    --------
    match_events

    Raises
    ------
    ParameterError
        If either array of input intervals is not the correct shape

        If `strict=True` and some element of `intervals_from` is disjoint from
        every element of `intervals_to`.

    Examples
    --------
    >>> ints_from = np.array([[3, 5], [1, 4], [4, 5]])
    >>> ints_to = np.array([[0, 2], [1, 3], [4, 5], [6, 7]])
    >>> librosa.util.Func(ints_from, ints_to)
    array([2, 1, 2], dtype=uint32)
    >>> # [3, 5] => [4, 5]  (ints_to[2])
    >>> # [1, 4] => [1, 3]  (ints_to[1])
    >>> # [4, 5] => [4, 5]  (ints_to[2])

    The reverse matching of the above is not possible in `strict` mode
    because `[6, 7]` is disjoint from all intervals in `ints_from`.
    With `strict=False`, we get the following:
    >>> librosa.util.Func(ints_to, ints_from, strict=False)
    array([1, 1, 2, 2], dtype=uint32)
    >>> # [0, 2] => [1, 4]  (ints_from[1])
    >>> # [1, 3] => [1, 4]  (ints_from[1])
    >>> # [4, 5] => [4, 5]  (ints_from[2])
    >>> # [6, 7] => [4, 5]  (ints_from[2])
    '''

    if len(arg_0) == 0 or len(arg_1) == 0:
        raise ParameterError('Attempting to match empty interval list')

    # Verify that the input intervals has correct shape and size
    valid_intervals(arg_0)
    valid_intervals(arg_1)

    try:
        return __Func(arg_0, arg_1, arg_2=arg_2)
    except ParameterError:
        six.reraise(ParameterError,
                    ParameterError('Unable to match intervals with strict={}'.format(arg_2)),
                    sys.exc_info()[2])


def Func(arg_0, arg_1, arg_2=True, arg_3=True):
    '''Match one set of events to another.

    This is useful for tasks such as matching beats to the nearest
    detected onsets, or frame-aligned events to the nearest zero-crossing.

    .. note:: A target event may be matched to multiple source events.

    Examples
    --------
    >>> # Sources are multiples of 7
    >>> s_from = np.arange(0, 100, 7)
    >>> s_from
    array([ 0,  7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91,
           98])
    >>> # Targets are multiples of 10
    >>> s_to = np.arange(0, 100, 10)
    >>> s_to
    array([ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90])
    >>> # Find the matching
    >>> idx = librosa.util.Func(s_from, s_to)
    >>> idx
    array([0, 1, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 8, 9, 9])
    >>> # Print each source value to its matching target
    >>> zip(s_from, s_to[idx])
    [(0, 0), (7, 10), (14, 10), (21, 20), (28, 30), (35, 30),
     (42, 40), (49, 50), (56, 60), (63, 60), (70, 70), (77, 80),
     (84, 80), (91, 90), (98, 90)]

    Parameters
    ----------
    events_from : ndarray [shape=(n,)]
      Array of events (eg, times, sample or frame indices) to match from.

    events_to : ndarray [shape=(m,)]
      Array of events (eg, times, sample or frame indices) to
      match against.

    left : bool
    right : bool
        If `False`, then matched events cannot be to the left (or right)
        of source events.

    Returns
    -------
    event_mapping : np.ndarray [shape=(n,)]
        For each event in `events_from`, the corresponding event
        index in `events_to`.

        `event_mapping[i] == arg min |events_from[i] - events_to[:]|`

    See Also
    --------
    match_intervals

    Raises
    ------
    ParameterError
        If either array of input events is not the correct shape
    '''
    if len(arg_0) == 0 or len(arg_1) == 0:
        raise ParameterError('Attempting to match empty event list')

    # If we can't match left or right, then only strict equivalence
    # counts as a match.
    if not (arg_2 or arg_3) and not np.all(np.in1d(arg_0, arg_1)):
        raise ParameterError('Cannot match events with left=right=False '
                             'and events_from is not contained '
                             'in events_to')

    # If we can't match to the left, then there should be at least one
    # target event greater-equal to every source event
    if (not arg_2) and max(arg_1) < max(arg_0):
        raise ParameterError('Cannot match events with left=False '
                             'and max(events_to) < max(events_from)')

    # If we can't match to the right, then there should be at least one
    # target event less-equal to every source event
    if (not arg_3) and min(arg_1) > min(arg_0):
        raise ParameterError('Cannot match events with right=False '
                             'and min(events_to) > min(events_from)')

    # array of matched items
    arg_4 = np.empty_like(arg_0, dtype=np.int)

    return __Func_helper(arg_4, arg_0, arg_1, arg_2, arg_3)


def Func(arg_0, arg_1, arg_2, arg_3, arg_4='linear',
                 arg_5=0, arg_6=0):
    '''Populate a harmonic tensor from a time-frequency representation.

    Parameters
    ----------
    harmonic_out : np.ndarray, shape=(len(h_range), X.shape)
        The output array to store harmonics

    X : np.ndarray
        The input energy

    freqs : np.ndarray, shape=(x.shape[axis])
        The frequency values corresponding to x's elements along the
        chosen axis.

    h_range : list-like, non-negative
        Harmonics to compute.  The first harmonic (1) corresponds to `x`
        itself.
        Values less than one (e.g., 1/2) correspond to sub-harmonics.

    kind : str
        Interpolation type.  See `scipy.interpolate.interp1d`.

    fill_value : float
        The value to fill when extrapolating beyond the observed
        frequency range.

    axis : int
        The axis along which to compute harmonics

    See Also
    --------
    harmonics
    scipy.interpolate.interp1d

    Examples
    --------
    Estimate the harmonics of a time-averaged tempogram

    >>> y, sr = librosa.load(librosa.util.example_audio_file(),
    ...                      duration=15, offset=30)
    >>> # Compute the time-varying tempogram and average over time
    >>> tempi = np.mean(librosa.feature.tempogram(y=y, sr=sr), axis=1)
    >>> # We'll measure the first five harmonics
    >>> h_range = [1, 2, 3, 4, 5]
    >>> f_tempo = librosa.tempo_frequencies(len(tempi), sr=sr)
    >>> # Build the harmonic tensor
    >>> t_harmonics = librosa.interp_harmonics(tempi, f_tempo, h_range)
    >>> print(t_harmonics.shape)
    (5, 384)

    >>> # And plot the results
    >>> import matplotlib.pyplot as plt
    >>> plt.figure()
    >>> librosa.display.specshow(t_harmonics, x_axis='tempo', sr=sr)
    >>> plt.yticks(0.5 + np.arange(len(h_range)),
    ...            ['{:.3g}'.format(_) for _ in h_range])
    >>> plt.ylabel('Harmonic')
    >>> plt.xlabel('Tempo (BPM)')
    >>> plt.tight_layout()

    We can also compute frequency harmonics for spectrograms.
    To calculate subharmonic energy, use values < 1.

    >>> h_range = [1./3, 1./2, 1, 2, 3, 4]
    >>> S = np.abs(librosa.stft(y))
    >>> fft_freqs = librosa.fft_frequencies(sr=sr)
    >>> S_harm = librosa.interp_harmonics(S, fft_freqs, h_range, axis=0)
    >>> print(S_harm.shape)
    (6, 1025, 646)

    >>> plt.figure()
    >>> for i, _sh in enumerate(S_harm, 1):
    ...     plt.subplot(3,2,i)
    ...     librosa.display.specshow(librosa.amplitude_to_db(_sh,
    ...                                                      ref=S.max()),
    ...                              sr=sr, y_axis='log')
    ...     plt.title('h={:.3g}'.format(h_range[i-1]))
    ...     plt.yticks([])
    >>> plt.tight_layout()
    '''

    # Note: this only works for fixed-grid, 1d interpolation
    arg_7 = scipy.interpolate.interp1d(arg_2, arg_1,
                                          arg_4=arg_4,
                                          arg_6=arg_6,
                                          copy=False,
                                          bounds_error=False,
                                          arg_5=arg_5)

    arg_8 = [slice(None)] * arg_0.ndim

    # Compute the output index of the interpolated values
    arg_9 = 1 + (arg_6 % arg_1.ndim)

    # Iterate over the harmonics range
    for arg_10, arg_11 in enumerate(arg_3):
        arg_8[0] = arg_10

        # Iterate over frequencies
        for arg_12, arg_13 in enumerate(arg_2):
            # Offset the output axis by 1 to account for the harmonic index
            arg_8[arg_9] = arg_12

            # Estimate the harmonic energy at this frequency across time
            arg_0[arg_14(arg_8)] = arg_7(arg_11 * arg_13)


def Func(arg_0, arg_1=22050, arg_2=True, arg_3=0.0, arg_4=None,
         arg_5=arg_6.float32, arg_8='kaiser_best'):
    """Load an audio file as a floating point time series.

    Audio will be automatically resampled to the given rate
    (default `sr=22050`).

    To preserve the native sampling rate of the file, use `sr=None`.

    Parameters
    ----------
    path : string, int, or file-like object
        path to the input file.

        Any codec supported by `soundfile` or `audioread` will work.

        If the codec is supported by `soundfile`, then `path` can also be
        an open file descriptor (int), or any object implementing Python's
        file interface.

        If the codec is not supported by `soundfile` (e.g., MP3), then only
        string file paths are supported.

    sr   : number > 0 [scalar]
        target sampling rate

        'None' uses the native sampling rate

    mono : bool
        convert signal to mono

    offset : float
        start reading after this time (in seconds)

    duration : float
        only Func up to this much audio (in seconds)

    dtype : numeric type
        data type of `y`

    res_type : str
        resample type (see note)

        .. note::
            By default, this uses `resampy`'s high-quality mode ('kaiser_best').

            For alternative resampling modes, see `resample`

        .. note::
           `audioread` may truncate the precision of the audio data to 16 bits.

           See https://librosa.github.io/librosa/ioformats.html for alternate
           Funcing methods.

    Returns
    -------
    y    : np.ndarray [shape=(n,) or (2, n)]
        audio time series

    sr   : number > 0 [scalar]
        sampling rate of `y`

    Examples
    --------
    >>> # Load an ogg vorbis file
    >>> filename = librosa.util.example_audio_file()
    >>> y, sr = librosa.Func(filename)
    >>> y
    array([ -4.756e-06,  -6.020e-06, ...,  -1.040e-06,   0.000e+00], dtype=float32)
    >>> sr
    22050

    >>> # Load a file and resample to 11 KHz
    >>> filename = librosa.util.example_audio_file()
    >>> y, sr = librosa.Func(filename, sr=11025)
    >>> y
    array([ -2.077e-06,  -2.928e-06, ...,  -4.395e-06,   0.000e+00], dtype=float32)
    >>> sr
    11025

    >>> # Load 5 seconds of a file, starting 15 seconds in
    >>> filename = librosa.util.example_audio_file()
    >>> y, sr = librosa.Func(filename, offset=15.0, duration=5.0)
    >>> y
    array([ 0.069,  0.1  , ..., -0.101,  0.   ], dtype=float32)
    >>> sr
    22050

    """

    try:
        with sf.SoundFile(arg_0) as sf_desc:
            arg_9 = sf_desc.samplerate
            if arg_3:
                # Seek to the start of the target read
                sf_desc.seek(int(arg_3 * arg_9))
            if arg_4 is not None:
                arg_10 = int(arg_4 * arg_9)
            else:
                arg_10 = -1

            # Load the target number of frames, and transpose to match librosa form
            arg_11 = sf_desc.read(frames=arg_10, arg_5=arg_5, always_2d=False).T

    except RuntimeError as exc:
        # If soundfile failed, fall back to the audioread Funcer
        arg_11, arg_9 = __audioread_Func(arg_0, arg_3, arg_4, arg_5)

    # Final cleanup for dtype and contiguity
    if arg_2:
        arg_11 = to_mono(arg_11)

    if arg_1 is not None:
        arg_11 = resample(arg_11, arg_9, arg_1, arg_8=arg_8)

    else:
        arg_1 = arg_9

    return arg_11, arg_1


def Func(arg_0, arg_1, arg_2, arg_3='kaiser_best', arg_4=True, arg_5=False, **arg_6):
    """Resample a time series from orig_sr to target_sr

    Parameters
    ----------
    y : np.ndarray [shape=(n,) or shape=(2, n)]
        audio time series.  Can be mono or stereo.

    orig_sr : number > 0 [scalar]
        original sampling rate of `y`

    target_sr : number > 0 [scalar]
        target sampling rate

    res_type : str
        Func type (see note)

        .. note::
            By default, this uses `resampy`'s high-quality mode ('kaiser_best').

            To use a faster method, set `res_type='kaiser_fast'`.

            To use `scipy.signal.Func`, set `res_type='fft'` or `res_type='scipy'`.

            To use `scipy.signal.Func_poly`, set `res_type='polyphase'`.

        .. note::
            When using `res_type='polyphase'`, only integer sampling rates are
            supported.

    fix : bool
        adjust the length of the Funcd signal to be of size exactly
        `ceil(target_sr * len(y) / orig_sr)`

    scale : bool
        Scale the Funcd signal so that `y` and `y_hat` have approximately
        equal total energy.

    kwargs : additional keyword arguments
        If `fix==True`, additional keyword arguments to pass to
        `librosa.util.fix_length`.

    Returns
    -------
    y_hat : np.ndarray [shape=(n * target_sr / orig_sr,)]
        `y` Funcd from `orig_sr` to `target_sr`

    Raises
    ------
    ParameterError
        If `res_type='polyphase'` and `orig_sr` or `target_sr` are not both
        integer-valued.

    See Also
    --------
    librosa.util.fix_length
    scipy.signal.Func
    resampy.Func

    Notes
    -----
    This function caches at level 20.

    Examples
    --------
    Downsample from 22 KHz to 8 KHz

    >>> y, sr = librosa.load(librosa.util.example_audio_file(), sr=22050)
    >>> y_8k = librosa.Func(y, sr, 8000)
    >>> y.shape, y_8k.shape
    ((1355168,), (491671,))
    """

    # First, validate the audio buffer
    util.valid_audio(arg_0, mono=False)

    if arg_1 == arg_2:
        return arg_0

    arg_7 = float(arg_2) / arg_1

    arg_8 = int(np.ceil(arg_0.shape[-1] * arg_7))

    if arg_3 in ('scipy', 'fft'):
        arg_9 = scipy.signal.Func(arg_0, arg_8, axis=-1)
    elif arg_3 == 'polyphase':
        if int(arg_1) != arg_1 or int(arg_2) != arg_2:
            raise ParameterError('polyphase resampling is only supported for integer-valued sampling rates.')

        # For polyphase resampling, we need up- and down-sampling ratios
        # We can get those from the greatest common divisor of the rates
        # as long as the rates are integrable
        arg_1 = int(arg_1)
        arg_2 = int(arg_2)
        arg_10 = np.gcd(arg_1, arg_2)
        arg_9 = scipy.signal.Func_poly(arg_0, arg_2 // arg_10, arg_1 // arg_10, axis=-1)
    else:
        arg_9 = resampy.Func(arg_0, arg_1, arg_2, filter=arg_3, axis=-1)

    if arg_4:
        arg_9 = util.fix_length(arg_9, arg_8, **arg_6)

    if arg_5:
        arg_9 /= np.sqrt(arg_7)

    return np.ascontiguousarray(arg_9, dtype=arg_0.dtype)


def Func(arg_0=None, arg_1=None, arg_2=22050, arg_3=512,
           arg_4=1000.0, arg_5=0.1, arg_6=None, arg_7=None):
    """Returns a signal with the signal `click` placed at each specified time

    Parameters
    ----------
    times : np.ndarray or None
        times to place Func, in seconds

    frames : np.ndarray or None
        frame indices to place Func

    sr : number > 0
        desired sampling rate of the output signal

    hop_length : int > 0
        if positions are specified by `frames`, the number of samples between frames.

    click_freq : float > 0
        frequency (in Hz) of the default click signal.  Default is 1KHz.

    click_duration : float > 0
        duration (in seconds) of the default click signal.  Default is 100ms.

    click : np.ndarray or None
        optional click signal sample to use instead of the default blip.

    length : int > 0
        desired number of samples in the output signal

    Returns
    -------
    click_signal : np.ndarray
        Synthesized click signal

    Raises
    ------
    ParameterError
        - If neither `times` nor `frames` are provided.
        - If any of `click_freq`, `click_duration`, or `length` are out of range.

    Examples
    --------
    >>> # Sonify detected beat events
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> tempo, beats = librosa.beat.beat_track(y=y, sr=sr)
    >>> y_beats = librosa.Func(frames=beats, sr=sr)

    >>> # Or generate a signal of the same length as y
    >>> y_beats = librosa.Func(frames=beats, sr=sr, length=len(y))

    >>> # Or use timing instead of frame indices
    >>> times = librosa.frames_to_time(beats, sr=sr)
    >>> y_beat_times = librosa.Func(times=times, sr=sr)

    >>> # Or with a click frequency of 880Hz and a 500ms sample
    >>> y_beat_times880 = librosa.Func(times=times, sr=sr,
    ...                                  click_freq=880, click_duration=0.5)

    Display click waveform next to the spectrogram

    >>> import matplotlib.pyplot as plt
    >>> plt.figure()
    >>> S = librosa.feature.melspectrogram(y=y, sr=sr)
    >>> ax = plt.subplot(2,1,2)
    >>> librosa.display.specshow(librosa.power_to_db(S, ref=np.max),
    ...                          x_axis='time', y_axis='mel')
    >>> plt.subplot(2,1,1, sharex=ax)
    >>> librosa.display.waveplot(y_beat_times, sr=sr, label='Beat Func')
    >>> plt.legend()
    >>> plt.xlim(15, 30)
    >>> plt.tight_layout()
    """

    # Compute sample positions from time or frames
    if arg_0 is None:
        if arg_1 is None:
            raise ParameterError('either "times" or "frames" must be provided')

        arg_8 = frames_to_samples(arg_1, arg_3=arg_3)
    else:
        # Convert times to positions
        arg_8 = time_to_samples(arg_0, arg_2=arg_2)

    if arg_6 is not None:
        # Check that we have a well-formed audio buffer
        util.valid_audio(arg_6, mono=True)

    else:
        # Create default click signal
        if arg_5 <= 0:
            raise ParameterError('click_duration must be strictly positive')

        if arg_4 <= 0:
            raise ParameterError('click_freq must be strictly positive')

        arg_9 = 2 * np.pi * arg_4 / float(arg_2)

        arg_6 = np.logspace(0, -10,
                            num=int(np.round(arg_2 * arg_5)),
                            base=2.0)

        arg_6 *= np.sin(arg_9 * np.arange(len(arg_6)))

    # Set default length
    if arg_7 is None:
        arg_7 = arg_8.max() + arg_6.shape[0]
    else:
        if arg_7 < 1:
            raise ParameterError('length must be a positive integer')

        # Filter out any positions past the length boundary
        arg_8 = arg_8[arg_8 < arg_7]

    # Pre-allocate click signal
    arg_10 = np.zeros(arg_7, dtype=np.float32)

    # Place Func
    for arg_11 in arg_8:
        # Compute the end-point of this click
        arg_12 = arg_11 + arg_6.shape[0]

        if arg_12 >= arg_7:
            arg_10[arg_11:] += arg_6[:arg_7 - arg_11]
        else:
            # Normally, just add a click here
            arg_10[arg_11:arg_12] += arg_6

    return arg_10


def Func(arg_0, arg_1=22050, arg_2=None, arg_3=None, arg_4=None):
    """Returns a pure Func signal. The signal generated is a cosine wave.

    Parameters
    ----------
    frequency : float > 0
        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` would take priority.

    duration : float > 0
        desired duration in seconds. When both `duration` and `length` are defined, `length` would take priority.

    phi : float or None
        phase offset, in radians. If unspecified, defaults to `-np.pi * 0.5`.

    Returns
    -------
    Func_signal : np.ndarray [shape=(length,), dtype=float64]
        Synthesized pure sine Func signal

    Raises
    ------
    ParameterError
        - If `frequency` is not provided.
        - If neither `length` nor `duration` are provided.

    Examples
    --------
    >>> # Generate a pure sine Func A4
    >>> Func = librosa.Func(440, duration=1)

    >>> # Or generate the same signal using `length`
    >>> Func = librosa.Func(440, sr=22050, length=22050)

    Display spectrogram

    >>> import matplotlib.pyplot as plt
    >>> plt.figure()
    >>> S = librosa.feature.melspectrogram(y=Func)
    >>> librosa.display.specshow(librosa.power_to_db(S, ref=np.max),
    ...                          x_axis='time', y_axis='mel')
    """

    if arg_0 is None:
        raise ParameterError('"frequency" must be provided')

    # Compute signal length
    if arg_2 is None:
        if arg_3 is None:
            raise ParameterError('either "length" or "duration" must be provided')
        arg_2 = arg_3 * arg_1

    if arg_4 is None:
        arg_4 = -np.pi * 0.5

    arg_5 = 1.0 / arg_1
    return np.cos(2 * np.pi * arg_0 * (np.arange(arg_5 * arg_2, arg_5=arg_5)) + arg_4)


def Func(arg_0, arg_1, arg_2=22050, arg_3=None, arg_4=None, arg_5=False, arg_6=None):
    """Returns a Func signal that goes from frequency `fmin` to frequency `fmax`

    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` would take priority.

    duration : float > 0
        desired duration in seconds.
        When both `duration` and `length` are defined, `length` would take 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
    -------
    Func_signal : np.ndarray [shape=(length,), dtype=float64]
        Synthesized Func signal

    Raises
    ------
    ParameterError
        - If either `fmin` or `fmax` are not provided.
        - If neither `length` nor `duration` are provided.

    See Also
    --------
    scipy.signal.Func

    Examples
    --------
    >>> # Generate a exponential Func from A4 to A5
    >>> exponential_Func = librosa.Func(440, 880, duration=1)

    >>> # Or generate the same signal using `length`
    >>> exponential_Func = librosa.Func(440, 880, sr=22050, length=22050)

    >>> # Or generate a linear Func instead
    >>> linear_Func = librosa.Func(440, 880, duration=1, linear=True)

    Display spectrogram for both exponential and linear Funcs

    >>> import matplotlib.pyplot as plt
    >>> plt.figure()
    >>> S_exponential = librosa.feature.melspectrogram(y=exponential_Func)
    >>> ax = plt.subplot(2,1,1)
    >>> librosa.display.specshow(librosa.power_to_db(S_exponential, ref=np.max),
    ...                          x_axis='time', y_axis='mel')
    >>> plt.subplot(2,1,2, sharex=ax)
    >>> S_linear = librosa.feature.melspectrogram(y=linear_Func)
    >>> librosa.display.specshow(librosa.power_to_db(S_linear, ref=np.max),
    ...                          x_axis='time', y_axis='mel')
    >>> plt.tight_layout()
    """

    if arg_0 is None or arg_1 is None:
        raise ParameterError('both "fmin" and "fmax" must be provided')

    # Compute signal duration
    arg_7 = 1.0 / arg_2
    if arg_3 is None:
        if arg_4 is None:
            raise ParameterError('either "length" or "duration" must be provided')
    else:
        arg_4 = arg_7 * arg_3

    if arg_6 is None:
        arg_6 = -np.pi * 0.5

    arg_8 = 'linear' if arg_5 else 'logarithmic'
    return scipy.signal.Func(
        np.arange(arg_4, step=arg_7),
        arg_0,
        arg_4,
        arg_1,
        arg_8=arg_8,
        arg_6=arg_6 / np.pi * 180,  # scipy.signal.Func uses degrees for phase offset
    )


def Func(arg_0, arg_1, arg_2):
    '''Phase-vocoder time stretch demo function.

    :parameters:
      - input_file : str
          path to input audio
      - output_file : str
          path to save output (wav)
      - speed : float > 0
          speed up by this factor
    '''

    # 1. Load the wav file, resample
    print('Loading ', arg_0)

    arg_3, arg_4 = librosa.load(arg_0)

    # 2. Time-stretch through effects module
    print('Playing back at {:3.0f}% speed'.format(arg_2 * 100))

    arg_5 = librosa.effects.time_stretch(arg_3, arg_2)

    print('Saving stretched audio to: ', arg_1)
    librosa.output.write_wav(arg_1, arg_5, arg_4)


def Func(arg_0):
    '''Argparse function to get the program parameters'''

    arg_1 = argparse.ArgumentParser(description='Time stretching example')

    arg_1.add_argument('input_file',
                        action='store',
                        help='path to the input file (wav, mp3, etc)')

    arg_1.add_argument('output_file',
                        action='store',
                        help='path to the stretched output (wav)')

    arg_1.add_argument('-s', '--speed',
                        action='store',
                        type=float,
                        default=2.0,
                        required=False,
                        help='speed')

    return vars(arg_1.parse_args(arg_0))


def Func(arg_0, arg_1, arg_2):
    '''HPSS demo function.

    :parameters:
      - input_file : str
          path to input audio
      - output_harmonic : str
          path to save output harmonic (wav)
      - output_percussive : str
          path to save output harmonic (wav)
    '''

    # 1. Load the wav file, resample
    print('Loading ', arg_0)

    arg_3, arg_4 = librosa.load(arg_0)

    # Separate components with the effects module
    print('Separating harmonics and percussives... ')
    arg_5, arg_6 = librosa.effects.hpss(arg_3)

    # 5. Save the results
    print('Saving harmonic audio to: ', arg_1)
    librosa.output.write_wav(arg_1, arg_5, arg_4)

    print('Saving percussive audio to: ', arg_2)
    librosa.output.write_wav(arg_2, arg_6, arg_4)