craigsapp / humlib

Humdrum data parsing library in C++
http://humlib.humdrum.org
BSD 2-Clause "Simplified" License
32 stars 8 forks source link

Add new tool to mark sections of a kern score #104

Open WolfgangDrescher opened 1 week ago

WolfgangDrescher commented 1 week ago

To highlight certain moments or sections in a score, I currently often use small JavaScript functions. Since this is unreliable, especially with spine splits, I have now added a tool called notemark. So you can easily highlight certain parts in the browser by adding a line !!!filter: notemark -l 19 or something similar before the score is rendered with Verovio.

notemark is perhaps not the best naming. I am open to better suggestions. How about notemarker or notehighlight?

Currently the highlighting of notes is only supported via line numbers. In the future it might be useful to implement support for measures or beat segments.

test.krn:

**kern  **kern  **kern  **kern
*clefF4 *clefGv2    *clefG2 *clefG2
*k[f#]  *k[f#]  *k[f#]  *k[f#]
*M3/4   *M3/4   *M3/4   *M3/4
4GG 4B  4d  4g
=1  =1  =1  =1
4G  4B  4d  2g
4E  8cL 4e  .
.   8BJ .   .
4F# 4A  4d  4dd
=2  =2  =2  =2
4G  4G  2d  4.b
4D  4F# .   .
.   .   .   8a
4E  4G  4B  4g
=3  =3  =3  =3
4C  8cL 8eL 4.g
.   8BJ 8d  .
8BBL    4c  8e  .
8AAJ    .   8f#J    8a
4GG 4d  4g  4b
=4  =4  =4  =4
2D; 2d; 2f#;    2a;
==  ==  ==  ==
*-  *-  *-  *-

notemark test.krn -l 19:

**kern  **kern  **kern  **kern
*clefF4 *clefGv2    *clefG2 *clefG2
*k[f#]  *k[f#]  *k[f#]  *k[f#]
*M3/4   *M3/4   *M3/4   *M3/4
4GG 4B  4d  4g
=1  =1  =1  =1
4G  4B  4d  2g
4E  8cL 4e  .
.   8BJ .   .
4F# 4A  4d  4dd
=2  =2  =2  =2
4G  4G  2d  4.b
4D  4F# .   .
.   .   .   8a
4E  4G  4B  4g
=3  =3  =3  =3
4C  8cL 8eL 4.g@
.   8BJ 8d  .
8BBL@   4c@ 8e@ .
8AAJ    .   8f#J    8a
4GG 4d  4g  4b
=4  =4  =4  =4
2D; 2d; 2f#;    2a;
==  ==  ==  ==
*-  *-  *-  *-
!!!RDF**kern: @ = marked note color="#ef4444"

notemark test.krn -l 11-15 -k 1,4

**kern  **kern  **kern  **kern
*clefF4 *clefGv2    *clefG2 *clefG2
*k[f#]  *k[f#]  *k[f#]  *k[f#]
*M3/4   *M3/4   *M3/4   *M3/4
4GG 4B  4d  4g
=1  =1  =1  =1
4G  4B  4d  2g
4E  8cL 4e  .
.   8BJ .   .
4F# 4A  4d  4dd
=2  =2  =2  =2
4G@ 4G  2d  4.b@
4D@ 4F# .   .
.   .   .   8a@
4E@ 4G  4B  4g@
=3  =3  =3  =3
4C  8cL 8eL 4.g
.   8BJ 8d  .
8BBL    4c  8e  .
8AAJ    .   8f#J    8a
4GG 4d  4g  4b
=4  =4  =4  =4
2D; 2d; 2f#;    2a;
==  ==  ==  ==
*-  *-  *-  *-
!!!RDF**kern: @ = marked note color="#ef4444"