Computational analysis of fuguesMathieu Giraud, Richard Groult, Emmanuel Leguy, Florence Levé
A fugue is a polyphonic piece built in imitation, where all voices appear successively sharing the same initial melodic material: a subject and, in most cases, a counter-subject. These patterns are repeated throughout the piece, either in their initial form or more often altered or transposed, building a complex harmonic texture.
We present here a computational analysis of fugues, trying to automatically analyze their structure. The diagrams below show the results of our algorithms on two sets of fugues:
- the 24 fugues of the first book of Bach's Well-Tempered Clavier (WTC I), BWV 846-893, analyzed from .krn files from KernScores.
- the 12 first fugues from Shostakovich 24 Preludes and Fugues (op. 57, 1952), analyzed from .mid files from José Oscar de Almeida Marques
- Subject and counter-subject predictions 
All the output files are computed with a diatonic interval model and a threshold of (2 + 10%% length). See the full log for details on candidate subjects and counter-subjects. The end of the subject is exactly predicted in 16 of the 24 fugues (bad predictions: Mozart K.546, and Bach's WTC I fugues #5, #8, #9, #12, #19, #22, #23, #24). For Shostakovich fugues, starting from MIDI files, the pitch equivalence model is +/- 1 semitone. The end of the subject is exactly predicted in 13 of the 24 fugues (bad predictions or no predictions: fugues #2, #3, #4, #6, #7, #8, #11, #12, #13, #16, #21).
- Partial harmonic sequences in episodes 
The interval model is here QPI (quantized partially overlapping intervals) [Lemstrom and Laine 98]. Harmonic sequences in at least two voices are detected. See the full log for details on candidate episodes. In WTC fugues, good coverage of episodes with such sequences is obtained for fugues #2, #3, #7, #10, #18, #21.
On the diagrams for Bach and Shostakovich fugues, you can switch between a ground truth analysis and the output of our method. For Bach fugues, clicking on any analysis links to a page where S/CS patterns can be displayed with the VexFlow notation engine. For more information, and discussion on this method and its results, please see the bibliographical references.
The complete fugue pipeline (S/CS/CS2, cadences, pedals, structure), as well as the reference dataset, is described in the article . Principles for S/CS detection were described in , and detection of harmonic sequences in .
-  Mathieu Giraud, Richard Groult, Emmanuel Leguy, Florence Levé, Computational Fugue Analysis, Computer Music Journal, 39(2), 2015
-  Mathieu Giraud, Richard Groult, Florence Levé, Subject and counter-subject detection for analysis of the Well-Tempered Clavier fugues, Computer Music Modeling and Retrieval (CMMR 2012), 2012
-  Mathieu Giraud, Richard Groult, Florence Levé, Detecting episodes with harmonic sequences for fugue analysis, Int. Society for Music Information Retrieval Conf. (ISMIR 2012), 2012