This module defines objects for defining and manipulating structures common to serial and/or twelve-tone music, including ToneRow subclasses.
A convenience function that, given a list of pitch classes represented as integers and turns it in to a serial.ToneRow object.
>>> from music21 import *
>>> a = serial.pcToToneRow(range(12))
>>> matrixObj = a.matrix()
>>> print matrixObj
0 1 2 3 4 5 6 7 8 9 A B
B 0 1 2 3 4 5 6 7 8 9 A
...
>>> a = serial.pcToToneRow([4,5,0,6,7,2,'a',8,9,1,'b',3])
>>> matrixObj = a.matrix()
>>> print matrixObj
0 1 8 2 3 A 6 4 5 9 7 B
B 0 7 1 2 9 5 3 4 8 6 A
...
takes a row of numbers of converts it to a 12-tone matrix.
Finds contiguous segments of notes in a stream, where the number of notes in the segment is specified.
The inputPart must be a stream.Part object or otherwise a stream object with at most one part. The length is an integer specifying the desired number of notes in each contiguous segment.
The reps argument specifies how repeated pitch classes are dealt with. It may be set to ‘skipConsecutive’, ‘rowsOnly’, or ‘includeAll’. The first setting treats immediate repetitions of pitch classes as one instance of the same pitch class. The second only finds segments of consecutive pitch classes which are distinct, i.e. tone rows. The third includes all repeated pitches.
The ‘chord’ argument specifies how chords are dealt with. At the present time, it must be set to ‘skipChords’, which ignores any segment containing a chord.
The returned list gives all contiguous segments with the desired number of notes subject to the specified constraints on repetitions and chords. Each entry of the list is a tuple of a contiguous segment of notes and the measure number of its first note.
>>> from music21 import *
>>> s = stream.Stream()
>>> n1 = note.Note('e4')
>>> n1.quarterLength = 6
>>> s.append(n1)
>>> n2 = note.Note('f4')
>>> n2.quarterLength = 1
>>> s.append(n2)
>>> n3 = chord.Chord(['g4', 'b4'])
>>> n3.quarterLength = 1
>>> s.append(n3)
>>> n4 = note.Note('g4')
>>> n4.quarterLength = 1
>>> s.repeatAppend(n4, 2)
>>> n5 = note.Note('a4')
>>> n5.quarterLength = 3
>>> s.repeatAppend(n5, 2)
>>> n6 = note.Note('b4')
>>> n6.quarterLength = 1
>>> s.append(n6)
>>> n7 = note.Note('c5')
>>> n7.quarterLength = 1
>>> s.append(n7)
>>> s = s.makeMeasures()
>>> s.makeTies()
>>> serial.getContiguousSegmentsOfLength(s, 3, 'skipConsecutive', 'skipChords')
[([<music21.note.Note G>, <music21.note.Note A>, <music21.note.Note B>], 3),
([<music21.note.Note A>, <music21.note.Note B>, <music21.note.Note C>], 3)]
>>> serial.getContiguousSegmentsOfLength(s, 3, 'rowsOnly', 'skipChords')
[([<music21.note.Note A>, <music21.note.Note B>, <music21.note.Note C>], 4)]
>>> serial.getContiguousSegmentsOfLength(s, 3, 'includeAll', 'skipChords')
[([<music21.note.Note G>, <music21.note.Note G>, <music21.note.Note A>], 3),
([<music21.note.Note G>, <music21.note.Note A>, <music21.note.Note A>], 3),
([<music21.note.Note A>, <music21.note.Note A>, <music21.note.Note B>], 3),
([<music21.note.Note A>, <music21.note.Note B>, <music21.note.Note C>], 4)]
Given a stream object and list of contiguous segments of pitch classes (each given as a list), returns a list of all instances of the segment in the stream subject to the constraints on repetitions of pitches and how chords are dealt with as described in getContinuousSegmentsOfLength. Each instance is given as a tuple of the segment of notes, the number of the measure in which it appears, and, if the stream object contains parts, the part in which it appears (where a lower number denotes a higher part).
>>> from music21 import *
>>> part = stream.Part()
>>> n1 = note.Note('e4')
>>> n1.quarterLength = 6
>>> part.append(n1)
>>> n2 = note.Note('f4')
>>> n2.quarterLength = 1
>>> part.append(n2)
>>> n3 = chord.Chord(['g4', 'b4'])
>>> n3.quarterLength = 1
>>> part.append(n3)
>>> n4 = note.Note('g4')
>>> n4.quarterLength = 1
>>> part.repeatAppend(n4, 2)
>>> n5 = note.Note('a4')
>>> n5.quarterLength = 3
>>> part.repeatAppend(n5, 2)
>>> n6 = note.Note('b4')
>>> n6.quarterLength = 1
>>> part.append(n6)
>>> n7 = note.Note('c5')
>>> n7.quarterLength = 1
>>> part.append(n7)
>>> newpart = part.makeMeasures()
>>> newpart.makeTies()
>>> findSegments(newpart, [[7, 9, 11]], 'skipConsecutive', 'skipChords')
[([<music21.note.Note G>, <music21.note.Note A>, <music21.note.Note B>], 3)]
>>> findSegments(newpart, [[7, 9, 11], [9, 11, 0]], 'skipConsecutive', 'skipChords')
[([<music21.note.Note G>, <music21.note.Note A>, <music21.note.Note B>], 3),
([<music21.note.Note A>, <music21.note.Note B>, <music21.note.Note C>], 3)]
>>> s = stream.Stream()
>>> s.repeatAppend(newpart, 2)
>>> findSegments(s, [[7, -3, 11]], 'skipConsecutive', 'skipChords')
[([<music21.note.Note G>, <music21.note.Note A>, <music21.note.Note B>], 3, 1),
([<music21.note.Note G>, <music21.note.Note A>, <music21.note.Note B>], 3, 2)]
Given a stream object and list of segments of pitch classes (each given as a list), returns a list of all instances of the segment and its transpositions in the stream subject to the constraints on repetitions of pitches and how chords are dealt with as described in getContinuousSegmentsOfLength. Each instance is given as a tuple of the segment of notes, the number of the measure in which it appears, and, if the stream object contains parts, the part in which it appears (where a lower number denotes a higher part).
>>> from music21 import *
>>> part = stream.Part()
>>> n1 = note.Note('e4')
>>> n1.quarterLength = 6
>>> part.append(n1)
>>> n2 = note.Note('f4')
>>> n2.quarterLength = 1
>>> part.append(n2)
>>> n3 = chord.Chord(['g4', 'b4'])
>>> n3.quarterLength = 1
>>> part.append(n3)
>>> n4 = note.Note('g4')
>>> n4.quarterLength = 1
>>> part.repeatAppend(n4, 2)
>>> n5 = note.Note('a4')
>>> n5.quarterLength = 3
>>> part.repeatAppend(n5, 2)
>>> n6 = note.Note('b4')
>>> n6.quarterLength = 1
>>> part.append(n6)
>>> n7 = note.Note('c5')
>>> n7.quarterLength = 1
>>> part.append(n7)
>>> newpart = part.makeMeasures()
>>> newpart.makeTies()
>>> findTransposedSegments(newpart, [[0, 1]], 'skipConsecutive', 'skipChords')
[([<music21.note.Note E>, <music21.note.Note F>], 1), ([<music21.note.Note B>, <music21.note.Note C>], 5)]
>>> s = stream.Stream()
>>> s.repeatAppend(newpart, 2)
>>> findTransposedSegments(s, [[12, 2]], 'skipConsecutive', 'skipChords')
[([<music21.note.Note G>, <music21.note.Note A>], 3, 1), ([<music21.note.Note A>, <music21.note.Note B>], 3, 1),
([<music21.note.Note G>, <music21.note.Note A>], 3, 2), ([<music21.note.Note A>, <music21.note.Note B>], 3, 2)]
Given a stream object and list of segments of pitch classes (each given as a list), returns a list of all instances of the segment and its transformations in the stream subject to the constraints on repetitions of pitches, how chords are dealt with as described in getContinuousSegmentsOfLength, and a transformation index convention. Each instance is given as a tuple of the segment of notes, the transformation of the original row, the number of the measure in which it appears, and, if the stream object contains parts, the part in which it appears (where a lower number denotes a higher part).
>>> from music21 import *
>>> n1 = note.Note('c#4')
>>> n2 = note.Note('e4')
>>> n3 = note.Note('d#4')
>>> n4 = note.Note('f4')
>>> n5 = note.Note('e4')
>>> n6 = note.Note('g4')
>>> notelist = [n1, n2, n3, n4, n5, n6]
>>> part = stream.Part()
>>> for n in notelist:
... n.quarterLength = 1
... part.append(n)
>>> part = part.makeMeasures()
>>> serial.findTransformedSegments(part, [[2, 5, 4]], 'rowsOnly', 'skipChords', 'zero')
[([<music21.note.Note C#>, <music21.note.Note E>, <music21.note.Note D#>], [('P', 1)], 1),
([<music21.note.Note F>, <music21.note.Note E>, <music21.note.Note G>], [('RI', 7)], 1)]
Given a stream object and list of (unordered) multisets of pitch classes (each given as a list), returns a list of all instances of the set in the stream subject to the constraints on repetitions of pitches and how chords are dealt with as described in getContinuousSegmentsOfLength. Note that a multiset is a generalization of a set in which multiple apperances of the same element (in this case, pitch class) in the multi-set are allowed, hence the use of the list, rather than the set, type. Each instance of the multiset is given as a tuple of the segment of notes, the number of the measure in which it appears, and, if the stream object contains parts, the part in which it appears (where a lower number denotes a higher part).
>>> from music21 import *
>>> part = stream.Part()
>>> n1 = note.Note('e4')
>>> n1.quarterLength = 4
>>> n2 = note.Note('f4')
>>> n2.quarterLength = 4
>>> part.repeatAppend(n1, 2)
>>> part.append(n2)
>>> part.append(n1)
>>> part = part.makeMeasures()
>>> findMultisets(part, [[5, 4, 4]], 'includeAll', 'skipChords')
[([<music21.note.Note E>, <music21.note.Note E>, <music21.note.Note F>], 1),
([<music21.note.Note E>, <music21.note.Note F>, <music21.note.Note E>], 2)]
Given a stream object and list of (unordered) multisets of pitch classes (each given as a list), returns a list of all instances of the set, with its transpositions in the stream subject to the constraints on repetitions of pitches and how chords are dealt with as described in getContinuousSegmentsOfLength. Note that a multiset is a generalization of a set in which multiple apperances of the same element (in this case, pitch class) in the multi-set are allowed, hence the use of the list, rather than the set, type. Each instance of the multiset is given as a tuple of the segment of notes, the number of the measure in which it appears, and, if the stream object contains parts, the part in which it appears (where a lower number denotes a higher part).
>>> from music21 import *
>>> part = stream.Part()
>>> n1 = note.Note('c4')
>>> n2 = note.Note('c#4')
>>> n3 = note.Note('d4')
>>> n4 = note.Note('e4')
>>> n5 = note.Note('e-4')
>>> n6 = note.Note('e4')
>>> n7 = note.Note('d4')
>>> for n in [n1, n2, n3, n4, n5, n6, n7]:
... n.quarterLength = 2
... part.repeatAppend(n, 2)
>>> part = part.makeMeasures()
>>> instancelist = serial.findTransposedMultisets(part, [[1, 2, 3]], 'skipConsecutive', 'skipChords')
>>> print instancelist
[([<music21.note.Note D>, <music21.note.Note E>, <music21.note.Note E->], 3),
([<music21.note.Note E->, <music21.note.Note E>, <music21.note.Note D>], 5),
([<music21.note.Note C>, <music21.note.Note C#>, <music21.note.Note D>], 1)]
The instances are ordered by transposition, then by measure number: to reorder the list one may use Python’s built-in list-sorting functions.
>>> sorted(instancelist, key = lambda instance:instance[1])
[([<music21.note.Note C>, <music21.note.Note C#>, <music21.note.Note D>], 1),
([<music21.note.Note D>, <music21.note.Note E>, <music21.note.Note E->], 3),
([<music21.note.Note E->, <music21.note.Note E>, <music21.note.Note D>], 5)]
Given a stream object and list of (unordered) multisets of pitch classes (each given as a list), returns a list of all instances of the set, with its transpositions and inversions in the stream subject to the constraints on repetitions of pitches and how chords are dealt with as described in getContinuousSegmentsOfLength. Note that a multiset is a generalization of a set in which multiple apperances of the same element (in this case, pitch class) in the multi-set are allowed, hence the use of the list, rather than the set, type. Each instance of the multiset is given as a tuple of the segment of notes, the number of the measure in which it appears, and, if the stream object contains parts, the part in which it appears (where a lower number denotes a higher part).
>>> from music21 import *
>>> s = stream.Stream()
>>> n1 = note.Note('c4')
>>> n2 = note.Note('e-4')
>>> n3 = note.Note('g4')
>>> n4 = note.Note('e4')
>>> n5 = note.Note('c4')
>>> for n in [n1, n2, n3, n4, n5]:
... n.quarterLength = 1
... s.append(n)
>>> s = s.makeMeasures()
>>> serial.findTransposedAndInvertedMultisets(s, [[0, 4, 7]], 'rowsOnly', 'skipChords')
[([<music21.note.Note G>, <music21.note.Note E>, <music21.note.Note C>], 1),
([<music21.note.Note C>, <music21.note.Note E->, <music21.note.Note G>], 1)]
Inherits from: Stream, Music21Object, JSONSerializer
A Stream representation of a tone row, or an ordered sequence of pitches.
ToneRow attributes
- row¶
A list representing the pitch class values of the row.
Attributes inherited from Stream: isMeasure, isStream, isFlat, autoSort, isSorted, flattenedRepresentationOf
Attributes inherited from Music21Object: classSortOrder, isSpanner, isVariant, id, groups, hideObjectOnPrint
ToneRow properties
Properties inherited from Stream: atSoundingPitch, beat, beatDuration, beatStr, beatStrength, derivationChain, derivationMethod, derivesFrom, duration, elements, finalBarline, flat, highestOffset, highestTime, isGapless, lowestOffset, metadata, midiFile, musicxml, mx, notes, notesAndRests, offsetMap, rootDerivation, seconds, secondsMap, semiFlat, sorted, spannerBundle, spanners, variants, voices
Properties inherited from Music21Object: activeSite, classes, derivationHierarchy, isGrace, measureNumber, offset, priority
Properties inherited from JSONSerializer: json
ToneRow methods
- pitches()¶
Convenience method showing the pitch classes of a serial.ToneRow object as a list.
>>> from music21 import * >>> L = [5*i for i in range(0,12)] >>> quintupleRow = serial.pcToToneRow(L) >>> quintupleRow.pitches() [0, 5, 10, 3, 8, 1, 6, 11, 4, 9, 2, 7] >>> halfStep = serial.pcToToneRow([0, 1]) >>> halfStep.pitches() [0, 1]
- noteNames()¶
Convenience method showing the note names of a serial.ToneRow object as a list.
>>> from music21 import * >>> chromatic = serial.pcToToneRow(range(0,12)) >>> chromatic.noteNames() ['C', 'C#', 'D', 'E-', 'E', 'F', 'F#', 'G', 'G#', 'A', 'B-', 'B'] >>> halfStep = serial.pcToToneRow([0,1]) >>> halfStep.noteNames() ['C', 'C#']
- isTwelveToneRow()¶
Describes whether or not a serial.ToneRow object constitutes a twelve-tone row. Note that a serial.TwelveToneRow object might not be a twelve-tone row.
>>> from music21 import * >>> serial.pcToToneRow(range(0,12)).isTwelveToneRow() True >>> serial.pcToToneRow(range(0,10)).isTwelveToneRow() False >>> serial.pcToToneRow([3,3,3,3,3,3,3,3,3,3,3,3]).isTwelveToneRow() False
- isSameRow(row)¶
Convenience function describing if two rows are the same.
>>> from music21 import * >>> row1 = serial.pcToToneRow([6, 7, 8]) >>> row2 = serial.pcToToneRow([-6, 19, 128]) >>> row3 = serial.pcToToneRow([6, 7, -8]) >>> row1.isSameRow(row2) True >>> row2.isSameRow(row1) True >>> row1.isSameRow(row3) False
- getIntervalsAsString()¶
Returns the string of intervals between consecutive pitch classes of a serial.ToneRow object. ‘T’ = 10, ‘E’ = 11.
>>> from music21 import * >>> cRow = serial.pcToToneRow([0]) >>> cRow.getIntervalsAsString() '' >>> reversechromatic = serial.pcToToneRow([11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) >>> reversechromatic.getIntervalsAsString() 'EEEEEEEEEEE'
- zeroCenteredTransformation(transformationType, index)¶
Returns a serial.ToneRow object giving a transformation of a tone row. Admissible transformations are ‘P’ (prime), ‘I’ (inversion), ‘R’ (retrograde), and ‘RI’ (retrograde inversion). Note that in this convention, the transformations P3 and I3 start on the pitch class 3, and the transformations R3 and RI3 end on the pitch class 3.
>>> from music21 import * >>> chromatic = serial.pcToToneRow(range(0,12)) >>> chromatic.pitches() [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] >>> chromaticP3 = chromatic.zeroCenteredTransformation('P',3) >>> chromaticP3.pitches() [3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2] >>> chromaticI6 = chromatic.zeroCenteredTransformation('I',6) >>> chromaticI6.pitches() [6, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7] >>> schoenberg = serial.pcToToneRow(serial.RowSchoenbergOp26().row) >>> schoenberg.pitches() [3, 7, 9, 11, 1, 0, 10, 2, 4, 6, 8, 5] >>> schoenbergR8 = schoenberg.zeroCenteredTransformation('R',8) >>> schoenbergR8.pitches() [10, 1, 11, 9, 7, 3, 5, 6, 4, 2, 0, 8] >>> schoenbergRI9 = schoenberg.zeroCenteredTransformation('RI',9) >>> schoenbergRI9.noteNames() ['G', 'E', 'F#', 'G#', 'B-', 'D', 'C', 'B', 'C#', 'E-', 'F', 'A']
- originalCenteredTransformation(transformationType, index)¶
Returns a serial.ToneRow object giving a transformation of a tone row. Admissible transformations are ‘T’ (transposition), ‘I’ (inversion), ‘R’ (retrograde), and ‘RI’ (retrograde inversion). Note that in this convention, which is less common than the ‘zero-centered’ convention, the original row is not transposed to start on the pitch class 0. Thus, the transformation T3 transposes the original row by 3 semitones, and the transformations I3, R3, and RI3 first transform the row appropriately (without transposition), then transpose the resulting row by 3 semitones.
>>> from music21 import * >>> chromatic = serial.pcToToneRow(range(0,12)) >>> chromatic.pitches() [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] >>> chromaticP3 = chromatic.originalCenteredTransformation('P',3) >>> chromaticP3.pitches() [3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2] >>> chromaticI6 = chromatic.originalCenteredTransformation('I',6) >>> chromaticI6.pitches() [6, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7] >>> schoenberg = serial.pcToToneRow(serial.RowSchoenbergOp26().row) >>> schoenberg.pitches() [3, 7, 9, 11, 1, 0, 10, 2, 4, 6, 8, 5] >>> schoenbergR8 = schoenberg.originalCenteredTransformation('R',8) >>> schoenbergR8.pitches() [1, 4, 2, 0, 10, 6, 8, 9, 7, 5, 3, 11] >>> schoenbergRI9 = schoenberg.originalCenteredTransformation('RI',9) >>> schoenbergRI9.noteNames() ['B-', 'G', 'A', 'B', 'C#', 'F', 'E-', 'D', 'E', 'F#', 'G#', 'C']
- findZeroCenteredTransformations(otherRow)¶
Gives the list of zero-centered serial transformations taking one tone row to another, the second specified in the argument. Each transformation is given as a tuple of the transformation type and index.
>>> from music21 import * >>> chromatic = serial.pcToToneRow([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1]) >>> reversechromatic = serial.pcToToneRow([8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10, 9]) >>> chromatic.findZeroCenteredTransformations(reversechromatic) [('I', 8), ('R', 9)] >>> schoenberg25 = serial.pcToToneRow(serial.RowSchoenbergOp25.row) >>> schoenberg26 = serial.pcToToneRow(serial.RowSchoenbergOp26.row) >>> schoenberg25.findZeroCenteredTransformations(schoenberg26) [] >>> schoenberg26.findZeroCenteredTransformations(schoenberg26.zeroCenteredTransformation('RI',8)) [('RI', 8)]
- findOriginalCenteredTransformations(otherRow)¶
Gives the list of original-centered serial transformations taking one tone row to another, the second specified in the argument. Each transformation is given as a tuple of the transformation type and index.
>>> from music21 import * >>> chromatic = serial.pcToToneRow([2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 0, 1]) >>> reversechromatic = serial.pcToToneRow([8, 7, 6, 5, 4, 3, 2, 1, 0, 'B', 'A', 9]) >>> chromatic.findOriginalCenteredTransformations(reversechromatic) [('I', 6), ('R', 7)] >>> schoenberg25 = serial.pcToToneRow(serial.RowSchoenbergOp25.row) >>> schoenberg26 = serial.pcToToneRow(serial.RowSchoenbergOp26.row) >>> schoenberg25.findOriginalCenteredTransformations(schoenberg26) [] >>> schoenberg26.findOriginalCenteredTransformations(schoenberg26.originalCenteredTransformation('RI',8)) [('RI', 8)]
- makeTwelveToneRow()¶
Convenience function returning a music21.TwelveToneRow object with the same pitches. Note that the TwelveToneRow object may not be a twelve tone row.
>>> from music21 import * >>> a = serial.pcToToneRow(range(0,11)) >>> type(a) <class 'music21.serial.ToneRow'> >>> p = pitch.Pitch() >>> p.pitchClass = 11 >>> a.append(p) >>> a = a.makeTwelveToneRow() ... >>> type(a) <class 'music21.serial.TwelveToneRow'>Methods inherited from Stream: activateVariants(), addGroupForElements(), allPlayingWhileSounding(), analyze(), append(), attachIntervalsBetweenStreams(), attachMelodicIntervals(), attributeCount(), augmentOrDiminish(), bestClef(), chordify(), expandRepeats(), explode(), extendDuration(), extendDurationAndGetBoundaries(), extendTies(), extractContext(), findConsecutiveNotes(), findGaps(), flattenUnnecessaryVoices(), getClefs(), getElementAfterElement(), getElementAfterOffset(), getElementAtOrAfter(), getElementAtOrBefore(), getElementBeforeElement(), getElementBeforeOffset(), getElementById(), getElementByObjectId(), getElementsByClass(), getElementsByGroup(), getElementsByOffset(), getElementsNotOfClass(), getInstrument(), getInstruments(), getKeySignatures(), getOffsetByElement(), getOverlaps(), getSimultaneous(), getTimeSignatures(), groupCount(), groupElementsByOffset(), hasElement(), hasElementByObjectId(), hasElementOfClass(), hasMeasures(), hasPartLikeStreams(), hasVoices(), haveAccidentalsBeenMade(), haveBeamsBeenMade(), index(), insert(), insertAndShift(), insertAtNativeOffset(), insertIntoNoteOrChord(), internalize(), invertDiatonic(), isSequence(), isTwelveTone(), isWellFormedNotation(), makeAccidentals(), makeBeams(), makeChords(), makeImmutable(), makeMeasures(), makeMutable(), makeNotation(), makeRests(), makeTies(), makeTupletBrackets(), makeVoices(), measure(), measureOffsetMap(), measureTemplate(), measures(), melodicIntervals(), mergeElements(), metronomeMarkBoundaries(), pitchAttributeCount(), playingWhenAttacked(), plot(), pop(), quantize(), realizeOrnaments(), recurse(), remove(), removeByClass(), removeByNotOfClass(), repeatAppend(), repeatInsert(), replace(), restoreActiveSites(), scaleDurations(), scaleOffsets(), setDerivation(), setupSerializationScaffold(), shiftElements(), showVariantAsOssialikePart(), simultaneousAttacks(), sliceAtOffsets(), sliceByBeat(), sliceByGreatestDivisor(), sliceByQuarterLengths(), sort(), splitAtQuarterLength(), splitByClass(), storeAtEnd(), stripTies(), teardownSerializationScaffold(), toSoundingPitch(), toWrittenPitch(), transferOffsetToElements(), transpose(), trimPlayingWhileSounding(), unwrapWeakref(), voicesToParts(), wrapWeakref()
Methods inherited from Music21Object: addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextAttr(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), next(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), searchActiveSiteByAttr(), setContextAttr(), setOffsetBySite(), show(), splitAtDurations(), splitByQuarterLengths(), unfreezeIds(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: ToneRow, Stream, Music21Object, JSONSerializer
A Stream representation of a twelve-tone row, capable of producing a 12-tone matrix.
TwelveToneRow attributes
Attributes inherited from ToneRow: row
Attributes inherited from Stream: isMeasure, isStream, isFlat, autoSort, isSorted, flattenedRepresentationOf
Attributes inherited from Music21Object: classSortOrder, isSpanner, isVariant, id, groups, hideObjectOnPrint
TwelveToneRow properties
Properties inherited from Stream: atSoundingPitch, beat, beatDuration, beatStr, beatStrength, derivationChain, derivationMethod, derivesFrom, duration, elements, finalBarline, flat, highestOffset, highestTime, isGapless, lowestOffset, metadata, midiFile, musicxml, mx, notes, notesAndRests, offsetMap, rootDerivation, seconds, secondsMap, semiFlat, sorted, spannerBundle, spanners, variants, voices
Properties inherited from Music21Object: activeSite, classes, derivationHierarchy, isGrace, measureNumber, offset, priority
Properties inherited from JSONSerializer: json
TwelveToneRow methods
- matrix()¶
Returns a TwelveToneMatrix object for the row. That object can just be printed (or displayed via .show())
>>> from music21 import * >>> src = serial.RowSchoenbergOp37() >>> [p.name for p in src] ['D', 'C#', 'A', 'B-', 'F', 'E-', 'E', 'C', 'G#', 'G', 'F#', 'B'] >>> len(src) 12 >>> s37 = serial.RowSchoenbergOp37().matrix() >>> print s37 0 B 7 8 3 1 2 A 6 5 4 9 1 0 8 9 4 2 3 B 7 6 5 A 5 4 0 1 8 6 7 3 B A 9 2 4 3 B 0 7 5 6 2 A 9 8 1 ... >>> [e for e in s37[0]] [C, B, G, G#, E-, C#, D, B-, F#, F, E, A]
- isAllInterval()¶
Describes whether or not a twelve-tone row is an all-interval row.
>>> from music21 import * >>> chromatic = serial.pcToToneRow(range(0,12)) >>> chromatic.pitches() [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] >>> chromatic.isAllInterval() False >>> bergLyric = serial.pcToToneRow(serial.RowBergLyricSuite().row) >>> bergLyric.pitches() [5, 4, 0, 9, 7, 2, 8, 1, 3, 6, 10, 11] >>> bergLyric.isAllInterval() True
- getLinkClassification()¶
Gives the classification number of a Link Chord (as given in http://www.johnlinkmusic.com/LinkChords.pdf), that is, is an all-interval twelve-tone row containing a voicing of the all-trichord hexachord: [0, 1, 2, 4, 7, 8]. In addition, gives a list of sets of five contiguous intervals within the row representing a voicing of the all-trichord hexachord. Note that the interval sets may be transformed.
Named for John Link who discovered them.
>>> from music21 import * >>> bergLyric = serial.pcToToneRow(serial.RowBergLyricSuite().row) >>> bergLyric.pitches() [5, 4, 0, 9, 7, 2, 8, 1, 3, 6, 10, 11] >>> bergLyric.isAllInterval() True >>> bergLyric.getLinkClassification() (None, []) >>> link = serial.pcToToneRow([0, 3, 8, 2, 10, 11, 9, 4, 1, 5, 7, 6]) >>> link.getLinkClassification() (62, ['8352E']) >>> doubleLink = serial.pcToToneRow([0, 1, 8, 5, 7, 10, 4, 3, 11, 9, 2, 6]) >>> doubleLink.getLinkClassification() (33, ['236E8', '36E8T'])
- isLinkChord()¶
Describes whether or not a twelve-tone row is a Link Chord.
>>> from music21 import * >>> bergLyric = serial.pcToToneRow(serial.RowBergLyricSuite().row) >>> bergLyric.pitches() [5, 4, 0, 9, 7, 2, 8, 1, 3, 6, 10, 11] >>> bergLyric.isAllInterval() True >>> bergLyric.isLinkChord() False >>> link = serial.pcToToneRow([0, 3, 8, 2, 10, 11, 9, 4, 1, 5, 7, 6]) >>> link.isLinkChord() True >>> doubleLink = serial.pcToToneRow([0, 1, 8, 5, 7, 10, 4, 3, 11, 9, 2, 6]) >>> doubleLink.isLinkChord() True
- areCombinatorial(transType1, index1, transType2, index2, convention)¶
Describes whether or not two transformations, with one of the zero-centered and original-centered conventions specified (as in the zeroCenteredRowTransformation and originalCenteredRowTransformation methods), of a twelve-tone row are combinatorial. The first and second arguments describe one transformation, while the third and fourth describe another.
>>> from music21 import * >>> moses = serial.pcToToneRow(serial.RowSchoenbergMosesAron.row) >>> moses.pitches() [9, 10, 4, 2, 3, 1, 7, 5, 6, 8, 11, 0] >>> moses.areCombinatorial('P', 1, 'I', 4, 'zero') True >>> moses.areCombinatorial('R', 5, 'RI', 6, 'original') FalseMethods inherited from ToneRow: findOriginalCenteredTransformations(), findZeroCenteredTransformations(), getIntervalsAsString(), isSameRow(), isTwelveToneRow(), makeTwelveToneRow(), noteNames(), originalCenteredTransformation(), pitches(), zeroCenteredTransformation()
Methods inherited from Stream: activateVariants(), addGroupForElements(), allPlayingWhileSounding(), analyze(), append(), attachIntervalsBetweenStreams(), attachMelodicIntervals(), attributeCount(), augmentOrDiminish(), bestClef(), chordify(), expandRepeats(), explode(), extendDuration(), extendDurationAndGetBoundaries(), extendTies(), extractContext(), findConsecutiveNotes(), findGaps(), flattenUnnecessaryVoices(), getClefs(), getElementAfterElement(), getElementAfterOffset(), getElementAtOrAfter(), getElementAtOrBefore(), getElementBeforeElement(), getElementBeforeOffset(), getElementById(), getElementByObjectId(), getElementsByClass(), getElementsByGroup(), getElementsByOffset(), getElementsNotOfClass(), getInstrument(), getInstruments(), getKeySignatures(), getOffsetByElement(), getOverlaps(), getSimultaneous(), getTimeSignatures(), groupCount(), groupElementsByOffset(), hasElement(), hasElementByObjectId(), hasElementOfClass(), hasMeasures(), hasPartLikeStreams(), hasVoices(), haveAccidentalsBeenMade(), haveBeamsBeenMade(), index(), insert(), insertAndShift(), insertAtNativeOffset(), insertIntoNoteOrChord(), internalize(), invertDiatonic(), isSequence(), isTwelveTone(), isWellFormedNotation(), makeAccidentals(), makeBeams(), makeChords(), makeImmutable(), makeMeasures(), makeMutable(), makeNotation(), makeRests(), makeTies(), makeTupletBrackets(), makeVoices(), measure(), measureOffsetMap(), measureTemplate(), measures(), melodicIntervals(), mergeElements(), metronomeMarkBoundaries(), pitchAttributeCount(), playingWhenAttacked(), plot(), pop(), quantize(), realizeOrnaments(), recurse(), remove(), removeByClass(), removeByNotOfClass(), repeatAppend(), repeatInsert(), replace(), restoreActiveSites(), scaleDurations(), scaleOffsets(), setDerivation(), setupSerializationScaffold(), shiftElements(), showVariantAsOssialikePart(), simultaneousAttacks(), sliceAtOffsets(), sliceByBeat(), sliceByGreatestDivisor(), sliceByQuarterLengths(), sort(), splitAtQuarterLength(), splitByClass(), storeAtEnd(), stripTies(), teardownSerializationScaffold(), toSoundingPitch(), toWrittenPitch(), transferOffsetToElements(), transpose(), trimPlayingWhileSounding(), unwrapWeakref(), voicesToParts(), wrapWeakref()
Methods inherited from Music21Object: addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextAttr(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), next(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), searchActiveSiteByAttr(), setContextAttr(), setOffsetBySite(), show(), splitAtDurations(), splitByQuarterLengths(), unfreezeIds(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: Stream, Music21Object, JSONSerializer
An object representation of a 2-dimensional array of 12 pitches. Internal representation is as a Stream, which stores 12 Streams, each Stream a horizontal row of pitches in the matrix.
This object is commonly used by calling the matrix() method of TwelveToneRow() (or a subclass).
Inherits from: TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
A 12-tone row used in the historical literature. Added attributes to document the the historical context of the row.
HistoricalTwelveToneRow attributes
- composer¶
The composers name.
- opus¶
The opus of the work, or None.
- title¶
The title of the work.
Attributes inherited from ToneRow: row
Attributes inherited from Stream: isMeasure, isStream, isFlat, autoSort, isSorted, flattenedRepresentationOf
Attributes inherited from Music21Object: classSortOrder, isSpanner, isVariant, id, groups, hideObjectOnPrint
HistoricalTwelveToneRow properties
Properties inherited from Stream: atSoundingPitch, beat, beatDuration, beatStr, beatStrength, derivationChain, derivationMethod, derivesFrom, duration, elements, finalBarline, flat, highestOffset, highestTime, isGapless, lowestOffset, metadata, midiFile, musicxml, mx, notes, notesAndRests, offsetMap, rootDerivation, seconds, secondsMap, semiFlat, sorted, spannerBundle, spanners, variants, voices
Properties inherited from Music21Object: activeSite, classes, derivationHierarchy, isGrace, measureNumber, offset, priority
Properties inherited from JSONSerializer: json
HistoricalTwelveToneRow methods
Methods inherited from TwelveToneRow: matrix(), isAllInterval(), getLinkClassification(), isLinkChord(), areCombinatorial()
Methods inherited from ToneRow: findOriginalCenteredTransformations(), findZeroCenteredTransformations(), getIntervalsAsString(), isSameRow(), isTwelveToneRow(), makeTwelveToneRow(), noteNames(), originalCenteredTransformation(), pitches(), zeroCenteredTransformation()
Methods inherited from Stream: activateVariants(), addGroupForElements(), allPlayingWhileSounding(), analyze(), append(), attachIntervalsBetweenStreams(), attachMelodicIntervals(), attributeCount(), augmentOrDiminish(), bestClef(), chordify(), expandRepeats(), explode(), extendDuration(), extendDurationAndGetBoundaries(), extendTies(), extractContext(), findConsecutiveNotes(), findGaps(), flattenUnnecessaryVoices(), getClefs(), getElementAfterElement(), getElementAfterOffset(), getElementAtOrAfter(), getElementAtOrBefore(), getElementBeforeElement(), getElementBeforeOffset(), getElementById(), getElementByObjectId(), getElementsByClass(), getElementsByGroup(), getElementsByOffset(), getElementsNotOfClass(), getInstrument(), getInstruments(), getKeySignatures(), getOffsetByElement(), getOverlaps(), getSimultaneous(), getTimeSignatures(), groupCount(), groupElementsByOffset(), hasElement(), hasElementByObjectId(), hasElementOfClass(), hasMeasures(), hasPartLikeStreams(), hasVoices(), haveAccidentalsBeenMade(), haveBeamsBeenMade(), index(), insert(), insertAndShift(), insertAtNativeOffset(), insertIntoNoteOrChord(), internalize(), invertDiatonic(), isSequence(), isTwelveTone(), isWellFormedNotation(), makeAccidentals(), makeBeams(), makeChords(), makeImmutable(), makeMeasures(), makeMutable(), makeNotation(), makeRests(), makeTies(), makeTupletBrackets(), makeVoices(), measure(), measureOffsetMap(), measureTemplate(), measures(), melodicIntervals(), mergeElements(), metronomeMarkBoundaries(), pitchAttributeCount(), playingWhenAttacked(), plot(), pop(), quantize(), realizeOrnaments(), recurse(), remove(), removeByClass(), removeByNotOfClass(), repeatAppend(), repeatInsert(), replace(), restoreActiveSites(), scaleDurations(), scaleOffsets(), setDerivation(), setupSerializationScaffold(), shiftElements(), showVariantAsOssialikePart(), simultaneousAttacks(), sliceAtOffsets(), sliceByBeat(), sliceByGreatestDivisor(), sliceByQuarterLengths(), sort(), splitAtQuarterLength(), splitByClass(), storeAtEnd(), stripTies(), teardownSerializationScaffold(), toSoundingPitch(), toWrittenPitch(), transferOffsetToElements(), transpose(), trimPlayingWhileSounding(), unwrapWeakref(), voicesToParts(), wrapWeakref()
Methods inherited from Music21Object: addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextAttr(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), next(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), searchActiveSiteByAttr(), setContextAttr(), setOffsetBySite(), show(), splitAtDurations(), splitByQuarterLengths(), unfreezeIds(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer
Inherits from: HistoricalTwelveToneRow, TwelveToneRow, ToneRow, Stream, Music21Object, JSONSerializer