How to find sample key?

To do a bit of nitpicking here; sachin22s question is not ambiguous. Your answer contributes to the confusion though. The “Key” always refers to the chord progression of a piece of music (which, technically, can be a single chord or a whole symphony). The pitch of a single note is always referred to as “Pitch”.

Since sachin22 is asking for the “Key”, he’s asking for (b) not (a). Therefore, what he need is a polyphonic detection system. I believe that software versions are beginning to show up. But the most advanced polyphonic detection software still resides in the brain of a human musician.