A modular approach to music cognition