Yes, this is what the FFT is all about! To give you the frequency spectrum of the data you feed. The hard part is the implementation details, as you have mentioned.
Depending on what you want to do, exactly, changes the answer.
If you just want to analyze your own music, there are already software out there to do that. You could look at EQ's that show the response(basically the FFT), or get a "musical EQ" that shows the pitches also. You can get audio to midi VST's that convert what you play in to the correct midi notes. If your keyboard is midi, just skip the VST's, and record the midi directly.
If you want to teach yourself the FFT and how it relates to music, then better to get something like Matlab where you can compute the FFT of any data. It has the ability to record and also playback along with reading wav files and such. These then to be reall easy to use. You can graph the audio and do all kinds of analysis rather quickly if you know the syntax.
If you want build a device to do such a thing then it's quite complex. You'll need a uC/dsp/fpga/etc to do the calculations. Most popular devices already come with FFT code so you won't have to code it yourself(also complicated).
You'll need to build the circuitry and all that. It is not difficult but depending on your experience/knowledge it could take quite some time and has a steep learning curve. It also depends on the quality of the final product.
Mathematically, an ideal musical note consists of a geometric series of the "fundamental".
Suppose F0 is the fundamental frequency, then most musical notes will be approximated by F(t) + F0*sum(a_ke^(2^kF0*piit)) = F0 + a_1*F1 + a_2*F2 + ....
The a_k's are just the strength of those higher frequencies F_k and F_k is just some multiple of F0. If a_k = 0 for all k, then we have a pure sinusoid. The pitch of this is easy to detect. Just find the maximum of the FFT and that frequency is the fundamental of the tone = the musical note.
When you take the FFT, you end up with data that, and just do math on. It's basically calculus.
All that is relatively easy.
Some problems you'll have to deal with. Note that not all of these are "solved".
Latency - If you are going to do any type of real time stuff, this can become a problem.
Multiple notes - It is difficult to determine the group of notes because of all the extra harmonics. If play A = 440hz and A' = 880hz, most of the harmonics will overlap. You can easily get the A = 440hz, but getting the A' = 880hz is more difficult. When you think of chords, fast runs, etc, then it can be very difficult to precisely get all the information(notes). While everything is generally mathematically possibly, the data itself has errors and aberrations, and the equations are under defined in some cases.
Noise - Noise in the signal can give you spurious results. If a musical noise occurs it can screw up your results. Better algorithms would then be required = time + money + knowledge.