Caution
You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.10.2.
librosa.pitch_tuning
- librosa.pitch_tuning(frequencies, resolution=0.01, bins_per_octave=12)[source]
Given a collection of pitches, estimate its tuning offset (in fractions of a bin) relative to A440=440.0Hz.
- Parameters:
- frequenciesarray-like, float
A collection of frequencies detected in the signal. See
piptrack
- resolutionfloat in (0, 1)
Resolution of the tuning as a fraction of a bin. 0.01 corresponds to cents.
- bins_per_octaveint > 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.ex('trumpet')) >>> freqs, times, mags = librosa.reassigned_spectrogram(y, sr, ... fill_nan=True) >>> # Select out pitches with high energy >>> freqs = freqs[mags > np.median(mags)] >>> librosa.pitch_tuning(freqs) -0.07