A Model of Melodic Expectation