Melody Analyser (slow single line)

Matlab. I developed a melody analyser that detects frequencies with their attack time. It only works with slow passages in which the notes are separable from each other. I wrote its algorithms by taking reference the signal’s total power. Basically, it smooths the power graph, reshaping it by 1 and 0, and finds the attack times for each note. Then, it creates sample segments for each note for next FFT calculations. It does not work well with fast or close note melodies because the power tail of previous pitch carries to the next. It fails to calculate to correct attack time and related frequency.

For demonstration, I used a simple piano segment. It is a 5 notes single melody line. Its STFT parameter and threshold can be changed. It gives the output with attack times and frequencies. For this line;

  1. 0.05 sec , 165.73 Hz
  2. 0.85  sec , 201.59 Hz
  3. 1.03 sec , 177.69 Hz
  4. 1.55 sec , 138.96 Hz
  5. 2.08 sec , 262.65 Hz

[1] Mathematics of the Discrete Fourier Transform, Julius O. Smith III

[2] Pitch Frequency List, The University of Virginia

[3] Power Spectral Density, Matlab Documentation