I had the same idea in mind and tried out a very simple but incomplete solution.
As fdreger's post pointed out, even professional software isn't actually able to perform this task correctly. (I tried some demo-versions of IntelliScore, AudioScore and some other software and none of these seemed to be particularly efficient when working with polyphonic music)
But if you want to try out on yourself, I used the source code found here : http://www.psychicorigami.com/2009/01/17/a-5k-java-guitar-tuner/
that helped me to find out how to determine the frequency. (FFT will be more accurate, but a bunch more complex).
To display the notes on screen, I used the abc4j library that can be found here :
http://code.google.com/p/abc4j/
But, as pointed out above, it works only with monophonic music (one single voice).
Good Luck!