Is it possible to write a plug-in?

• Feb 16, 2020 - 10:34

Using the "Right Arrow" button you can play the entire melody as if you were playing the piano, but if it has no pauses and tied notes. I want to use the MuseScoore to teach children the duration of notes.
Is it possible to write a plug-in to move the cursor with the "Right Arrow" button without cursor stopping at pauses and the second of two tied notes?


Currently right arrow plays notes without any difference in duration. If this is sufficient for your task and your intention is just to have a way to iterate over notes skipping rests and tied notes I believe it should be perfectly possible to do so. I am not sure whether it is possible to override a global shortcut for right arrow but it should at least be possible to show a panel which would make right arrow behave so when focused (or would contain a button which has a similar effect). If this is what is needed I could describe here possible ways to implement this, or maybe create a minimalistic plugin with this functionality so you could modify it further for your needs.

In reply to by arturchernysh

Well, this indeed is doable. The plugin which implements something similar is attached to this post. You can assign a shortcut to it (be it right arrow or any other key or key sequence) in Plugin Manager, so there is no need to implement any additional UI for it to work. You might need to ensure that the shortcut does not conflict with other shortcuts which are normally defined in Edit→Preferences.

As for its code, the parts which you might most likely need to modify are onRun which defines the main logic of plugin and skipElement which defines criteria for skipping elements when searching for the next note to play. I left comments in the code to explain what happens in some parts of it, but feel free to ask here in case of any questions.

Hope this helps!

Attachment Size
NextPlayedNote.qml 2.77 KB

In reply to by dmitrio95

Hi Dmitrio!
Thanks for the plugin!!
If possible, make changes to the plugin code so that at the beginning of the score the cursor can be placed on the treble clef (or first pause) and begin to move further along the notes from it.
Now the plugin only works if I place the cursor on the first note. But I need to cursor jump to the first note by the first click on the plugin shortcut button.

In reply to by dmitrio95

I found one unpleasant feature - if I move cursor with plug-in hotkey, the program immediately switches to the "note input" mode. If later you want to select some place in the score with the cursor, you have to first exit the input mode by pressing Esc or N. This is very inconvenient - you can accidentally enter an extra note in the score and even not notice it.
Is it possible to change the code so that when moving the cursor with the hotkey, the program does not enter the "note input" mode?

Обнаружил одну неприятную особенность - если перемещать курсор горячей клавишей плагина, то программа сразу переходит в режим "ввод ноты". Если потом хочешь выбрать какое-то место в партитуре курсором, то приходится сначала выходить из режима ввода клавишей Esc или N. Это очень неудобно - можно случайно ввести в партитуру лишнюю ноту и даже этого не заметить.
Можно ли изменить код, чтобы при перемещении курсора горячей клавишей программа не входила в режим "ввод ноты"?

In reply to by arturchernysh

Right, and what I am saying is, this happens already once you first press Alt+Right to get started. Or click the first note/rest. So unless something physically prevents you from doing that, it seems the problem is solved. Pres Alt+Right or click to get started, and then you play the song using the plugin from there.

In reply to by Marc Sabatella

To return to the beginning of the passage, I click Ctrl Home. The cursor moves to the treble clef of the first measure. And in order to start play, I need to press another button one or more times until the first note sounds. It is not comfortable. Imagine that you need to play the Jingle Bells on the piano, but you have to play the first note on the saxophone.

Do you still have an unanswered question? Please log in first to post your question.