How do I get staffIdx and tick information for Articulation, Arpeggio, Dynamics, etc?
In order to get their mearsure and beat. And staffIdx
In order to get their mearsure and beat. And staffIdx
Do you still have an unanswered question? Please log in first to post your question.
Comments
I can't get their ticks and staffIdx through the cursor.segment method.
In reply to I can't get their ticks and… by davil123
For dynamics you can use segment.annotations:
unfortunately i havent yet found an easy way to access articulation or arpeggios, without selection. here is my workaround:
In reply to For dynamics you can use… by XiaoMigros
For any element you can use element.staff to get the staff they are on
In reply to For any element you can use… by XiaoMigros
Could not find their ticks
In reply to Could not find their ticks … by davil123
sorry, my mistake: you have to do
curScore.selection.elements[i].parent.parent.tick
to access the segment (as chords don't have a tick)In reply to For any element you can use… by XiaoMigros
If I use this method, I can easily detect their staffidx and tick messages. However, this method does not allow you to select elements outside the main track, such as Articulation, Arpeggio, Dynamics
In reply to For any element you can use… by XiaoMigros
element.staff's method cannot get the number of tracks. For example, the piano has 2 tracks, and element.staff groups them into one track.
In reply to For any element you can use… by XiaoMigros
I'm really sorry, just now there were some problems in my plugin test area, and retesting after rebooting found that the ticks information of all elements can be obtained normally.
In reply to For any element you can use… by XiaoMigros
Unfortunately, it is still not possible to get staffIdx, and the method of using element.staff.part does not work, only the names of their instruments.
In reply to For dynamics you can use… by XiaoMigros
It seems that staffIdx is only available through cursor.staffIdx
In reply to It seems that staffIdx is… by davil123
i think thats the case, since staffidx is an int and element.staff is a staff element type
you might have to save the parent of articulation and then locate it with the cursor, to find the staff
In reply to i think thats the case,… by XiaoMigros
I tried it and it seems to modify the scope of curScore.selection, and then detect it line by line, and it seems to work!
In reply to i think thats the case,… by XiaoMigros
But this will generate a lot of code
In reply to But this will generate a lot… by davil123
That is the unfortunate consequence, but I don't know of a better way to do this. Perhaps someone else knows of an easier way?
In reply to But this will generate a lot… by davil123
Actually one shorter way I have, to reduce the number of checks:
like this you can quickly check the staff element type of the cursor, and then you can compare it to the staff of any other elements.
In reply to Actually one shorter way I… by XiaoMigros
This is great, but I suddenly realized that elements such as pedial and otava cannot obtain ticks. Their parent element is the system.
In reply to This is great, but I… by davil123
the cursor cant change ottava and pedal lines, what do you need these elements for?
In reply to the cursor cant change… by XiaoMigros
This is very bad. I am developing an independent software related to jianpu.
In reply to the cursor cant change… by XiaoMigros
I tried playEvents but failed. It seems that the plugin does not support obtaining this information
In reply to I tried playEvents but… by davil123
yes, the integration with lines is basically nonexistent at the moment unfortunately
In reply to yes, the integration with… by XiaoMigros
But for plugins alone, Jianpu has already been completed, and the remaining work is designed by Deakon because I am not aware of the specific requirements of Jianpu in China. It is worth mentioning that since Deakon does not have a Mac computer, the Mac version of the plugin will be indefinitely delayed
In reply to But for plugins alone,… by davil123
the plugin should almost certainly work on mac anyway, if its only qml
In reply to the plugin should almost… by XiaoMigros
Converting music scores into another form through plugins can be fatal if there are some minor errors, which are unknown bugs that we cannot test, and there are also interactive windows. such as :
https://musescore.org/en/node/349854
In reply to Converting music scores into… by davil123
that's true, but this here was a special case
In reply to that's true, but this here… by XiaoMigros
Flat shooting is perfectly compatible with Windows, but there seem to be many errors on the Mac, and I feel that there will be many bugs,if I directly apply my plugin.
In reply to that's true, but this here… by XiaoMigros
Are there many such errors on Mac?
In reply to Are there many such errors… by davil123
only if you customise the ui, which is something most people dont do
In reply to only if you customise the ui… by XiaoMigros
If that's the case, that would be great, but can plugins customize the interaction window instead of using the default interaction window of Musescore?
In reply to only if you customise the ui… by XiaoMigros
This interactive window is very plain, and I don't want it designed like this. If there are other ways to customize the window interface.
In reply to This interactive window is… by davil123
Your interface looks great to me! Which version of Qt are you using for this?
In reply to Your interface looks great… by yonah_ag
That interface is not my work.So I'm not sure, reference :https://musescore.org/en/project/jianpu-numbered-notation-0
In reply to That interface is not my… by davil123
That could be very useful. It is using the same Qt that I am but without all the issues. The main difference is that it uses the RowLayout container control. I'm inclined to throw away my UI and start again. I did originally use GridLayout but removed it for more control. Little did I know the hassle that this would cause me.
In reply to only if you customise the ui… by XiaoMigros
Of course, this is not my job, it depends on how my partner handles it
In reply to Of course, this is not my… by davil123
if you send me the code i would be happy to design a nicer interface :)
In reply to if you send me the code i… by XiaoMigros
I'm very sorry, the code needs to be completed by Deakon, and I'm only responsible for a small part. The overall code is in Deakon's hands.
In reply to if you send me the code i… by XiaoMigros
We have discussed before that if a plugin is completed, it will definitely not be used for commercial purposes. However, if the plugin is sold by someone else after completion, it will be very uncomfortable. Deakon once told me that a Sibelius notation plugin sold for over 700 RMB! I don't know if it's true.
In reply to For dynamics you can use… by XiaoMigros
This is a really nice workaround! Were you able to determine which type of arpeggio it is like that? I can't find any way of accessing the internal arpeggioType
In reply to This is a really nice… by Geordie J
does using
element.symbol
yield any result?In reply to does using element.symbol… by XiaoMigros
If not, try
element.subtype
but I'd expect this option to be more limitedIn reply to does using element.symbol… by XiaoMigros
element.symbol and element.subtype are both undefined when element.type === Element.ARPEGGIO :(
In reply to element.symbol and element… by Geordie J
I can look into it but it's likely it may not be possible then..
In reply to For dynamics you can use… by XiaoMigros
Re: XiaoMigros • May 18, 2023 - 16:28
"unfortunately i havent yet found an easy way to access articulation or arpeggios, without selection. here is my workaround:
cmd('select-all')
for (var i in curScore.selection.elements) {
if (curScore.selection.elements[i].type == Element.ARTICULATION) { // or other element
console.log(curScore.selection.elements[i].parent.tick) //parent of articulation is an Element.CHORD
//do code
}
}"
I don't seem to be able to use the curScore.selection.selectRange method instead of cmd('select all') to set a selection range for this type of processing. Any idea why not?
In reply to I don't seem to be able to… by yonah_ag
Yes:
cmd
s have an immediate effect on the score, any other plugin code is only executed aftercurScore.endCmd()
It appears from the plugin API documentation that articulation elements are not directly exposed for use in plugin code. This is an inconvenience in my current development. The only place that I have been able to process them, (e.g. to detect staccato dots), is via the MSCX file format but this leads to a plugout rather than a plugin. (A plugout has full access to absolutely everything in the score.) So I think that we are limited to working out an articulation's tick as explained above.
In reply to It appears from the plugin… by yonah_ag
Do you know where there is a good plugin design interface, so far I only see one example that is more in line with my aesthetic. and its: https://musescore.org/en/project/counterpoint-check-v0451ms3
In reply to Do you know where there is a… by davil123
That's a very interesting plugin since it has no pluginType. It also uses an older version of Qt, which I had to move away from because of the issue regarding dock type and dropdown boxes, so it appears that the issue doesn't happen for plugins with no type.
Does that plugin have all the elements that you need? You could reverse engineer them for your design, using Qt's online documentation for clarification where needed.
The plugin section of the Musescore forum unfortunately doesn't always show a screenshot for each plugin so it's a case of "download-install-safetycheck-try".
In reply to Do you know where there is a… by davil123
Here's an example layout I designed
the existing code is extremely messy
In reply to Here's an example layout I… by XiaoMigros
Nice! but I can't see it in the plugin forum.
In reply to Nice! but I can't see it in… by yonah_ag
Its not my plugin :p
In reply to Its not my plugin :p by XiaoMigros
Unfortunately, even with the newer version of Qt, this UI misbehaves when it's a docked plugin.
You can see that the dropdown list is rendered outside of the dock area and on the Windows desktop!
If it runs as a dialog plugin then it's fine but dialogs do not stay on top of the score! I'll have to decide on the best compromise.
In reply to Unfortunately, even with the… by yonah_ag
Im confused, are you also working on this plugin?
In reply to Im confused, are you also… by XiaoMigros
No, I'm working on a separate plugin but having some related issues in terms of UI design and access to articulation details.
In reply to It appears from the plugin… by yonah_ag
I think parkingb's work is also very good, in terms of interface window design.
In reply to I think parkingb's work is… by davil123
you can check out some of my work as well, i wouldnt call it amazing but most of it is pretty good
In reply to you can check out some of my… by XiaoMigros
Will do.
In reply to It appears from the plugin… by yonah_ag
They are quite detectable and you can add them to scores, I dont know what you mean
they are an element just like other elements
In reply to They are quite detectable… by XiaoMigros
I'll be happy to be wrong. How can I detect whether a note has a staccato dot? (I have no need to add them; only detect them.)
In reply to I'll be happy to be wrong… by yonah_ag
that is the issue, there are no ways to access children of elements, only parents. the way i do it is create a range selection and look inside there for articulations. the parent of the articulation is a chord
In reply to that is the issue, there are… by XiaoMigros
Can this workaround be used to find chords which have staccato dots? I need this level of detail: it will not be sufficient to detect only articulation.
In reply to Can this workaround be used… by yonah_ag
yes, for example:
note that the symid enum is accessible but not exposed in mu4, meaning that it wont work as expected there
In reply to yes, for example: cmd(… by XiaoMigros
I havent tested this code i wrote just now, but see my example of this in use
In reply to I havent tested this code i… by XiaoMigros
Thanks. I've got it working.
In reply to Thanks. I've got it working. by yonah_ag
Do you know what the reason might be? yonah
In reply to Do you know what the reason… by davil123
davil123 • May 21, 2023 - 14:33
Do you know what the reason might be? yonah
The thread is starting to getting a bit tangled.
Which post does your question refer to?
In reply to I havent tested this code i… by XiaoMigros
I have a question: Why does the solid circle for this interactive button appear blue in MuseScore 4, but black in MuseScore 3? I am using your Advanced-Tuplets-main plugin.
In reply to I have a question: Why does… by davil123
MuseScore 4 uses a completely different UI style
In reply to MuseScore 4 uses a… by XiaoMigros
I have referred to the parkingb's plugin, which is a solid black circle, but I cannot understand it in a short time. Did he use a custom UI?
In reply to I have referred to the… by davil123
parkingb uses custom styling but it's a lot more work.
In reply to MuseScore 4 uses a… by XiaoMigros
Can I implement this idea through plugins. See: https://musescore.org/en/node/350234
In reply to Can I implement this idea… by davil123
See https://doc.qt.io/qt-6/qtquickcontrols-customize.html#customizing-check…
You can use CheckBox and CheckDelegate but you will probably need to use the radio button index as well for individual colour circles.
In reply to See https://doc.qt.io/qt-6… by yonah_ag
I want to change the color of the solid circle when the user selects it. I don't know if the Qt version that comes with MuseScore can implement them,see : https://musescore.org/en/node/350234
In reply to I want to change the color… by davil123
This should be possible in Qt / MS3 so I would expect no less with the Qt shipped with MS4. You will need to detect which option is selected in order to set a specific colour. Alternatively draw a filled circle in the required colours but only make it visible when the option is selected, (but this starts to get quite complex.)
https://doc.qt.io/qt-6/qml-qtquick-controls2-buttongroup.html#checkedBu…
You could also use predefined images for the indicator.
See https://doc.qt.io/archives/qt-4.8/stylesheet-examples.html#customizing-…
In reply to This should be possible in… by yonah_ag
Thanks, I'm learning
In reply to Thanks, I'm learning by davil123
This looks interesting from O'Reilly but I haven't seen inside it:
https://www.oreilly.com/library/view/learn-qt-5/9781788478854/
In reply to This looks interesting from… by yonah_ag
Thank you, I have already resolved the issue.