Musical Pitch or Pitch is something like as "C C# D Eb ..." determined by the first peak of a sound in the frequency domain. Most of the time, the first peak is the highest one, so it is easy to recognize by just finding the maximum of the signal (max(abs(fft(signal)))). But in some instrument such as Violin, Cello, Kamancheh, etc the first peak is not always the highest one. Therefore, another method must be used. This phenomenon is one of the reasons for the hardship of playing violin (your ears cannot recognize the first peak very easily too).
Download all files or just zip file. Extract. In their directory:
to run, type in command window: pitch
(don't run the GUI file)
link in mathworks: https://www.mathworks.com/matlabcentral/fileexchange/47277-pitch-detection?s_tid=prof_contriblnk