Plugins cannot add chords and can add notes only in very limited ways
Reported version
3.0
Type
Plugins
Frequency
Once
Severity
S3 - Major
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project
The problem came up in #283179: (some of the) missing objects/properties in the plugin framework in this post by Bacchushlg and currently affects all 3.x versions of MuseScore.
A plugin cannot add chords (i.e. more than one note at the same time).
A plugin can currently only add notes using Cursor.addNote, which has several problems. I created a simple demonstration plugin to show these:
- The TPC cannot be set immediately. So adding a D flat major scale looks like this
- Using a second pass (or rewinding the cursor after addNote and advancing to where it was) can give the correct result. However, this doesn't work for transposing instruments. For a Clarinet in Bb we get this when in concert pitch view:
- This clarinet part now has this in transposed view (concert pitch off):
The TPCs now no longer match but worse yet, the notes are just wrong (although they play back the same as the transposed view – a major second higher than shown).
Attachment | Size |
---|---|
testAddNote.qml | 1.54 KB |
Comments
Hi heuchi. I was having the same problem, and your fix worked for the first note of a chord. I am using the AddChord plugin. But I can't get it to work for the other notes of the chord.
chord[i].note.tpc (and variations) is not valid: 109:-1: TypeError: Cannot read property 'note' of undefined.
Any suggestions?
It is
chord.notes[i].tpc
, notes and an index into thatIn reply to It is chord[i].notes.tpc ,… by Jojo-Schmitz
Thanks a lot Jojo!! that worked and fixed the problem:
chord.add(note); //add notes to the chord
chord.notes[i].tpc = tpc; // this line must come after chord.add.
So is this even still valid?
In reply to (No subject) by Jojo-Schmitz
Works for me. I’m on version 3.52.311459983 revision 465e7b6. Create an empty piano score with at least 62 bars & run writechords.qml (code mostly borrowed from other plugins).
Let's mark it fixed then, even if we don't know since when exactly
Automatically closed -- issue fixed for 2 weeks with no activity.