# ALGORITHMIC ANALYSIS AND HARMONIC DATABASE GENERATION FOR MUSICOLOGISTS

Anais Binet, Myriam Desainte-Catherine

► To cite this version:

Anais Binet, Myriam Desainte-Catherine. ALGORITHMIC ANALYSIS AND HARMONIC DATABASE GENERATION FOR MUSICOLOGISTS. 2024 Sound and Music Computing Conference (SMC 2024), School of Music and Performing Arts, Jul 2024, Porto, Portugal. hal-04904140

HAL Id: hal-04904140

https://hal.science/hal-04904140v1

Submitted on 21 Jan 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# ALGORITHMIC ANALYSIS AND HARMONIC DATABASE GENERATION FOR MUSICOLOGISTS

Anais BINET (anais.binet@labri.fr)¹ and

Myriam DESAINTE-CATHERINE (myriam.desainte-catherine@labri.fr)²

¹,²Univ. Bordeaux, CNRS, Bordeaux INP, LaBRI, UMR 5800, F-33400, Talence, France

## ABSTRACT

Harmony is an integral part of both the musicology and conservatory curricula. This article discusses some technical aspects of the "Learning Harmonizer" project aiming at developing a pedagogical tool for the hybrid teaching of this discipline. It can be used by teachers in class to help students complete exercises on their own, or to correct exercises on blackboards. In fact, in addition to a hybrid classroom, the tool will offer hybrid teaching with e-learning. Students will be able to do their homework with the help of the tool, which will help them complete all the exercises, even if they have difficulty. The teacher will also be able to monitor students' personal investment and performance in their work at home and in class. This will make it easier for the teacher to know which students are struggling, giving up or to identify notions not acquired by a majority. For this purpose, it is necessary to work on large corpora. But, analyzing and studying an entire corpus takes a lot of time and energy, which is why we have developed tools that do this automatically.

This article presents two modules of this projet, one to analyze many scores, and the other to extract the harmonic sequences used by the composers of the scores. The Music21 toolbox [1] is used to analyse the scores, and an oracle is built using the VMO library [2] to extract the harmonic sequences.

We analyze tones, modulations, chords and foreign notes. And we transcribe these analyses into Baroque and Anglo-Saxon notation. This tool can be used independently of the harmony teaching tool. Indeed, it could be used to teach musical analysis, another subject in the curriculum. In addition to their usefulness in the Learning Harmonizer project, they enable the automatic generation of databases of analyzed scores and chord sequences appropriate to the composer's writing style. These databases can be used by musicologists and other computer music researchers for their projects and teaching.

## 1. INTRODUCTION

Harmony is a combination of several elements that "go well together". In the field of music, and more specifically

in Western music theory, harmony is the art of studying the construction of chords. This is known as the study of the vertical dimension of music.

The use of computers is becoming increasingly common in the classroom, and offers a number of pedagogical advantages. In the Learning Harmonizer project, we propose tools for developing software architectures for the teaching of music writing in universities and conservatories [3]. In this article, we won't go into the socio-political issues surrounding our project.

By its interdisciplinary nature, this project will draw on work from a variety of fields, including musicology and computer science.

### 1.1 Motivation

The aim of the Learning Harmonizer project is to propose solutions to help teachers teach and students learn harmony.

The problems encountered by teachers that we deal with are:

* the difficulty of individually correcting all students' work

* knowing whether students understand the concepts

* tackling the entire program in a given timeframe

In fact, teachers are sometimes faced with large classes. In such conditions, they can only make very few individual corrections, which are costly in terms of class time. As a result, they are not always able to pinpoint concepts that students have failed to grasp, since a sample that is too small is not representative of what the class as a whole has learned.

The problems encountered by our students are as follows:

* Assessing one's own progress

* Identifying weaknesses and strengths

* Knowing whether the solution found could be correct even if it does not appear in the teacher's answer sheet

* Needing help with exercises outside the classroom

* Needing more independent practice

* Breaking away from rules when working on creative projects

