Humdrum wiki extension

From CCARH Wiki
Revision as of 18:20, 14 December 2018 by Craig (talk | contribs)
Jump to navigation Jump to search

The CCARH wiki includes a Humdrum music notation extension that allows Humdrum data embedded within a page to be rendered as graphical music notation.

Here is a basic example:

<humdrum>

    • kern

1f;

  • -

</humdrum>

The above notation was created with the Humdrum tag:


  <humdrum>
  **kern
  1f;
  *-
  </humdrum>


Here is a more complicated example that includes lyrics, coloring of notes with RDF records, and a transposition filter (Transposing from A-flat major in the data to C major in the notation).


<humdrum scale="55"> !!!OMD: Slow

    • kern **text
  • k[b-e-a-d-] *
  • A-: *
  • M4/4 *
  • met(c) *
  • *color:gold

4cc If =1 =1 (8dd-L@ Mu- 8ccJ)@ . (8b-L@ -sic_ 8a-J)@ . (8gL be_ 8a-J) . (8b-L the_ 8ccJ) . =2 =2 (8b-L food_ 8a-J) . (8gL of_ 8fJ) . 4.enN Love, 8c sing =3 =3 4f on, 4f sing 4.a- on, 8f sing =4 =4 4cc on, 4cc sing 4.ee- on, =- =-

  • - *-

!!!RDF**kern: @ = marked note, color=chartreuse !!!RDF**kern: N = marked note, color=hotpink !!!filter: transpose -k c </humdrum>


which was created with the text:

  <humdrum scale="55">
  !!!OMD: Slow
  **kern	**text
  *k[b-e-a-d-]	*
  *A-:	*
  *M4/4	*
  *met(c)	*
  4cc	If
  =1	=1
  (8dd-L@	Mu-
  8ccJ)@	.
  (8b-L@	-sic_
  8a-J)@	.
  (8gL	be_
  8a-J)	.
  (8b-L	the_
  8ccJ)	.
  =2	=2
  (8b-L	food_
  8a-J)	.
  (8gL	of_
  8fJ)	.
  4.enN	Love,
  8c	sing
  =3	=3
  4f	on,
  4f	sing
  4.a-	on,
  8f	sing
  =4	=4
  4cc	on,
  4cc	sing
  4.ee-	on,
  =-	=-
  *-	*-
  !!!RDF**kern: @ = marked note, color=chartreuse
  !!!RDF**kern: N = marked note, color=hotpink
  !!!filter: transpose -k c
  </humdrum>


The standard WikiMedia page editor does not allow inserting tab characters, so either copy-and-paste humdrum text from another editor, such as http://verovio.humdrum.org,

(which can also be used to validate the Humdrum data) or encode the Humdrum data in CSV format instead of TSV:


  <humdrum scale="55">
  !!!OMD: Slow
  **kern,**text
  *k[b-e-a-d-],*
  *A-:,*
  *M4/4,*
  *met(c),*
  4cc,If
  =1,=1
  (8dd-L@,Mu-
  8ccJ)@,.
  (8b-L@,-sic_
  8a-J)@,.
  (8gL,be_
  8a-J),.
  (8b-L,the_
  8ccJ),.
  =2,=2
  (8b-L,food_
  8a-J),.
  (8gL,of_
  8fJ),.
  4.enN,"Love,"
  8c,sing
  =3,=3
  4f,"on,"
  4f,sing
  4.a-,"on,"
  8f,sing
  =4,=4
  4cc,"on,"
  4cc,sing
  4.ee-,"on,"
  =-,=-
  *-,*-
  !!!RDF**kern: @ = marked note, color=chartreuse
  !!!RDF**kern: N = marked note, color=hotpink
  !!!filter: transpose -k c
  </humdrum>
  

The TSV form of Humdrum can be converted to CSV on VHV by using the alt-u command. Verovio and the humdrum-plugin library know how to convert the CSV form of Humdrum back into the TSV form for processing.


Options

The Humdrum notation extension is implemented using the humdrum javascript plugin documented at https://plugin.humdrum.org. All of the options described in that documentation can be used as attributes for the humdrum element on a wiki page. The full list of options: https://plugin/humdrum.org/options.

Here is an example that loads the Humdrum data from an external source, and it is not stored in the webpage:

<humdrum

        url="https://raw.githubusercontent.com/craigsapp/mozart-piano-sonatas/master/kern/sonata06-3c.krn"
        scale="33"
        header="true"

></humdrum>


This musical example was created with the following text:


  <humdrum 
           url="https://raw.githubusercontent.com/craigsapp/mozart-piano-sonatas/master/kern/sonata06-3c.krn"
           scale="33"
           header="true"
  ></humdrum>

In this case, the music is downloaded from the Github repository https://github.com/craigsapp/moart-piano-sonatas.