This makes sense, and explains why I love classical and despise most rap; one keeps things interesting with theme and variation, the other samples the same beats over and over:
The brain is designed to learn by association: if this, then that. Music works by subtly toying with our expected associations, enticing us to make predictions about what note will come next, and then confronting us with our prediction errors. In other words, every melody manipulates the same essential mechanisms we use to make sense of reality.
The second takeaway is that music requires surprise, the dissonance of “low-probability notes”. While most people think about music in terms of aesthetic beauty – we like pretty consonant pitches arranged in pretty patterns – that’s exactly backwards. The point of the prettiness is to set up the surprise, to frame the deviance.