Cautionary key signature at end-repeat bar

I have a score where the end-repeat sends the singer back to a bar with a different key signature.

The segment in C minor ends at bar 29 and sends the singer back to an earlier bar where the key signature is D minor. The comment in red is from a pencilled note in my score.

My experience with vocal scores is primarily Baroque where that sort of thing doesn’t happen. But I did realize that the pencilled note, however helpful, was hardly standard, so I looked in my reference (Gould, Behind Bars, 235), which tells me that the proper thing to do is to have a cautionary key signature before the end-repeat barline. So, there should be a flat sign on the second line after the G quaver in the last beat of bar 29.

Dorico would not let me put a key change there: it had to be before the G quaver, or after the barline, which would contradict the key change to C major after the repeat. I did try putting the key change before the G quaver and moving it graphically to before the barline in Engrave mode. That might work for vocal music where the note to be sung is not affected by the key change, but for instrumental music (and so, in general) it is clearly only a partial visual solution.

Is there a solution other than the graphical cheat, and if so, what is it? I am so accustomed to having Dorico do the right thing without being asked that I am a bit baffled. I know that repeat barlines are quite clever, but I really don’t expect them to be that clever.

Dorico can put a key signature change at any rhythmic position by activating the caret, moving it to that rhythmic position, typing Shift-K to open the key signature popover and entering the desired key. But in your example, if the key signature is changed to D minor on the last 32nd of bar 29, the change to C major in bar 30 will not have the correct number of naturals to show the change from C minor:


What we need is a key signature that looks like D minor but behaves like C minor. To do this, edit the 12-EDO tonality system, add an accidental that looks like a natural but behaves like a flat by setting its pitch delta to -1, and add a custom key signature that has a normal Bb and the new accidental in place of Eb and Ab. Now activate the caret, move it to the last 32nd of bar 29 and change to the custom key signature. This provides the correct number of naturals in bar 30 but has too many at the end of bar 29:


The final step is to edit the tonality system again and delete the natural glyph from the new accidental:



Though John’s advice is quite ingenious, I think it’s only right to point out that I agree Dorico should handle this kind of situation automatically, and indeed making it do so is on our list of features to add in future versions.


Thank you both for the differently helpful responses. I’m especially grateful to John for pointing out the defect in my proposal, that would cause the key change to C major in bar 30 to cancel one preceding flat instead of three.