Mixing music and mathematics

Wayne Muller

Illustration by Ronel van Heerden


Imagine attending a symphony concert, the sweeping sounds from the orchestra filling the hall while you feel the rhythm of the music resound within your body. You hear notes rising and falling in pitch, and becoming expressively louder and intimately softer. 


You hear the patterns in the music, the shaping of harmonies, and the intermingling of different melodic lines. At times, sudden changes in rhythm, pitch, and intensity surprise you. All these various elements interlock like small puzzle pieces to form a coherent piece of music.

Although we may listen to it daily, we seldom think of all the components that were combined to create our favourite piece of music. We don’t think about each musical note individually but rather hear and experience the bigger structure that constitutes the whole of these elements.

Simply put, this is what Gestalt theory is all about – the whole being greater than its parts. Individual notes say nothing about the musical creation as a whole. They only make sense when a variety of them are organised rhythmically on various pitches and at different intervals to construct a melody.

This idea of structure in music is what brought together two neighbours, composer Prof Hans Roosenschoon and mathematician Prof Zurab Janelidze, during the COVID-19 lockdown period in 2020. What started as casual neighbourly conversations later turned into increasingly serious philosophical dialogues over coffee about the intersections between music and mathematics.

Prof Hans Roosenchoon |  Picture by Stefan Els

Musical conversations

Roosenschoon, an emeritus professor at Stellenbosch University’s (SU’s) Department of Music, is an award-winning composer whose work has been appreciated across the globe. As a lecturer, he enjoys teaching new generations of composers. His own body of work spans a variety of genres: works for orchestra, choral works with orchestra, solo works with orchestra, chamber works, keyboard works, solo vocal works, choral works, and electro-acoustic music. Interestingly, as he explained in a colloquium talk hosted by the National Institute for Theoretical and Computational Sciences (NITheCS) in 2022, some of Roosenschoon’s music has mathematical patterns at its base.

As a professor of mathematics in SU’s Department of Mathematical Sciences, Janelidze’s field of expertise is that of categorical algebra (algebra seen from, and generalised via, the category theory). Since obtaining his PhD at the Tbilisi State University in Georgia in 2006, Janelidze has been steadily climbing the ranks at SU, eventually becoming a full professor in 2019. He currently serves as the president of the South African Mathematical Society. But his interests do not stop with mathematics. Janelidze is also an avid musician who plays piano and composes his own music.

It was conversations about their own compositions that led them to also talking about the touchpoints between music and mathematics. This sparked the beginnings of a project that would bring together their expertise in these two disciplines and explore how they intertwine.

Music has a mathematical structure, and the question of how the structure of music can be mathematically represented quickly became Roosenschoon and Janelidze’s major interest. This question is what led them to considering Gestalt theory as a means of representing the structure of a piece of music.

There is already much literature on aspects of music and mathematics such as symmetry, geometry, and equations. The concept of Gestalt structures in music was first explored in the early 1980s, when certain rules for the application of the theory were devised, but the concept of a universal Gestalt underlying all music was not yet explored.

Prof Zurab Janelidze |  Picture by Stefan Els

Find out more about Gestalt theory for musical form

In search of the universal

In their joint project, Roosenschoon and Janelidze conceptualised a musical phrase or idea as a large Gestalt that can be broken down into different smaller Gestalts organised in specific identifiable patterns.

The pair, together with their research assistants, took Roosenschoon’s piano solo piece “Kriek/Cricket” and transformed it into Gestalts using a string of numbers. Janelidze says this relates to the mathematical concept of trees, which represent a graph or structure that can be broken down into the smaller units.

After “Kriek/Cricket”, they turned to Beethoven’s popular “Für Elise” with its opening bars of repeated sections. Their focus was on reflecting this repetition in a Gestalt structure that shows the bigger musical idea broken down into repeated patterns. A song by the Beatles followed, and eventually even death metal music. This was all done in an attempt at finding a Gestalt that represents a universal structure in music. However, they found that there is no single universally applicable structure. “And that put us off,” Janelidze quips, “because if there isn’t a real unique and universal structure in music, then why are we doing this?”

Watch Liezl-Marét Jacobs perform "Kriek/Cricket"

"Kriek / Cricket"  is the first piece from Goggaboek, a set of five pieces composed by prof Hans Roosenschoon.

Individual interpretations

With “Für Elise”, they found there were also different interpretations of the Gestalt structure, depending on the listener’s experience. When the pair and their assistants asked each other to identify the piece’s Gestalts and its patterns, each individual came up with a unique but valid structure. Moreover, different musical forms already identified, such as the sonata, also didn’t conform to a uniform Gestalt structure.

