a structural theory of rhythm notation based on tree...

41
A Structural Theory of Rhythm Notation based on Tree Representations and Term Rewriting Jean Bresson Pierre Donat-Bouillud Florent Jacquemard Ircam Paris, France ENS Rennes Ircam Paris, France INRIA

Upload: buituyen

Post on 22-Mar-2018

223 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

A Structural Theory of Rhythm Notation based on Tree Representations and Term Rewriting

Jean Bresson Pierre Donat-Bouillud Florent Jacquemard

Ircam Paris, France

ENS Rennes Ircam

Paris, FranceINRIA

Page 2: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Objectives• tree structured encoding of rhythm

• used for reasoning about rhythms with standard theoretical tools for tree processing

• for assisted algorithmic composition with OpenMusic

1. motivation and definition of a tree encoding for rhythm

2. tree languages (tree automata)

3. tree transformations by rewriting (equational theory), application to exploring equivalent rhythmic notations

4. properties, perspectives

Page 3: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Trees Encodings of Rhythm

natural representation of common western notations for rhythms durations are defined hierarchically, by recursive subdivisions

RizoSymbolic music comparison with tree data structures

PhD thesis U. Alicante, 2010

see survey in

Page 4: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Lee The rhythmic interpretation of simple musical sequences

Musical Structure and Cognition, 1985

CHAPTER 3. MUSIC SIMILARITY WITH TREES

!" ##$#% #&' (#(a) First two bars of“Auld Lang Syne”

S! ¯ | <|4

2 +4

2

4

2 ! ˘ “ | <|4

1 +4

1

4

1 ! ˇ “ | > | 8

1 +8

1

8

