humdrum-tools / verovio-humdrum-viewer

Verovio Humdrum Viewer
http://verovio.humdrum.org
37 stars 9 forks source link

Merge multiple spines into a single staff #778

Open WolfgangDrescher opened 1 year ago

WolfgangDrescher commented 1 year ago

Is it currently possible to display multiple spines in a single staff with multiple layers? I have already seen this discussion from **HUG: https://groups.google.com/g/starstarhug/c/PcFt9hha4lQ/m/BKs2DxN_BgAJ. However, the satb2gs filter does not work in my case, because I need three voices in the right hand of a piano system and only one in the left hand.

Ideally it should be possible to transform the score directly in the browser with verovio. Any hint on where to start for an implementation for this?

craigsapp commented 1 year ago

satb2gs could be adjusted to convert 4-part single-voice parts to this format.

Currently this can be done semi-automatically by first running this filter:

extract -k 1,4,3,2

This extracts the first, then the fourth, third and finally second staves from the original score. Subspines are arrange from high-to-low unlike staves which are low-to-high, so the extract command is flipping the three voices to get ready to merge into a single staff.

Then I hand-edited the output of the extract filter (which can be automated in the satb2gs filter):

Screen Shot 2022-11-07 at 8 59 47 PM

Lines 10 and 11 expand the top staff to three voices.

Line 23 has *join interpretations which will merge the stems of notes in different layers if they have the same durations. This is only implemented currently for 2 voices/layers, so I would also need to expand to 3 so that the first chord in the top staff all share a stem for the quarter-note duration (line 24).

There would need to be some clean up for things such as the fermatas in measure 4 (just one fermata above the top staff should be sufficient if all rhythms are the same for the fermata notes).

How to deal with figured-bass spines and scale degrees would have to be considered (probably OK if they are attached to the bass part).

Click to view hand-edited 1+3 layout of a Bach chorale ```tsv !!!!SEGMENT: chor001.krn !!!COM: Bach, Johann Sebastian !!!CDT: 1685/02/21/-1750/07/28/ !!!OTL@@DE: Aus meines Herzens Grunde !!!OTL@EN: From the Depths of My Heart !!!SCT: BWV 269 !!!PC#: 1 !!!AGN: chorale **kern **kern * *^ * * *^ *ICvox *ICvox *ICvox *ICvox *Ibass *Isoprn *Ialto *Itenor *I"Bass *I"Soprano *I"Alto *I"Tenor *>[A,A,B] *>[A,A,B] *>[A,A,B] *>[A,A,B] *>norep[A,B] *>norep[A,B] *>norep[A,B] *>norep[A,B] *>A *>A *>A *>A *clefF4 *clefG2 *clefG2 *clefGv2 *k[f#] *k[f#] *k[f#] *k[f#] *G: *G: *G: *G: *M3/4 *M3/4 *M3/4 *M3/4 *MM100 *MM100 *MM100 *MM100 * *join *join *join 4GG 4g 4d 4B =1 =1 =1 =1 4G 2g 4d 4B 4E . 4e 8cL . . . 8BJ 4F# 4dd 4d 4A =2 =2 =2 =2 4G 4.b 2d 4G 4D . . 4F# . 8a . . 4E 4g 4B 4G =3 =3 =3 =3 4C 4.g 8eL 8cL . . 8d 8BJ 8BBL . 8e 4c 8AAJ 8a 8f#J . 4GG 4b 4g 4d =4 =4 =4 =4 2D; 2a; 2f#; 2d; 4GG 4b 4g 4d =5 =5 =5 =5 4FF# 2dd 4d 4A 4GG . 4e 4B 4AA 4cc 4f# 4c =6 =6 =6 =6 4BB 4b 2g 4d 4C 2a . 4e 4D . 4f# 8dL . . . 8cJ =7 =7 =7 =7 2GG; 2g; 2d; 2B; =:|! =:|! =:|! =:|! *>B *>B *>B *>B 4GG 4b [4g 4d =8 =8 =8 =8 4GG 4b 8gL] 4d . . 8f#J . 4AA 4cc 8eL 4c . . 8f#J . 4BB 4dd [4g 8BL . . . 8AJ =9 =9 =9 =9 4.BB 4.dd 8gL] 8BL . . 8aJ 8cJ . . 8gL 4d 8AA 8cc 8f#J . 4GG 4b 4g 4d =10 =10 =10 =10 2D; 2a; 2f#; 2d; [4E 4g 4e 4B =11 =11 =11 =11 4E] 2b 4e 4G 4D . 8f#L 4B . . 8gJ . 4C 4cc 4a 4e =12 =12 =12 =12 4.BB 2dd 4a 2d . . 4.g . 8C . . . 4D 4cc . 4d . . 8f# . =13 =13 =13 =13 8GGL 2.b 2g 2.d 8AAJ . . . 4BB . . . 4GG . 4f . =14 =14 =14 =14 2C; 2g; 2e; 2c; 4GG 4b 4g 4d =15 =15 =15 =15 4FF# 2dd 4.a 8dL . . . 8cJ 4GG . . 4B . . 8g . 4AA 4cc 4f# 4c =16 =16 =16 =16 4BB 2b 2g 2d 4GG . . . 4D 4a [4f# 8dL . . . 8cJ =17 =17 =17 =17 8EL 4.g 8f#L] 4B 8D . 8eJ . 8C . 8eL 4c 8BB 8a 8f#J . 8AA 4b 4g 4d 8GGJ . . . =18 =18 =18 =18 2D; 2a; 2f#; 2d; [4G 4b 4g 4d =19 =19 =19 =19 4G] 2dd 2a 2d 4F# . . . [4E 4cc 8gL 4e . . 8f#J . =20 =20 =20 =20 8EL] 4b 2g 2e 8DJ . . . 4C 2a . . 4D . 4f# 8dL . . . 8cJ =21 =21 =21 =21 2GG; 2g; 2d; 2B; == == == == * *v *v *v *- *- !!!hum2abc: -Q '' !!!title: @{PC#}. @{OTL@@DE} !!!YOR1: 371 vierstimmige Choralgesänge von Johann Sebastian Bach, !!!YOR2: 4th ed. by Alfred Dörffel (Leipzig: Breitkopf und Härtel, !!!YOR3: c.1875). 178 pp. Plate "V.A.10". reprint: J.S. Bach, 371 Four-Part !!!YOR4: Chorales (New York: Associated Music Publishers, Inc., c.1940). !!!SMS: B&H, 4th ed, Alfred Dörffel, c.1875, plate V.A.10 !!!EED: Craig Stuart Sapp !!!EEV: 2009/05/22 ```