How do I create and add tuplets by plugin?
How do I create and add tuplets in MuseScore 2.x and 3.x?
console.log(newElement(Element.TUPLET));
logs
Debug: cannot create type 32 <Tuplet>
Debug: null
in MuseScore 2.x and CRASHES in MuseScore 3.x.
Comments
Not directly supported.
If you can get the total beat duration entered and then selected, you could try using the
cmd("")
to call the shortcut-action from Ctrl-2 up to Ctrl-9; but I don't think any other ratios can be created.In reply to Not directly supported. If… by jeetee
In 3.5 version it will be supported (should be in 3.5 Beta version already) with
Cursor.addTuplet()
method. I don't know when the updated documentation will be published but you can find some explanation about its usage, for example, here.In reply to In 3.5 version it will be… by dmitrio95
Thank you for your replies and the commit.
That's exactly what I what, but does it mean that I am unable to create tuplets more than 11 notes by plugin without 3.5 Beta? Won't there be a command for "Other Tuplets"?
In reply to Not directly supported. If… by jeetee
I finally realised the commands for tuplets (duplet, triplet and so on), but I will be glad if there is a full list of
cmd
available.In reply to I finally realised the… by graphemecluster
You can look at the list of shortcuts in the source code. For tuplets not covered by such shortcuts there is a
tuplet-dialog
command but it will probably just open up a dialog to define custom tuplet properties, just like "Add→Tuplets→Other…" menu action does.In reply to Not directly supported. If… by jeetee
Also I would like to know how could I change the selection, since it seems that both
cursor.next()
andcursor.nextMeasure()
only moves the cursor internally.In reply to Also I would like to know… by graphemecluster
For pre-3.5 try
select-next-chord
andselect-next-measure
commands from the same list.For 3.5 version there is also an API to change selection, see https://github.com/musescore/MuseScore/pull/6091 and documentation comments inside it.
In reply to For pre-3.5 try select-next… by dmitrio95
Thank you again for the big help.
My advice would be to not bother with MS < 3.5 and make your plugin for 3.5+
Then using the function indicated by the commit above, you can create any ratio you need.
In reply to My advice would be to not… by jeetee
I just wanted to make the compatibility greater. Anyway, I am going to try both methods and thank you for your help.