Measure splits my chord
Hello everyone, I've developed a plugin that manages the pitches of musical elements (double notes, single notes, or rests) and adjusts their durations. However, I've encountered an issue with double notes when they span across measures. In such cases, the double note seems to split, and the entire double note starts anew in the following measure. Has anyone experienced a similar problem, and do you have any insights on how to address this issue? Your assistance would be greatly appreciated. Thank you!
Attachment | Size |
---|---|
measure.png | 31.6 KB |
Comments
import QtQuick 2.0
import MuseScore 3.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
MuseScore {
menuPath: "Plugins.pluginName"
description: "Description goes here"
version: "1.0"
height: 400
width: 400
pluginType: "dialog"
}
In reply to import QtQuick 2.0 import… by kamilio141414
do you mean lengthening of 44? that requires manually changing the bar. maybe related to https://musescore.org/en/project/duration-editor
In reply to do you mean lengthening of… by msfp
I mean the lowest note in a chord starts where it should and then at the beggining of the next measure all remaining notes start. Not at a place they just just like the lowest note
In reply to I mean the lowest note in a… by kamilio141414
haven't try the code yet, maybe wrapping each addNote and addRest with startcmd and endcmd individually
In reply to haven't try the code yet,… by msfp
Give it a try please
In reply to Give it a try please by kamilio141414
also addNote mutates the cursor
In reply to also addNote mutates the… by msfp
Thats why I used second parameter in addNote
In reply to Thats why I used second… by kamilio141414
i mean the cursor's time position changes after addnote
see https://musescore.org/en/node/320673#s7
In reply to i mean the cursor's time… by msfp
Yeah but when u addNote(note[0].pitch, true) the second parameter true keeps the same position so the notes stack up one another
In reply to Yeah but when u addNote(note… by kamilio141414
just tried the code. the weird problem occurs only when the chord created spans across measures. run out of idea for now
In reply to just tried the code. the… by msfp
Exactly,, thanks for the effort tho
In reply to Exactly,, thanks for the… by kamilio141414
turns out "the second parameter true keeps the same position so the notes stack up one another" is not true
cursor advances to 2460, but it should stay at 1980
one solution may be repositioning the cursor beforehand at each loop
In reply to turns out "the second… by msfp
Thanks I will give it a try :)
In reply to Thanks I will give it a try … by kamilio141414
I just cannot get it going right can please help me wit the code ?
In reply to I just cannot get it going… by kamilio141414
how about
...
var tick=cursor.tick
for (var j = 0; j < newElements[i].notes.length; j++) {
cursor.rewindToTick(tick)
...
edit
newElements[i].notes.length could change along with addition of notes too, so better
...
var originalnotelength=newElements[i].notes.length
var tick=cursor.tick
for (var j = 0; j < originalnotelength; j++) {
cursor.rewindToTick(tick)
...
In reply to how about var tick=cursor… by msfp
It still works kinda weird the chord somehow never spreads over one meassure right now