Copyright: © 2024. This is an open-access article distributed under the terms of the Creative Commons Attribution 3.0 Unported License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
The question of individualized corrections also has a major impact on students. They are a good indicator of progress, and put their weaknesses as well as their strengths into perspective. What's more, in music as in many other subjects, there is no single solution to a given problem. In traditional teaching, if the teacher has not corrected each student's work individually, the student will have only the teacher's single correction to use for self-assessment. This method only allows them to analyze the differences between their work and the single correction available to them.

Another problem encountered by students is having to wait for the next lesson to get the correction when they have difficulty doing the exercise. This makes it much harder for students to memorize and understand concepts. Sometimes, a single intervention by the teacher would be enough to help the student. However, the teacher cannot provide individualized support for each student between lessons.

## 1.2 State of the art

Several tools for teaching music already exist. Some are aimed at teachers and students in music schools/conservatories for teaching music theory and even instrumental practice. Others are aimed more at people wishing to become music professionals.

There are many tools available for teaching and learning solfège, sometimes called musical training (FM). One of the pillars of musical training is ear training, from pitch and rhythm recognition to musical analysis. EarMaster [4], for example, is a tool for learning to recognize pitches and rhythms so as to be able to identify themes and works. But this tool doesn't stop there: it also offers reading, rhythmic and singing exercises. So you can practice the fundamentals of musical training on your own. A version of the software is available for music schools and conservatories, with a teacher interface. Teachers can then create their own exercises. Deepsolfège [5], Solfeggio [6] and Troubadour [7] are also available for learning music theory.

Other tools have also been designed for learning an instrument. Students sometimes need advice between lessons, and unfortunately have to wait until the next lesson for the teacher to unblock the situation. Digital Violin Tutor (DVT) [8] has been designed to address this problem. It is based on 3D visualization of the gesture using an avatar that reproduces the movements recorded on video, error tracking displayed on a piano roll and a 2D animation representing finger positions on the violin fingerboard. We can also mention other tools for learning the piano and guitar with Yousician [9] or the flute with the anthropomorphic robot WF-4 [10].

A number of these tools can be used independently. This can create a number of difficulties in the learning process. Students need to be organized and practice regularly without outside prompting. However, only a certain percentage of students will achieve this. What's more, students may become weary of difficulties that cannot be solved by the tool itself. The intervention of a teacher is often essential in the learning process. It is a guide on the path to acquiring knowledge and skills. A tool alone

cannot replace traditional teaching, but a tool can help teachers. This is what we call hybrid teaching.

## 1.3 A software for teaching harmony

In this section the pedagogical method of the project is detailed and a usage scenario of the tool in the classroom is proposed. At last, we introduce some technical modules needed to develop the generation process and that are considered later in this paper.

### 1.3.1 Pedagogy at the center of the project

The pedagogy at the centre of the project combines hybridation of the classroom, with a concept of guidance enabling students self-sufficiency, and the proposition of several solutions encouraging students' creativity.

#### 1.3.1.1 An hybrid classrooms

The aim of this project is to propose a pedagogical tool for harmony that fits in with the process of building hybrid classrooms and hybrid harmony teaching. Hybrid teaching is a form of training that combines face-to-face lessons with e-learning. A hybrid classroom is an environment where the teacher can alternate between traditional teaching and teaching using one or more IT tools (tablet, computer, etc.).

In this project, e-learning helps meet certain needs of the students, in particular self-sufficiency. Between lessons, they sometimes need guidance and hints to help them complete homework assignments. Whereas in traditional teaching, students have to wait for the teacher to correct their work on the blackboard before they can copy the correction, sometimes without really understanding it. E-learning allows them to get help when they express the need, to unblock a problem and enable them to complete the entire exercise.

As part of the e-learning program, students will also have access to a set of exercises selected by the teacher from a database, enabling them to train independently. Each student can therefore learn at his or her own pace, both individually and collectively. This is called differentiated teaching.

#### 1.3.1.2 Individualized correction

