Data structures and code for analysing harmony and counterpoint