Skip to content

Commit 9d21514

Browse files
committed
add options for bend char
1 parent 9541fad commit 9d21514

File tree

1 file changed

+47
-38
lines changed

1 file changed

+47
-38
lines changed

harmonica_tablature.qml

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ MuseScore {
2121
description: "Harmonica Tab plugin"
2222
menuPath: "Plugins.Harmonica Tablature"
2323
pluginType: "dialog"
24-
24+
25+
// ------ OPTIONS -------
26+
property string sep : "\n" // change to "," if you want tabs horizontally
27+
property string bendChar : "b" // change to "'" if you want bend to be noted with a '
28+
// ------ OPTIONS -------
29+
2530
id: window
2631
width:280
2732
height: 180
@@ -32,7 +37,7 @@ MuseScore {
3237
anchors.left: parent.left
3338
anchors.right: parent.right
3439
height: 90
35-
40+
3641
ComboBox {
3742
currentIndex: 17
3843
model: ListModel {
@@ -128,74 +133,74 @@ MuseScore {
128133
text: "Close"
129134
onClicked: { Qt.quit() }
130135
}
131-
136+
132137
}
133-
138+
134139
function tabNotes(notes, text) {
135-
140+
136141
var richter = ["+1", "-1b", "-1", "+1o", "+2", "-2bb", "-2b", "-2", "-3bbb", "-3bb", "-3b", "-3",
137142
"+4", "-4b", "-4", "+4o", "+5", "-5", "+5o", "+6", "-6b", "-6", "+6o", "-7",
138143
"+7", "-7o", "-8", "+8b", "+8", "-9", "+9b", "+9", "-9o", "-10", "+10bb", "+10b",
139144
"+10", "-10o" ]; //Standard Richter tuning with overbends
140-
145+
141146
var richterValved = ["+1", "-1b", "-1", "+2b", "+2", "-2bb", "-2b", "-2", "-3bbb", "-3bb", "-3b", "-3",
142147
"+4", "-4b", "-4", "+5b", "+5", "-5", "+6b", "+6", "-6b", "-6", "-7b", "-7",
143148
"+7", "-8b", "-8", "+8b", "+8", "-9", "+9b", "+9", "-10b", "-10", "+10bb", "+10b",
144149
"+10" ];
145150
richterValved[-2] = "+1bb"; richterValved[-1] = "+1b"; //Two notes below the key at blow 1
146-
151+
147152
var paddyRichter = ["+1", "-1b", "-1", "+2b", "+2", "-2bb", "-2b", "-2", "+3b", "+3", "-3b", "-3",
148153
"+4", "-4b", "-4", "+5b", "+5", "-5", "+6b", "+6", "-6b", "-6", "-7b", "-7",
149154
"+7", "-8b", "-8", "+8b", "+8", "-9", "+9b", "+9", "-10b", "-10", "+10bb", "+10b",
150155
"+10" ];
151156
paddyRichter[-2] = "+1bb"; paddyRichter[-1] = "+1b"; //Two notes below the key at blow 1
152157
// Brendan Power's tuning, half valved
153-
158+
154159
var country = ["+1", "-1b", "-1", "+1o", "+2", "-2bb", "-2b", "-2", "-3bbb", "-3bb", "-3b", "-3",
155160
"+4", "-4b", "-4", "+4o", "+5", "-5b", "-5", "+6", "-6b", "-6", "+6o", "-7",
156161
"+7", "-7o", "-8", "+8b", "+8", "-9", "+9b", "+9", "-9o", "-10", "+10bb", "+10b",
157162
"+10", "-10o" ];
158-
163+
159164
var standardChromatic = ["+1", '+1s', "-1", "-1s", "+2", "-2", "-2s", "+3", "+3s", "-3", "-3s","-4",
160165
"+4", "+4s", "-5", "-5s", "+6", "-6", "-6s", "+7", "+7s", "-7", "-7s", "-8",
161166
"+8", "+8s", "-9", "-9s", "+10", "-10", "-10s", "+11", "+11s", "-11", "-11s", "-12",
162167
"+12", "+12s", "-12", "-12s" ];
163-
168+
164169
var zirkValved = ["+1", "-1b", "-1", "+2b", "+2", "-2", "+3b", "+3", "-3b", "-3", "+4", "-4b",
165170
"-4", "+5b", "+5", "-5b", "-5", "+6", "-6b", "-6", "+7b", "+7", "-7", "+8b",
166171
"+8", "-8b", "-8", "+9b", "+9", "-9", "10b", "+10", "-10b", "-10" ]; // Circular/Spiral tuned diatonic
167172
// Key per Seydel "G"on blow 1, C major at draw 2, A minor at draw 1
168-
173+
169174
var trueChrom = ["+1", "-1b", "-1", "+2", "-2b", "-2", "+3b", "+3", "-3b", "-3", "+4", "-4b",
170175
"-4", "+5b", "+5", "-5b", "-5", "+6", "-6b", "-6", "+7b", "+7", "-7b", "-7",
171176
"+8", "-8b", "-8", "+9b", "+9", "-9b", "-9", "+10", "-10b", "-10" ]; //True Chromatic diatonic, valves
172-
//Another side of the spiral logic is expanded in the “True Chromatic” tuning, designed by Eugene Ivanov.
173-
//All chords can be arranged in a continuous, looped progression on major and minor triads:
177+
//Another side of the spiral logic is expanded in the “True Chromatic” tuning, designed by Eugene Ivanov.
178+
//All chords can be arranged in a continuous, looped progression on major and minor triads:
174179
//C Eb G Bb D F A C E G B D Gb A Db E Ab B Eb Gb Bb Db F Ab C (and looped on C minor after that).
175-
180+
176181
var naturalMinor = ["+1", "-1b", "-1", "+2", "-2bbb", "-2bb", "-2b", "-2", "-3bb", "-3b", "-3", "+3o",
177182
"+4", "-4b", "-4", "+5", "-5b", "-5", "+5o", "+6", "-6b", "-6", "-7", "+7b",
178183
"+7", "-7o", "-8", "+8", "-8o", "-9", "+9b", "+9", "-9o", "-10", "+10bb", "+10b",
179184
"+10", "-10o" ]; //Labeled by blow 1 like Hohner. Seydel and Lee Okar labels by draw 2
180-
185+
181186
var melodyMaker = [ , , , , , // label by draw 2
182187
"+1", "-1b", "-1", "+1o","+2", "-2bb","-2b", "-2", "+2o", "+3", "-3b", "-3",
183188
"+4", "-4b", "-4", "+4o", "+5", "-5b", "-5", "+6", "-6b", "-6", "+6o", "-7",
184189
"+7", "-7o", "-8", "+8b", "+8", "-8o", "-9", "+9", "-9o", "-10", "+10bb", "+10b",
185-
"+10", "-10o" ];
186-
190+
"+10", "-10o" ];
191+
187192
var spiral_b1 = ["+1", "-1b", "-1", "+2b", "+2", "-2", "+3b", "+3", "-3b", "-3", "+4b", "+4",
188193
"-4", "+5b", "+5", "-5b", "-5", "+6", "-6b", "-6", "+7b", "+7b", "-7", "-7",
189194
"+8", "-8b", "-8", "+9b", "+9", "-9", "+10b", "+10", "-10b", "-10" ]; // Circular/Spiral tuned diatonic
190195
// Inversed for Blow 1. Key of C major scale starts at blow 1
191-
196+
192197
var powerBender = ["+1", "-1b", "-1", "+2b", "+2", "-2bb", "-2b", "-2", "-3bbb", "-3bb", "-3b", "-3",
193198
"+4", "-4b", "-4", "-5b", "-5", "+6", "-6b", "-6", "+7b", "+7", "-7b", "-7",
194199
"+8", "-8b", "-8", "+9b", "+9", "-9bb", "-9b", "-9", "+10b", "+10", "-10bb", "-10b",
195200
"-10" ];
196201
powerBender[-2] = "+1bb"; powerBender[-1] = "+1b"; //Two notes below the key at blow 1
197202
// Brendan Power's tuning, half valved
198-
203+
199204
var powerDraw = ["+1", "-1b", "-1", "+2b", "+2", "-2bb", "-2b", "-2", "-3bbb", "-3bb", "-3b", "-3",
200205
"+4", "-4b", "-4", "+5b", "+5", "-5", "+6b", "+6", "-6b", "-6", "-7b", "-7",
201206
"+8", "-8b", "-8", "+9b", "+9", "-9bb", "-9b", "-9", "+10b", "+10", "-10bb", "-10b",
@@ -219,24 +224,28 @@ MuseScore {
219224
case 12: tuning = powerDraw; break;
220225
default: tuning = richter; break;
221226
}
222-
227+
223228
var harpkey = keylist.key
224-
console.log("harpkey set to " +keylist.key)
225-
229+
console.log("harpkey set to " + keylist.key)
230+
226231
for (var i = 0; i < notes.length; i++) {
227-
var sep = "\n"; // change to "," if you want them horizontally
232+
228233
if ( i > 0 )
229234
text.text = sep + text.text;
230-
235+
231236
if (typeof notes[i].pitch === "undefined") // just in case
232237
return
233-
if (typeof tuning[notes[i].pitch - harpkey] === "undefined")
234-
text.text = "X";
235-
else
236-
text.text = tuning[notes[i].pitch - harpkey] + text.text;
238+
var tab = tuning[notes[i].pitch - harpkey];
239+
if (typeof tab === "undefined")
240+
text.text = "X";
241+
else {
242+
if (bendChar !== "b")
243+
tab = tab.replace(/b/g, bendChar);
244+
text.text = tab + text.text;
245+
}
237246
}
238247
}
239-
248+
240249
function applyToSelection(func) {
241250
if (typeof curScore === 'undefined')
242251
Qt.quit();
@@ -267,20 +276,20 @@ MuseScore {
267276
endStaff = cursor.staffIdx;
268277
}
269278
console.log(startStaff + " - " + endStaff + " - " + endTick)
270-
279+
271280
for (var staff = startStaff; staff <= endStaff; staff++) {
272281
for (var voice = 0; voice < 4; voice++) {
273282
cursor.rewind(1); // beginning of selection
274283
cursor.voice = voice;
275284
cursor.staffIdx = staff;
276-
285+
277286
if (fullScore) // no selection
278287
cursor.rewind(0); // beginning of score
279-
288+
280289
while (cursor.segment && (fullScore || cursor.tick < endTick)) {
281290
if (cursor.element && cursor.element.type == Element.CHORD) {
282291
var text = newElement(Element.STAFF_TEXT);
283-
292+
284293
var graceChords = cursor.element.graceNotes;
285294
for (var i = 0; i < graceChords.length; i++) {
286295
// iterate through all grace chords
@@ -294,11 +303,11 @@ MuseScore {
294303
// new text for next element
295304
text = newElement(Element.STAFF_TEXT);
296305
}
297-
306+
298307
var notes = cursor.element.notes;
299308
tabNotes(notes, text);
300309
text.pos.y = textposition;
301-
310+
302311
if ((voice == 0) && (notes[0].pitch > 83))
303312
text.pos.x = 1;
304313
cursor.add(text);
@@ -309,13 +318,13 @@ MuseScore {
309318
} // end for staff
310319
Qt.quit();
311320
} // end applyToSelection()
312-
321+
313322
function apply() {
314323
curScore.startCmd()
315324
applyToSelection(tabNotes)
316-
curScore.endCmd()
325+
curScore.endCmd()
317326
}
318-
327+
319328
onRun: {
320329
if (typeof curScore === 'undefined')
321330
Qt.quit();

0 commit comments

Comments
 (0)