Docsity

FORMAL SEMANTICS FOR MUSIC NOTATION CONTROL ..., Exams of Compiler Design

Partial preview of the text

Download FORMAL SEMANTICS FOR MUSIC NOTATION CONTROL ... and more Exams Compiler Design in PDF only on Docsity!

FORMAL SEMANTICS FOR MUSIC NOTATION

CONTROL FLOW

A DISSERTATION

SUBMITTED TO THE DEPARTMENT OF COMPUTER SCIENCE

AND THE COMMITTEE ON GRADUATE STUDIES

OF CARNEGIE MELLON UNIVERSITY

IN PARTIAL FULFILLMENT OF THE REQUIREMENTS

FOR THE DEGREE OF

MASTER OF SCIENCE

Zeyu Jin July 2013

iv

Acknowledgements

I would like to express my deep gratitude to Professor Dannenberg, my research supervisor, for his patient guidance, enthusiastic encouragement and useful critiques of this research work. I would also like to thank Professor Stern and Professor Randall, for their advice and assistance in during the planning and development of this research work. My grateful thanks are also extended to Mr. Xia, Mr. Øland and Mr. Liang, for their support and suggestions, and to Mr. Tang, Mr. Cheng, Miss. Peng, Mr. Liu and Mr. Ozbay for their help in system evaluation.

vi

Contents

Abstract v

  • 1 Introduction Acknowledgements vi
  • 2 Background and Motivation
    • 2.1 Common Music Practice
    • 2.2 Extended Music Practice
    • 2.3 Score Display and Representation
  • 3 The framework for defining music control flow
    • 3.1 Symbolize the Score
    • 3.2 Context-free Grammar
    • 3.3 Parsing the grammar
      • 3.3.1 Ambiguity
      • 3.3.2 Error Handling
    • 3.4 Syntax Directed Translation and Attribute Grammar
    • 3.5 The Mapping Function
    • 3.6 Formalizing nested control flow
  • 4 SDL: the Score Discription Language
    • 4.1 The Intuition
    • 4.2 Translating to SDL
    • 4.3 The SDL compiler
      • 4.3.1 Recursive parsing algorithm for SDL
      • 4.3.2 Sequential parsing algorithm for SDL
    • 4.4 Arrangement
  • 5 The Dynamic Control Flow
    • 5.1 DCL: the Dynamic Control Language
    • 5.2 Scheduling Dynamic Events
  • 6 Implementation and Application
    • 6.1 The Score Compiler API
      • 6.1.1 Symbol Definition
      • 6.1.2 Grammar Definition
      • 6.1.3 Compilation
    • 6.2 Score Models
      • 6.2.1 Notated Score
      • 6.2.2 Static Score
      • 6.2.3 The Intermediate Score and The Flattened Score
      • 6.2.4 Arrangement and the Dynamic Score
    • 6.3 Live Score Display
      • 6.3.1 Score Annotation Interface
      • 6.3.2 Arrangement Interface
      • 6.3.3 Performance Interface
  • 7 Evaluation and Results
    • 7.1 Correctness
    • 7.2 Effectiveness
    • 7.3 Extensibility
    • 7.4 Performance of Live Score Display
  • 8 Conclusions and Future Work
  • A Long Definition
    • A.1 Complete Symbol Definition
    • A.2 Complete Syntax Definition for Well-Nested Control Flow Notation
    • A.3 Well-formed common practice notation
  • B Live Score Display
  • Bibliography

List of Tables

3.1 Symbols used to label Control flow notation................. 13 4.1 Default instruction set for SDL........................ 29

5.1 The proposed vocabulary for Dynamic Control Language.......... 52

7.1 Tester’s feedback result............................ 91

A.1 Test set T1................................... 102

x

7.1 Example test case for Set T1: No.8. The visualized score structure and the desired output are shown............................ 79

7.2 Notation for Example 3 in Figure 3.2: notation is done by labeling all the control flow symbols on the score directly (above the stuff). Below is shows the nested structure of these symbols..................... 84

7.3 SDL Notation for the “cross-nested” example “Armando’s Rhumba”. Two jmp instructions are used to get in and out of the inner repeat......... 85

7.4 Mixed SDL Notation for Example 1 in Figure 3.2: We can understand the word notation as: in the first repetition of the whole piece, we play the block between Segno and DS as usual; and in the second repetition, we only play this section once by jumping out of the loop. In this way, we can define a new loop L0 around the piece, notate Segno and DS signs as usual and mix it with SDL by putting a jump sign around the DS for the condition [L0,2].................................... 85

7.5 Mixed SDL Notation for Example 6 in Figure 3.2: we use jmp sign or njmp instructions to selectively play the word-notated block............ 86

