GSoC 2016 - Week 5 - Voice separation & rhythmical ties
This was my fifth week working on note entry with MuseScore for Google Summer of Code. Last week I began to separate the user’s input into different voices to make it look more like sheet music. This week I continued with that task, and took another look at simplifying note durations in an attempt to follow standard rules for the placement of any remaining ties, or when tied notes should be actually be used in favour of dotted notes, according to the rhythm and placement within the measure.
This week’s summary:
- Improvements to voice separation algorithm
- Rhythmical ties
Still to do:
- Rhythmical note groupings based on time signature.
Voice separation
Last week I managed to achieve basic voice separation, but there were many situations in which the result was not ideal, and some extreme cases that the algorithm was not able to handle at all. This week I improved the algorithm to handle most of these cases. One area for improvement was ensuring the the voices are sorted in terms of pitch, so that Voice 1 is higher on average than any of the other voices, Voice 2 is lowest, and the remaining voices are in-between (with Voice 3 being higher than Voice 4).
Rhythmical ties
Sometimes it is not possible to represent a certain note duration without using a tie. An obvious example is when the note crosses a barline, but this is not a problem for voice separation because the placement of the tie is well-defined.
Problems occur when a note has a duration that cannot be represented by a standard duration (crotchet/quarter-note, quaver/eighth-note, etc.), not even when combined with any number of dots. An example of this would be a note that lasts for 2 ½ beats in 4/4 time. Such a note must either be represented by a tied minim + quaver (half-note + eighth-note), or as a crotchet + dotted crotchet (quarter-note + dotted quarter note), and the order of the notes is also variable. In such cases it is standard practice to arrange the notes such that the note after the tie begins on a full beat, because this is thought to make it easier to stay in rhythm.
Similarly, there are times when two notes are used when only one is strictly necessary. This happens if the note does not begin on a full beat, or if it crosses a principal beat in a compound time signature. In such cases the note is again split such that the second part does start on a full beat.
Comments
The midi import code seems to work decently for grouping notes. Perhaps you can adapt that for your project.