def estimate_tuning(input_file):

    print('Loading ', input_file)
    y, sr = librosa.load(input_file)

    print('Separating harmonic component ... ')
    y_harm = librosa.effects.harmonic(y)

    print('Estimating tuning ... ')
    # Just track the pitches associated with high magnitude
    tuning = librosa.estimate_tuning(y=y_harm, sr=sr)

    print('{:+0.2f} cents'.format(100 * tuning))
Load an audio file and estimate tuning (in cents)
dataset/ETHPy150Open bmcfee/librosa/examples/estimate_tuning.py/estimate_tuning