Skip to content

Commit

Permalink
Bug with some transposing instruments
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent committed Jun 24, 2022
1 parent 52355b6 commit 7660fb6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion soloanalyser-interactive.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ import "soloanalyser"

/**********************
/* Parking B - MuseScore - Solo Analyser plugin
/* v1.4.0
/* v1.4.1
/* ChangeLog:
/* - 1.3.0: Initial version based on SoloAnalyser 1.3.0
/* - 1.3.1: New altered notes color
/* - 1.4.0: Multi track and voices
/* - 1.4.0: Settings for the multi track and voices
/* - 1.4.1: Bug with some transposing instruments
/**********************************************/

MuseScore {
Expand Down
9 changes: 5 additions & 4 deletions soloanalyser.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "soloanalyser/core.js" as Core

/**********************
/* Parking B - MuseScore - Solo Analyser plugin
/* v1.4.0
/* v1.4.1
/* ChangeLog:
/* - 1.0.0: Initial release
/* - 1.0.1: Using of ChordAnalyzer shared library
Expand All @@ -21,12 +21,13 @@ import "soloanalyser/core.js" as Core
/* - 1.3.1: New altered notes color
/* - 1.4.0: Multi track and voices
/* - 1.4.0: Settings for the multi track and voices
/* - 1.4.1: Bug with some transposing instruments + bug when initiating useBelow/AboveSymbols
/**********************************************/

MuseScore {
menuPath: "Plugins." + pluginName
description: "Colors and names the notes based on their role if chords/harmonies."
version: "1.4.0"
version: "1.4.1"

readonly property var pluginName: "Solo Analyser"

Expand Down Expand Up @@ -64,8 +65,8 @@ MuseScore {
property var colorNotes: Core.defColorNotes
property var nameNotes: Core.defNameNotes
property var textType : Core.defTextType
property var useBelowSymbols : defUseBelowSymbols
property var useAboveSymbols : defUseAboveSymbols
property var useBelowSymbols : Core.defUseBelowSymbols
property var useAboveSymbols : Core.defUseAboveSymbols
}

MessageDialog {
Expand Down
11 changes: 8 additions & 3 deletions soloanalyser/core.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@

/**********************
/* Parking B - MuseScore - Solo Analyser core plugin
/* v1.2.0
/* v1.2.1
/* ChangeLog:
/* - 1.0.0: Initial release
/* - 1.1.0: New alteredColor
/* - 1.2.0: Multi track
/* - 1.2.0: Don't modify the note color on "Color none"
/* - 1.2.0: Transposing instruments
/* - 1.2.1: Bug with some transposing instruments
/**********************************************/

var degrees = '1;2;3;4;5;6;7;8;9;11;13';
Expand Down Expand Up @@ -160,7 +161,11 @@ function doAnalyse() {
// !! The chord name is depending if we are in Instrument Pitch or Concert Pitch (this is automatic in MuseScore)
// So we have to retrieve the pitch as shown on the score. In instrument pitch this might be different than the pitch
// given by note.pitch which is corresponding to the *concert pitch*.
var tpitch = note.pitch - (note.tpc - note.tpc1); // note displayed as if it has that pitch

// var tpitch = note.pitch - (note.tpc - note.tpc1); // note displayed as if it has that pitch
var tpitch = note.pitch + NoteHelper.deltaTpcToPitch(note.tpc,note.tpc1); // note displayed as if it has that pitch


var p = (tpitch - curChord.pitch + 12) % 12;
var color = null;
if (p == 0) {
Expand Down Expand Up @@ -191,7 +196,7 @@ function doAnalyse() {
degree = role.role;
}
}
console.log(tpitch + ((tpitch!==note.pitch)?(" (transposing instrument !! original pitch: "+note.pitch+")"):"")+ " | " + curChord.pitch + " ==> " + p + " ==> " + color);
console.log("note pitch: "+tpitch + ((tpitch!==note.pitch)?(" (transposing!! original: "+note.pitch+")"):"")+ " | Chord pitch:" + curChord.pitch + " ==> position: " + p + " ==> color: " + color);
}
} else
// no current chord, so resetting the color
Expand Down

0 comments on commit 7660fb6

Please sign in to comment.