Skip to content

Latest commit

 

History

History
93 lines (57 loc) · 3.69 KB

File metadata and controls

93 lines (57 loc) · 3.69 KB
author k-l-lambda
email k.l.lambda@gmail.com
title A concise representation of sheet music vertical structure
tags
sheet music
DSL
coauthor k-l-lambda
date 2021-10-24 05:50:29 -0700

In the previous post A domain-specific language for sheet music paragraph layout, we discussed how to concisely represent sheet music paragraph structure in computer. Orthogonally, we also need to express the sheet music vertical structure: instruments, staves, voices and their relationship.

{% img figure /images/conductor-music-score-sample.png 480 '"" "conductor music score sample"' %} An example for sheet music vertical structure,
we represents this by <[-]----><[-]--[-]->{-}

We aim to do this concisely and intuitively. And this will be a meta-language which can be exported to other music languges, such as Lilypond, MusicXML and MEI.

The first example

I call this mini language staff layout code. This is our 'hello world':

We can name every staff by an identifier, a string made up with alphabet, number and underscore.

Conjunctions

We define barlines between staves in 3 types: solid -, dashed . and blank ,. And the blank type is default, can be ignored:

Anonymous staves

Staff names is not required to specify. Unnamed staves have number name by default. As a result, the empty string "" is a valid staff layout code, and it represents an anonymous single staff:

Brackets

The grand staff:

We have 3 types of brackets: bracket <>, brace {} and square bracket [].

And you can imagine that rotate the code by 90° to corresponds the sheet music:

Instrument names

Beside staff layout code, we can define the instrument names by a name dictionary.

For the example picture above, the complete representation is:

Try it yourself

Try to customize your own staff layout in below.

We will open source the language library after some arrangement work.

<script src="https://github.com/vue/chunk-vendors.js"></script> <script src="https://github.com/vue/staff-layout-viewer.js"></script>