Skip to content

tandav/pitch-detectors

Repository files navigation

pitch-detectors

collection of pitch (f0, fundamental frequency) detection algorithms with unified interface

list of algorithms

algorithm cpu gpu MDBStemSynth accuracy Mir1K accuracy
Crepe 0.886 ± 0.059 0.759 ± 0.073
Penn 0.699 ± 0.263 0.660 ± 0.090
PipTrack 0.524 ± 0.286 0.864 ± 0.071
PraatAC 0.777 ± 0.302 0.859 ± 0.074
PraatCC 0.776 ± 0.300 0.872 ± 0.068
PraatSHS 0.534 ± 0.238 0.578 ± 0.169
Pyin 0.722 ± 0.252 0.888 ± 0.047
Rapt 0.791 ± 0.282 0.827 ± 0.078
Reaper 0.792 ± 0.261 0.795 ± 0.083
Spice 0.024 ± 0.034 0.889 ± 0.046
Swipe 0.784 ± 0.276 0.796 ± 0.062
TorchCrepe 0.764 ± 0.273 0.774 ± 0.084
TorchYin 0.735 ± 0.268 0.866 ± 0.052
World 0.869 ± 0.135 0.842 ± 0.075
Yaapt 0.740 ± 0.271 0.744 ± 0.107
Yin 0.749 ± 0.269 0.884 ± 0.043

accuracy is mean raw pitch accuracy

install

all agorithms tested on python3.10, this is recommended python version to use

pip install pitch-detectors

usage

from scipy.io import wavfile
from pitch_detectors import algorithms
import matplotlib.pyplot as plt

fs, a = wavfile.read('data/b1a5da49d564a7341e7e1327aa3f229a.wav')
pitch = algorithms.Crepe(a, fs)
plt.plot(pitch.t, pitch.f0)
plt.show()

Alt text

additional features

  • robust (vote + median) ensemble algorithm using all models
  • json import/export