Monophonic pitch estimation isn't too hard these days (see e.g. the YIN frequency estimator). Polyphonic pitch detection of even a single instrument is a hard problem. Real music, with multiple instruments, becomes a very challenging unsolved AI problem with current technology.