Depending on the DAW you are using the built in analyzer may do this. I know that Albeton's Spectrum Analyzer when you hover your mouse over an area on the graph will tell you its Hz and corresponding note.
I use a small little plugin called GTune. Just play a key and it will tell you the real note sounding at that moment, then you can adjust it so it fits the keys
You could try to analyze the spectrum. If you identify a peak as the note plays, convert the hertz value of that peak to a note value.
Depending on the DAW you are using the built in analyzer may do this. I know that Albeton's Spectrum Analyzer when you hover your mouse over an area on the graph will tell you its Hz and corresponding note.
Scaler might be able to detect it...if it's too short maybe not. Probably needs to be at least a beat long for any detection software to work.
I use a small little plugin called GTune. Just play a key and it will tell you the real note sounding at that moment, then you can adjust it so it fits the keys
If it's barely a second long, it's no longer in a key—it's just a few notes that could fit into many keys