GSoC 2016 - Week 1 - Switching note entry modes and rhythm input

Posted 6 years ago

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:

note-entry-mode-button.png

New note entry menu:

note-entry-toolbutton-menu.png

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 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.

Personal blog post: http://peterjonas.net/blog/musescore/gsoc-week-1-rhythm-input-and-switc…


Comments

In Rhythm mode, I wanted to add a rest or three. So far the only way I can find is to press zero, which puts things into rest-entry mode. Can I suggest that pressing another key in combination with 4 could enter a quaver rest? I want to put in quaver,rest,quaver,rest,quaver,rest,quaver,rest etc and I find the current way a little tricky. Also, I couldnt find a way to change a note into a rest and vice versa. The note duration is correct - I just want to convert it into a rest. R would be good!
I am using Revision 53d4ad2

In reply to by Frank Eden

Just curious, are you using the computer keyboard and find pressing a sequence such as A0B0A0C0 tricky?

I find the keyboard method very easy. My left hand is on the notes and my right hand is on the key pad pressing the proper number for the duration and 0 as needed for rests. But then again, I used to enter binary code programs out of magzines into my PC 25 years ago and its almost the same keys as hexadecimal numbers. In any case, with a little practice it becomes easy. If the note duration is correct get out of note entry mode and click the note and press 0, the note becomes a rest of the same duration. If there is a rest and you want to turn it into a note just click the rest (not in note entry mode) and press the letter for the note. The duration will remain the same.

In reply to by mike320

Note I am using new "Rythm mode", (available in the latest nightly build) . I want to enter a series of quavers separated by quaver rests. Unless I am mistaken, I would need to enter the following:
"40404040404" etc. Each time I press zero, it changes mode and I find it confusing to remember which mode I am in,especially since if I get it wrong, I cannot easily change it to a rest (or a note).

Here is my new suggestion: Use zero as a modifier key. Pressing it would change the last note entered into a rest or vice versa. So the sequence would be "440440440" etc

In addition, after selecting a note eg by using the back arrow key, pressing zero would toggle it - from note to rest and vice versa/

Thoughts?