7.6 Notation for Example 2 and 4 in Figure 3.2 using Section marks and ar- rangement signs. Note that to divide repetitions of section C in Example 4 into a solo part and an improvisation part, we put the section mark in- side the repeat loop. The flattened score will generate two flattened section marks, C-[L3,1] and C-[L3,2] which can be used for solo and improvi- sation respectively............................... 87

7.7 Example implementation of a notated score .mxml viewer based on the notation panel in LSD. The systems, barlines and the signature changes are marked in the notated score. The piece shown here is “Druid Fire” by Zeyu Jin. The notation is shown as an additional layer overlaying the score image..................................... 89

7.8 Example implementation of a abbreviated score painter built on the lexi- cal analyzer in the score compiler. According to the string symbols, this application paints the abbreviated score used in this thesis.......... 89

xii

B.1 Live Score Display: Score Annotation Interface............... 104 B.2 Live Score Display: Arrangement Interface................. 105 B.3 Live Score Display: Score Annotation Interface............... 106

xiii

Chapter 1

Introduction

Music notation has been evolving for centuries, creating a symbolic system to convey mu- sic information. Early music notation contained only lines and notes, which are sufficient for communicating pitches and durations. It was later that bar lines and time signatures emerged, grouping music into measures and introducing the idea of beats.^1 The notation for music control flow, like repeats and codas, came even later. Control flow helps to identify repeating structures of music and eliminates duplication in the printed score. In the Classical period, control flow notation is closely tied to music forms such as binary, ternary and sonata and is more of a musical architecture than a means of saving space.^2 Conventional practice for control flow notation is well established. The literature [6, 20] has formalized the notation in all kinds of ways and there is little conflict among defini- tions. However, traditional music theory has not explored the possibilities of expanded or enriched representations for control flow, and there is a gap between often-simplified the- oretical ideals and actual practice, especially in modern works. In practice, we find nested repeats, exceptions and special cases indicated by textual annotations, multiple endings,

(^1) Far beyond formalizing the notion of beats, music notation led to the “discovery” of time as an inde- pendent dimension that did not depend upon physical actions. In particular the musical rest is the first direct representation of “nothingness” existing over time, or of time itself. Composers developed this concept cen- turies before the scientific revolution, Kepler, Newton, graphs with a time axes, etc. [3] 2 For example, “In practically all the sonatas of the earlier period the exposition is repeated, as is indicated by the repeat-sign at its end, which is also helpful for the reader in finding the end of the exposition ...” [2]

1

2 CHAPTER 1. INTRODUCTION

and symbols for rearrangement.

We encountered this gap between theory and practice in the implementation of music no- tation display software. We needed a formal (computable) way to relate notation to its performance, and we found conventional notions too limiting to express what we found in actual printed scores. To address this problem, we developed new theoretical foundations based upon models of formal language and compilation, and we applied these develop- ments to the implementation of a flexible music display system.

Music control flow is the reading order of measures affected by control symbols including the time signature, measures, repeats, endings, DC/DS signs, section signs, etc. It can also be viewed formally as a function f that maps the performed beat k to a location of a score, <m, b>, a measure and beat pair. f (k) describes the reading order of the score. In principle, we can rewrite the score in the order f ( 1 ), f ( 2 ),... to create an equivalent score with no control flow (other than reading sequentially). We call this the “flattened score” or “performance score”. Audio recordings and MIDI sequences are both in the order of the flattened representation of the corresponding score.

Existing music theory devotes little attention to control flow, and in fact, there does not seem to be even a standard term for the concept of control flow. Conventional practice focuses on meaning of individual control flow symbols; the most widely accepted way is to use words and visuals to illustrate the reading order. For example, Read uses arrows to mark the true reading order (see Figure 1.1) [20]. This approach defines both the syntax and meaning.

In this work, we focus on a system that formalizes the syntax and semantics of control flow notation. The goal is to form a definition that meets the two criteria: (1) A well-defined syntax provides productions for interpreting all valid scores; (2) A well-defined semantics ensures that all valid scores have one and only one interpretation, namely there is a unique mapping from beat to score position. Under these criteria, however, the conventional visual definition is incomplete; there are cases where we are not sure which rule to use. One such case is nested repeats where there are two ways of grouping the right repeat with the left repeat. In common practice music, we often restrict the number of levels of repeats to be

Chapter 2

Background and Motivation

