A Generalized Mechanism for Perception of Pitch Patterns