In conventional harmony teaching, where the teacher only corrects a small sample of exercises performed by the students, he or she does not have sufficient data to know whether the concepts are understood when the students do not express their misunderstandings or difficulties in class. To provide an answer to this problem, the tool will carry out an individualized correction of all exercises, then, in a second step, they can be transcribed into statistics and sent to the teacher interface in the form of diagrams. So, at a glance, the teacher will know which concepts need to be re-explained in class.

This feature should enable the teacher to save time during the lesson, while allowing not just a small group, but all students to benefit from individualized corrections. In particular, this will enable more active group correction in class. Students will have an individualized correction in front of them, enabling them to share their solution orally
with the whole class, and thus feed into the correction made on the board. This will encourage oral participation and help establish fairness and a climate of trust between all students. The teacher won't be correcting only on the basis of his or her own solutions, but can combine them with those of the students.

Thanks to this tool, all students can benefit from an individualized correction in which their errors are explained. This will enable them to see how they are progressing. What's more, the tool will enable them to observe more solutions and examples based on their own unique approach to harmony. This will also help to fuel their own creativity.

### 1.3.1.3 Guidance module

Depending on the settings made by the teacher, the tool will be able to correct the student's assignment step by step, enabling the student to avoid errors that could have repercussions on the rest of the exercise, sometimes making it completely wrong. Teachers can therefore choose whether to allow students to be guided step by step, on demand or not at all, depending on their own teaching choices. In all cases, the tool will not provide the student with the right answer, but it could, for example, suggest a list of solutions. This list could include false answers. In designing this feature, we'll be drawing inspiration from spell-checking software such as Antidote [11], which, unlike the spell-checkers in text-editing software, doesn't provide the answer, but invites the user to question him or herself to find the answer on their own, and thus learn from it. If they choose an incorrect answer, a message is displayed explaining why the answer is incorrect, i.e. which rules have been broken. Students who have given a wrong answer can then make another proposal.

Each time the student makes a mistake, the system increments a list in which each element corresponds to a notion. This then generates a diagram which is sent to the teacher for pedagogical follow-up once all the students have completed the exercise. After a certain number of unsuccessful attempts, the system completes with a correct answer, enabling the student to continue.

If the teacher does not choose step-by-step guidance and the system detects too many errors even before correcting the student's entire assignment, a message will be displayed inviting the student to ask for help via the integrated guidance module. Whether the teacher chooses to use step-by-step guidance or some other method, the system records the time spent by each student on the assignment and the progress made, enabling the teacher to analyze the data and detect any lack of work, and above all any demotivation of one or more students.

### 1.3.1.4 Encouraging creativity

A major advantage of this teaching method is to encourage students' creativity by presenting a greater number of examples inspired by the styles of the composers studied. Solutions that are considered false by harmony textbooks, but used by composers, can then be tackled. In this way, we hope to reverse the trend and allow the discipline to fuel students' creativity.

To bring this project to a successful conclusion, appropriate technical solutions has to be proposed. The analysis algorithm and rule extraction module presented in this article are two examples.

## 1.3.2 Usage scenario

In this subsection, we present a possible scenario for using the system in a university undergraduate class. Figure 1 shows the system's block diagram.

<figure><img src="image_2.png" /><figcaption>Figure 1. Usage scenario diagram</figcaption></figure>

First, the teacher fills in all the parameters in the dedicated interface. For example, the teacher chooses these parameters:

* Composer: J. S. BACH

* Notions to include: the chord of fifths and its two inversions

* Notions to exclude: dominant seventh, species seventh, ninth and their respective inversions with and without fundamental

* Step-by-step guidance

The software then suggests exercises that meet the teacher's criteria, taken from the catalog provided in the system. The teacher can then choose the one he or she wishes. The teacher then checks that all students are logged into the student interface and ready to do the exercise.

The students can then begin the exercise. A guidance module and a correction model will enable them to interact with the system. The guidance module, depending on the parameters chosen by the teacher, can suggest solutions to the student at each stage of the exercise, or when requested, or not at all. It's up to the teacher to choose between the three
guidance modes for each exercise.

The correction module can be set to different levels, allowing teachers to adapt it to each student, within the limits of their pedagogical choices. Thus, when set to maximum, it provides feedback on the student's work, even if it is entirely correct.

