A discussion of "Implode" and potential revisions to how it works
I’d like to propose some changes to the Edit / Tools / Implode function. Let’s begin by reviewing the current documentation:
Select a range of measures across staves that have substantially similar rhythms, run Edit → Tools → Implode. MuseScore will combine the contents of the staves into chords on the top staff - the opposite of explode. There is a special case if you select only a single staff - MuseScore will do essentially the same thing but combine the contents of multiple voices on that staff into chords in voice 1.
Let’s look at Implode with examples. As the documentation tells us, there are two modes. Here is an example in which multiple staves are selected ("before" on the left, "after" on the right):
Note that Implode combines only voice 1 in each staff. All other voices are ignored and unchanged. Voice 1 of the first staff is the only voice modified.
Let’s try an Implode with a single staff selected. This is only useful if we have more than one voice:
Voice 1 now contains the notes that used to be in voice 2, and voice 2 is gone.
Let’s take a look at a rather simple example that shows one of the big shortcomings of the current Implode:
What’s happening is that Implode uses voice 1 as a guide. It only looks at content on the other staves when voice 1 contains a chord. The documentation states that the measures must have “substantially similar rhythms” and one can certainly argue that an empty measure does not have the same rhythm as a measure with chords. Still, this approach makes a lot of reasonable combinations rather tedious.
The problem also occurs when a single staff is selected:
This is troubling in that even though the voice 2 and 3 notes were not combined, they were deleted.
Now, let’s look at what happens when the rhythms are not “substantially similar”. The first example is with multiple staves:
When a chord in staves 2 and 3 begin at the same time as a chord in staff 1, the notes are copied but their durations are (of course) the same as the other notes in the chord.
Let’s try it with a single staff:
The end result are quite different. When combining voices on a single staff, chords with same start time and duration are combined, chords with different start times, but which occur while a voice 1 chord is playing are left unchanged and chords that occur while voice 1 has a rest are discarded. In this example, nothing is actually merged, but some voice 2 notes are deleted.
Another problem (feature?) of Implode is that it pays no attention to the Selection Filter. If a single staff is selected, it tries to combine voices 1-4 into voice 1. If multiple staves are selected, it combines voice 1 of each staff to voice 1 of the top staff.
The revisions I would like to propose are the following:
- Chords are favored over rests, regardless of which voice the chords occur in.
- In single-staff mode, all selected voices are combined into the highest selected voice. A chord is only deleted if its notes are copied into this highest voice or if the notes are duplicates of notes already in the chord.
- In multiple-staves mode, all selected voices are combined into the highest selected voice (as in single-staff mode), but nothing is deleted.
We still need to deal with notes with different durations and start times. One option would be to break chords into combinations that use ties and that can be merged:
There is another alternative: merge the chords that can be merged, and put the rest into additional voices. Only selected (by the Selection Filter) voices are considered. When merging a chord, look at all candidate voices in the top staff. If any of them have a chord with the same start time and duration, merge the chord with that one. If not, but one of the candidate voices has a rest that can accommodate the chord, copy the chord into that voice. If neither option is present, then we could discard the chord or apply the “tie” approach to the last candidate voice in the staff.
The current algorithm either changes the durations of chords with the same start time as chords in the top-most voice 1 or ignores chords with a different start time. This is possible because the top-most voice 1 is the “master”. I would prefer to use algorithms that don’t give preference to one voice over another (as much as possible).
I’m not sure if one of my alternatives is better than the other, but I hate to add a dialog that asks you which method you prefer each time you use the function. Perhaps, we could use a preference setting?
Thoughts? Should I pursue this? Are the other factors I should consider?