Pattern theory provides a set of principles for constructing generative models of the information contained in natural signals, such as images or sound. Consequently, it also represents a useful language within which to develop generative systems of art. A pattern theory inspired framework and set of algorithms for interactive computer music composition are presented in the form of a self-organising hidden Markov model -a modular, graphical approach to the representation and spontaneous organisation of sound events in time and in parameter space. The result constitutes a system for composing stochastic music which incorporates creative and structural ideas such as uncertainty, variability, hierarchy and complexity, and which bears a strong relationship to realistic models of statistical physics or perceptual systems. The pattern theory approach to composition provides an elegant set of organisational principles for the production of sound by computer. Further, its machine learning underpinnings suggest many interesting applications to emergent tasks concerning the learning and creative modification of musical forms.