Understanding the mechanisms of violated expectations in music elucidates some of the basic functions of learning, memory, and our perception of time. Along with enhancing our understanding of music, the study of how we process expectations, and learn to revel in ambiguity and uncertainty, is important in understanding how we appreciate many aspects of art and life that involve solving puzzles and deciphering codes, from poetry to painting, science to math.