Minimising a polymetric structure

👉 For geeks only!

This page is about the poly­met­ric nota­tion used in the Bol Processor project and, most like­ly, oth­er soft­ware envi­ron­ments. This advanced tool is used to rep­re­sent the time struc­ture of events, which can be sim­ple notes, sound-objects, or more gen­er­al­ly time-objects that can be instan­ti­at­ed as video frag­ments, sequences of robot­ic actions, and so on.

In a poly­met­ric struc­ture, rests (or 'silences') are rep­re­sent­ed by inte­ger ratios (their sym­bol­ic dura­tion), for exam­ple ‘6’ for "six beats" or '4 2/3' for "four and two third beats". Small inte­gers can be replaced with hyphens, for exam­ple '---' for '3'.

In some (but not all) poly­met­ric struc­tures, rests with explic­it dura­tions can be replaced with unde­ter­mined rests (notat­ed '' or '_rest'), the val­ue of which is cal­cu­lat­ed by a (deter­min­is­tic) algo­rithm in the con­sole (file 'polymetric.c'). This is an impor­tant fea­ture because it enables the nota­tion to be sim­pli­fied with­out com­pro­mis­ing the accu­ra­cy of the time. Take a look at Charles Ames' exam­ple, for instance.

A poly­met­ric struc­ture con­tain­ing at least an unde­ter­mined rest is called 'min­imised" for this rea­son. Examples of min­imised struc­tures are found on the Polymetric struc­tures page.

The top­ic of this page is about 'revert­ing' the algo­rithm that assigns explic­it dura­tions to unde­ter­mined rests in the Bol Processor con­sole. Geeks will find this algo­rithm in the 'polymetric.c' file, and they can set the 'trace_und' vari­able to '1' to trace its operation.

Examples of minimisation

All exam­ples are found in the "-da.tryMinimise" data file (dis­trib­uted from the 3.3.6 ver­sion). Click the MINIMISE but­ton to min­imise all (eli­gi­ble) poly­met­ric expres­sions on the page.

Only poly­met­ric expres­sions between curled braces { } are processed.

The first exam­ple {2, C4 C4 --} will be min­imised as {2, C4 C4 …} where­as the sec­ond exam­ple {2, C4 C4 -} is not eli­gi­ble. The rea­son is that {2, C4 C4 …} is always instan­ti­at­ed as {2, C4 C4 --} (or {2, C4 C4 2}) and there is no min­imised ver­sion of {2, C4 C4 -}.

The third exam­ple {C4 D4 E4, A4 B4 F4 3 G4 A4 B4} is min­imised as {C4 D4 E4, A4 B4 F4 G4 A4 B4}. Both ver­sions yield the fol­low­ing time structure:

For this demo, we use sim­ple notes with arbi­trary pitch­es in English nota­tion, as we are only focus­ing on the time structures.

The fol­low­ing exam­ples are not eli­gi­ble for a minimisation:

{C4 D4 E4, A4 B4 F4 1 G4 A4 B4}
{C4 D4 E4, A4 B4 F4 2 G4 A4 B4}
{C4 D4 E4, A4 B4 F4 4 G4 A4 B4}

It is not easy to guess which dura­tion of the rest — 1, 2, 3, 4 beats? — makes it eli­gi­ble for being unde­ter­mined. The cor­rect val­ue can be found by click­ing the EXPAND but­ton to the right of {C4 D4 E4, A4 B4 F4 … G4 A4 B4}. The first line of the result is the expand­ed poly­met­ric expression:

/1 {*1/1 C4 D4 E4,*1/3 A4 B4 F4 - _ _ G4 A4 B4}

The '- _ _ ' sequence is a rest of dura­tion 3 beats. The sym­bol '-' rep­re­sents a rest of one beat. This is fol­lowed by two pro­lon­ga­tions, '_'.

Note that the "expand­ed poly­met­ric expres­sion" dis­plays absolute tem­po mark­ers, such as '*1/3', to rep­re­sent the struc­ture, rather than rel­a­tive mark­ers, such as '__tempo(1/3)'. This rep­re­sen­ta­tion can be used for data, as was the case in ear­ly ver­sions of the Bol Processor.

