@cache
def cqt(y, sr=22050, hop_length=512, fmin=None, n_bins=84,
        bins_per_octave=12, tuning=None, filter_scale=1,
        aggregate=None, norm=1, sparsity=0.01, real=True,
        resolution=util.Deprecated()):

    filter_scale = util.rename_kw('resolution', resolution,
                                  'filter_scale', filter_scale,
                                  '0.4.2', '0.5.0')

    if real:
        warn('Real-valued CQT (real=True) is deprecated in 0.4.2. '
             'Complex-valued CQT will become the default in 0.5.0. '
             'Consider using np.abs(librosa.cqt(..., real=False)) '
             'instead of real=True to maintain forward compatibility.',
             DeprecationWarning)

    # How many octaves are we dealing with?
    n_octaves = int(np.ceil(float(n_bins) / bins_per_octave))

    if fmin is None:
        # C1 by default
        fmin = note_to_hz('C1')

    if tuning is None:
        tuning = estimate_tuning(y=y, sr=sr)

    # First thing, get the freqs of the top octave
    freqs = cqt_frequencies(n_bins, fmin,
                            bins_per_octave=bins_per_octave)[-bins_per_octave:]

    fmin_t = np.min(freqs)
    fmax_t = np.max(freqs)

    # Determine required resampling quality
    Q = float(filter_scale) / (2.0**(1. / bins_per_octave) - 1)

    filter_cutoff = fmax_t * (1 + filters.window_bandwidth('hann') / Q)

    nyquist = sr / 2.0

    if filter_cutoff < audio.BW_FASTEST * nyquist:
        res_type = 'kaiser_fast'
    elif filter_cutoff < audio.BW_BEST * nyquist:
        res_type = 'kaiser_best'
    else:
        res_type = 'kaiser_best'

    cqt_resp = []

    len_orig = len(y)

    y, sr, hop_length = __early_downsample(y, sr, hop_length,
                                           res_type, n_octaves,
                                           nyquist, filter_cutoff)

    n_filters = min(bins_per_octave, n_bins)

    if res_type != 'kaiser_fast':

        # Do two octaves before resampling to allow for usage of sinc_fastest
        fft_basis, n_fft, filter_lengths = __fft_filters(sr, fmin_t,
                                                         n_filters,
                                                         bins_per_octave,
                                                         tuning,
                                                         filter_scale,
                                                         norm,
                                                         sparsity)
        min_filter_length = np.min(filter_lengths)

        # Compute a dynamic hop based on n_fft
        my_cqt = __variable_hop_response(y, n_fft,
                                         hop_length,
                                         min_filter_length,
                                         fft_basis,
                                         aggregate)

        # Convolve
        cqt_resp.append(my_cqt)

        fmin_t /= 2
        fmax_t /= 2
        n_octaves -= 1

        filter_cutoff = fmax_t * (1 + filters.window_bandwidth('hann') / Q)
        assert filter_cutoff < audio.BW_FASTEST*nyquist

        res_type = 'kaiser_fast'

    # Make sure our hop is long enough to support the bottom octave
    num_twos = __num_two_factors(hop_length)
    if num_twos < n_octaves - 1:
        raise ParameterError('hop_length must be a positive integer '
                             'multiple of 2^{0:d} for {1:d}-octave CQT'
                             .format(n_octaves - 1, n_octaves))

    # Now do the recursive bit
    fft_basis, n_fft, filter_lengths = __fft_filters(sr, fmin_t,
                                                     n_filters,
                                                     bins_per_octave,
                                                     tuning,
                                                     filter_scale,
                                                     norm,
                                                     sparsity)

    min_filter_length = np.min(filter_lengths)

    my_y, my_sr, my_hop = y, sr, hop_length

    # Iterate down the octaves
    for i in range(n_octaves):

        # Resample (except first time)
        if i > 0:
            if len(my_y) < 2:
                raise ParameterError('Input signal length={} is too short for '
                                     '{:d}-octave CQT'.format(len_orig, n_octaves))

            # The additional scaling of sqrt(2) here is to implicitly rescale the filters
            my_y = np.sqrt(2) * audio.resample(my_y, my_sr, my_sr/2.0,
                                               res_type=res_type,
                                               scale=True)
            my_sr /= 2.0
            assert my_hop % 2 == 0
            my_hop //= 2

        # Compute a dynamic hop based on n_fft
        my_cqt = __variable_hop_response(my_y, n_fft,
                                         my_hop,
                                         min_filter_length,
                                         fft_basis,
                                         aggregate)

        # Convolve
        cqt_resp.append(my_cqt)

    return __trim_stack(cqt_resp, n_bins, real)
>>> clone_name("120038881639")
dataset/ETHPy150Open bmcfee/librosa/librosa/core/constantq.py/cqt--crossover with--dataset/ETHPy150Open tanghaibao/jcvi/assembly/coverage.py/clone_name