GSoC 2019: Week 2

Posted 2 years ago

After last week's work of automatically opening the instrument change dialog when an instrument change is added, my goal this week was to automatically change the instrument change text to the newly selected instrument.

After a bit of experimentation, this turned out to be a fairly simple thing to do, using the trackName() function on the instrument template, which gets the long name. There is some scope for future work for allowing the user to choose which name to use (long or short), although books such as Elaine Gould's Behind Bars recommends only using the long name.

After doing this, I decided to move on to automatically changing the clef when an instrument change was placed, if necessary. This proved more difficult, as I found it quite tricky to follow the steps of creating a clef, although I got there in the end. My first implementation worked well, and if, for example, the user changed from flute to bassoon, the clef would automatically be changed. The only issue was that if the instrument change was placed at the start of the bar, the clef would be placed after the barline. I therefore added a check, to find the position of the object in the bar, and inserted the clef at the start of the measure if necessary, which places it before the barline.

Over the next week, I will be aiming to automatically change the key signature for transposing instruments.


Sounds great! If changing to a different instrument then the long instrument name is indeed the way to go. The short name might be useful for changing to a different transposition of the same instrument, unless you can handle this automatically and replace the name with "in C" or whatever? Or maybe that could simply be a third option: long name, short name, transposition. Anyway, I agree that the naming is less important than the other changes you are making.

Gould's Behind Bars recommends only using the long name

I agree with this when changing to a completely different instrument, but in Symphonic pieces, changing to an instrument in a different key is more common and the norm in these scores is to simply put "in A" or "muta in La" rather than "Clarinet in A".

Having said this, I like the idea of automatically changing the text, even always to the long name, so it's easier to keep track of which instruments I've changed when I need to change 3 clarinets to A or 4 horns to D. The user still has the option to change the text.

Fortunately (or maybe not) clef and instrument changes at the same time are rare, but the auto clef change is welcome. I'm guessing your clef change can be overridden in a case like when the user changes from a Horn on the bass clef to a different key and still wants to use the bass clef. I say this may be unfortunate because real world testing will not happen a lot.