Indeed, in this sim­ple exam­ple, the dura­tion was vis­i­ble on the graph. However, it becomes increas­ing­ly dif­fi­cult to mea­sure when rhyth­mic struc­tures become more com­pli­cat­ed. For exam­ple, {A4 F4 G4, … C4 D4 … E4} is expand­ed as:

/1 {*1/1 A4 F4 G4, *3/8 - *3/4 C4 D4 *3/8 - *3/4 E4}

It is not easy to fig­ure out that '*3/8 -' is a silence at twice the speed of '*3/4 C4', there­fore its (rel­a­tive) dura­tion is 1/2 and the struc­ture is equiv­a­lent to {A4 F4 G4, 1/2 C4 D4 1/2 E4}.

The process is more com­plex for fields of the poly­met­ric struc­ture that con­tain at least two rests with dif­fer­ent dura­tions. For example:

{C3 D3 E3, A5 5/4 B5 5/2 C5 5/4 D5}

The algo­rithm gen­er­ates a table of equiv­a­lent rests in chains, such as two 5/4 rests and one 5/2 rest. The table is sort­ed down on the num­ber of rests in each chain, which yields:

5/4 5/4
5/2

Then, each chain is con­sid­ered as a poten­tial solu­tion to the unde­ter­mined rest(s). The first one that meets the con­di­tions pro­vides the solu­tion. Here, it is "5/4 5/4", which yields:

{C3 D3 E3, A5 B5 5/2 C5 D5}

In this exam­ple, {C3 D3 E3, A5 5/4 B5 C5 5/4 D5} is anoth­er solution.

If sev­er­al chains con­tain the same num­ber of units, the first accept­able one is giv­en as the solu­tion and the (deter­min­is­tic) algo­rithm ends. However, oth­er chains of max­i­mum length might also meet the con­di­tions. This means that the min­imi­sa­tion algo­rithm does not pro­vide all solu­tions, but at least it does pro­vide one which has the max­i­mum num­ber of unde­ter­mined rests.

Tracing the minimisation

The algo­rithm for min­imis­ing poly­met­ric struc­tures is more com­pli­cat­ed to design than the one for assign­ing explic­it dura­tions to unde­ter­mined rests. As per this writ­ing, it does not cov­er all cas­es. Updated ver­sions will be imple­ment­ed in the inter­face file 'data.php'.

If you need to fol­low the process while look­ing at the code, open the set­tings file and enter the item num­ber at the bot­tom of the form. In this exam­ple, we have cho­sen to trace the min­imi­sa­tion of item #30.

Don't for­get to save the set­tings and save again the Data page. Now, click the MINIMISE but­ton. You will get a trace that looks like this:

👉 { C3 D3 E3 , A5 5/4 B5 5/2 C5 5/4 D5 }
field #0 = 3/1 sounds, 3/1 beats, tem­po = 1/1
field #1 = 9/1 sounds, 9/1 beats, tem­po = 1/1
ref field = 0, dura­tion = 3/1 beats
sounds = 9/1
TRYING field #1, "A5 5/4 B5 5/2 C5 5/4 D5 "
—> ref_field = 0, token = "5/4", number_rests = 2, dura­tion = 5/2
➡ beats (3/1) - sounds (9/1) + rest dura­tion (5/2) = xp/xq = -7/2, number_rests = 2
case 1 —> beats[ref_field] = 3/1, sounds[field] = 13/4
pmax/qmax = 12/4, lcm = 4, psounds/qsounds = 13/4
mgap = 1, x = 1.0833333333333, p_therest (before adjust) = 5.5
p_therest (after adjust) = 5, q_therest = 4
[field #1 -> rest = 5/4]
GOT IT: "A5 _rest B5 5/2 C5 _rest D5" —> count_this = 2
Result = {C3 D3 E3 , A5 _rest B5 5/2 C5 _rest D5}

(This trace will dif­fer in sub­se­quent versions.)

.🛠 Work in progress .…. to be continued .….…

Leave a Reply

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