Skip to main content

Module reduce_chords

Module reduce_chords 

Source
Expand description

A score reduced to the chords it is made of: music21’s analysis.reduceChords.

reduce_chords is music21’s ChordReducer.run. It reads the score’s notes as spans of time – a part, a stretch, and the notes sounding in it – drops the spans of no length and, if asked, the notes above the bass of a dissonant moment. Each measure of the first part is then cut into slices wherever a note starts or stops, and the slices sounding the same pitch classes are weighed together: how long each lasts, times how strong the beat it starts on is (the last sounding slice counting its length alone), times a tenth if it is dissonant. The few heaviest are kept, each lasting until the next kept slice of other classes. A chord that is the same as the first chord of the next measure is tied to it, and the reduction gets the clef that best fits its notes.

Structs§

KeptChord
One chord a reduction keeps: which of the measure’s chords it is, where it goes and how long it sounds.
MeasureSlice
One stretch of a measure between two places where a note starts or stops: music21’s MeasureSlice, its verticality read as where it stands and what sounds there.
ReductionOptions
What a reduction is asked for: music21’s arguments to ChordReducer.run.
SliceWeigher
What a slice of a measure weighs, given its quarter length, the meter’s accent where it starts, whether it is the last sounding slice of the measure and whether it is consonant: music21’s weightAlgorithm.
WeighedChord
One chord of a measure as the weighing reads it: where it stands, what it is, and how strong the beat it stands on is.

Enums§

ChordWeight
How much a chord weighs in its measure: music21’s four weight algorithms, one of which its ChordReducer hands to computeMeasureChordWeights.

Functions§

interval_class_set
Every interval class between two of the notes, 1 to 6, each once and in order: music21’s _getIntervalClassSet, which is how is_consonant reads the notes and the chords a reduction allows or forbids.
is_consonant
Whether notes sound consonant: music21’s isConsonant. Notes whose interval_class_set is one of the forbidden sets are dissonant, and those whose set is one of the allowable consonant; any others are as consonant as their chord is. Each set is read as a set, in any order.
keep_heaviest_slices
The slices to keep of a measure’s, lengthened: music21’s keepHeaviestSlices.
measure_chord_weights
How much each chord of a measure weighs, keyed by the pitch classes it sounds and in the order the chords were met: music21’s computeMeasureChordWeights.
measure_slices
The stretch of tree from start to end cut wherever a timespan starts or stops, each slice with where it starts from start, how long it lasts, and what sounds there: music21’s measureSlices. time_points hands over the tree’s all_time_points where many measures are cut from one tree.
reduce_chords
A score reduced to its chords: music21’s ChordReducer.run, which hands back a score of one part, the first part’s measures holding the chords.
reduce_measure_to_n_chords
A measure reduced to the few chords weighing most in it: music21’s reduceMeasureToNChords, built on reduced_measure_places.
reduced_measure_places
Which chords of a measure a reduction keeps, and where: music21’s reduceMeasureToNChords read as places rather than as a stream.
slice_weight
What a slice weighs by default: music21’s sliceWeight. Its quarter length times its accent, or its quarter length alone if it is the last sounding slice, times a tenth unless it is consonant.
slice_weights
What each set of sorted pitch classes sounding among slices weighs, in the order they are met: music21’s sliceWeights.