The teacher can make a global correction of the exercise on the blackboard, focusing on the notions revealed by the system as being the least understood. The teacher has the choice of working out the correction on his own, having the system generate one and explain it to him, or building it with the class. The teacher is free to apply the teaching method he or she considers most appropriate at any time.

### 1.3.3 Building the generation process

To meet these needs, and in the light of examples of the application of artificial intelligence to music generation, we have considered several technical options.

To enable teachers to select composers according to their pedagogical choices, we are planning to build a database that will group together a set of musical scores classified into corpora and labeled according to their composer, with each composer not belonging to the same stylistic trend.
We intend to use the Music XML format, which preserves the nature of the intervals, instead of the MIDI format to build our database. For example, if we consider the interval between the notes "C" and "E#", we have an augmented third. But if we consider the interval between the notes "C" and "F", we have a perfect fourth. The MIDI values of "E#" and "F" are identical.

Our system must be able to reproduce the way composers write from a corpus. We therefore plan to use a deep learning technique because this technique has already proved its worth in completing existing sequences using inpainting. This will meet the need for student guidance and correction. However, the system must be part of a pedagogical approach, and therefore be capable of explaining the generation obtained. The problem of explanation for neural networks is still in the research phase. For this task, we therefore plan to experiment with a coupling between a neural network and a rule-based system. The rule-based system should be able to analyze the generator's output to extract the rules used in the sequences or to detect errors. This module can also be used to correct student productions. Figure 2 shows the sequence of modules. Between the generator and the corrector is an analysis module, designed to harmonically label the sequence. This module will also be used to analyze students' work, making our system interactive.

We have chosen to base the generator on the DeepBach neural network created by Gaetan Hadjeres [12], which can take XML files as input. What led us to choose this particular network is its ability to perform inpainting, as opposed to other neural networks we have studied. As the program was developed as part of a thesis within the LIP6 Laboratory in the ASIM Department of the Université Pierre et Marie Curie, under an MIT license, it can be modified and reused. What's more, there's a plug-in to integrate it with the free, open-source score-editing software MuseScore.

<figure><img src="image_3.png" /><figcaption>Figure 2. Central module of the generation and correction process</figcaption></figure>

In contrast, the corrector takes the form of a factor oracle built with the Python module designed by WANG (Cheng-i) [2].

All the modules making up this architecture can be used independently for learning (e.g. the analysis module), but also for new IT projects, as they will all be open source.

## 2. ANALYSIS MODULE

In this section we present the harmonic analysis module we have developed. First, we'll explain its objectives and the choices we've made to achieve them. Then, we'll talk about the database we chose and used in the development and testing process. Next, we'll look at the module's internal architecture. Finally, we'll explain how we intend to scientifically validate our work.

### 2.1 Purpose of the analysis algorithm

The purpose of the analysis module is to analyze a score provided in MusicXML format in order to return several lists with the harmonic analysis of the piece. It will return the following lists: harmonic analysis in Anglo-Saxon notation, harmonic analysis in Baroque notation, chord degree analysis and tonality and modulation analysis. To do this, it will also calculate the value of the harmonic frequency. If the frequency is a quarter note, the lists will be made up of one element for each time step equal to a quarter note.

We first developed the analysis algorithm for two reasons: to build a database for the rule extractor algorithm and to analyze the scores/exercises written by the students to offer them an individualized correction. It will be used in several places in our architecture: to develop multiple modules, to
1 correct the students and to collect data in order to extract
2 statistics useful to the teacher in adapting his course to the
3 level of his class.

4 Doing such a job manually would be extremely time-
5 consuming, so we decided to automate it. Moreover, it
6 is desirable to be able to generate a database for several
7 composers, so as to offer more exercises that could be per-
8 formed. Adding new features will therefore be quicker and
9 easier, taking a longer-term view of the project.

## 2.2 Data used

