A prefix tree-based user interface for exploring abstract structure in Irish folk tunes

by James McDermott

When writing a tune, when do composers repeat some material; when do they introduce a variation of previous material; and when do they introduce totally new material? To ask the same questions in a different way: what are the abstract syntactical structures in melodies?

11 August 2023

by James McDermott

When writing a tune, when do composers repeat some material; when do they introduce a variation of previous material; and when do they introduce totally new material? To ask the same questions in a different way: what are the abstract syntactical structures in melodies?

In 2020, composer, musicologist, and traditional Irish fiddle player Seán Doherty (Dublin City University) set out to answer these questions in the context of Irish traditional music. He used “the bible”, O’Neill’s The Dance Music of Ireland: 1001 Gems as his source.

Figure 1: O’Neill’s The Dance Music of Ireland: 1001 Gems (title page and extract from page 1, showing 4 tunes)

Doherty developed a simple system for analysing repetition and variation in these tunes, working at the bar level. We’ll explain it using the first tune, Shandon Bells, as an example.

In these tunes there are usually 2 or 3 main parts, of 8 bars each, usually repeated, possibly with alternate endings for each repeat. Shandon Bells has 2 parts, labelled A and B above.

In the repetition/variation annotation system, the first bar is labelled a as shown above. (These letters A and a are part labels and bar labels, not musical notes.) Then for each subsequent bar:

  • If it’s the same or almost the same as a previous bar, it gets the same label.
  • If it’s similar to a previous bar (50% or more, or a transposition), it’s labelled as a variation, eg a1, as in bar 3 above.
  • Otherwise, it gets the next sequential letter, eg bar 2 above is labelled b.
  • If a bar is similar to a bar in a previous part, the label is prefixed with the part name, eg bar 7 in part B is labelled Ad.

With this system, Doherty annotated all 1001 Gems. He found for example the following structures (focussing just on the A part in each case):

We observe that multiple tunes, even quite different ones, can share the same abstract syntactical structure (eg Johnny’s Wedding and Lough Allen, above). Doherty went on to analyse several different types of structure and their frequency in different tune types, eg jigs and reels.

At this point, Doherty contacted James McDermott (University of Galway), the leader of Polifonia Work Package 3 (on Mining Musical Patterns), and McDermott brought in Kieran Jayes, a student in University of Galway. As computer scientists, McDermott and Jayes were keen to introduce an appropriate data structure and user interface to explore the analyses produced by Doherty.

In collaboration, then, we began by observing that of course all structures start with a by definition, but more importantly there is a prefix structure: every pair of tunes shares some prefix, for example Shandon Bells and The Pipers’ Picnic share a, b before they diverge. This suggests the prefix tree or trie data structure. This is a tree where every node label is a prefix of the labels of its children. For example, in Figure 2, we see that node a has a child a, a1, and that child has a child labelled a, a1, a2. However, when we visualise all 1001 tunes in a prefix tree, it quickly becomes unwieldy (Figure 3).

Figure 2: an extract of the prefix tree, showing the root node a at the left-hand side.

Figure 3: the full prefix tree, with the root node a at the top, showing all 1001 Gems.

We decided to base the user interface on visualising and exploring that data structure in a more manageable way. Using Firebase, Node, Typescript, React, and D3, Jayes created an online user interface in which the user can expand and collapse levels of the tree, filter and search (Figure 4). The nodes in the final level of the tree are now labelled with tune names (Figure 5), which can be clicked to access a score and audio rendering (Figure 6).

Figure 4: the control bar allows the user to expand or collapse levels of the tree, and to filter and search.

Figure 5: the nodes in the final level are labelled with tune titles.

Figure 6: clicking a tune title leads to a score and audio rendering.

Exploring this user interface we find interesting results, such as structures which are unique across the corpus (eg Petticoat Loose is the only tune with structure a, b, a, c, a, d, e, c1,  see top of Figure 5) and others which are extremely common (eg there are 89 tunes with structure a, b, c, d, a, b, c, f).  

