A real time model of the formulation and realization of musical expectations