Musical dice game

Skip to first unread message


Aug 13, 2020, 9:18:06 AM8/13/20
to starstarhug
Hi **HUGers,

I implemented a musical dice game as a demonstration of using the Humdrum Notation Plugin with interactive javascript code:

There is also a stand-alone website that gives an enhanced interface version of the same example:

There is a grid of measures that you select with the roll of two dice to generate a particular realization of the music:

Screen Shot 2020-08-12 at 4.49.41 PM.png

To play the music, a link on the right above the realization loads the score into VHV.  You can also load the full score directly into VHV from this link:

Screen Shot 2020-08-13 at 5.24.21 AM.png

where there is documentation about the game in the header to the score along with example use of the myank ("measure yank") filter to extract the measures into a realized score.

Note that from, the realized score does not show the Humdrum text in VHV:

Screen Shot 2020-08-13 at 6.04.57 AM.png

This is done by adding the parameter k=y to the URL.  To view the text editor in VHV, type alt-y (or option-y in MacOS):

Screen Shot 2020-08-13 at 6.06.42 AM.png

A new feature added to the myank filter is allowing for measure styling.  For example there are 11 ending measures for the realization, and they are not stored with final barlines in the combined input score (since that would instead add a final barline to the start of the next measure when extracted).  Instead, you can add the final barline styling in the measure extraction string for myank, such as:

     !!!filter: myank -m "131"

which produces:

Screen Shot 2020-08-13 at 5.30.03 AM.png


     !!!filter: myank -m "131=="

adds a double barline styling after measure 131:

Screen Shot 2020-08-13 at 5.31.33 AM.png

The quotes around the extraction list are optional if you do not use spaces, but if used on the command-line, you will also have to enclose in quotes if you give stylings that involve the pipe character, such as for double barlines:

     !!!filter: myank -m "14||83||79||170||93||151|172||111||8||78||131=="

Screen Shot 2020-08-13 at 5.34.11 AM.png

which is a display of all of the ending measures for the game (you are guaranteed to cadence on C :-)

The source edition for the Humdrum encoding is from a version printed in Berlin around 1790:,_K.516f_(Mozart,_Wolfgang_Amadeus)

I compared it to the c. 1793 Bonn edition and there were a few differences.  One of the differences was clearly an error that was probably added during typesetting:

Screen Shot 2020-08-10 at 11.50.16 AM.png Screen Shot 2020-08-10 at 11.49.29 AM.png

(score on the left is using a sopano clef on the top staff)

On the left is the Berlin edition and on the right is the Bonn edition.  The C3 at the end of the bottom staff is probably wrong since it is a non-harmonic note compared to the other notes (and was accidentally copied from the pattern of a nearby measure), and in the Bonn edition there is instead a rest (so it was either a corrected copy of the Berlin edition or perhaps typeset from a different source that did not have the error).

Such errors can be encoded along with their resolutions in the Humdrum scores with the SIC system that I recently implemented:

Measure 117 is encoded in the Humdrum score like this:

Screen Shot 2020-08-13 at 5.49.54 AM.png

The token


means that the next note (or rest in this case) was originally an eighth-note C3 in the source edition.

The sic filter can be used to show the original diplomatic version of the score by adding the filter line:

   !!!filter: sic -o

(with -o meaning "original"):

Screen Shot 2020-08-13 at 5.53.34 AM.png

If you compile the filter (by typing alt-c or option-c on MacOS), you can see what happens to the digital score:

Screen Shot 2020-08-13 at 5.54.27 AM.png

In this case the "8r" and "8C" tokens are swapped, and the token:


means that the next note is marked as being incorrect in the original score, and it should be substituted with an eighth-note rest as a correction.

When editing scores in VHV, you can display markers above notes that have SIC qualifications by using this filter:

     !!!filter: sic -v

(-v meaning "verbose").  This will cause a green triangle icon to display above the note that has a sic parameter:

Screen Shot 2020-08-13 at 6.00.11 AM.png

To force the corrections to display as well as the warning marker:

     !!!filter: sic -sv

Screen Shot 2020-08-13 at 6.01.03 AM.png


Reply all
Reply to author
0 new messages