Trombone positions

• Oct 13, 2016 - 19:09

Hi!
I have found this plugin code for musescore 1.0.
I would like to have the plugin work in musescore 2.0. Can anyone help me?

Greetings
Rune

//=============================================================================
// Brass instrument fingering plugin for MuseScore
//
// Copyright (C)2012 Ian McLeod (underquark)
// Trombone positions by DerPosaunist
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//=============================================================================

var notes = [ "7", "6", "5", "4", "3", "2", "1", // Bb //
"7", "6", "5", "4", "3", "2", "1", // F //
"5", "4", "3", "2", "1", // Bb //
"4", "3", "2", "1", // D //
"3", "2", "1", // F //
"3+", "2+", // G //
"3", "2", "1", // Bb //
"2", "1", // C //
"2", "1", // D //
"3", "2", "1", // F //
"3", "2", // G //
"3", "2", "1"] // Bb //
//=============================================================================
// Alternative Positions
//=============================================================================
//var notes = [ "7", "6", "5", "4", "3", "2", "1", // Bb //
// "7", "6", "5", "4", "3", "2/7", "1/6", // F //
// "5", "4", "3/7", "2/6", "1/5", // Bb //
// "4/7", "3/6", "2/5", "1/4/7", // D //
// "3/6", "2/5/7", "1/4/6", // F //
// "3+/5/7", "2+/4/6", // G //
// "3/5/7", "2/4/6", "1/3/5", // Bb //
// "2/4/6", "1/3/5", // C //
// "2/4/5", "1/3/4", // D //
// "3/2", "2", "1", // F //
// "3", "2", // G //
// "3", "2", "1"] // Bb //

//---------------------------------------------------------
// init
//---------------------------------------------------------

function init()
{
}

//-------------------------------------------------------------------
// run
//-------------------------------------------------------------------

function run()
{
var cursor = new Cursor(curScore);
cursor.staff = 0;
cursor.voice = 0;
cursor.rewind(); // move cursor to first note or rest
var font = new QFont("Times New Roman", 7);
while (!cursor.eos()) {
if (cursor.isChord()) {

var pitch = cursor.chord().topNote().pitch;
var index = pitch - 40;
if (index >= 0 && index < notes.length){
var glyph = new Text(curScore);
glyph.text = notes[index];
glyph.defaultFont = font;
glyph.yOffset = 6
// if (pitch < 59){
// glyph.yOffset = glyph.yOffset + 2;
// }
glyph.xOffset = 0
cursor.putStaffText(glyph);
}
}
cursor.next();
}
}

var mscorePlugin = {
menu: 'Plugins.Create Trombone Positions',
init: init,
run: run
};

mscorePlugin;


Comments

Instead of varying the above code to work with 2.x it might be easier to take an existing 2.x Plugin for brass fingering - https://musescore.org/sites/musescore.org/files/brass_fingering.qml - and changing the fingering values. The fingerings given appear to be for 3-valve Bb transposing instruments but I'm sure you could change them to the appropriate trombone slide positions (depends on your trombone, of course, and whether you want to get complicated and add the valves that some trombones have).

Do you still have an unanswered question? Please log in first to post your question.