Determining notes reliably is quite a complex matter, and becomes many time more complicated if there is more than one note playing at a time (polyphony).
There is a “pitch detect” Nyquist plugin which is able to analyse the pitch of single notes reasonably accurately: http://wiki.audacityteam.org/wiki/Nyquist_Analyze_Plug-ins#Pitch_Detect
There is a bit of additional information about that plugin here: https://forum.audacityteam.org/t/pitch-detection-plug-in/29126/1
It is based on the “Yin” function in Nyquist http://www.cs.cmu.edu/~rbd/doc/nyquist/part8.html#index550
Nyquist is a scripting language built into Audacity - simple commands may be run directly from the Nyquist Prompt effect (http://manual.audacityteam.org/o/man/nyquist_prompt.html), or more complex things can be done by writing plugins (http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference).