AI recognition of polymetric notation

Polymetric nota­tion is one of the main fea­tures of the Bol Processor project, which is here con­sid­ered as musi­co­log­i­cal research rather than soft­ware devel­op­ment. Other fea­tures include tonal mod­el­ling and the time-setting of sound objects.

Polymetric expres­sions are a con­ve­nient prod­uct of rule-based music com­po­si­tion. They are rep­re­sent­ed as strings of sym­bols that embody a semi-lattice struc­ture, here mean­ing a tree of sound objects with ties. Polymetric nota­tion, gen­er­al­ly speak­ing, is a sequence of poly­met­ric expres­sions that is processed as a sin­gle poly­met­ric expression.

The aim of the cur­rent project is to tran­scribe a musi­cal input (giv­en by a stream of MIDI events) to the most com­pre­hen­si­ble poly­met­ric nota­tion. An exten­sion of this would indeed be to accept a sound sig­nal as input.

(just for decoration)

To achieve this, we plan to train a trans­former (a type of neur­al net­work), using sets of poly­met­ric expres­sions along­side their asso­ci­at­ed MIDI file ren­der­ings. As we require large sam­ple sets that cov­er a wide range of musi­cal styles, the plan is to cre­ate these sets using exist­ing musi­cal scores.

The process described on the Importing MusicXML scores page demon­strates the abil­i­ty to "trans­late" any Western musi­cal score (in its dig­i­tal for­mat) to a poly­met­ric expres­sion. This process is irre­versible because poly­met­ric expres­sions can­not be ful­ly con­vert­ed into human-readable musi­cal scores, despite them car­ry­ing time struc­tures that sound "musi­cal". A typ­i­cal exam­ple of this is the use of unde­ter­mined rests, as these imply fur­ther pro­cess­ing of the struc­ture in order to set exact durations.

Sample sets that asso­ciate poly­met­ric expres­sions with their MIDI file ren­der­ings will con­tain iden­ti­cal pitch and tim­ing infor­ma­tion on both sides. However, the trans­former should be able to han­dle streams of MIDI events cre­at­ed by humans or ran­dom effects, where the tim­ings are not based on a sim­ple frame­work. Therefore, a quan­ti­za­tion will be need­ed to adjust the stream before it is analysed. This quan­ti­za­tion of incom­ing events is already oper­a­tional on the Bol Processor — see the Capture MIDI input page.

The creation of sample sets

Sample sets are cre­at­ed from musi­cal works import­ed from MusicXML scores. For instance:

Click the CREATE SET FOR AI button.

A sam­ple set is cre­at­ed and can be down­loaded in a zip file:
set_-da.Hungarian_Rhapsody_OguzSirin.zip.

More sets can be cre­at­ed using the same musi­cal work. Clicking the CREATE SET FOR AI but­ton again would pro­duce the same set, as it is built from a sequence of ran­dom num­bers that is not reini­tialised. To ensure the new set is dif­fer­ent, click the refresh but­ton. When down­load­ing it, the sys­tem will auto­mat­i­cal­ly assign it a dif­fer­ent name, e.g.:
set_-da.Hungarian_Rhapsody_OguzSirin (1).zip.

Sample sets of minimised polymetric structures

The mini but­ton close to the refresh but­ton mod­i­fies the sam­ple set so that all (eli­gi­ble) poly­met­ric struc­tures are min­imised. In a min­imised struc­ture, some rests with explic­it dura­tions are replaced with unde­ter­mined rests (notat­ed '') with­out any loss of tim­ing accu­ra­cy. Read the Minimising a poly­met­ric struc­ture page for more details. These sets are small­er in size than the ones they are derived from because only eli­gi­ble struc­tures have been retained.

Once sam­ples in the train­ing set have been min­imised, the CREATE SET FOR AI but­ton is changed to CREATE min­imised SET FOR AI.

The sets of min­imised struc­tures are down­loaded with spe­cif­ic names that men­tion the 'mini' fea­ture, such as:
set_-da.Hungarian_Rhapsody_OguzSirin_mini.zip

When train­ing an AI, these sets should be used sep­a­rate­ly from stan­dard sets because they are expect­ed to train the trans­former to guess the prop­er loca­tions of unde­ter­mined rests. Nevertheless, it could be inter­est­ing to com­pare relat­ed (stan­dard ver­sus min­imised) sam­ples in order to mod­el changes between stan­dard and min­imised poly­met­ric structures.

The content of a sample set

The first sam­ple set cre­at­ed in this demo con­tains 160 sam­ples. These sam­ples are text files named 1.txt, 2.txt, etc., asso­ci­at­ed with MIDI files 1.mid, 2.mid, etc. One of the text files con­tains for instance:

{_tempo(4/3) _vel(85){2,{3/16,D6& E6& D7&}{3/16,&D6,&E6,&D7}{1/8,C6,C7}{3/8,B5,B6}{1/8,A5,A6}{3/8,G#5,G#6}{1/8,A5,A6}{3/8,B5,B6}{1/8,G#5,G#6},{3/8,G#3}{1/8,D4}{3/8,B4}{1/8,E4}{3/8,E3}{1/8,B3}{3/8,G#4}{1/8,E4}}} {_tempo(4/3) _vel(85){2,{3/8,A5,A6}{1/8,G#5,G#6}{3/8,A5,A6}{1/8,B5,B6}{3/8,C6,C7}{1/8,B5,B6}{3/8,C6,C7}{1/8,D6,D7},{3/8,A3}{1/8,D4}{3/8,C5}{1/8,A4}{3/8,E3}{1/8,C4}{3/8,A4}{1/8,E4}}}

This poly­met­ric expres­sion cov­ers 2 mea­sures of the musi­cal score. Clicking the CREATE SET FOR AI TRAINING but­ton slices the score ran­dom­ly into chunks con­tain­ing between 1 and 5 mea­sures. The upper lim­it of 5 has been set arbi­trar­i­ly and may be revised at a lat­er date. Every time the Refresh but­ton is clicked, a new slice is cre­at­ed, result­ing in a dif­fer­ent sam­ple set.

The idea is twofold: (1) the trans­former should be trained to recog­nise sequences of poly­met­ric expres­sions, and (2) tied notes may span more than one mea­sure. A tied note in the above exam­ple is the pair "D6& &D6" (read more). Each sam­ple con­tains only com­plete pairs of tied notes. This means that any notes whose ties are not present in the sam­ple are untied for consistency.

Note that the tim­ings of the poly­met­ric expres­sion and the MIDI file are iden­ti­cal, as the metronome is auto­mat­i­cal­ly set to a default tem­po of 60 bpm when the MIDI file sam­ples are cre­at­ed. In the above phrase, the tem­po is set to 4/3, which is equiv­a­lent to a metronome set at 80 bpm.

A collection of sample sets

Several col­lec­tions of sam­ple sets can be found in the fold­er:
https://bolprocessor.org/misc/AI/samples

These can be used for train­ing a trans­former of your choice. We rec­om­mend cre­at­ing more sets from more musi­cal works to achieve a bet­ter train­ing. Run the Bol Processor and browse import­ed MusicXML scores in the ctests/Imported_MusicXML work­space, or import more works from a ded­i­cat­ed score server.

A test of the transformer's abil­i­ty to "trans­late" MIDI files to poly­met­ric nota­tion will first be to retro-convert (to poly­met­ric expres­sions) all sam­ples, then to retro-convert the MIDI file of every musi­cal work used for the training.

What follows…

Once a prop­er trans­former type and an opti­mum size of sam­ple sets have been found, we will work on the fol­low­ing extensions:

  1. Translate MIDI streams pro­duced by human inter­preters, for which accu­rate tim­ings are not guaranteed.
  2. Extend the AI recog­ni­tion to the use of unde­ter­mined rests when it per­mits a more sim­ple poly­met­ric structure.

🛠 Work in progress!

Leave a Reply

Your email address will not be published. Required fields are marked *