Plugin Roadmap? Plus a suggestion for a simple plugin enhancement
Hi,
I just recently discovered MuseScore and like others, I'd like to thank everyone for the hard work that has obviously gone into this program.
Does anyone currently involved in development have a road map or even a wish list for the plugin API? I'm not talking about enhancements that users want, I'm talking about enhancements that the people actually developing the plugin API are interested in.
I decided to try writing a plugin to deal with voices. One feature I wanted to include was the ability to mute voices. That's not too hard, I can mute a voice all right (by setting the velocity to 0)—but I can't figure out any reasonable and safe way to restore the original note velocities. Any suggestions that would work with the current plugin API would be welcome, but here's my suggestion for the an API enhancement:
For each MuseScore plugin object (Score, Note, Chord, Rest, etc.), add a "data" property. The idea is that data is an empty object to which plugin writers could add properties. For example:
note.data.savedVelocity = note.velocity;
note.velocity = 0;
would allow for a voice to be muted and restored. If this interface is difficult to implement, then
note.data("savedVelocity", note.velocity);
would work. If the variant data types assigned to "data" are a problem, you could even require a string and people could use JSON to convert objects to strings and back.
Thanks for listening!
Comments
Musescore is marvellous.
Plugin development useful.
Had a similar dilemma with plugin createchords except I wanted to preserve the whole of the staff selection.
Toyed with writing details to a text file but settled for the not so elegant option of getting the user to copy the staff.
In your case Ive two suggestions, both inelegant and untried:
Use note.color - can always be set back to black. But changing R G or B may give a colour that 'hides' the note!
Actually theres only one suggestion. Was going to say create a text object but I dont think theres a read method.
Another thought - this is getting complicated! Create a copy note whose pitch is the velocity to preserve with a velocity
of 0.
Agree that a general text property or method would be useful. Or even a copystaff method and a makestaff invisible propert! But that is the future.
Not sure if these ramblings help. Best of luck and let us all know your solution.
In reply to I agree by johnhenry
After my previous ramblings I now realise the solution to my problem of keeping the original contents of a staff.
Since createchords takes a note and adds to it, all I need to do is 'mark' the original note and to restore just
remove all the others. So I can use the colour for this.
Now for your problem.
Put the velocitity [V] in the colour as follows:
R is V divided by 25
G is the remainder divided by 5
B is the remainder from that
So 127 gives 5, 0, 2
The colours generated by this are indistinguishable from black.
Hope this helps. Its certainly helped me- thanks