music21.analysis.reduceChordsOld¶
Automatically reduce a MeasureStack to a single chord or group of chords.
Functions¶
-
music21.analysis.reduceChordsOld.
testMeasureStream1
()¶ returns a simple measure stream for testing:
>>> s = analysis.reduceChords.testMeasureStream1() >>> s.show('text') {0.0} <music21.meter.TimeSignature 4/4> {0.0} <music21.chord.Chord C4 E4 G4 C5> {2.0} <music21.chord.Chord C4 E4 F4 B4> {3.0} <music21.chord.Chord C4 E4 G4 C5>
ChordReducer¶
-
class
music21.analysis.reduceChordsOld.
ChordReducer
¶
ChordReducer
methods
-
ChordReducer.
computeMeasureChordWeights
(measureObj, weightAlgorithm=None)¶ >>> s = analysis.reduceChords.testMeasureStream1().notes >>> cr = analysis.reduceChords.ChordReducer() >>> cws = cr.computeMeasureChordWeights(s) >>> for pcs in sorted(cws): ... print("%18r %2.1f" % (pcs, cws[pcs])) (0, 4, 7) 3.0 (0, 11, 4, 5) 1.0
Add beatStrength:
>>> cws = cr.computeMeasureChordWeights(s, weightAlgorithm=cr.quarterLengthBeatStrength) >>> for pcs in sorted(cws): ... print("%18r %2.1f" % (pcs, cws[pcs])) (0, 4, 7) 2.2 (0, 11, 4, 5) 0.5
Give extra weight to the last element in a measure:
>>> cws = cr.computeMeasureChordWeights(s, ... weightAlgorithm=cr.quarterLengthBeatStrengthMeasurePosition) >>> for pcs in sorted(cws): ... print("%18r %2.1f" % (pcs, cws[pcs])) (0, 4, 7) 3.0 (0, 11, 4, 5) 0.5
Make consonance count a lot:
>>> cws = cr.computeMeasureChordWeights(s, weightAlgorithm=cr.qlbsmpConsonance) >>> for pcs in sorted(cws): ... print("%18r %2.1f" % (pcs, cws[pcs])) (0, 4, 7) 3.0 (0, 11, 4, 5) 0.1
-
ChordReducer.
multiPartReduction
(inStream, maxChords=2, closedPosition=False, forceOctave=False)¶ Return a multipart reduction of a stream.
-
ChordReducer.
qlbsmpConsonance
(c)¶ Everything from before plus consonance
-
ChordReducer.
quarterLengthBeatStrength
(c)¶
-
ChordReducer.
quarterLengthBeatStrengthMeasurePosition
(c)¶
-
ChordReducer.
quarterLengthOnly
(c)¶
-
ChordReducer.
reduceMeasureToNChords
(measureObj, numChords=1, weightAlgorithm=None, trimBelow=0.25)¶ >>> s = analysis.reduceChords.testMeasureStream1() >>> cr = analysis.reduceChords.ChordReducer()
Reduce to a maximum of 3 chords; though here we will only get one because the other chord is below the trimBelow threshold.
>>> newS = cr.reduceMeasureToNChords(s, 3, ... weightAlgorithm=cr.qlbsmpConsonance, trimBelow = 0.3) >>> newS.show('text') {0.0} <music21.meter.TimeSignature 4/4> {0.0} <music21.chord.Chord C4 E4 G4 C5> >>> newS.notes[0].quarterLength 4.0
-
ChordReducer.
reduceThisMeasure
(mI, measureIndex, maxChords, closedPosition, forceOctave)¶