We’ve reached the pencils down date for the Google Summer of Code 2014 program.
We’ve also successfully completed the implementation of swing playback feature for MuseScore 🙂
The idea of implementing the swing playback in two phases, first one with global control and the second one with local control proved to be effective and ensured smooth, step-by-step progress in the coding aspect of the project.
Those who have been following this blog would know that Phase 1 of this project included a global control implementation of the swing using style parameters with control over the type of swing (Eighth note/ Sixteenth note) and the extent of the swing (Swing ratio), and that I have been working on implementing the swing playback by using staff-texts now as part of Phase 2 of the project. I have completed all steps of Phase 2 now and also added tests for the same, so that we can come to know if anytime in the future, the swing behavior breaks due to changes in other parts of the code. The current implementation now uses staff-texts to make the score swing as was planned earlier for the phase 2. User can also add a system text to mark global swing easily. Note that staff text applies swing to the particular staff and system text does so globally. User can use either according to his/her needs.
Thus the current implementation now ensures local control over the swing, and the user can now have all sorts of combinations in his score with regards to swing behavior, for example, swinging eighth notes in some parts of the score with a swing ratio of 60/40, swinging sixteenth notes in other parts of the score with a swing ratio of 70/30, not swinging in remaining parts of the score, and so on. Another change that has been done in the implementation is that in place of using swing unit as 240/120 for eighth note/sixteenth note swing, I am now using the MuseScore constant Division to store the swing unit, thereby eighth note swing has swing unit Division/2 and sixteenth note swing has swing unit Division/4. This is to ensure that the swing works smoothly in case the constant Division is changed from its current value (480 ticks).
This change implies that those scores created using the earlier implementation of the swing feature (The one using style parameters) might not exhibit the desirable swing behavior. However, this should not be a problem as it had not been made part of the public release.
Note that we have also retained the global control through style parameters, so if the user wants a single style of swing for his entire score, (s)he can go for it by going to Style->General and setting the swing settings there (System text would be another (better) way to do so). (S)he can also override the global parameters by using staff-texts within the score to modify the global swing behavior.
Thus, I’ve now implemented a full fledged swing playback feature which uses staff-texts prioritized over style parameters to acquire the parameters from the user.
The link of the relevant PR on Github is :
Those who are too keen to check out the implementation before it gets merged, you can get it by building the branch textswing :
After you build the branch successfully, you can add a staff-text to the staff where you want to add swing, right click on the staff text and go to Staff Text Properties. In that dialog, there is a tab called Swing Settings which contains the UI through which you can enter the swing parameters you want your staff to swing with. If you want global swing, you could as well just add a system text and set the swing parameters there.
Any doubts/clarifications/suggestions are welcome. You can comment on the branch on github or find me idling at MuseScore IRC with the handle ‘shredpub’.