This article presents methodology that allows a computer to play the role o
f musical accompanist in a nonimprovised musical composition for soloist an
d accompaniment. The modeling of the accompaniment incorporates a number of
distinct knowledge sources including timing information extracted in real-
time from the soloist's acoustic signal, an understanding of the soloist's
interpretation learned from rehearsals, and prior knowledge that guides the
accompaniment toward musically plausible renditions. The solo and accompan
iment parts are represented collectively as a large number of Gaussian rand
om variables with a specified conditional independence structure-a Bayesian
belief network. Within this framework a principled and computationally fea
sible method for generating real-time accompaniment is presented that incor
porates the relevant knowledge sources. The EM algorithm is used to adapt t
he accompaniment to the soloist's interpretation through a series of rehear
sals. A demonstration is provided from J.S. Bach's Cantata 12.