Can a plugin control which string in a TAB staff to write a note to?
Trying to make a plugin that writes to a TAB staff. Does anyone know if there is a way to control which TAB string to write a note to from within a plugin? For example, in some cases, for playability, I'd want to specify that the note be fretted on a string different from that which Musescore puts it on.
Comments
Note.string and Note.fret might work by looking at the code of https://musescore.org/en/project/fretboard
In reply to Note.string and Note.fret… by jeetee
Thanks for the pointer jeetee - I've downloaded that plugin code and will inspect it for clues.
In reply to Thanks for the pointer… by rocchio
Update: I've not been able to specify a TAB string for a note. I've tried a few things, but they won't do the trick. I have also inspected some source code for clues and based on that I have concluded there is no such provision. In particular it appears to me that stringdata.cpp is the module where string/fret assignment is controlled. stringdata.cpp seems to be doing the right thing in terms of working out the best string to use given the note pitch so I've no complaints - just observing that you really just have to let it do it's thing. As this need is an infrequent case, a nice to have, I'm going to let this go and just accept that some manual fix-up will occasionally be needed for my purposes.
As an aside, jeetee: Fretboard.qml is a pretty cool plugin! I think I'm going to be able to put it to good use, even for my 3-string Mountain Dulcimer chords.
In reply to Update: I've not been able… by rocchio
And yet, this plugin does seem to successfully enter notes onto the exact string and fret I choose. So unless I'm missing something, clearly it is possible. Maybe post the code you are trying and someone can see what you are missing?
In reply to And yet, this plugin does… by Marc Sabatella
I think it uses the cmd() interface to do so.
In reply to And yet, this plugin does… by Marc Sabatella
I believe jeetee to be correct - it uses the cmd function. Which I suppose I could try, tho I am trying to do this in pure 'batch' mode. And certainly I could be missing something. In Fretboard's addNoteWithCursor() function there is:
Here is what I've tried:
Complete plugin code attached.
In reply to I believe jeetee to be… by rocchio
You're not yet setting the note.fret property.
Quick test changes on my end:
function addNewForcedToString(measures, notesToWrite, pitch, string, **fret,** cursor) {
oNote.string = string;
oNote.fret = fret;
oNote.pitch = pitch;
addNewForcedToString(1, 1, 62, 2, 7, cursor);
or
addNewForcedToString(1, 1, 62, 1, 3, cursor);
or
addNewForcedToString(1, 1, 62, 4, 17, cursor);
all seems to work, regardless of having selected the chord in the standard staff or in the tablature staff
[EDIT] PS: so the cmd() things were only there for MuseScore versions prior to 3.3.4 in which those properties were exposed.
In reply to You're not yet setting the… by jeetee
That works! Ok, so I had a mental block - I was steadfast in a belief that you couldn't 'over specify' among the three parameters. That is, if I'm specifying string + pitch then that has used up all the degrees of freedom so to also specify fret would be wrong. I now see that you actually must specify all three, and they must match up correctly (meaning that string + fret must correctly match the pitch you provide). In playing around it appears that if any of the three are inconsistent with other two than Musescore will use pitch to set the string/fret.
Thanks for breaking my logjam jeetee.