Tools for generation reduction displays, showing a score and or a chord reduction, and one or more reductive representation lines.

Used by graph.PlotHorizontalBarWeighted()


class music21.analysis.reduction.PartReduction(srcScore=None, *args, **keywords)

A part reduction reduces a Score into one or more parts. Parts are combined based on a part group dictionary. Each resulting part is then segmented by an object. This object is assigned as floating-point value.

This reduction is designed to work with the GraphHorizontalBarWeighted and related Plot subclasses.

If the fillByMeasure parameter is True, and if measures are available, each part will segment by Measure divisions, and look for the target activity only once per Measure.

If more than one target is found in the Measure, values will be averaged.

If fillByMeasure is False, the part will be segmented by each Note.

The segmentByTarget parameter is True, segments, which may be Notes or Measures, will be divided if necessary to show changes that occur over the duration of the segment by a target object.

If the normalizeByPart parameter is True, each part will be normalized within the range only of that part. If False, all parts will be normalized by the max of all parts. The default is True.

If the normalize parameter is False, no normalization will take place. The default is True.

PartReduction methods


Get all data organized into bar span specifications.


Core processing routines.


class music21.analysis.reduction.ReductiveNote(specification, inputNote, measureIndex, measureOffset)

The extraction of an event from a score and specification of where and how it should be presented in a reductive score.

A specification string, as well as Note, must be provided for parsing.

ReductiveNote methods


Produce a new note, a deep copy of the supplied note and with the specified modifications.



class music21.analysis.reduction.ScoreReduction(*args, **keywords)

An object to reduce a score.

ScoreReduction read/write properties


Get or set a Chord reduction as a Stream or Score. Setting the this values set a deepcopy of the reduction; the reduction set here will not be altered.


Get or set the Score. Setting the score set a deepcopy of the score; the score set here will not be altered.

>>> s = corpus.parse('bwv66.6')
>>> sr = analysis.reduction.ScoreReduction()
>>> sr.score = s

ScoreReduction methods


Given a score, populate this Score reduction