The pitch of a signal is an extremely important descriptor for signals like speech or musical instruments. Modern machine learning techniques have consistently improved the reliability of this operation.
Recognize the pitch of a monophonic signal using PitchRecognize.
Use a neural network–based method.
You can also import and use the CREPE pitch recognition neural net from the Wolfram Neural Net Repository. A HiddenMarkovProcess can be used to interpret the output of the network into a sequence of frequency estimates and their confidence.
The network was trained to predict an estimate of the pitch as a probability distribution on a set of 360 logarithmic pitch classes. You can define a utility function to interpolate between the class predictions provided by the network as well as a function that outputs the recognized frequency and its confidence.
Recognize the pitch and compute the corresponding confidence.
Plot the recognized frequency with the confidence mapped to the color.