The current implementation uses matched filtering at the piano frequencies to perform the extraction. We then compute the log of the absolute of the magnitude and trunctate the values. The music note frequencies are known so it is easy to filter for each note separately.
We also match filter at the first and second harmonic. Experience has shown that this information is very valuable in helping the user determing the presence of a note.
In order to perform the filtering efficiently, we use FFT to perform the convolution. Note that FFT is not used for the algorithm itself, but only as a tool. The problem with using the FFT is that the frequencies are linearly spaced, while the piano keyboard frequencies are spaced exponentially. In addition, the frequencies for the DFT are determined by the sampling rate, and the number of samples, we cannot select them, For this reason, matched filtering is more appropriate. I use the term matched filtering note since we are just matching with a sine wave of the note frequency.