{"id":10848,"date":"2013-08-07T13:36:07","date_gmt":"2013-08-07T17:36:07","guid":{"rendered":"http:\/\/mith.umd.edu\/?p=10848"},"modified":"2020-10-08T16:00:40","modified_gmt":"2020-10-08T20:00:40","slug":"improving-mei-to-vexflow","status":"publish","type":"post","link":"https:\/\/mith.umd.edu\/improving-mei-to-vexflow\/","title":{"rendered":"Improving MEI to VexFlow"},"content":{"rendered":"<p><em>MEI to VexFlow<\/em> is a JavaScript library used to render music notation encoded according to the \u00a0<a href=\"http:\/\/music-encoding.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Music Encoding Initiative<\/a> (MEI) format. MEI is a community-driven effort to create a commonly-accepted, digital, symbolic representation of music notation documents, while keeping in mind the needs of textual scholars and the Digital Humanities.<\/p>\n<p>The three-month project supported by Google Summer of Code is at its mid-term milestone, and on this occasion it\u2019s worth to have a look what has been achieved and what is coming up for the rest of the project.<\/p>\n<p>During our first month and a half, I\u2019ve been busy revising the existing code and adding new features. The main objective was extending the repertoire and the range of MEI features that <em>MEI to VexFlow<\/em> can support. In order to achieve that, I first focused on <strong>improving the handling of \u201clines\u201d such as slurs, ties and hairpins<\/strong>. This work is very much an under-the-hood improvement, but it is important, because it paves the way for dealing with the quite common phenomenon of hairpins and slurs that do not begin and end precisely with a note on the staff.<\/p>\n<p>&nbsp;<\/p>\n<div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 hundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"background-color: rgba(255,255,255,0);background-position: center center;background-repeat: no-repeat;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-bottom: 0px;margin-top: 0px;border-width: 0px 0px 0px 0px;border-color:#eae9e9;border-style:solid;\" ><div class=\"fusion-builder-row fusion-row\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_1 1_1 fusion-one-full fusion-column-first fusion-column-last fusion-column-no-min-height\" style=\"margin-top:0px;margin-bottom:0px;\"><div class=\"fusion-column-wrapper fusion-flex-column-wrapper-legacy\" style=\"background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;padding: 0px 0px 0px 0px;\"><div id=\"attachment_10850\" style=\"width: 714px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-09.52.03.png\"><img aria-describedby=\"caption-attachment-10850\" class=\"wp-image-10850 size-full\" title=\"Introduction and Allegro by Maurice Ravel\" src=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-09.52.03.png\" alt=\"Introduction and Allegro by Maurice Ravel\" width=\"704\" height=\"115\" srcset=\"https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-09.52.03-200x33.png 200w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-09.52.03-700x115.png 700w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-09.52.03.png 704w\" sizes=\"(max-width: 704px) 100vw, 704px\" \/><\/a><p id=\"caption-attachment-10850\" class=\"wp-caption-text\">Figure 1: First four measures from Introduction and Allegro by Maurice Ravel, flute and clarinet parts only (scan)<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>MEI provides two ways of describing where a line begins and where it ends. The most straightforward way is to specify that a crescendo, for instance, \u2018starts at note one in measure two and ends at note two in measure two\u2019, as in the example below:<\/p>\n<p>On the other hand there are instances when the line doesn\u2019t exactly correspond to the start of notes. For these cases MEI allows the encoder to specify two points in time expressed as beats. For example the diminuendo in the second bar of the Ravel example (Figure 1) starts roughly on the third beat, hence one can describe it as a \u2018<em>diminuendo starting at beat three and ending at beat \u201cfive\u201d\u2014that is at the very end of the measure<\/em>\u2019. Or indeed, in the fourth measure the crescendo \u2018<em>starts at beat one and ends at beat three<\/em>\u2019.<\/p>\n<p>I\u2019ve made <em>MEI to VexFlow<\/em> capable of dealing with such encodings, in other words, it is now possible to display lines that are described with beats in the MEI file. Although, VexFlow is only capable of drawing lines that start and end with a note, so my solution was to find the closest notes of two given beats and to draw the lines as if they were attached to such notes. This is a very important step towards more advanced support for these objects. In the future it will be possible to render the lines between the correct locations by calculating offsets from the closest notes.<\/p>\n<p>&nbsp;<\/p>\n<div class=\"fusion-clearfix\"><\/div><\/div><\/div><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-1 fusion_builder_column_1_1 1_1 fusion-one-full fusion-column-first fusion-column-last fusion-column-no-min-height\" style=\"margin-top:0px;margin-bottom:0px;\"><div class=\"fusion-column-wrapper fusion-flex-column-wrapper-legacy\" style=\"background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;padding: 0px 0px 0px 0px;\"><div id=\"attachment_10853\" style=\"width: 278px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-17.20.55.png\"><img aria-describedby=\"caption-attachment-10853\" class=\"wp-image-10853 \" title=\"Second measure from Introduction and Allegro by Maurice Ravel\" src=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-17.20.55.png\" alt=\"Second measure from Introduction and Allegro by Maurice Ravel\" width=\"268\" height=\"114\" srcset=\"https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-17.20.55-200x85.png 200w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-17.20.55.png 430w\" sizes=\"(max-width: 268px) 100vw, 268px\" \/><\/a><p id=\"caption-attachment-10853\" class=\"wp-caption-text\">Figure 2: Second measure from Introduction and Allegro by Maurice Ravel, flute and clarinet part only (as rendered by MEI to VexFlow) MEI to VexFlow draws displays the diminuendo, even though it\u2019s starting at the notehead of the third note in the measure.<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>Several other features have been introduced. <strong>Now it\u2019s possible to display changing time signature, meter or clef<\/strong>. For instance, in the harp part of the Sonata for Flute Viola and Harp by Debussy all three occur at once:<\/p>\n<p>&nbsp;<\/p>\n<div class=\"fusion-clearfix\"><\/div><\/div><\/div><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-2 fusion_builder_column_1_1 1_1 fusion-one-full fusion-column-first fusion-column-last fusion-column-no-min-height\" style=\"margin-top:0px;margin-bottom:0px;\"><div class=\"fusion-column-wrapper fusion-flex-column-wrapper-legacy\" style=\"background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;padding: 0px 0px 0px 0px;\"><div id=\"attachment_10852\" style=\"width: 382px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-15.33.19.png\"><img aria-describedby=\"caption-attachment-10852\" class=\"wp-image-10852 \" title=\"Excerpt from Sonata for Flute Viola and Harp by Debussy\" src=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-15.33.19.png\" alt=\"Excerpt from Sonata for Flute Viola and Harp by Debussy\" width=\"372\" height=\"109\" srcset=\"https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-15.33.19-200x59.png 200w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-15.33.19.png 577w\" sizes=\"(max-width: 372px) 100vw, 372px\" \/><\/a><p id=\"caption-attachment-10852\" class=\"wp-caption-text\">Figure 3: Excerpt from Sonata for Flute Viola and Harp by Debussy (as rendered by MEI to VexFlow)<\/p><\/div>\n<p>&nbsp;<\/p>\n<p><strong>System breaks are also now supported<\/strong> (Figure 4), and staff connectors are now rendered on the left of each system. Different staff connectors are supported in order to render different symbols connecting different groups of staves (for example, a brace for the piano right left hand, or a bracket for a group of instruments in an orchestral score).<\/p>\n<p>&nbsp;<\/p>\n<div class=\"fusion-clearfix\"><\/div><\/div><\/div><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-3 fusion_builder_column_1_1 1_1 fusion-one-full fusion-column-first fusion-column-last fusion-column-no-min-height\" style=\"margin-top:0px;margin-bottom:0px;\"><div class=\"fusion-column-wrapper fusion-flex-column-wrapper-legacy\" style=\"background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;padding: 0px 0px 0px 0px;\"><div id=\"attachment_10854\" style=\"width: 679px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-07-at-15.38.15.png\"><img aria-describedby=\"caption-attachment-10854\" class=\"wp-image-10854 size-large\" title=\"C Major Prelude from The Well Tempered Clavier by J. S. Bach\" src=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-07-at-15.38.15-980x304.png\" alt=\"C Major Prelude from The Well Tempered Clavier by J. S. Bach\" width=\"669\" height=\"208\" srcset=\"https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-07-at-15.38.15-200x62.png 200w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-07-at-15.38.15-980x304.png 980w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-07-at-15.38.15.png 988w\" sizes=\"(max-width: 669px) 100vw, 669px\" \/><\/a><p id=\"caption-attachment-10854\" class=\"wp-caption-text\">Figure 4: First two lines of the C Major Prelude from The Well Tempered Clavier by J. S. Bach (as rendered by MEI to VexFlow)<\/p><\/div>\n<p>&nbsp;<\/p>\n<div class=\"fusion-clearfix\"><\/div><\/div><\/div><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-4 fusion_builder_column_1_1 1_1 fusion-one-full fusion-column-first fusion-column-last fusion-column-no-min-height\" style=\"margin-top:0px;margin-bottom:0px;\"><div class=\"fusion-column-wrapper fusion-flex-column-wrapper-legacy\" style=\"background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;padding: 0px 0px 0px 0px;\"><div id=\"attachment_10851\" style=\"width: 210px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-11.02.40.png\"><img aria-describedby=\"caption-attachment-10851\" class=\"wp-image-10851 size-medium\" title=\"Multi-staff system with instrument groups\" src=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-11.02.40-200x172.png\" alt=\"Multi-staff system with instrument groups\" width=\"200\" height=\"172\" srcset=\"https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-11.02.40-200x172.png 200w, https:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-11.02.40.png 428w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/><\/a><p id=\"caption-attachment-10851\" class=\"wp-caption-text\">Figure 5: Multi-staff system with instrument groups (as rendered by MEI to VexFlow)<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>These are important steps towards the usability of the scores in real-life use cases such as performance or practice.<\/p>\n<p>For more information about the project, visit our <a href=\"http:\/\/tei-music-sig.github.io\/MEItoVexFlow\/\" target=\"_blank\" rel=\"noopener noreferrer\">project page<\/a> and to see <em>MEI to VexFlow<\/em> in action (scores rendered directly in your browser) try out the <a href=\"http:\/\/tei-music-sig.github.io\/MEItoVexFlow\/demo.html\" target=\"_blank\" rel=\"noopener noreferrer\">demo page<\/a>!<\/p>\n<p><strong>In our next milestone we are turning our attention towards variant handling<\/strong>. Historical musical pieces make their way to us through multiple documents and it often happens that multiple sources introduce differences and variants in the music. We are designing a sample web application that will be able to display 15\u201316<sup>th<\/sup> century music and provide a dynamic mechanism for the user to select which variant they want to see.<\/p>\n<p>To achieve this, we are adding new parsing interface to <em>MEI to VexFlow<\/em> in order to expose the set of variants encoded in the input file. A web application will be able to display this information to the user and allow them to make their choices before rendering, and to see multiple variants at the same time.<div class=\"fusion-clearfix\"><\/div><\/div><\/div><\/div><style type=\"text\/css\">.fusion-fullwidth.fusion-builder-row-1 { overflow:visible; }<\/style><\/div>\n","protected":false},"excerpt":{"rendered":"<p>MEI to VexFlow is a JavaScript library used to render music notation encoded according to the \u00a0Music Encoding Initiative (MEI) format. MEI is a community-driven [&hellip;]<\/p>\n","protected":false},"author":33,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[66,77],"tags":[125,126,128,140],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Improving MEI to VexFlow &ndash; Maryland Institute for Technology in the Humanities<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mith.umd.edu\/improving-mei-to-vexflow\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Improving MEI to VexFlow &ndash; Maryland Institute for Technology in the Humanities\" \/>\n<meta property=\"og:description\" content=\"MEI to VexFlow is a JavaScript library used to render music notation encoded according to the \u00a0Music Encoding Initiative (MEI) format. MEI is a community-driven [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mith.umd.edu\/improving-mei-to-vexflow\/\" \/>\n<meta property=\"og:site_name\" content=\"Maryland Institute for Technology in the Humanities\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/UMD.MITH\" \/>\n<meta property=\"article:published_time\" content=\"2013-08-07T17:36:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-10-08T20:00:40+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-09.52.03.png\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mith.umd.edu\/#website\",\"url\":\"https:\/\/mith.umd.edu\/\",\"name\":\"Maryland Institute for Technology in the Humanities\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/mith.umd.edu\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/mith.umd.edu\/improving-mei-to-vexflow\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/mith.umd.edu\/wp-content\/uploads\/2013\/08\/Screen-Shot-2013-08-05-at-09.52.03.png\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mith.umd.edu\/improving-mei-to-vexflow\/#webpage\",\"url\":\"https:\/\/mith.umd.edu\/improving-mei-to-vexflow\/\",\"name\":\"Improving MEI to VexFlow &ndash; Maryland Institute for Technology in the Humanities\",\"isPartOf\":{\"@id\":\"https:\/\/mith.umd.edu\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/mith.umd.edu\/improving-mei-to-vexflow\/#primaryimage\"},\"datePublished\":\"2013-08-07T17:36:07+00:00\",\"dateModified\":\"2020-10-08T20:00:40+00:00\",\"author\":{\"@id\":\"https:\/\/mith.umd.edu\/#\/schema\/person\/f0f966c620a8737b15ad3e4c9d4a352a\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mith.umd.edu\/improving-mei-to-vexflow\/\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/mith.umd.edu\/#\/schema\/person\/f0f966c620a8737b15ad3e4c9d4a352a\",\"name\":\"Zoltan Komives\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/mith.umd.edu\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/be8d65533b52638822db18e96bdcb822?s=96&d=mm&r=g\",\"caption\":\"Zoltan Komives\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/posts\/10848"}],"collection":[{"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/comments?post=10848"}],"version-history":[{"count":1,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/posts\/10848\/revisions"}],"predecessor-version":[{"id":21143,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/posts\/10848\/revisions\/21143"}],"wp:attachment":[{"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/media?parent=10848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/categories?post=10848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mith.umd.edu\/wp-json\/wp\/v2\/tags?post=10848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}