Similar to the concept of control flow used in programming language, music control flow defines the reading order of a score and is used to both simplify and clarify the score structure by merging repetitive patterns into loops. Also similar to programming languages, music control flow has implicitly included both branching and looping expressions [?]. This statement will be further evaluated in Section 4.1 and it also motivates this work to explore music notation and extend it as if it is a program language. Before going into details of the formal semantics behind the music practice, this chapter reviews music symbols and their general usage that are frequently seen in real music practice. It also draws upon the difference between tradition music notation and the more flexible and informal practices used in popular music such as Jazz to show the need of finding a practical and well-defined framework for people to formalize and explain existing and new music notation. In the last section, we review some of the existing digital music display and representation approaches that relate to and motivate the design of Live Score Display, the real-time score display system built over the formal definition of music control flow notation.

4

2.1. COMMON MUSIC PRACTICE 5

2.1 Common Music Practice

The so-called “common practice” refers to the traditional and widely-used system of mu- sic notation, consistent with most popular music education books and manuals[6, 20, 23]. The main elements include repeat, endings, and a series of Da Capo / Dal Segno nota- tion (“DC/DS family” for abbreviation). The following is a list of symbols used in these notation patterns:

  • Left repeat and right repeat: ‖: and :‖ (double-sided repeat :‖: can be seen as one right repeat followed by a left repeat);
  • First and second ending: − 1 ¬ and − 2 ¬. Sometimes, there might be a third or a fourth ending;
  • DC/DS family and related symbols, including D.C., D.S., D.C. al coda, D.S. al coda, D.C. al fine, D.S. al fine, Segno, to coda, coda, and fine;
  • Measure repeat signs.

To define the meaning and usage of these symbols, most books use visual definitions like the one in Read’s book [20], which is based on redirection, and the one shown in Figure 2.1, which is based on the reading order. These definitions are well defined for the reading order given a score without erratic or ambiguous notation, but the definitions alone are not precise or complete to show what’s correct and non-ambiguous for all scores. To do that, we often make the following assumptions:

  • No control flow symbols are allowed within the blank staff in Rule 1, 2 and 3.
  • There can only be at most one type of DC/DS symbols in the entire music.
  • Left and right repeats can be used within the blank staff in Rules 4-9.

Although these assumptions are not as formal as those visual definitions and it is possible for us to find ambiguous counter examples, they do a good job excluding a large number of cases, especially the nested repeats, from the set of “correct music notation” in common

2.2. EXTENDED MUSIC PRACTICE 7

Figure 2.2: Control flow notation in modern music practice

many unconventional examples found in The Real Book [9]. The six examples^1 contain four typical notations in modern music practice:

Nested repeats (example 1 and 5): it is assumed in the book that repeat signs work like nested brackets; the right repeat sign is associated with the left repeat sign at the same level instead of the closest.

Multiple and nested DS/DC-coda notation: In Example 3, the notation is complicated. The relation among D.C. al coda, to coda and coda signs are connected by lines. (^1) From 1 to 6: “Follow Your Heart” by J. Mclaughlin pp.154–155; “Forest Flower” by Charles Lloyd p.158; “Good Evening Mr. & Mrs. America” by John Guerin p.176; “Group your own” by Keith Jarrett p.182; Little Niles by Raudy Weston p.267; “Mallet Man” by Gordon Boek p.

8 CHAPTER 2. BACKGROUND AND MOTIVATION

Re-arranged sections (Example 2): re-order the section marks to create a different read- ing order of the score.

Word annotation (Example 1, 4 and 6): omitting or playing some measures conditioned on different rounds of repetition.

One could dismiss these particular scores as anomalies, but we find that in music, the exception proves the rule. Existing commercial software interprets Example 5 inconsis- tently. In Finale 2012 and Sibelius 7, the default reading order is a-b-b-c-b-b-c-d^2 , but in MuseScore^3 , the order is a-b-b-c-a-b-c-d. The second right repeat connects to the be- ginning of the music, capturing the nested pattern, but later, section b is repeated only once, which seems to be a flaw. The correct order is a-b-b-c-a-b-b-c-d, which differs from both software interpretations. Later, we will discuss the practice of “arrangements,” where score sections are performed according to directions that are external to the score itself. This raises additional problems of notation and semantics. Clearly, we need a more so- phisticated approach that offers syntax and meaning that can be shared by both humans and computers. In Chapter 3, we show such an approach based on formal languages and attribute grammars. In Chapter 4, we show an even more flexible method based an interme- diate notation called Score Description Language that supports extensions based on textual annotations. In Chapter 7.2, we show some of the examples of how the extended music practice is mapped onto our approach.

2.3 Score Display and Representation

The score representation and interpretation is essential to score writing, printing, auto- accompaniment and conducting systems. Most works in this field focus mainly on storing and visualizing the score so as to accommodate both traditional and modern music practice, and, as a minor concern, provide room for implementing correct and user-friendly score play-back systems. Early studies such as MuseData [11] and Common Music Notation (^2) One can notate nested repeat by manually specifying which measure the right repeat goes to. (^3) MuseScore music notation software: http://musescore.org/