0%

A concise representation of sheet music vertical structure

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.

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.