music21.analysis.transposition¶
TranspositionChecker¶
- class music21.analysis.transposition.TranspositionChecker(pitches: Iterable[Pitch] = ())¶
Given a list of pitches, checks for the number of distinct transpositions.
>>> pList = [pitch.Pitch('C4'), pitch.Pitch('E4'), pitch.Pitch('G#4')] >>> tc = analysis.transposition.TranspositionChecker(pList) >>> tc.numDistinctTranspositions() 4 >>> allNormalOrderPitchTuples = tc.getPitchesOfDistinctTranspositions() >>> allNormalOrderPitchTuples [(<music21.pitch.Pitch C>, <music21.pitch.Pitch E>, <music21.pitch.Pitch G#>), (<music21.pitch.Pitch C#>, <music21.pitch.Pitch F>, <music21.pitch.Pitch A>), (<music21.pitch.Pitch D>, <music21.pitch.Pitch F#>, <music21.pitch.Pitch A#>), (<music21.pitch.Pitch E->, <music21.pitch.Pitch G>, <music21.pitch.Pitch B>)] >>> myChord = chord.Chord(['C', 'E-', 'F#', 'A']) >>> pList = myChord.pitches >>> tc = analysis.transposition.TranspositionChecker(pList) >>> allNormalOrderChords = tc.getChordsOfDistinctTranspositions() >>> allNormalOrderChords [<music21.chord.Chord C E- F# A>, <music21.chord.Chord C# E G A#>, <music21.chord.Chord D F G# B>]
TranspositionChecker
methods
- TranspositionChecker.getChordsOfDistinctTranspositions()¶
Outputs chords for each distinct transposition (normal order).
>>> pList = [pitch.Pitch('C4'), pitch.Pitch('E4'), pitch.Pitch('G#4')] >>> tc = analysis.transposition.TranspositionChecker(pList) >>> tc.getChordsOfDistinctTranspositions() [<music21.chord.Chord C E G#>, <music21.chord.Chord C# F A>, <music21.chord.Chord D F# A#>, <music21.chord.Chord E- G B>]
- TranspositionChecker.getPitchesOfDistinctTranspositions()¶
Outputs pitch tuples for each distinct transposition (normal order).
>>> pList = [pitch.Pitch('C4'), pitch.Pitch('E4'), pitch.Pitch('G#4')] >>> tc = analysis.transposition.TranspositionChecker(pList) >>> tc.getPitchesOfDistinctTranspositions() [(<music21.pitch.Pitch C>, <music21.pitch.Pitch E>, <music21.pitch.Pitch G#>), (<music21.pitch.Pitch C#>, <music21.pitch.Pitch F>, <music21.pitch.Pitch A>), (<music21.pitch.Pitch D>, <music21.pitch.Pitch F#>, <music21.pitch.Pitch A#>), (<music21.pitch.Pitch E->, <music21.pitch.Pitch G>, <music21.pitch.Pitch B>)]
- TranspositionChecker.getTranspositions()¶
Gets all 12 transpositions (distinct or otherwise).
>>> p = [pitch.Pitch('D#')] >>> tc = analysis.transposition.TranspositionChecker(p) >>> tc.getTranspositions() [[<music21.pitch.Pitch E->], [<music21.pitch.Pitch E>], [<music21.pitch.Pitch F>], [<music21.pitch.Pitch F#>], [<music21.pitch.Pitch G>], [<music21.pitch.Pitch G#>], [<music21.pitch.Pitch A>], [<music21.pitch.Pitch B->], [<music21.pitch.Pitch B>], [<music21.pitch.Pitch C>], [<music21.pitch.Pitch C#>], [<music21.pitch.Pitch D>]]
- TranspositionChecker.listDistinctNormalOrders()¶
List the distinct normal orders (without duplication).
>>> pList = [pitch.Pitch('C4'), pitch.Pitch('E4'), pitch.Pitch('G#4')] >>> tc = analysis.transposition.TranspositionChecker(pList) >>> tc.listDistinctNormalOrders() [[0, 4, 8], [1, 5, 9], [2, 6, 10], [3, 7, 11]]
- TranspositionChecker.listNormalOrders()¶
List the normal orders for all 12 transpositions
>>> pList = [pitch.Pitch('C4'), pitch.Pitch('E4'), pitch.Pitch('G#4')] >>> tc = analysis.transposition.TranspositionChecker(pList) >>> tc.listNormalOrders() [[0, 4, 8], [1, 5, 9], [2, 6, 10], [3, 7, 11], [0, 4, 8], [1, 5, 9], [2, 6, 10], [3, 7, 11], [0, 4, 8], [1, 5, 9], [2, 6, 10], [3, 7, 11]]
- TranspositionChecker.numDistinctTranspositions()¶
Gives the number of distinct transpositions (normal orders).
>>> pList = [pitch.Pitch('C4'), pitch.Pitch('E4'), pitch.Pitch('G#4')] >>> tc = analysis.transposition.TranspositionChecker(pList) >>> tc.numDistinctTranspositions() 4