What has to be changed to make version 2 plugins work in Musescore 3
I use a plugin "brass fingerings" (or maybe it's called "trombone slide positions) in Musescore 2. It does not work in Musescore 3. Any clues on, what has to be changed? The plugin can be selected, but it does nothing to the notes - should write the trombone slide positions.
The code:
//=============================================================================
// Brass Fingering Plugin
//
// Copyright (C) 2016 Alexander Schwedler
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
import QtQuick 2.0
import MuseScore 3.0
MuseScore {
version: "1.1"
description: qsTr("This plugin adds fingering for brass instruments")
menuPath: qsTr("Plugins.Brass Fingering")
property variant seperator: "\n";
property variant offsetFactor: -2.3;
property variant verbose: false;
property variant baseKey: -2;
property variant noteTable: {
26: {fingering: "123"}, // E
27: {fingering: "13"}, // F
28: {fingering: "23"}, // Gb
29: {fingering: "12"}, // G
30: {fingering: "1"}, // Ab
31: {fingering: "2"}, // A
32: {fingering: "0"}, // Bb
33: {fingering: "123"}, // B
34: {fingering: "13"}, // C
35: {fingering: "23"}, // Db
36: {fingering: "12"}, // D
37: {fingering: "1"}, // Eb
38: {fingering: "2"}, // E
39: {fingering: "0"}, // F
40: {fingering: "23"}, // Gb
41: {fingering: "12"}, // G
42: {fingering: "1", slide: "3"}, // Ab
43: {fingering: "2", slide: "2"}, // A
44: {fingering: "0", slide: "1"}, // Bb
45: {fingering: "12", slide: "7\n2"}, // B
46: {fingering: "1", slide: "6\n1"}, // C
47: {fingering: "2", slide: "5"}, // Db
48: {fingering: "0", slide: "4"}, // D
49: {fingering: "1", slide: "3"}, // Eb
50: {fingering: "2", slide: "2"}, // E
51: {fingering: "0", slide: "1"}, // F
52: {fingering: "23", slide: "5"}, // Gb
53: {fingering: "12", slide: "4"}, // G
54: {fingering: "1", slide: "3"}, // Ab
55: {fingering: "2", slide: "2"}, // A
56: {fingering: "0", slide: "1"}, // Bb
57: {fingering: "123", slide: "4"}, // B
58: {fingering: "13", slide: "3"}, // C <-----
59: {fingering: "23", slide: "2"}, // Db
60: {fingering: "12", slide: "1\n4"}, // D
61: {fingering: "1", slide: "3"}, // Eb
62: {fingering: "2", slide: "2"}, // E
63: {fingering: "0", slide: "1"}, // F
64: {fingering: "23", slide: "3"}, // Gb
65: {fingering: "12", slide: "2\n4"}, // G
66: {fingering: "1", slide: "3\n1"}, // Ab
67: {fingering: "2", slide: "2"}, // A
68: {fingering: "0", slide: "1"}, // Bb
69: {fingering: "12"}, // B
70: {fingering: "1"}, // C
71: {fingering: "2"}, // Db
72: {fingering: "0"}, // D
73: {fingering: "1"}, // Eb
74: {fingering: "2"}, // E
75: {fingering: "0"}, // F
76: {fingering: "23"}, // Gb
77: {fingering: "12"}, // G
78: {fingering: "1"}, // Ab
79: {fingering: "2"}, // A
80: {fingering: "0"}, // Bb
81: {fingering: "12"}, // B
82: {fingering: "1"}, // C
83: {fingering: "2"}, // Db
84: {fingering: "0"}, // D
}
function getNoteName (tpc) {
var noteName = "";
switch (tpc) {
case -1: noteName = qsTranslate("InspectorAmbitus", "Fbb") + noteName; break;
case 0: noteName = qsTranslate("InspectorAmbitus", "Cbb") + noteName; break;
case 1: noteName = qsTranslate("InspectorAmbitus", "Gbb") + noteName; break;
case 2: noteName = qsTranslate("InspectorAmbitus", "Dbb") + noteName; break;
case 3: noteName = qsTranslate("InspectorAmbitus", "Abb") + noteName; break;
case 4: noteName = qsTranslate("InspectorAmbitus", "Ebb") + noteName; break;
case 5: noteName = qsTranslate("InspectorAmbitus", "Bbb") + noteName; break;
case 6: noteName = qsTranslate("InspectorAmbitus", "Fb") + noteName; break;
case 7: noteName = qsTranslate("InspectorAmbitus", "Cb") + noteName; break;
case 8: noteName = qsTranslate("InspectorAmbitus", "Gb") + noteName; break;
case 9: noteName = qsTranslate("InspectorAmbitus", "Db") + noteName; break;
case 10: noteName = qsTranslate("InspectorAmbitus", "Ab") + noteName; break;
case 11: noteName = qsTranslate("InspectorAmbitus", "Eb") + noteName; break;
case 12: noteName = qsTranslate("InspectorAmbitus", "Bb") + noteName; break;
case 13: noteName = qsTranslate("InspectorAmbitus", "F") + noteName; break;
case 14: noteName = qsTranslate("InspectorAmbitus", "C") + noteName; break;
case 15: noteName = qsTranslate("InspectorAmbitus", "G") + noteName; break;
case 16: noteName = qsTranslate("InspectorAmbitus", "D") + noteName; break;
case 17: noteName = qsTranslate("InspectorAmbitus", "A") + noteName; break;
case 18: noteName = qsTranslate("InspectorAmbitus", "E") + noteName; break;
case 19: noteName = qsTranslate("InspectorAmbitus", "B") + noteName; break;
case 20: noteName = qsTranslate("InspectorAmbitus", "F♯") + noteName; break;
case 21: noteName = qsTranslate("InspectorAmbitus", "C♯") + noteName; break;
case 22: noteName = qsTranslate("InspectorAmbitus", "G♯") + noteName; break;
case 23: noteName = qsTranslate("InspectorAmbitus", "D♯") + noteName; break;
case 24: noteName = qsTranslate("InspectorAmbitus", "A♯") + noteName; break;
case 25: noteName = qsTranslate("InspectorAmbitus", "E♯") + noteName; break;
case 26: noteName = qsTranslate("InspectorAmbitus", "B♯") + noteName; break;
case 27: noteName = qsTranslate("InspectorAmbitus", "F♯♯") + noteName; break;
case 28: noteName = qsTranslate("InspectorAmbitus", "C♯♯") + noteName; break;
case 29: noteName = qsTranslate("InspectorAmbitus", "G♯♯") + noteName; break;
case 30: noteName = qsTranslate("InspectorAmbitus", "D♯♯") + noteName; break;
case 31: noteName = qsTranslate("InspectorAmbitus", "A♯♯") + noteName; break;
case 32: noteName = qsTranslate("InspectorAmbitus", "E♯♯") + noteName; break;
case 33: noteName = qsTranslate("InspectorAmbitus", "B♯♯") + noteName; break;
default: noteName = qsTr("?") + noteName; break;
}
return noteName;
}
function log(msg) {
if (verbose)
console.log(msg);
}
function getFingering(instrument, notes) {
var sections = instrument.split(".");
if (sections == "undefined" || sections.length < 1)
return "";
var mode = sections[1] == "trombone" ? "slide" : "fingering";
var text = "";
for (var i = 0; i < notes.length; i++) {
if (text != "")
text += seperator
var index = notes[i].pitch + baseKey;
log("Pitch: " + index + " | NoteName: " + getNoteName(notes[i].tpc));
if (index in noteTable && notes[i].tieBack == null)
if (mode in noteTable[index])
text += qsTr(noteTable[index][mode]);
}
return text;
}
onRun: {
if (typeof curScore === 'undefined')
Qt.quit();
var cursor = curScore.newCursor();
var startStaff;
var endStaff;
var endTick;
var fullScore = false;
cursor.rewind(1);
if (!cursor.segment) {
fullScore = true;
startStaff = 0;
endStaff = curScore.nstaves - 1;
} else {
startStaff = cursor.staffIdx;
cursor.rewind(2);
if (cursor.tick == 0) {
// this happens when the selection includes
// the last measure of the score.
// rewind(2) goes behind the last segment (where
// there's none) and sets tick=0
endTick = curScore.lastSegment.tick + 1;
} else {
endTick = cursor.tick;
}
endStaff = cursor.staffIdx;
}
for (var staff = startStaff; staff <= endStaff; staff++) {
cursor.rewind(1)
cursor.voice = 0;
cursor.staffIdx = staff;
if (fullScore) // no selection
cursor.rewind(0); // beginning of score
var instrument = curScore.parts[staff].instrumentId;
if (instrument.substring(0, 6) != "brass.") {
log("Skipped instrument: " + instrument)
continue;
}
while (cursor.segment && (fullScore || cursor.tick < endTick)) {
if (!cursor.element || cursor.element.type != Element.CHORD) {
cursor.next();
continue;
}
var fingering = getFingering(instrument, cursor.element.notes);
if (fingering) {
var text = newElement(Element.STAFF_TEXT);
text.text = fingering;
text.pos.y = (cursor.element.notes.length - 1) * offsetFactor;
cursor.add(text);
}
cursor.next();
}
}
Qt.quit();
}
}
Comments
For one the current plugin framework is pretty broken, not much, if anything, works really
But see https://musescore.org/en/handbook/plugins-30 as to what changes are needed
In reply to For one the current plugin… by Jojo-Schmitz
Thanks. Thought Musescore 3 was out of beta... might be wrong :-(((
In reply to Thanks. Thought Musescore 3… by runekamel
plugins have deleberatly been left unfixed... will be done later, hopefully in a month or so
In reply to plugins have deleberatly… by Jojo-Schmitz
Hi there, any news on the trombone plugin? I would love to have that back, I also tried to change the old one but without success :-/
thanks a lot,
Uschi
In reply to Hi there, any news on the… by Ursula Glaser
It looks like it could be made working after returning an
instrumentId
property back to plugins API. There is a pull request on this issue already (see https://github.com/musescore/MuseScore/pull/5148) so chances are good that it can be resolved in the new 3.2 version. The plugin would require small changes but probably nothing beyond its automatic conversion with the converter script.In reply to It looks like it could be… by dmitrio95
I tried to convert the plugin but my knowledge in Python none.
If they could, they could post here, or on the Plugin Brass page, this is very useful for those who are Musician Teacher, which is my case.
In reply to I tried to convert the… by Isaac James Ch…
I was able to convert from Python and it is working.
In reply to I was able to convert from… by Isaac James Ch…
Hey, this one works almost perfectly. The only thing is, that the fingering is above the notes, is there any chance to get them under the note?
In reply to Hey, this one works almost… by Vedras
It's probably possible to edit the plugin and change wherever it might say "above" to "below", but failing that, simply select one fingering, press "X" to flip it below, then click the set as style button ("S" icon) next to Placement in the Inspector.
EDIT: I see now, it's using staff text rather than fingering, and not setting the placement explicitly, but probably someone who knows the plugin framework better could advise on how to adjust this to set the placement to be "below" directly.
In reply to It's probably possible to… by Marc Sabatella
Probably
text.placement = Placement.BELOW
should work?Here is the version with text placement set below, totally untested though.
In reply to I was able to convert from… by Isaac James Ch…
Thank you so much Isaac. I've been trying to fix it without success for months and hence stayed away from v3. Can't say how much this helps!
Did anyone convert this to musescore 4?
In reply to Did anyone convert this to… by MarkWild
Not yet. But simply changing 'Qt.quit();' to just "quit();" should do the trick
In reply to Not yet. But simply changing… by Jojo-Schmitz
Hi Jojo
Well, it won't change anything, already tried to do so.
In reply to Hi Jojo Well, it won't… by MarkWild
Then there's apparently more to change, but thar Qt.quit(); is a very common one, wrong on Mu3 already, but crashing in Mu4
In reply to Then there's apparently more… by Jojo-Schmitz
Ok, who will do the change to ms4?
In reply to Ok, who will do the change… by MarkWild
Try contacting the author
In reply to Try contacting the author by Jojo-Schmitz
You do realize that the plugin is for Euphonium only (in US)
{fingering: "0", slide: "1"}, // Bb
Fingering 0 is C on all brass instruments.