GSoC Week 1 – Rhythm input and switching note entry modes
This is the second blog post about my project to improve note entry in MuseScore as part of Google Summer of Code. In my first post I explained how the new note entry modes would work from the user’s point of view. For the past week I have been laying the foundations for the new modes in MuseScore’s code, including the ability to switch between different input modes. This was my first week of actual coding, so I also spent some time familiarising myself MuseScore’s code structure and the existing note entry mode.
Switching between note entry modes
Before implementing the new input modes I wanted to work out how they would be presented to the user. It is good coding practice to keep the details of implementation separate from the user interface as much as possible. However, implementation and interface will inevitably be related to some extent and it is important that the relationship is done in a logical way. MuseScore users are probably familiar with re-pitch mode, which allows you to quickly change the pitch of a series of notes without affecting their rhythms. Re-pitch mode is currently accessed via a button on the note input toolbar right next to the button for note entry mode. The fact that they have separate buttons means that re-pitch mode and note entry mode are often treated as two independent modes in MuseScore’s code, despite the fact that re-pitch mode does nothing outside of note entry mode. In my implementation I have removed the re-pitch button and added a drop-down list of note entry modes to the note input button. Clicking the button once toggles note input on or off, while holding the button allows access to the sub-modes.
Existing note input and re-pitch buttons:
New note entry menu:
As well as saving space on the toolbar, this arrangement is more logical, in my opinion, because it makes it clear to the user that re-pitch mode is actually a type of note entry mode rather than a separate mode in its own right. A corresponding change has been made within the code, where there is a single “note entry mode” and re-pitch mode is now treated as one of many possible “note entry methods”. The note entry toolbutton menu is the first of it’s kind in MuseScore, and it proved to be a bit tricky to get it to behave exactly as I wanted and I had to override some aspects of the default menu behaviour as defined in Qt. (Qt is the set of libraries MuseScore uses to achieve a consistent look-and-feel across different operating systems: Windows, Mac and Linux.)
Rhythm input – a new note entry mode
There are three new modes in addition to normal (steptime) and re-pitch modes. The bulk of my project will be spent implementing the realtime and semi-realtime modes I discussed in my last post. However, while doing a little research into other music notation programs, I came across a unique approach to note entry offered by Denemo, a frontend for Lilypond. Denemo has a two-pass method to entering notes: firstly the user enters the rhythm for the entire piece, and then they go back and assign pitches to each rhythm. Although it’s not really related to my semi-realtime idea, Denemo’s mode of input is much easier to implement and doing so seemed like a good way to get to grips with the existing codebase before moving on to semi-realtime note entry.
In fact, MuseScore’s re-pitch mode has the second step of Denemo’s input mode covered already, so all that’s missing is a way to add rhythms with a single keystroke. To implement this, I simply used the existing numeric shortcuts for changing note duration. In note entry mode, pressing the number 5 on the keyboard normally switches to a crotchet (quarter-note) in the toolbar, but in rhythm mode it actually adds a crotchet to the score (currently the pitch is set to middle C). This allows the user to enter rhythms quickly using just the numbers 1-9 without having to swap to keys to enter pitches. Pitches are added later in re-pitch mode.
That’s basically all so far. There are still a few things left to iron out with rhythm mode, such as how to enter rests and dotted notes, but my focus for next week will be on getting started with the semi-realtime modes.
Link to MuseScore blog post: https://musescore.org/en/user/57401/blog/2016/05/29/gsoc-2016-week-1-switching-note-entry-modes-and-rhythm-input