11 To design the analysis tool, a corpus was needed to try out
12 and think about the functionalities to develop. As this tool
13 is part of a development of the "Learning Harmonizer", the
14 score corpus has also to be suitable for this one. In the 1st
15 years of teaching harmony, it's J. S. Bach's style of writing
16 and the type of work called Chorales that is often used.

17 The corpus consists of 339 J. S. Bach chorales for four-part
18 choir. As writing for choir and string quartet is not entirely
19 similar, we have chosen to select only a portion of the 413
20 chorales written by Bach during his lifetime. As four-part
21 choral formations are more often approached before instru-
22 mental formations, we have selected these.

23 We used the corpus available in the Music21 toolbox [13],
24 programmed in Python and comprising 363 chorales by
25 Johann Sebastian Bach. We have removed chorales for in-
26 strumental or vocal training that do not strictly contain four
27 voices. We therefore removed 12 chorales, leaving 339 to
28 form our data set.

29 Here are the chorales we removed from our data sam-
30 ple : bwv112.5-sc, bwv248.9-1, bwv248.23-2, bwv227.7,
31 bwv248.42-4, bwv251, bwv299, bwv315, bwv41.6,
32 bwv437, bwv8.6, cpebach.h186

33 His database is available online on GitHub [14].

## 2.3 Analysis algorithm design

35 There are different techniques for notating harmony in mu-
36 sic. There's Baroque notation, which uses Arabic numerals
37 for chords and Roman numerals for degrees, and Anglo-
38 Saxon notation, which is often used in jazz.

39 We have designed an analysis module that enables har-
40 monic analysis of XML score files. The algorithm is shown
41 in Figure 3 and is available on GitHub [15]. It will be used
42 to build the analyzed corpora that will be input to the rule
43 extraction module.

44 First, the musical data is extracted from a file in Music
45 XML format, i.e. the pitches and rhythms of the various
46 parts (voices). Then the data is normalized to obtain a list
47 of chords with a time step of a sixteenth note (a quarter
48 beat).

49 To analyze chords, the context in which they are played is
50 used. Two kinds of notes must be identified : the foreign
51 notes that are not part of the same harmony, and the real
52 notes that are part of the harmony, but are played before or
53 after the chord.

54 Once the foreign notes have been analyzed and replaced in
55 the table for each chord by the real notes, the system re-
56 duces the data set to the essential elements. We no longer
57 need to observe chords with a time step of a sixteenth note.

<figure><img src="image_4.png" /><figcaption>Figure 3. Analysis algorithm</figcaption></figure>

For example, we'll keep one chord in four if the harmonic
frequency is quarter-note, or one in two if the frequency is
eighth-note, and so on.

In order to give the Baroque cipher of a chord, the key in
which it is played is needed. Indeed, the degree of a chord
depends on the key, and may be a first degree in one key
and a fifth degree in another. In harmony, the sequence of
degrees is important and is the subject of numerous rules.
The system then creates a table showing the key in which
each chord is played.

Once the harmonic context is known, it's possible to start
analyzing the chords. The module begins by constructing
a table with the Anglo-Saxon cipher of all chords. Then, it
does the same with the Baroque cipher, but in two tables:
one for the cipher and one for the degrees.

Finally, this module returns all these lists: one for mod-
ulations, one for degrees, one for Baroque ciphering and
one with Anglo-Saxon ciphering. The last one is used as
oracle input. Here is an extract of the result, lists and file,
generated by the algorithm on the chorale BWV 2.6 in G
minor :

Below is a list of chords in MIDI notation for each time
step. In this example, a quarter note.

[[69, 66, 62, 50], [70, 67, 62, 55],
[69, 66, 60, 57], [67, 67, 62, 58],
[74, 70, 67, 57], [74, 69, 62, 54],
[70, 67, 62, 55], [69, 66, 62, 50],
[72, 68, 63, 48], ...]]

This second list represents the analysis of the song's
tonality at each time step. This makes it possible to visu-
alize modulations and is essential for degree analysis. For
example, in C Major a C chord is the I (1st) degree of the
scale, and in F Minor it's the V (5th) degree of the scale.

