Second Note in a Tie is silent when first note is deleted

• Jan 11, 2011 - 20:44
Type
Functional
Severity
S4 - Minor
Status
closed
Project

OS: WIndows 7 x86-64
MuseScore Version: MuseScore 0.9.6.0 (x86)
When two notes are tied together and the first is deleted, I found that when playing the note in the score, MuseScore does not create a sound for this second note.
I found this bug By Creating a note that is longer than the included measure Duration and deleting the first note in the tied sequence.
I would like to hear the note that is left when I delete the first Tied Note.


Comments

I can confirm on 0.9.6.3 on Mac 10.6.5.
1. Create a basic score in 4/4
2. Create a note in the first measure and then press 8 to make it 8 beats long.
3. Put a normal-length note(s) in the third measure.
4. Delete the first measure's note
5. Play --> The second measure does not play, but the score continues on after resting to the third measure

I think the issue is that while MuseScore deletes only the first note element in the tie sequence, it fails to consider the second note, There is probably a property in the second not that says that while it doesn't start a sound it continues the sound occurring right before it.
I can see to possible fixes:
One, when deleting a note, MuseScore should check to see whether or not it starts a tie, and if so, delete the following note as well, else it should proceed normally.
Two, MuseScore could Check the properties of the next note, and find if that note, while having a pitch, does not start a sound and either deletes it or changes the properties to let it start the sound.

Status (old) active patch (code needs review)

Hi,
I made a change to the MuseScore Code which would, when deleting a note with leading a tie, remove the tie, and have the second note in the tie play.
The addition I made is underlined in the following code segment the following:


void Score::deleteItem(Element* el)
{
switch(el->type()) { ....
case CHORD:
{ ...
Chord* chord = static_cast(el);
removeChordRest(chord, false);

// replace with rest if voice 0 or if in tuplet
Tuplet* tuplet = chord->tuplet();
// if ((el->voice() == 0 || tuplet) && (chord->noteType() == NOTE_NORMAL)) {
if (chord->noteType() == NOTE_NORMAL) {
Rest* rest = new Rest(this, chord->durationType());
rest->setDurationType(chord->durationType());
rest->setDuration(chord->duration());
rest->setTrack(el->track());
rest->setParent(chord->parent());
Segment* segment = chord->segment();
undoAddCR(rest, segment->measure(), segment->tick());
QList notes=chord->notes();
foreach(Note* n,notes){
Tie* tie = n->tieFor();
if(tie!=NULL)
{
Score::removeElement(tie);
}

}
// undoAddElement(rest);
if (tuplet) {
tuplet->add(rest);
rest->setTuplet(tuplet);
rest->setDurationType(chord->durationType());
}
select(rest, SELECT_SINGLE, 0);
}
else {
// remove segment if empty
Segment* seg = chord->segment();
if (seg->isEmpty())
undoRemoveElement(seg);
}
}
break;

Should I commit edit.cpp with the following changes? I've never done this before, and I want to make sure I'm doing the right thing. I would appreciate confirmation before I upload my file.

Thanks --- Andrew

Attachment Size
issue8625.patch 134.56 KB

I'm not the best to review your patch, but I noticed that the patch replaces every line in the file (instead of just the lines affected by the code that you want to change). Which makes a more difficult to review the important changes.

What text editor did you use? What program did you use to create the patch file?

Status (old) patch (code needs review) fixed

MuseScore source files have a "unix style" newline ending ("\n"). The change was made with an editor which creates "microsoft style" cr/lf ("\r\n") endings. So all lines are different which makes a diff pretty useless.

When making changes make sure using a text editor which uses "\n" line endings.

The problem was that the backlink of the second note to the tie was not removed. On playback the second note then still looks like a tied note which is skipped.

The above patch may give problems with undo. I choosed another fix by removing the backlinks in undo.cpp: RemoveElement() (revision 3906).