1 ! ˇ “( | ? | · · ·(b) Grammar for meter 4/4

! "" " " · · · · ""

43 · · · · !!! ! !!

!43 · · · · !" ! !! !## "

! "#" " " · · · · | " ""# $

(c) Some possible parses of (a) usingthe grammar in (b) and that detailed inFig. 3.3a.

44

42

81

81

42

41

41

44

42

41

41

42

41

41

(d) Some possible parses

Figure 3.5: Longuet-Higgins grammar for meter 4/4 (from (Lee, 1985) pages 54-55) andsome possible parses.

62

CHAPTER 3. MUSIC SIMILARITY WITH TREES

!" ##$#% #&' (#(a) First two bars of“Auld Lang Syne”

S! ¯ | <|4

2 +4

2

4

2 ! ˘ “ | <|4

1 +4

1

4

1 ! ˇ “ | > | 8

1 +8

1

8

1 ! ˇ “( | ? | · · ·(b) Grammar for meter 4/4

! "" " " · · · · ""

43 · · · · !!! ! !!

!43 · · · · !" ! !! !## "

! "#" " " · · · · | " ""# $

(c) Some possible parses of (a) usingthe grammar in (b) and that detailed inFig. 3.3a.

44

42

81

81

42

41

41

44

42

41

41

42

41

41

(d) Some possible parses

Figure 3.5: Longuet-Higgins grammar for meter 4/4 (from (Lee, 1985) pages 54-55) andsome possible parses.

62

CHAPTER 3. MUSIC SIMILARITY WITH TREES

!" ##$#% #&' (#(a) First two bars of“Auld Lang Syne”

S! ¯ | <|4

2 +4

2

4

2 ! ˘ “ | <|4

1 +4

1

4

1 ! ˇ “ | > | 8

1 +8

1

8

1 ! ˇ “( | ? | · · ·(b) Grammar for meter 4/4

! "" " " · · · · ""

43 · · · · !!! ! !!

!43 · · · · !" ! !! !## "

! "#" " " · · · · | " ""# $

(c) Some possible parses of (a) usingthe grammar in (b) and that detailed inFig. 3.3a.

44

42

81

81

42

41

41

44

42

41

41

42

41

41

(d) Some possible parses

Figure 3.5: Longuet-Higgins grammar for meter 4/4 (from (Lee, 1985) pages 54-55) andsome possible parses.

62

Syntax Trees

Longuet-Higgins The perception of music

I.S.R., 1978

Page 5: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

OpenMusic Rhythm TreesOpenMusic: graphical programming environment for algorithmic composition developed at Ircam

Laurson Patchwork: A Visual Programming Language

Helsinki: Sibelius Academy, 1996

OM RT (nested lists) are a first class data structure for the representation of rhythms in OM

Page 6: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Arbres de rythme dans OpenMusic

Des rapports hiérarchisésLes nombres représentent une durée relative par rapport auxautres nombres de la mesure : c’est un rapport de durée.

Le chiffrage est intégré à la notation.

4

3 1 2 1 1

2 1 1 1 1

FIGURE : L’arbre de rythme (? (((4 4) ( 3 (1 ( 2 1)) 2 1 (1 ( 1 11)) ))))

Pierre Donat-Bouillud (ENS Cachan Bretagne) Quantification rythmique dans OpenMusic 4 Juillet 2013 4 / 18

Arbres de rythme dans OpenMusic

Des rapports hiérarchisésLes nombres représentent une durée relative par rapport auxautres nombres de la mesure : c’est un rapport de durée.

Le chiffrage est intégré à la notation.

4

3 1 2 1 1

2 1 1 1 1

FIGURE : L’arbre de rythme (? (((4 4) ( 3 (1 ( 2 1)) 2 1 (1 ( 1 11)) ))))

Pierre Donat-Bouillud (ENS Cachan Bretagne) Quantification rythmique dans OpenMusic 4 Juillet 2013 4 / 18

OpenMusic Rhythm Trees

• infinite alphabet (integers) • processing require arithmetics

Objective to use Term Rewriting tools: ➡ purely syntactic processing ➡ labeling with finite alphabet

Page 7: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Durations in Semi-Structured Music Encodings

in MEI, MusicXML, etc a score is a tree (XML doc) durations are attributes of notes

score transformations can be defined using (tree) patterns but not for rhythms…

➡ encode durations in the tree structure

<mei:note pname="c" oct="5" dur="4"/>

Page 8: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rhythm Trees (sum-up)

• hierarchical encoding of durations in tree structures • labeling with finite (and small) alphabet

➡ expression of symbolic constraints (e.g. sum = 1) ➡ definition of schemas (types) for rhythms ➡ transformations defined syntactically

Page 9: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rhythm Trees (RT)

ordered ranked trees over a signature: • inner nodes labeled by prime numbers (= arity) • leaves labeled by n, r, s, d, o

2

n 2

n n

denoted: 2(n(2(n,n))

Page 10: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Distinguished Nodes and Node Relations

3

2

r n

2

r n

2

r n

Page 11: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Distinguished Nodes and Node Relations

root

3

2

r n

2

r n

2

r n

Page 12: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Distinguished Nodes and Node Relations

root

3

2

r n

2

r n

2

r n

leaves

Page 13: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Distinguished Nodes and Node Relations

root

3

2

r n

2

r n

2

r n

Page 14: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Distinguished Nodes and Node Relations

root

3

2

r n

2

r n

2

r n

siblings

Page 15: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Distinguished Nodes and Node Relations

root

3

2

r n

2

r n

2

r n

siblings

siblings

Page 16: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Distinguished Nodes and Node Relations

root

3

2

r n

2

r n

2

r n

siblings

Page 17: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Distinguished Nodes and Node Relations

root

3

2

r n

2

r n

2

r n

siblings

cousins

Page 18: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Semantics: Rhythmic Value

we associate durations to nodes:

dur(root) = 1 beat or 1 measure

dur(node) = dur(parent)arity(parent)

when previous cousin is not o

2

n 2

n n

Page 19: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Semantics: Rhythmic Value

we associate durations to nodes:

dur(root) = 1 beat or 1 measure

dur(node) = dur(parent)arity(parent)

when previous cousin is not o

2

n 2

n n

rhythmic value = sequence of ratios = duration of leaves (in dfs traversal) in the case of n and r

1

2

1

4

1

4

Page 20: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rhythmic Value

3

2

r n

2

r n

2

r n

1

6

�1

6

1

6

�1

6

1

6

�1

6rhythmic value

Page 21: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rhythmic Value

3

2

r n

2

r n

2

r n

1

6

�1

6

1

6

�1

6

1

6

�1

6

notes

rhythmic value

Page 22: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rhythmic Value

3

2

r n

2

r n

2

r n

1

6

�1

6

1

6

�1

6

1

6

�1

6

rests notes

rhythmic value

Page 23: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rhythmic Value

1

5

1

5

1

15

1

15

1

15

1

5

1

5

5

n n 3

n n n

n n

rhythmic value

Page 24: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rhythmic Value

3

2

2

n n

2

n n

n 2

2

n n

2

n n

1

12

1

12

1

12

1

12

1

3

1

12

1

12

1

12

1

12rhythmic value

Page 25: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Ties and Dots

2

2

n n

d

2

2

n n

s

we sum durations for subsequences of leafs of the form n s … s or n d or n d d

1

4

3

4

1

4

3

4rhythmic value

Page 26: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Simplifiable RT with Ties

1

2

1

2

3

n 2

s n

s

Page 27: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Summation with Symbol o (a)

1

4

1

2

1

4

2

2

n o

2

n n

dur(node) = dur(parent)arity(parent)

where d’(node) = dur(previous cousin) when the previous cousin labelled with o and 0 otherwise

+ dur’(node)

we ignore the leaves labeled with o in the computation of rhythmic value

Page 28: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Ratios with Symbol o

2

2

n o

2

3

n n n

r

1

4

1

6

1

6

1

6

1

4

3 in the time of 2

3

10

3

10

3

10

3

10

3

10

1

2

2

2

o o

2

5

n n n n n

n

5 in the time of 3

dur(root) = 2

3

2dur =1

2dur =

Page 29: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Tuplet Beaming: one beat

3

2

n n

2

n n

2

n n

3

n n n

3

n n n

2

n n

2

n n

2

n n

Page 30: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Tuplet Beaming: one bar

2

2

r n

2

n n

2

2

n n

2

n r

2

r n

2

n n

2

n n

2

n r

r n

n n

n n

n r

Page 31: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Regular Tree Languagesdefined by tree automata

(embed all current XML schema languages)Murata et al

Taxonomy of XML schema languages using formal language theory ACM Trans. Internet Technol., 5:660–704, 2005

definition of well-formed trees

definition of user preferences

e.g. every d must occur in one of the following patterns2

n 2

d 2

d x

2

2

2

x n

d

d

2

n 2

d x

2

2

x n

d

Page 32: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rewrite Ruleslocal transformations of RT

d ! s

p̄(x1, . . . , xp) ! p(x1, . . . , xp) p 2 P

symbols with same semantics

(1)

(2)

replacement of a subtree (matching the left pattern) by a subtree

Page 33: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rewrite Rules

addition of rests

p(r, . . . , r| {z }p

) ! r p 2 P

r; s ! r; r

o; r ! r; r

(3)

(4)

(5)

; denotes the cousin relation replacement of a sequence of cousins

by a sequence of cousins of same length

Page 34: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rewrite Rules

normalization of ties

(6)

(7)

p(s, . . . , s) ! s p 2 P

p(n, s, . . . , s) ! n p 2 P

Page 35: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rewrite Rules

elimination of o

(8)

(9)

o; s ! s; s

sum and division by 1 o; n ! n; s

sum and division by 2 o; 2(x1, x2) ! x1;x2

o; o; o; 2(x1, x2) ! o;x1; o;x2

o; o; 3(x1, x2, x3) ! x1;x2;x3sum and division by 3

o; . . . ; o| {z }kp�1

; p(x1, . . . , xp) ! o; . . . ; o| {z }k�1

;x1; o; . . . ; o| {z }k�1

;x2; . . . ; o; . . . ; o| {z }k�1

;xp

(10)simulated with intermediate rules and auxiliary symbols

Page 36: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

6.3.4 General

o; . . . ; o| {z }kp�1

; p(x1, . . . , xp)! o; . . . ; o| {z }k�1

;x1; o; . . . ; o| {z }k�1

;x2; . . . ; o; . . . ; o| {z }k�1

;xp (10)

Simulated in several steps, using auxiliary symbols of ⇥rn.

6.4 Subdivision Equivalence

6.4.1 Examples

2(x1, x2) ! 3(2(o, o), 2(x1, o), 2(o, x2))

2(x1, x2) ! 5(2(o, o), 2(o, o), 2(x1, o), 2(o, o), 2(o, x2))

3(x1, x2, x3) ! 2(3(o, x1, o), 3(x2, o, x3)) . . .

6.4.2 General

p(x1, . . . , xp)! p

0�p(u1,1, . . . , u1,p), . . . , p(up0,1, . . . , up0,p)

�(11)

where p, p

0 2 P, p 6= p

0, for all 1 i p

0, 1 j p, ui,j 2 {o, x1, . . . , xp} and the

sequence u1,1, . . . , u1,p, . . . , up0,1, . . . , up0,p has the form o, . . . , o, x1| {z }p0

, . . . , o, . . . , o, xp| {z }p0

.

6.5 Examples

2

2

n o

2

n s

��!(9) 2

2

n n

2

s s

��!(6) 2

2

n n

s

��(1) 2

2

n n

d

3

n

2

s n

s

���!(11) 2

3

o n o

3

2

s n

o s

���!(10) 2

3

o n s

3

n o s

���!(9,8) 2

3

n s s

3

n s s

��!(7) 2

n n

8

Rewriting Equivalent Rhythms

Page 37: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Rewrite Rules

equivalent subdivisions

2(x1, x2) ! 3(2(o, o), 2(x1, o), 2(o, x2))2(x1, x2) ! 5(2(o, o), 2(o, o), 2(x1, o), 2(o, o), 2(o, x2))

3(x1, x2, x3) ! 2(3(o, x1, o), 3(x2, o, x3)) . . .

p(x1, . . . , xp) ! p

0�p(u1,1, . . . , u1,p), . . . , p(up0,1, . . . , up0,p)

where p, p

0 2 P, p 6= p

0,

for all 1 i p

0, 1 j p, ui,j 2 {o, x1, . . . , xp}

and the sequence u1,1, . . . , u1,p, . . . , up0,1, . . . , up0,p

has the form o, . . . , o, x1| {z }p0

, . . . , o, . . . , o, xp| {z }p0

.

(11)

Page 38: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Reduction Sequence

6.3.4 General

o; . . . ; o| {z }kp�1

; p(x1, . . . , xp)! o; . . . ; o| {z }k�1

;x1; o; . . . ; o| {z }k�1

;x2; . . . ; o; . . . ; o| {z }k�1

;xp (10)

Simulated in several steps, using auxiliary symbols of ⇥rn.

6.4 Subdivision Equivalence

6.4.1 Examples

2(x1, x2) ! 3(2(o, o), 2(x1, o), 2(o, x2))

2(x1, x2) ! 5(2(o, o), 2(o, o), 2(x1, o), 2(o, o), 2(o, x2))

3(x1, x2, x3) ! 2(3(o, x1, o), 3(x2, o, x3)) . . .

6.4.2 General

p(x1, . . . , xp)! p

0�p(u1,1, . . . , u1,p), . . . , p(up0,1, . . . , up0,p)

�(11)

where p, p

0 2 P, p 6= p

0, for all 1 i p

0, 1 j p, ui,j 2 {o, x1, . . . , xp} and the

sequence u1,1, . . . , u1,p, . . . , up0,1, . . . , up0,p has the form o, . . . , o, x1| {z }p0

, . . . , o, . . . , o, xp| {z }p0

.

6.5 Examples

2

2

n o

2

n s

��!(9) 2

2

n n

2

s s

��!(6) 2

2

n n

s

��(1) 2

2

n n

d

3

n

2

s n

s

���!(11) 2

3

o n o

3

2

s n

o s

���!(10) 2

3

o n s

3

n o s

���!(9,8) 2

3

n s s

3

n s s

��!(7) 2

n n

8

(simplification)2(x1, x2) ! 3(2(o, o), 2(x1, o), 2(o, x2))2(x1, x2) ! 5(2(o, o), 2(o, o), 2(x1, o), 2(o, o), 2(o, x2))

3(x1, x2, x3) ! 2(3(o, x1, o), 3(x2, o, x3)) . . . (11)

Page 39: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Properties

➡ explore the space of rhythms with same value as a given rhythm

➡ suggest alternative notations

for well-formed trees

Every two trees in relation by rewriting have the same rhythmic value (equivalent)

Page 40: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Properties (perspectives)

under restriction for termination (bounded depth)

• confluence

➡ canonical representation of equivalence classes of rhythms

• rewrite strategies e.g. top-down ➡ for efficiency ➡ prove completeness?

T

T’

T1 T2

Page 41: A Structural Theory of Rhythm Notation based on Tree ...repmus.ircam.fr/_media/jacquemard/strn-mcm.pdf · A Structural Theory of Rhythm Notation based on Tree Representations and

Applications and Perspectives➡ framework for rhythm transcription (by quantization)

in OpenMusic, based on RT ➡ conversions ‣ RT → OMRT for rendering ‣ RT ↔ standard encodings

➡ alternative: rewriting and tree automata with build-in arithmetic

Conclusion• tree structured encoding of rhythm • defining well formed tree languages (schemas) • tree rewriting rules defining rhythm equivalence