<music21.key.Key of g minor>, ...
<music21.key.Key of g minor>,
<music21.key.Key of g minor>,
<music21.key.Key of d minor>,
<music21.key.Key of d minor>,
<music21.key.Key of d minor>, ...
<music21.key.Key of g minor>, ...]
1

Finally, we have the analysis in Anglo-Saxon notation, with one element per time step. Here we have the first 3 bars of the chorale BWV 2.6 in G minor.

3

4 Hermonic analysis

5 ['D', 'Gm', 'F#dim/A', 'Gm/B-',

6 'Gm/A', 'D/F%', 'Gm', 'D',

7 'A-/C', ..., 'D']

8

This module generates also a MusicXML file with the annotations and opens it in Musescore. The annotated score is displayed on Figure 4. We’ve designed a plug-in that allows it to be used outside our global project.

9

10

11

<figure><img src="image_5.png" /><figcaption>Figure 4. Choral BWV 2.6 analysed by algorithm</figcaption></figure>

12

## 2.4 Algorithm validation

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

## 3. RULES EXTRACTION MODULE

38

39

40

41

42

To validate our algorithm, an automatic comparaison is performed with the analysis carried out by the American musicologist Christopher Czarnecki, published in the book J.S. Bach 413 Chorales: Analyzed [16], used as a reference. To do this, we’ve transcribed his analysis into a CSV file, more precisely the anlayse in Anglo-Saxon notation. It would be interesting to label various types of possible error to obtain detailed statistics.

We have already carried out a few manual comparisons on the BWV 1.6, BWV 2.6 and BWV 14.5 choruses, and the algorithm’s success rate is 90% on this limited sample. We have observed that the algorithm has difficulties with foreign notes and the exact location of modulations. It does not systematically produce errors in these two areas. Most of the time he can detect that there is a foreign note and find the one that actually belongs to the chord. And in the majority of cases, he can locate modulations to within a few beats.

Next, we’ll run an automatic test on a sample of one hundred chorales. We also hope to achieve a success rate of 90%. Based on these initial results, we will then try to improve the algorithm to obtain optimal results. In particular, we plan to improve the detection of foreign notes and modulation.

In this section we present the rule extraction module [17]. First, we’ll explain why we’ve chosen to use the oracle technique. Then, we’ll talk about the database we used to build and validate the oracle. Finally, we’ll look at how we validated the module.

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

## 3.1 Choice of technique: VMO

In a previous research project carried out by the first author [18], a manual rule extraction method has been proposed. On the basis of this work, and with a view to extending it to a larger database, ways of automating the process have been studied.

This previous work has led to the design of a mobile application, Learning Harmoniser [19], which harmonizes a melody note by note in the style of MOZART. In this mobile application, the analysis was based on sequences of two consecutive chords. However, certain rules of music writing require to take into account longer sequences. We therefore plan to distinguish harmonic sequences between short sequences (two chords) and long sequences (an example of which is the anatole, which is made up of four chords).

The method is based on identifying the harmonic sequences of two or more consecutive chords used by a composer or in a musical genre. The algorithm must therefore memorize the sequences already encountered, so as not to add them to the list again. And the final objective is to predict the next chord according to the note of the melody and the preceding chord or chords, as illustrated in Figure 5. This method being quite similar to what an oracle can do, we automated it using the Python module designed by WANG (Cheng-i) [2].

<figure><img src="image_6.png" /><figcaption>Figure 5. Oracle prediction illustration</figcaption></figure>

## 3.2 Preparation of database

To feed the oracle, we used the analysis of the J. S. Bach corpus performed with our analysis algorithm. As we have done in the past, we have extracted from our analysis essentially the chords in Anglo-Saxon notation and the melody sung at the same time as the chord. his database is available online on GitHub [20].

Tonality doesn’t influence harmonic rules, but modes do, we standardized the corpus, i.e. we transposed all the chorales to either C major or A minor. If we hadn’t done this, we’d have had to sort the chorales by key and would have obtained a much smaller number of rules for each separately. By normalizing the database, all we need to do when using the oracle is to transpose the rules obtained according to the tonality of the exercise.

70

71

72

73

74

