def pitch_tuning(frequencies, resolution=<NUM_LIT>, bins_per_octave=<NUM_LIT:12>):
frequencies = np.atleast_1d(frequencies)<EOL>frequencies = frequencies[frequencies > <NUM_LIT:0>]<EOL>if not np.any(frequencies):<EOL><INDENT>warnings.warn('<STR_LIT>')<EOL>return <NUM_LIT:0.0><EOL><DEDENT>residual = np.mod(bins_per_octave *<EOL>time_frequency.hz_to_octs(frequencies), <NUM_LIT:1.0>)<EOL>residual[residual >= <NUM_LIT:0.5>] -= <NUM_LIT:1.0><EOL>bins = np.linspace(-<NUM_LIT:0.5>, <NUM_LIT:0.5>, int(np.ceil(<NUM_LIT:1.> / resolution)) + <NUM_LIT:1>)<EOL>counts, tuning = np.histogram(residual, bins)<EOL>return tuning[np.argmax(counts)]<EOL>
Given a collection of pitches, estimate its tuning offset
    (in fractions of a bin) relative to A440=440.0Hz.

    Parameters
    ----------
    frequencies : array-like, float
        A collection of frequencies detected in the signal.
        See `piptrack`

    resolution : float in `(0, 1)`
        Resolution of the tuning as a fraction of a bin.
        0.01 corresponds to cents.

    bins_per_octave : int > 0 [scalar]
        How many frequency bins per octave

    Returns
    -------
    tuning: float in `[-0.5, 0.5)`
        estimated tuning deviation (fractions of a bin)

    See Also
    --------
    estimate_tuning
        Estimating tuning from time-series or spectrogram input

    Examples
    --------
    >>> # Generate notes at +25 cents
    >>> freqs = librosa.cqt_frequencies(24, 55, tuning=0.25)
    >>> librosa.pitch_tuning(freqs)
    0.25

    >>> # Track frequencies from a real spectrogram
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> pitches, magnitudes, stft = librosa.ifptrack(y, sr)
    >>> # Select out pitches with high energy
    >>> pitches = pitches[magnitudes > np.median(magnitudes)]
    >>> librosa.pitch_tuning(pitches)
    0.089999999999999969