I build application witch will be transform piano sound to musical notes. I found some pitch detection algorithms with implementations (mainly based on autocorrelation or fft), but chord recognition, of course is not working. What is best method for instrument as piano(both hands + chords)? Is there any implementation of this problem?

  • 2
    $\begingroup$ Apparently the Melodyne software has this implemented (they call it Direct Note Access). It seems to be quite a difficult problem to do and as far as I know, there is no "standard way" to do this. $\endgroup$ – jan Nov 2 '13 at 19:10
  • $\begingroup$ This method may work because piano strings show similar inharmonicity: lup.lub.lu.se/search/publication/… $\endgroup$ – igorinov Jul 10 '19 at 22:14

As @jan pointed out, you're probably asking for a little too much, especially if you're looking for a ready implementation. Doing a quick search on Google, I came across several papers that may be a helpful start.

In this paper called Multi-pitch Detection Algorithm Using Constrained Gaussian Mixture, the authors use the Expectation Maximization algorithm to solve a Gaussian Mixture Model to detect multiple tones. This is most likely not a very computationally efficient algorithm, since mixture models are normally very hard to solve, and have to be primarily done offline (no real-time version).

If you're looking for a moderately robust, but potentially fast algorithm, look at this Stack Overflow answer. The author recommends MUSIC and ESPRIT algorithms.

The best thing to do is to give something a try and come back to us with specific DSP and algorithms questions and sites like Stack Overflow for specific implementation questions.

  • 1
    $\begingroup$ Thanks for reply. I also found method described in Klapuri publications: Multiple fundamental frequency estimation by summing harmonic amplitudes and doctorl thesis: Signal processing methods for the automatic transcription of music, implemented in link. What do you think about it? $\endgroup$ – rbrisuda Nov 3 '13 at 0:02

Here is a bibliography including some recent research papers on possible solutions to polyphonic pitch detection/recognition/estimation problems: http://www.cs.tut.fi/~klap/iiro/

The ISMIR/MIREX conference also publishes many research papers on this topic.


monophonic pitch detection is hard enough. polyphonic is a whole dimension harder. dunno how Melodyne does it, but they're probably the top of the pile these days.

there aren't a lot of papers published on pitch detection, these days. back in the olden days it was about speech processing and there are a few algs for monophonic. then the issue became that of measuring the fundamental frequency $f_0$ (or the period, $\tau_0$) of a periodic or quasi-periodic signal. ultimately the algs that were any good were based on Average Magnitude Difference Function (AMDF) or autocorrelation. there's a relationship between the two (or at least between autocorrelation and the average magnitude-squared difference function). one has peaks exactly where the other has minimums.

i've never really fiddled with polyphonic pitch detection, because most of what i had worked on was meant to be used in real time. perhaps, if you can identify a note (perhaps the note with the most amplitude) out of the mix, you can use a comb filter to filter out that note and continue to identify the strongest note of the residual that is left. all this is predicated on the notion that all of the notes are harmonic or quasi-periodic. some tones, that humans perceive as having a pitch, are not harmonic. bells, for instance. in that case, i dunno how you would use a comb filter to isolate the note, since the harmonics might not line up with the teeth of the comb.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.