Thanks for the correction, but the key signature in a piece may be changing. Also, those with perfect pitch can tell the key signature from a short passage if there are few accidentals.
[1] https://www.reddit.com/r/DJs/comments/hwlzyt/key_detection_c...