How it Works

Probabilistic harmonisation

In this work we wanted to see if a computer program could learn how to harmonise by itself. Rather than teaching it rules from a textbook, we gave it example harmonisations by Bach. The program looked for patterns in Bach's music, then used what it had learnt to compose its own harmonisations.

The program used a Hidden Markov Model to learn from the examples and to produce new harmonisations. A Hidden Markov Model divides sequences of events into two parts. Here, the tune is one part, and the additional lines of music are the other. The tune is 'visible', since we are always given it, but the additional lines of music are 'hidden'. When we compose a new harmonisation, we need to predict a new chord to go with each beat in the tune.

Hidden Markov Model diagram
Hidden Markov Model

The Hidden Markov Model learns patterns by looking at the probabilities of small parts of harmonisations in its examples. It learns how often each type of chord is written for each pitch in the tune, and how often the different types of chords follow each other. Once the Hidden Markov Model has learnt these probabilities, it is straightforward for it to work out what it thinks is the most likely harmonisation for a new chorale tune. It can also say how likely it thinks any harmonisation of the tune is.

State sequence diagram
Finding the most likely sequence under a Hidden Markov Model

We can listen to the program's harmonisations and say how good we think they are, but it is also useful to be able to give a precise score to how well it is doing. One way to do this is to ask the program how good it thinks Bach's own harmonisations are. If it thinks that these are very likely harmonisations, then its own harmonisations will be good. If it thinks Bach's harmonisations are very unlikely then it is doing less well.

Possible enhancements

There are many things we could take account in our probabilities beyond the notes of the chorale tunes and patterns of chords, such as the position in the bar, voices' typical pitch ranges, simpler or more complex styles of harmonisation, key signature, and the words of the chorales.


Back