amads.polyphony.skyline#
- amads.polyphony.skyline(score, threshold=0.1)[source]#
Finds the skyline of a musical score.
(Copy-pasted from Prof Dannenberg’s email) Filters a score, removing any note that is below another note. There are tricky edge cases:
A lower note that quickly is followed by a higher note: Probably the right thing is ignore the lower note if the time to the upper note is less than some threshold (maybe default to 0.1 beats) that can be set through a keyword parameter.
(not implemented yet) A rolled chord with 10 notes starts at the bottom, and every 0.05 quarter notes, a new note enters. So the previous rule applies to each note but the top note is a full 0.45 quarters after the first one? Do we still ignore notes? I would say yes.
A lower note is not so quickly followed by a higher note. Shorten the lower note to end at the time of the upper note.
An upper note of a melody sustains in a legato fashion past the next, but lower, note of the melody. Though musically the upper note should be shortened and we should keep the lower note, the “skyline” concept says the top note has priority, so shift the onset time of the lower note to the end time of the upper note, and shorten the lower note duration so that it still ends at the same time as before.
It is common to have melodies in lower voices. This algorithm just fails to find the melody.
- Args:
score (Score): The musical score to filter threshold (float, optional): The threshold for quickly followed notes
(default 0.1)
- Returns:
Score: A new score containing the “skyline” notes
- Parameters:
score (
Score
)threshold (
float
)