Navigation

  • index
  • modules |
  • next |
  • previous |
  • music21 »
  • Documentation and tests in progress »
  • User’s Guide, Chapter 56: Segmented and Approximate Search

Previous topic

User’s Guide, Chapter 46: Streams 3: Manipulation, inPlace, and deepcopy

Next topic

User’s Guide, Chapter 57: Speeding up music21

Table of Contents

  • About music21
  • User’s Guide
  • Module Reference
  • Installation
  • Developer Reference
  • Documentation and tests in progress
    • User’s Guide, Chapter 33: Expressions and Ornaments
    • User’s Guide, Chapter 36: Clients and Weak References
    • User’s Guide, Chapter 41: Figured Bass
    • User’s Guide, Chapter 46: Streams 3: Manipulation, inPlace, and deepcopy
    • User’s Guide, Chapter 56: Segmented and Approximate Search
    • User’s Guide, Chapter 57: Speeding up music21
    • Examples and Demonstrations
    • Timespan Demos
    • Inversion Demo
    • Testing Plotting w/o Music21
    • Testing Plotting with Music21
    • Testing ipywidgets and Music21
    • Tests of .show() of music21 within Notebooks

Quick search

This Page

  • Show Source

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()
../_images/usersGuide_56_searching2_1_0.png

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:

Navigation

  • index
  • modules |
  • next |
  • previous |
  • music21 »
  • Documentation and tests in progress »
  • User’s Guide, Chapter 56: Segmented and Approximate Search
© Copyright 2006-2023 Michael Scott Asato Cuthbert. Last updated on Jun 12, 2023.