75

76

77

78

79

80

81

82

83
## 3.3 Validation of the algorithm

To validate the algorithm, we used two sets of test data, one being positive, i.e. comprising only valid sequences, and the other one comprising valid or false sequences, but assumed to be mostly invalid. Let *P* be the positive set and *N* the other one. The two sets are built from the database, i.e. from the corpus of Bach chorales transposed to either C major or A minor. The set *P* is built by randomly selecting one million sequences of consecutive chords, and the set *N* by taking the same number of sequences of chords, with these chords each taken at random which must be either false or valid.

Concerning the positive sequences, the tests check that the oracle recognises all the elements in *P*. This test has been applied to one million sequences with a 100% success rate on sequences of varying size from two to ten.

Concerning the set *N*, we assume that the rate of false sequences is higher than the rate of valid sequences. Tests on selecting one million sequences give a rate of 91,4% false sequences for sequences of length two, which corresponds to our expectations. In other words, the oracle recognizes 8,6% of the elements in *N*. The same test was performed using longer sequences. The set size is always one million sequences. Let *L* denote the length of the sequences. For *L* = 3, we obtain a rate of 99.994% of false sequences, which corresponds to our expectations. With *L* = 10, we obtain 100% success for positive sequences and other sequences. The longer the sequences, the higher the percentage of success for both tests as shown in the table 1. All these tests can be performed by the readers using the rule extraction module [17].

<table><caption>Table 1. Percentage of algorithm success depending of sequences length.</caption><thead><tr><th rowspan="2">Length L</th><th colspan="2">Positive P</th><th colspan="2">Other sequences N</th></tr><tr><th>True</th><th>False</th><th>False</th><th>True</th></tr></thead><tbody><tr><td>2 chords</td><td>100%</td><td>0%</td><td>91,4%</td><td>8,6%</td></tr><tr><td>3 chords</td><td>100%</td><td>0%</td><td>99,7%</td><td>0,3%</td></tr><tr><td>4 chords</td><td>100%</td><td>0%</td><td>99.994%</td><td>0.006%</td></tr><tr><td>5 chords</td><td>100%</td><td>0%</td><td>99.9998%</td><td>0.0002%</td></tr><tr><td>6 chords</td><td>100%</td><td>0%</td><td>100%</td><td>0%</td></tr><tr><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr><tr><td>10 chords</td><td>100%</td><td>0%</td><td>100%</td><td>0%</td></tr></tbody></table>

At last, the oracle is used to answer two questions: is the sequence recognisable? And is the sequence false? We have also checked that each element obtains consistent answers to these two questions, i.e. one true and one false, with a 100% success.

# 4. CONCLUSIONS

## 4.1 Summary of work carried out

To conclude, this paper presents two main modules of the Learning Harmonizer project: the analysis module and the rule extraction module. We are now at the stage of bringing together the three modules that make up the generation process, in order to test it on a few selected harmonies exercises.

We are currently designing the user interface that will give visual feedback on the harmonization generation tests of selected harmonic exercises.

## 4.2 Next step

The next step would be to formalize a set of selected harmony rules. We plan to select the most complex ones that will require more explanation for students to understand.

In parallel, hundreds of harmony exercises extracted from "300 Textes et Realisations" written by RAYNAUD Jean-Claude [21] have been encoded in MusicXML format by the first author. Then the exercises need to be labeled according to the notions they cover. We are currently developing the first version of the selection module, which will need to be modified each time we add a new composer.

The guidance and correction modules will then be developed using the modules that make up the generation process. It will mainly involve interface design work.

## 4.3 Project outlook

We hope that this project will not only advance the pedagogy of harmony, but also initiate students earlier in their curriculum, ideally from the 2nd cycle onwards, i.e. from around the 4th year of music (depending on the school).

In order to validate and/or improve the system, we plan to have our architecture tested by various audiences: students at Bordeaux Montaigne University, band students at Bordeaux Conservatory and 2nd cycle music students at Mérignac Conservatory.

## Acknowledgments

