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

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

Polifonia is known for its strong links with academia and is pleased to present some highlights in its involvement in research and associated conferences.

Polifonia is known for its strong links with academia and is pleased to present some highlights in its…

29 February 2024

In 2024, Paul Mulholland, Naomi Barker and Paul Warren (The Open University, U.K) are continuing their experiment investigating how different kinds of music influence the appreciation of an artwork; and to what extent the same kind of sense-making processes are used when viewing artwork and when listening to music. To do this, the researchers are looking for more participants. They have now automated the process so that participants can complete the experiment online without the involvement of an experimenter.

Music instrument with music notes on white background illustration In 2024, Paul Mulholland, Naomi…

17 January 2024

During the last project meeting, the Polifonia consortium extensively discussed how to foster the impact of the project in academia and beyond. How to make the output of Polifonia sustainable after the lifetime of the project is one important aspect. But fostering re-usability does not end by long-term preservation of certain assets (such as data and tools). In Polifonia Research Ecosystem – Impact of a project. A webinar on Data re-use and workflows, we will discuss how we ensure that more fluid assets such as interfaces, but also experiences in setting up and executing workflows via those interfaces, become reproducible and reuseable.

During the last project meeting, the Polifonia consortium extensively discussed how to foster the impact…

15 January 2024

For the Polifonia project, the Central Institute for Cataloging and Documentation (ICCD) of the Italian Ministry of Culture is carrying out activities on the historical bell heritage. The ICCD has also initiated a process of documentation of the practices and knowledge associated with bell production through collaboration with historical Italian foundries.

The bell casting process performed by the Pontifical Marinelli Foundry. Photo courtesy of ICC For…

9 January 2024

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