Skip to content

ASoleimaniB/Pitch-Detection

Repository files navigation

Musical Pitch Detection Matlab GUI

This is the matlab code I wrote for my Bachelor Thesis (Musical Pitch Detection). Previously, I uploaded it on mathworks website and now it is exactly on github.
 
 
 

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).

I applied an intelligent method to find musical pitches. I recorded some sounds from Violin, Ney and Kamancheh (two Iranian Music Instruments) . Then by sampling and dividing samples into regions with and without peaks, I trained a neural network to recognize peaks. After that I devised a plan to check Harmonics to find the first peak.
It seems that by this method, we can determine all other peaks and use in other applications.
Although, there are other methods but I think this is fast enough, easy and trainable!
Frequency domain of a sample of simple instrument like Ney
 
Frequency domain of a sample of non-simple instrument like Kamancheh
Samples with and without peak:
 
 

How To Run

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

Releases

No releases published

Packages

No packages published