We would like to thank François PACHET, Gérard AS-SAYAG, Jean-Pierre BRIOT and Pierrick LEGRAND, for their invaluable advice and help in defining the project.

We would also like to thank Pascal PISTONE, Professor of Musicology at Bordeaux Montaigne University, for his co-supervision of the project.

And finally, we would like to thank the team at the Studio de Création et de Recherche en Informatique et Musiques Expérimentales (SCRIME) for their support in this project.

# 5. REFERENCES

[1] M. Cuthbert, C. Ariza, B. Hogue, and J. W. Oberholtzer, "Music21 - open-source toolkit for computer-aided musicology," 2006.

[2] C. Wang, "vmo - python variable markov oracle library," 2022. [Online]. Available: https://github.com/wangsix/vmo
[3] A. Binet and M. Desainte-Catherine, "Vers une architecture logicielle pour l'enseignement hybride de l'harmonie," in *Proc. Journées d'Informatique Musicale*, Paris, 2023, pp. 213-218.

[4] C. Thebaut, "Questioning conservatories cultural legitimacy: An investigation of dutch and french networks of music education," Ph.D. dissertation, Utrecht University, 2019.

[5] B. H. D. Ferreira and etc, "Deepsolfège: Recognizing solfège hand signs using convolutional neural networks," Springer International Publishing, 2021.

[6] K. Zsuzsanna, "Solfeggio 1: A vertical ear training instruction assisted by the computer," *International Journal of Music Education*, 2003.

[7] P. Matevž, V. Žiga, Šavli Peter, K. Alenka, and M. Matija, "Troubadour: A gamified e-learning platform for ear training," *IEEE Access*, 2020.

[8] J. Yin, Y. Wang, and D. Hsu, "Digital violin tutor: An integrated system for beginning violin learners," *Proceedings of the 13th ACM International Conference on Multimedia*, 2005.

[9] E. A. Claudia, ""yousician" - music education platform," *Information and Communication Technology in Musical Field*, 2017.

[10] J. Solis, M. Bergamasco, K. Chida, S. Isoda, and A. Takanishi, "The anthropomorphic flutist robot wf-4 teaching flute playing to beginner students," *Proceedings - IEEE International Conference on Robotics and Automation*, 2004.

[11] D. informatique inc., "Antidote," 1435, rue Saint-Alexandre, bureau 1040 Montréal (Québec) H3A 2G4 Canada, 1996 to present.

[12] G. Hadjeres, F. Pachet, and F. Nielsen, "Deepbach: a steerable model for bach chorales generation," *Cornell University Library*, 2017.

[13] M. Cuthbert, C. Ariza, B. Hogue, and J. W. Oberholtzer, "List of works found in the music21 corpus," 2023. [Online]. Available: https://web.mit.edu/music21/doc/about/referenceCorpus.html

[14] A. BINET, "Database of bach choirs for 4-part choir," 2024. [Online]. Available: https://github.com/doremijazz/Database_of_Bach_choirs_for_4_part_choir.git

[15] —, "Musescore harmonic anlayse and score anotation plugin," 2024. [Online]. Available: https://github.com/doremijazz/Musescore_harmonic-anlayse_and_score_anotation_plugin.git

[16] C. Czarnecki, *J.S. Bach 413 Chorales: Analyzed*. SeeZar Publications, 2013.

[17] A. BINET, "Computer-generated harmonic sequence rule extractor," 2024. [Online]. Available: https://github.com/doremijazz/Computer_generated_harmonic_sequence_rule_extraction.git

[18] —, "L'intelligence artificielle pour la composition musicale," Master's thesis, Université Bordeaux Montaigne, Pessac, 2022. [Online]. Available: https://doi.org/10.13140/RG.2.2.35830.06722

[19] —, "Learning harmonizer – applications sur google play," 2022.

[20] —, "Database of j. s. bach's choral works analysed and computer-anotated," 2024. [Online]. Available: https://github.com/doremijazz/Database_of_J._S._Bach_choral_works_analysed_and_computer_anotated.git

[21] J. C. RAYNAUD, *300 Textes et Realisations*. Robert Martin, 2001.