“Music is a mystery,” says Roosenschoon, adding that Gestalts and other forms of codification do not explain the enigma of the human experience of music. There are many aspects of musical interpretation that are not codified and cannot be captured in notes written on paper. It is only in hearing a piece of music, for instance, that one can experience its texture (the effect of different layers of sound, created through the particular combination of tempo with melodic and harmonic elements). Also, the same note (say C) sounds very different at different pitches. None of what is codified in the notes on paper really explains our experiences of music, which are very personal. And although the musical text (or ‘score’) may remain the same, its interpretation can differ when the piece is played by different musicians or on different instruments.

Live experimentation

In July 2023, Janelidze and Roosenschoon did a presentation in the Department of Music’s Jannash Lecture Hall where they experimented with musicians’ interpretations of Gestalts. On a piece of paper, they drew a Gestalt structure that represented a musical idea and the patterns that make up the structure. Two music students and a musically gifted student in applied mathematics were then asked to look at the picture and interpret the structure by improvising on the piano and saxophone.

For audience members too it was an interesting exercise to participate in. During the lecture, Janelidze showed the structure drawn on paper to the audience first, and then only to the musician. This allowed time for the audience to imagine for themselves what type of music could be created with the given structure. When the pianist moved behind the piano and regarded the structure for the first time, he started an improvisation that was often quite different to what audience members had imagined. This indicates that, although a given piece of music necessarily has a set structure, there is much that can be improvised and interpreted within those boundaries, ultimately rendering each performance and interpretation thereof unique.

Subjectivity in analysing music

Roosenschoon explains that composing music is a life-long training process, and that seeing notes and hearing them are two very different things. A bar diagram cannot really explain this difference, he adds.

While the same Gestalt diagram can have different musical interpretations, as demonstrated in the lecture, the converse is also true: When listening to a piece of music and trying to draw a Gestalt representative of its structure, the result will depend on the listener’s interpretation and experience of the music. Hence, there is subjectivity in the process.

One must decide what the parts are and which priorities determine how you compartmentalise the patterns. Do you consider the beats to be the deciding factor in where a Gestalt starts or ends, or do pauses in the music indicate those beginnings and endings?

In music theory, there are already different ways to analyse music — different ways of looking at music on paper — such as the systems developed by Heinrich Schenker (Schenkerian analysis) and Allan Forte (atonal musical structure analysis). Still, what has been discovered through this experimentation around Gestalts in music can be useful in music training, says Roosenschoon.

Listening to music and then writing down the Gestalt structure can serve as a method for analysing music from an aural perspective rather than on grounds of the score. Roosenschoon reckons this creates an opportunity in music theory for a new approach to music analysis, as well as a means of developing young students’ aural skills. A study of the score can follow afterwards, allowing for comparisons to be made between the aural and score analyses. This method can even be used in schools as a fun way of building bridges between music and mathematics, thereby sparking an interest in both subjects.

To this end, in December 2023, the theatrical production Fundamano 2 at the Drostdy Theatre in Stellenbosch was dedicated to conveying the basic ideas of Gestalt structures to a wider audience, including school learners. This was done by means of an improvisatory play prepared by Janelidze, with the help of colleagues and students in mathematics and music.

Both professors believe the method of structuring music according to Gestalts holds future applications. They would like to employ it in analysing and creating structures for large works such as entire symphonies. Janelidze is particularly keen on exploring mathematical algorithms for generating, from music, a Gestalt hierarchy that takes into account the intuitive, subjective interpretations of Gestalts. Even for a seasoned composer such as Roosenschoon, the Gestalt method offers a means of better understanding the theory and practice of music in order to improve composition.

Recently, as a means to further test the sonic reach of the Gestalt method, Janelidze engaged with Dr Esther Marie Pauw and her team at SU’s Africa Open Institute for Music, Research and Innovation in free improvisation sessions. Here, musicians improvised the performance of a piece of music on grounds of a mathematical tree representing a Gestalt hierarchy.

In this video, a group of musicians improvise the performance of a piece of music on grounds of a mathematical tree representing a Gestalt hierarchy .

Janelidze and Roosenschoon plan to continue their collaboration in expanding the theory and applications of musical Gestalt theory under the auspices of the NITheCS. Their research team includes Bethany Robinson, both a musician and a master’s student in mathematics. In her studies, she hopes to unravel new links between mathematics and music through means of Gestalt theory.

Gerhard Woithe, a musician and a master’s student in theoretical physics, is another member of the research team who has contributed to the project thus far. He will continue his postgraduate studies in neuroscience at the Ludwig Maximilian University of Munich (LMU) in Germany.

The research initiatives reported on above are geared towards addressing the United Nations’ Sustainable Development Goals numbers 4, 9, and 17, and goal number 2 of the African Union’s Agenda 2063.