The user interface is available at: https://fyproject-98a82.firebaseapp.com/ and necessary data files are available at: https://gist.github.com/jmmcd/7fefb0fea2a4d00d74f6a3a8eaab81cf

This work was presented at the HCI International 2023 Workshop on Interactive Technologies for Analysing and Visualizing Musical Structure, Sunday 23 July 2023, Copenhagen, Denmark https://2023.hci.international/W1.html. The workshop organiser was David Meredith. The full programme is available at: http://www.titanmusic.com/events/hcii2023/workshop/accepted-papers/hcii2023workshopprogramme.html

Kieran Jayes, School of Computer Science, University of Galway

Seán Doherty, School of Theology, Philosophy, and Music, Dublin City University

James McDermott, School of Computer Science, University of Galway

Recent News

Polifonia recently released results of 40 months of research and development at the intersection of musicology, semantic web technologies, AI and Music Information Retrieval. And the Polifonia Web Portal, which enhances the discoverability of European musical heritage with Linked Open Data and Knowledge Graphs, can now be explored.

Polifonia recently released results of 40 months of research and development at the intersection of…

3 July 2024

With a strong base in academia, the Polifonia team looks forward to the conference season every year. One of the highlights is the Extended Semantic Web Conference. In this article, a brief review of our participation in this conference and update on our paper output.

With a strong base in academia, the Polifonia team looks forward to the conference season every year.…

26 June 2024

From the beginning of the project, Podiumkunst.net and Polifonia have been in close contact and looked to each other as role models. Our stakeholder Podiumkunst.net reflects on this synergy with a positive outlook. Remco de Boer and Monique in het Veld on the importance of the collaboration and the impact. 

From the beginning of the project, Podiumkunst.net and Polifonia have been in close contact and looked…

11 June 2024

TONALITIES, IReMus’ pilot for musical heritage data project Polifonia, develops tools for the modal-tonal identification, exploration and classification of monophonic and polyphonic notated music from the Renaissance to the twentieth century. Now, the tools are available for use within the TONALITIES Interface for music analysis. Additionally, a patent was recently acquired for this collaborative interface by the IReMus lab.

TONALITIES, IReMus' pilot for musical heritage data project Polifonia, develops tools for the modal-tonal…

29 May 2024

From April 8 to May 6 Polifonia organised their own version of the Eurovision Song Contest, the Polifonia Song Contest: musicians of all levels were challenged to create the ‘soundtrack of our history’ by using samples from the rich collections in the Polifonia project. Today we can announce the winning song.

From April 8 to May 6 Polifonia organised their own version of the Eurovision Song Contest, the Polifonia…

13 May 2024

After four years of development work, the Polifonia project team is excited to present the results. The consortium, consisting of 10 partners from Italy, the Netherlands, France, England and Ireland launches the music discoverability platform ‘Polifonia Web Portal’. In addition, the researchers and developers have also unlocked and linked other music data, developed tools and software that will help musicologists take steps forward in their research on European musical heritage.

After four years of development work, the Polifonia project team is excited to present the results.…

8 May 2024

The Polifonia project formally ended on April 30, which means that the tools and software developed within this 4-year-project are released and ready for use. Today we look at ‘Patterns UI’.

The Polifonia project formally ended on April 30, which means that the tools and software developed…

3 May 2024

Polifonia Song Contest is two weeks in, and will continue for another two weeks. Have you downloaded the sample pack yet?

With two weeks to go until the deadline, the "Polifonia Song Contest" beckons all musicians who find…

22 April 2024

Are you the type of musician that is inspired by old sounds, such as cheerful Irish folk melodies, the majestic resonance of pipe organ concerts, and the timeless chimes echoing from century-old Italian bell towers? Then ‘Polifonia Song Contest’ is your challenge!

Are you the type of musician that is inspired by old sounds, such as cheerful Irish folk melodies, the…

8 April 2024

The consortium is preparing for the last face-to-face consortium meeting of the Polifonia project in April 2024.

The consortium is preparing for the last face-to-face consortium meeting of the Polifonia project in…

4 April 2024

This project has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement N. 101004746