paulrosen / abcjs

javascript for rendering abc music notation
Other
1.94k stars 285 forks source link

clef change in grand staff does not persist to subsequent lines #1041

Open AGBrown opened 2 months ago

AGBrown commented 2 months ago

Environment:

Issue:

As the title says, if you change clef in the following abc, then it does not persist on subsequent lines:

(expand for test abc).

``` %abc-2.1 X:0 T:Clef change test %%barnumbers 1 %%measurenb 0 %%score {R|L} %%stretchlast 1 Q:"Misterioso" 1/4=80 M:2/4 L:1/4 V:R clef=treble V:L clef=bass K:Gmaj [V:R] x x/ G/ | G2 | G2 | G2 | [V:L] x x/ z/ | C2 | C2 | C2 | % %%vskip 40 [V:R] G2 | G2 | G2 | G2 | [V:L] C2 | C2 | C2 | [K:clef=treble] C2 | % %%vskip 40 [V:R] G2 | G2 | G2 | G2 |] [V:L] C2 | C2 | C2 | C2 |] ```

Expected output

The clef change should persist on subsequent lines for the relevant stave.

(e.g. from abc2svg ):

(expand for example of expected rendered output).

![image](https://github.com/user-attachments/assets/b106eac4-e4be-4f14-bb3c-f53e515e3efa)

Actual output:

The clef change does not persist for subsequent lines for the relevant stave.

(expand for actual output image).

![image](https://github.com/user-attachments/assets/ad3344de-48ce-4a0e-bab0-c90796ab2c75)

As you can see, the treble clef is not persisted for the lower staff on the last line. There is also a difference in where the treble clef change is rendered, but I'm not sure this is important.

Other observations

%abc-2.1

X:1
T:Clef and key change test
%%barnumbers 1
%%measurenb 0
%%score {R|L}
%%stretchlast 1
Q:"Misterioso" 1/4=80
M:2/4
L:1/4
V:R clef=treble
V:L clef=bass
K:Gmaj
[V:R] x x/ G/ | G2 | G2 | G2 |
[V:L] x x/ z/ | C2 | C2 | C2 |
%
%%vskip 40
[V:R] G2 | G2 | G2 | [K:Dmaj] G2 |
[V:L] C2 | C2 | C2 | [K:Dmaj] [K:clef=treble] C2 |
%
%%vskip 40
[V:R] G2 | G2 | G2 | G2 |]
[V:L] C2 | C2 | C2 | C2 |]

(expand for rendered image).

![image](https://github.com/user-attachments/assets/b8d6f625-766b-49f5-b500-5c9057b35ebf)

paulrosen commented 2 months ago

Definitely a bug. Thanks for the report.