User’s Guide, Chapter 56: Segmented and Approximate Search¶
Previously we have looked at ways of finding passages of notes within a single score, but what if we want to search across scores, or find only approximate matches? The music21.search and music21.search.segment modules have tools for making this possible. Let’s load up a piece by Palestrina to start:
from music21 import *
pal = corpus.parse('palestrina/Agnus_0')
pal.measures(0, 7).show()
It looks like the opening motive in the first part (let’s call it “Cantus” even though it’s unlabeled) will reoccur in the Tenor, and maybe elsewhere in the piece. Let’s divide the score up into four-note segments: