music21.serial¶
This module defines objects for defining and manipulating structures
common to serial and/or twelve-tone music,
including ToneRow
subclasses.
Serial searching methods that were previously here have been moved to
serial
.
ToneRow¶
- class music21.serial.ToneRow(row=None, **keywords)¶
A Stream representation of a tone row, or an ordered sequence of pitches; can most importantly be used to deal with serial transformations.
Unlike a normal Stream, the first argument is assumed to be a ToneRow:
>>> toneRow = serial.ToneRow([10, 9, 4, 5, 6, 3, 2, 8, 7, 11, 0, 1])
The representation of a ToneRow will be the contents:
>>> toneRow <music21.serial.ToneRow A94563287B01>
Unless (like a Stream), the id is set:
>>> toneRow.id = 'retrograde_jungfrau' >>> toneRow <music21.serial.ToneRow retrograde_jungfrau>
A ToneRow does not need to have twelve pitches, like this ten-tone row from Ruth Crawford Seeger’s String Quartet 1931
>>> rcsRow = serial.ToneRow([2, 4, 5, 3, 6, 9, 8, 7, 1, 0]) >>> rcsRow <music21.serial.ToneRow 2453698710> >>> len(rcsRow) 10
ToneRow
bases
ToneRow
read-only properties
Read-only properties inherited from Stream
:
Read-only properties inherited from StreamCore
:
Read-only properties inherited from Music21Object
:
Read-only properties inherited from ProtoM21Object
:
ToneRow
read/write properties
Read/write properties inherited from Stream
:
Read/write properties inherited from Music21Object
:
ToneRow
methods
- ToneRow.findOriginalCenteredTransformations(otherRow)¶
Gives the list of original-centered serial transformations taking one
ToneRow
to another, the second specified in the argument. Each transformation is given as a tuple of the transformation type and index.See
originalCenteredTransformation()
for an explanation of this convention.>>> 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.getHistoricalRowByName('SchoenbergOp25') >>> schoenberg26 = serial.getHistoricalRowByName('SchoenbergOp26') >>> schoenberg25.findOriginalCenteredTransformations(schoenberg26) [] >>> schoenberg26.findOriginalCenteredTransformations( ... schoenberg26.originalCenteredTransformation('RI',8)) [('RI', 8)]
- ToneRow.findZeroCenteredTransformations(otherRow) bool | list[Any] ¶
Gives the list of zero-centered serial transformations taking one
ToneRow
to another, the second specified in the argument. Each transformation is given as a tuple of the transformation type and index.See
zeroCenteredTransformation()
for an explanation of this convention.>>> 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.getHistoricalRowByName('SchoenbergOp25') >>> schoenberg26 = serial.pcToToneRow(serial.getHistoricalRowByName( ... 'SchoenbergOp26').row) >>> schoenberg25.findZeroCenteredTransformations(schoenberg26) [] >>> schoenberg26.findZeroCenteredTransformations( ... schoenberg26.zeroCenteredTransformation('RI', 8)) [('RI', 8)]
- ToneRow.getIntervalsAsString()¶
Returns the string of intervals between consecutive pitch classes of a
ToneRow
. ‘T’ = 10, ‘E’ = 11.>>> cRow = serial.pcToToneRow([0]) >>> cRow.getIntervalsAsString() '' >>> reverseChromatic = serial.pcToToneRow([11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) >>> reverseChromatic.getIntervalsAsString() 'EEEEEEEEEEE'
- ToneRow.isSameRow(other)¶
Convenience function describing if two rows are the same.
>>> 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
- ToneRow.isTwelveToneRow()¶
Describes whether a
ToneRow
constitutes a twelve-tone row. Note that aTwelveToneRow
object might not be a twelve-tone row.>>> serial.ToneRow([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]).isTwelveToneRow() True >>> serial.ToneRow([0, 4, 8]).isTwelveToneRow() False >>> serial.ToneRow([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]).isTwelveToneRow() False
- ToneRow.makeTwelveToneRow()¶
Convenience function returning a
TwelveToneRow
with the same pitches. Note that aToneRow
may be created without being a true twelve tone row.>>> r1 = serial.pcToToneRow(range(11)) >>> type(r1) <class 'music21.serial.ToneRow'> >>> n = note.Note() >>> n.pitch.pitchClass = 11 >>> r1.append(n) >>> r2 = r1.makeTwelveToneRow() >>> type(r2) <class 'music21.serial.TwelveToneRow'>
- ToneRow.noteNames()¶
Convenience function showing the note names of a
ToneRow
as a list.>>> chromatic = serial.TwelveToneRow(range(12)) >>> chromatic.noteNames() ['C', 'C#', 'D', 'E-', 'E', 'F', 'F#', 'G', 'G#', 'A', 'B-', 'B']
>>> halfStep = serial.ToneRow([0, 1]) >>> halfStep.noteNames() ['C', 'C#']
- ToneRow.originalCenteredTransformation(transformationType: str, index: int)¶
Returns a
ToneRow
giving a transformation of a tone row. Admissible transformations are ‘T’ (transposition), ‘I’ (inversion), ‘R’ (retrograde), and ‘RI’ (retrograde inversion).In the “original-centered” convention, which is less common than the “zero-centered” convention, the original row is not initially transposed to start on the pitch class 0. Thus, the transformation Tn transposes the original row up by n semitones, and the transformations In, Rn, and RIn first transform the row appropriately (without transposition), then transpose the resulting row by n semitones.
>>> chromatic = serial.pcToToneRow(range(12)) >>> chromatic.pitchClasses() [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] >>> chromaticP3 = chromatic.originalCenteredTransformation('T',3) >>> chromaticP3.pitchClasses() [3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2] >>> chromaticI6 = chromatic.originalCenteredTransformation('I',6) >>> chromaticI6.pitchClasses() [6, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7] >>> schoenberg = serial.getHistoricalRowByName('SchoenbergOp26') >>> schoenberg.pitchClasses() [3, 7, 9, 11, 1, 0, 10, 2, 4, 6, 8, 5] >>> schoenbergR8 = schoenberg.originalCenteredTransformation('R',8) >>> schoenbergR8.pitchClasses() [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']
- ToneRow.pitchClasses()¶
Convenience function showing the pitch classes of a
ToneRow
as a list.>>> fiveFold = [5 * i for i in range(12)] >>> fiveFold [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]
>>> quintupleRow = serial.pcToToneRow(fiveFold) >>> quintupleRow <music21.serial.TwelveToneRow 05A3816B4927> >>> quintupleRow.pitchClasses() [0, 5, 10, 3, 8, 1, 6, 11, 4, 9, 2, 7]
>>> halfStep = serial.pcToToneRow([0, 1]) >>> halfStep.pitchClasses() [0, 1]
- ToneRow.zeroCenteredTransformation(transformationType, index)¶
Returns a
ToneRow
giving a transformation of a tone row. Admissible transformationTypes are ‘P’ (prime), ‘I’ (inversion), ‘R’ (retrograde), and ‘RI’ (retrograde inversion).In the “zero-centered” convention, the transformations Pn and In start on the pitch class n, and the transformations Rn and RIn end on the pitch class n.
>>> chromatic = serial.pcToToneRow(range(12)) >>> chromatic.pitchClasses() [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] >>> chromaticP3 = chromatic.zeroCenteredTransformation('P',3) >>> chromaticP3.pitchClasses() [3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2] >>> chromaticI6 = chromatic.zeroCenteredTransformation('I',6) >>> chromaticI6.pitchClasses() [6, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7] >>> schoenberg = serial.getHistoricalRowByName('SchoenbergOp26') >>> schoenberg.pitchClasses() [3, 7, 9, 11, 1, 0, 10, 2, 4, 6, 8, 5] >>> schoenbergR8 = schoenberg.zeroCenteredTransformation('R',8) >>> schoenbergR8.pitchClasses() [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']
Methods inherited from Stream
:
Methods inherited from StreamCore
:
Methods inherited from Music21Object
:
Methods inherited from ProtoM21Object
:
ToneRow
instance variables
- ToneRow.row¶
A list representing the pitch class values of the row.
Instance variables inherited from Stream
:
Instance variables inherited from Music21Object
:
TwelveToneRow¶
- class music21.serial.TwelveToneRow(row=None, **keywords)¶
A Stream representation of a twelve-tone row, capable of producing a 12-tone matrix.
TwelveToneRow
bases
TwelveToneRow
read-only properties
Read-only properties inherited from Stream
:
Read-only properties inherited from StreamCore
:
Read-only properties inherited from Music21Object
:
Read-only properties inherited from ProtoM21Object
:
TwelveToneRow
read/write properties
Read/write properties inherited from Stream
:
Read/write properties inherited from Music21Object
:
TwelveToneRow
methods
- TwelveToneRow.areCombinatorial(transType1: str, index1: int, transType2: str, index2: int) bool ¶
Describes whether two transformations of a twelve-tone row are combinatorial.
The first and second arguments describe one transformation, while the third and fourth describe another.
First, let’s take a row we know to have a combinatoriality pair:
>>> moses = serial.getHistoricalRowByName('SchoenbergMosesAron') >>> moses.pitchClasses() [9, 10, 4, 2, 3, 1, 7, 5, 6, 8, 11, 0]
Combinatoriality holds here between P0 and I3
>>> moses.areCombinatorial('P', 0, 'I', 3) True
And a combinatorial pair like this between P0 and I3 will also hold if you modify both rows in the same way, e.g. if you transpose both by the same amount
>>> moses.areCombinatorial('P', 1, 'I', 4) True
or if you retrograde both
>>> moses.areCombinatorial('R', 1, 'RI', 4) True
Any modification made to one row form and not the other means all bets are off
>>> moses.areCombinatorial('R', 6, 'RI', 4) False
Changed in v7: convention is no longer necessary and no longer used. Renamed to unused_convention and defaults None; to be removed in v8.
- TwelveToneRow.findHistorical()¶
Checks if a given
music21.serial.TwelveToneRow
is the same as any of the historical twelve-tone rows stored by music21: seemusic21.serial.getHistoricalRowByName()
. Returns a list of names of historical rows to which the input row is identical.>>> row = serial.pcToToneRow([2, 3, 9, 1, 11, 5, 8, 7, 4, 0, 10, 6]) >>> row.findHistorical() ['SchoenbergOp32'] >>> chromatic = serial.pcToToneRow(range(12)) >>> chromatic.findHistorical() []
- TwelveToneRow.findTransformedHistorical(convention)¶
Checks if a given
music21.serial.TwelveToneRow
is a transformation of any historical twelve-tone row stored by music21 (seemusic21.serial.getHistoricalRowByName()
). Returns a list of tuples, the tuple consisting of the name of a historical row, and a list of transformations relating the input row to the historical row.The convention for serial transformations must also be specified as ‘zero’ or ‘original’, as explained in
findZeroCenteredTransformations()
andfindOriginalCenteredTransformations()
.>>> row = serial.pcToToneRow([5, 9, 11, 3, 6, 7, 4, 10, 0, 8, 2, 1]) >>> row.findTransformedHistorical('original') [('SchoenbergOp32', [('R', 11)])]
- TwelveToneRow.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.
>>> bergLyric = serial.getHistoricalRowByName('BergLyricSuite') >>> bergLyric.pitchClasses() [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'])
- TwelveToneRow.isAllInterval() bool ¶
Describes whether a
TwelveToneRow
is an all-interval row.>>> chromatic = serial.pcToToneRow(range(12)) >>> chromatic.pitchClasses() [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] >>> chromatic.isAllInterval() False >>> bergLyric = serial.getHistoricalRowByName('BergLyricSuite') >>> bergLyric.pitchClasses() [5, 4, 0, 9, 7, 2, 8, 1, 3, 6, 10, 11] >>> bergLyric.isAllInterval() True
- TwelveToneRow.isLinkChord() bool ¶
Describes whether a
TwelveToneRow
is a Link Chord.>>> bergLyric = serial.getHistoricalRowByName('BergLyricSuite') >>> bergLyric.pitchClasses() [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
- TwelveToneRow.matrix()¶
Returns a
TwelveToneMatrix
object for the row. That object can just be printed (or displayed via .show())>>> src = serial.getHistoricalRowByName('SchoenbergOp37') >>> [p.name for p in src] ['D', 'C#', 'A', 'B-', 'F', 'E-', 'E', 'C', 'G#', 'G', 'F#', 'B'] >>> len(src) 12 >>> s37 = serial.getHistoricalRowByName('SchoenbergOp37').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 ... >>> [str(e.pitch) for e in s37[0]] ['C', 'B', 'G', 'G#', 'E-', 'C#', 'D', 'B-', 'F#', 'F', 'E', 'A']
Methods inherited from ToneRow
:
Methods inherited from Stream
:
Methods inherited from StreamCore
:
Methods inherited from Music21Object
:
Methods inherited from ProtoM21Object
:
TwelveToneRow
instance variables
Instance variables inherited from ToneRow
:
Instance variables inherited from Stream
:
Instance variables inherited from Music21Object
:
HistoricalTwelveToneRow¶
- class music21.serial.HistoricalTwelveToneRow(composer: None | str = None, opus: None | str = None, title: None | str = None, row=None, **keywords)¶
Subclass of
TwelveToneRow
storing additional attributes of a twelve-tone row used in the historical literature.
HistoricalTwelveToneRow
bases
HistoricalTwelveToneRow
read-only properties
Read-only properties inherited from Stream
:
Read-only properties inherited from StreamCore
:
Read-only properties inherited from Music21Object
:
Read-only properties inherited from ProtoM21Object
:
HistoricalTwelveToneRow
read/write properties
Read/write properties inherited from Stream
:
Read/write properties inherited from Music21Object
:
HistoricalTwelveToneRow
methods
- HistoricalTwelveToneRow.mergeAttributes(other)¶
Merge relevant attributes from the Other stream into this one.
>>> s = stream.Stream() >>> s.append(note.Note()) >>> s.autoSort = False >>> s.id = 'hi' >>> s2 = stream.Stream() >>> s2.mergeAttributes(s) >>> s2.autoSort False >>> s2 <music21.stream.Stream hi> >>> len(s2) 0
Methods inherited from TwelveToneRow
:
Methods inherited from ToneRow
:
Methods inherited from Stream
:
Methods inherited from StreamCore
:
Methods inherited from Music21Object
:
Methods inherited from ProtoM21Object
:
HistoricalTwelveToneRow
instance variables
- HistoricalTwelveToneRow.composer¶
The name of the composer, or None. (String)
- HistoricalTwelveToneRow.opus¶
The opus of the work, or None. (String)
- HistoricalTwelveToneRow.title¶
The title of the work, or None. (String)
Instance variables inherited from ToneRow
:
Instance variables inherited from Stream
:
Instance variables inherited from Music21Object
:
TwelveToneMatrix¶
- class music21.serial.TwelveToneMatrix(givenElements: None | Music21Object | Sequence[Music21Object] = None, *, givenElementsBehavior: GivenElementsBehavior = GivenElementsBehavior.OFFSETS, **keywords)¶
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 ofTwelveToneRow
(or a subclass).>>> ttr = serial.TwelveToneRow([0, 2, 11, 7, 8, 3, 9, 1, 4, 10, 6, 5]) >>> aMatrix = ttr.matrix() >>> print(aMatrix) 0 2 B 7 8 3 9 1 4 A 6 5 A 0 9 5 6 1 7 B 2 8 4 3 1 3 0 8 9 4 A 2 5 B 7 6 5 7 4 0 1 8 2 6 9 3 B A 4 6 3 B 0 7 1 5 8 2 A 9 9 B 8 4 5 0 6 A 1 7 3 2 3 5 2 A B 6 0 4 7 1 9 8 B 1 A 6 7 2 8 0 3 9 5 4 8 A 7 3 4 B 5 9 0 6 2 1 2 4 1 9 A 5 B 3 6 0 8 7 6 8 5 1 2 9 3 7 A 4 0 B 7 9 6 2 3 A 4 8 B 5 1 0
>>> repr(aMatrix) '<music21.serial.TwelveToneMatrix for [<music21.serial.TwelveToneRow row-1>]>'
>>> fourthQuartetMatrix = serial.getHistoricalRowByName('SchoenbergOp37').matrix() >>> repr(fourthQuartetMatrix) '<music21.serial.TwelveToneMatrix for [<music21.serial.HistoricalTwelveToneRow Schoenberg Op. 37 Fourth String Quartet>]>'
TwelveToneMatrix
bases
TwelveToneMatrix
read-only properties
Read-only properties inherited from Stream
:
Read-only properties inherited from StreamCore
:
Read-only properties inherited from Music21Object
:
Read-only properties inherited from ProtoM21Object
:
TwelveToneMatrix
read/write properties
Read/write properties inherited from Stream
:
Read/write properties inherited from Music21Object
:
TwelveToneMatrix
methods
Methods inherited from Stream
:
Methods inherited from StreamCore
:
Methods inherited from Music21Object
:
Methods inherited from ProtoM21Object
:
TwelveToneMatrix
instance variables
Instance variables inherited from Stream
:
Instance variables inherited from Music21Object
:
Functions¶
- music21.serial.pcToToneRow(pcSet)¶
A convenience function that, given a list of pitch classes represented as integers and turns it in to a
ToneRow
object.>>> chromaticRow = serial.pcToToneRow([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) >>> chromaticRow.show('text') {0.0} <music21.note.Note C> {1.0} <music21.note.Note C#> {2.0} <music21.note.Note D> {3.0} <music21.note.Note E-> {4.0} <music21.note.Note E> {5.0} <music21.note.Note F> {6.0} <music21.note.Note F#> {7.0} <music21.note.Note G> {8.0} <music21.note.Note G#> {9.0} <music21.note.Note A> {10.0} <music21.note.Note B-> {11.0} <music21.note.Note B> >>> matrixObj = chromaticRow.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 ...
>>> fancyRow = serial.pcToToneRow([4, 5, 0, 6, 7, 2, 'a', 8, 9, 1, 'b', 3]) >>> matrixObj = fancyRow.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 ...
Note that the Row does not have to be a valid row to exist:
>>> multiSetRow = serial.pcToToneRow([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) >>> multiSetRow.pitchClasses() [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
Or even have 12 notes:
>>> shortRow = serial.pcToToneRow([3, 4]) >>> shortRow.pitchClasses() [3, 4]
If the row does have twelve notes (whether unique or not) the object returned is a TwelveToneRow:
>>> multiSetRow <music21.serial.TwelveToneRow 111111111111>
Otherwise, it is simply a ToneRow:
>>> shortRow <music21.serial.ToneRow 34>
- music21.serial.rowToMatrix(p: list[int]) str ¶
Takes a list of numbers of converts it to a string representation of a 12-tone matrix.
>>> aMatrix = serial.rowToMatrix([0, 2, 11, 7, 8, 3, 9, 1, 4, 10, 6, 5]) >>> print(aMatrix) 0 2 11 7 8 3 9 1 4 10 6 5 10 0 9 5 6 1 7 11 2 8 4 3 1 3 0 8 9 4 10 2 5 11 7 6 5 7 4 0 1 8 2 6 9 3 11 10 4 6 3 11 0 7 1 5 8 2 10 9 9 11 8 4 5 0 6 10 1 7 3 2 3 5 2 10 11 6 0 4 7 1 9 8 11 1 10 6 7 2 8 0 3 9 5 4 8 10 7 3 4 11 5 9 0 6 2 1 2 4 1 9 10 5 11 3 6 0 8 7 6 8 5 1 2 9 3 7 10 4 0 11 7 9 6 2 3 10 4 8 11 5 1 0
This function survives today (2020) because it’s been an example function for music21 since the very first demonstrations of predecessors from around 2000 onwards. Nowadays, better to create a TwelveToneRow() object and then get a matrix from that:
>>> ttr = serial.TwelveToneRow([0, 2, 11, 7, 8, 3, 9, 1, 4, 10, 6, 5]) >>> matrix = ttr.matrix() >>> print(matrix) 0 2 B 7 8 3 9 1 4 A 6 5 A 0 9 5 6 1 7 B 2 8 4 3 1 3 0 8 9 4 A 2 5 B 7 6 5 7 4 0 1 8 2 6 9 3 B A 4 6 3 B 0 7 1 5 8 2 A 9 9 B 8 4 5 0 6 A 1 7 3 2 3 5 2 A B 6 0 4 7 1 9 8 B 1 A 6 7 2 8 0 3 9 5 4 8 A 7 3 4 B 5 9 0 6 2 1 2 4 1 9 A 5 B 3 6 0 8 7 6 8 5 1 2 9 3 7 A 4 0 B 7 9 6 2 3 A 4 8 B 5 1 0
- music21.serial.getHistoricalRowByName(rowName)¶
Given the name referring to a twelve-tone row used in the historical literature, returns a
HistoricalTwelveToneRow
object with attributes describing the row.The names of the rows with stored attributes are below (each must be passed as a string, in single quotes).
>>> for r in sorted(list(serial.historicalDict)): ... print(r) BergChamberConcerto BergDerWein BergLulu BergLuluActIIScene1 BergLuluActIScene20 BergLyricSuite BergLyricSuitePerm BergViolinConcerto BergWozzeckPassacaglia SchoenbergFragOrganSonata SchoenbergFragPiano SchoenbergFragPianoPhantasia SchoenbergIsraelExists SchoenbergJakobsleiter SchoenbergMosesAron SchoenbergOp23No5 SchoenbergOp24Mvmt4 SchoenbergOp24Mvmt5 SchoenbergOp25 SchoenbergOp26 SchoenbergOp27No1 SchoenbergOp27No2 SchoenbergOp27No3 SchoenbergOp27No4 SchoenbergOp28No1 SchoenbergOp28No3 SchoenbergOp29 SchoenbergOp30 SchoenbergOp31 SchoenbergOp32 SchoenbergOp33A SchoenbergOp33B SchoenbergOp34 SchoenbergOp35No1 SchoenbergOp35No2 SchoenbergOp35No3 SchoenbergOp35No5 SchoenbergOp36 SchoenbergOp37 SchoenbergOp41 SchoenbergOp42 SchoenbergOp44 SchoenbergOp45 SchoenbergOp46 SchoenbergOp47 SchoenbergOp48No1 SchoenbergOp48No2 SchoenbergOp48No3 SchoenbergOp50A SchoenbergOp50B SchoenbergOp50C WebernOp17No2 WebernOp17No3 WebernOp18No1 WebernOp18No2 WebernOp18No3 WebernOp19No1 WebernOp19No2 WebernOp20 WebernOp21 WebernOp22 WebernOp23 WebernOp24 WebernOp25 WebernOp26 WebernOp27 WebernOp28 WebernOp29 WebernOp30 WebernOp31 WebernOpNo17No1
>>> web = serial.getHistoricalRowByName('WebernOp29') >>> web.row [3, 11, 2, 1, 5, 4, 7, 6, 10, 9, 0, 8] >>> web.composer 'Webern' >>> web.opus 'Op. 29' >>> web.title 'Cantata I' >>> web.isLinkChord() False
NOTE: before v6, these rows had ‘Row’ in front of them, like ‘RowWebernOp29’ instead of ‘WebernOp29’. They can still be accessed by the old name.
>>> rowWeb = serial.getHistoricalRowByName('RowWebernOp29') >>> rowWeb.row == web.row True