Well, we’ve got MuseScore swinging! At least for the cases used most often 🙂
You can find the relevant branch here: https://github.com/shredpub/MuseScore/tree/swing2
Cases tackled so far:
Swinging eighth notes
Swinging dotted quarter notes
For quarter notes, the implementation needs to be improved further. The quarter notes on the offbeat are currently being shortened, (which is not the desired behavior) which will soon be taken care of.
Also, the code I had initially submitted had some formatting issues, so I reformatted the code and structured it according to the MuseScore coding rules. I hope it is fine now.
One logical flaw in the initial implementation was that I was considering the relative change in length of the chords with respect to the duration of original chord rather than the duration of the beat. Thanks to Marc for pointing this out. This is now fixed too.
Soon I’ll be adding the functionality of user specified swing ratio. The idea is to have a nice slider presented to the user, which would alter the swing ratio on the fly, thereby enabling playback with different swing ratios in real time. Alternatively, we can have a dialog box with certain fields whose values are set by default (eg: ratio is set to 50/50 i.e. no swing) which could be modified. (I like the slider idea more!) With that into place, we will have a decent basic feature for swing playback for MuseScore.
So this will be what I will be working on for the next week. Stay tuned!