The various Scale objects provide a bi-directional object representation of octave repeating and non-octave repeating scales built by network of Interval objects as modeled in IntervalNetwork. The main public interface to these resources are the numerous ConcreteScale subclasses, such as MajorScale, MinorScale, and MelodicMinorScale. More unusual scales are also available, such as OctatonicScale, SieveScale, and RagMarwa. All ConcreteScale subclasses provide the ability to get a pitches across any range, get a pitch for scale step, get a scale step for pitch, and, for any given pitch ascend or descend to the next pitch. In all cases Pitch objects are returned.
>>> from music21 import *
>>> sc1 = scale.MajorScale('a')
>>> sc1.getPitches('g2', 'g4')
[G#2, A2, B2, C#3, D3, E3, F#3, G#3, A3, B3, C#4, D4, E4, F#4]
>>> sc2 = scale.MelodicMinorScale('a')
>>> sc2.getPitches('g2', 'g4', direction='descending')
[G4, F4, E4, D4, C4, B3, A3, G3, F3, E3, D3, C3, B2, A2, G2]
>>> sc2.getPitches('g2', 'g4', direction='ascending')
[G#2, A2, B2, C3, D3, E3, F#3, G#3, A3, B3, C4, D4, E4, F#4]
>>> # a sieve-based scale using Xenakis's representation of the Major scale
>>> sc3 = scale.SieveScale('a', '(-3@2 & 4) | (-3@1 & 4@1) | (3@2 & 4@2) | (-3 & 4@3)')
>>> sc3.getPitches('g2', 'g4')
[G#2, A2, B2, C#3, D3, E3, F#3, G#3, A3, B3, C#4, D4, E4, F#4]
Inherits from: Scale, Music21Object, JSONSerializer
A concrete scale is specific scale formation with a defined pitch collection (a tonic Pitch) that may or may not be bound by specific range. For example, a specific Major Scale, such as G Major, from G2 to G4. This class is not generally used directly but is used as a base class for all concrete scales.
ConcreteScale attributes
Attributes without Documentation: boundRange
Attributes inherited from Scale: directionSensitive, type
Attributes inherited from Music21Object: classSortOrder, id
ConcreteScale properties
- abstract¶
Return the AbstractScale instance governing this ConcreteScale.
>>> from music21 import * >>> sc1 = scale.MajorScale('d') >>> sc2 = scale.MajorScale('b-') >>> sc1 == sc2 False >>> sc1.abstract == sc2.abstract True
- chord¶
- Return a Chord object form this harmony over a default range
- isConcrete¶
Return True if the scale is Concrete, that is, it has a defined Tonic.
>>> from music21 import * >>> sc1 = scale.MajorScale('c') >>> sc1.isConcrete True >>> sc2 = scale.MajorScale() >>> sc2.isConcrete False
- musicxml¶
- Return a complete musicxml representation.
- name¶
Return or construct the name of this scale.
>>> from music21 import * >>> sc = scale.DiatonicScale() # abstract, as no defined tonic >>> sc.name 'Abstract Diatonic'
- pitches¶
- Get a default pitch list from this scale.
Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
ConcreteScale methods
- derive(other, comparisonAttribute=pitchClass)¶
>>> from music21 import * >>> sc1 = scale.MajorScale() >>> sc1.derive(['c#', 'e', 'g#']) <music21.scale.MajorScale B major> >>> sc1.derive(['e-', 'b-', 'd'], comparisonAttribute='name') <music21.scale.MajorScale B- major>
- deriveByDegree(degree, pitch)¶
Given a scale degree and a pitch, get a new Scale that satisfies that condition.
>>> from music21 import * >>> sc1 = scale.MajorScale() >>> sc1.deriveByDegree(7, 'c') # what scale has c as its 7th degree <music21.scale.MajorScale D- major>
- deriveRanked(other, resultsReturned=4, comparisonAttribute=pitchClass)¶
Return a list of closest matching concrete scales from this abstract scale, given a collection of pitches, provided as a Stream, a ConcreteScale, a list of pitches. Integer values returned represent the number of mathces.
>>> from music21 import * >>> sc1 = scale.MajorScale() >>> sc1.deriveRanked(['c', 'e', 'b']) [(3, <music21.scale.MajorScale G major>), (3, <music21.scale.MajorScale C major>), (2, <music21.scale.MajorScale B major>), (2, <music21.scale.MajorScale A major>)] >>> sc1.deriveRanked(['c', 'e', 'e', 'e', 'b']) [(5, <music21.scale.MajorScale G major>), (5, <music21.scale.MajorScale C major>), (4, <music21.scale.MajorScale B major>), (4, <music21.scale.MajorScale A major>)] >>> sc1.deriveRanked(['c#', 'e', 'g#']) [(3, <music21.scale.MajorScale B major>), (3, <music21.scale.MajorScale A major>), (3, <music21.scale.MajorScale E major>), (3, <music21.scale.MajorScale C- major>)]
- findMissing(other, comparisonAttribute=pitchClass, minPitch=None, maxPitch=None, direction=ascending, alteredNodes={})¶
>>> from music21 import * >>> sc1 = scale.MajorScale('g4') >>> sc1.findMissing(['d']) [G4, A4, B4, C5, E5, F#5, G5]
- getChord(minPitch=None, maxPitch=None, direction=ascending)¶
- Return a realized chord containing all the pitches in this scale within a particular range
- getPitches(minPitch=None, maxPitch=None, direction=ascending)¶
- Return a list of Pitch objects, using a deepcopy of a cached version if available.
- getScaleDegreeFromPitch(pitchTarget, direction=ascending, comparisonAttribute=pitchClass)¶
For a given pitch, return the appropriate scale degree. If no scale degree is available, None is returned.
>>> from music21 import * >>> sc = scale.MajorScale('e-') >>> sc.getScaleDegreeFromPitch('e-2') 1 >>> sc.getScaleDegreeFromPitch('d') 7 >>> sc.getScaleDegreeFromPitch('d#', comparisonAttribute='name') == None True >>> sc.getScaleDegreeFromPitch('d#', comparisonAttribute='pitchClass') 1>>> sc = scale.HarmonicMinorScale('a') >>> sc.getScaleDegreeFromPitch('c') 3 >>> sc.getScaleDegreeFromPitch('g#') 7
- getTonic()¶
Return the tonic.
>>> from music21 import * >>> sc = scale.ConcreteScale('e-4') >>> sc.getTonic() E-4
- match(other, comparisonAttribute=pitchClass)¶
Given another object of various forms (e.g., a Stream, a ConcreteScale, a list of pitches), return a named dictionary of pitch lists with keys ‘matched’ and ‘notMatched’.
>>> from music21 import * >>> sc1 = scale.MajorScale('g') >>> sc2 = scale.MajorScale('d') >>> sc3 = scale.MajorScale('a') >>> sc4 = scale.MajorScale('e') >>> sc1.match(sc2) {'notMatched': [C#5], 'matched': [D4, E4, F#4, G4, A4, B4, D5]} >>> sc2.match(sc3) {'notMatched': [G#5], 'matched': [A4, B4, C#5, D5, E5, F#5, A5]} >>> sc1.match(sc4) {'notMatched': [G#4, C#5, D#5], 'matched': [E4, F#4, A4, B4, E5]}
- next(pitchOrigin, direction=ascending, stepSize=1, getNeighbor=True)¶
Get the next pitch given a pitchOrigin or None. The direction attribute must be either ascending or descending. Default is ascending. An optional stepSize argument can be used to set the number of scle steps that are stepped through. The getNeighbor will return a pitch from the scale if pitchOrigin is not in the scale. This value can be True, ‘ascending’, or ‘descending’.
>>> from music21 import * >>> sc = scale.MajorScale('e-') >>> sc.next('e-5') F5 >>> sc.next('e-5', stepSize=2) G5 >>> sc.next('e-6', stepSize=3) A-6 >>> from music21 import * >>> sc = scale.HarmonicMinorScale('g') >>> sc.next('g4', 'descending') F#4 >>> sc.next('F#4', 'descending') E-4 >>> sc.next('E-4', 'descending') D4 >>> sc.next('E-4', 'ascending', 1) F#4 >>> sc.next('E-4', 'ascending', 2) G4
- pitchFromDegree(degree, minPitch=None, maxPitch=None, direction=ascending)¶
Given a scale degree, return the appropriate pitch.
>>> from music21 import * >>> sc = scale.MajorScale('e-') >>> sc.pitchFromDegree(2) F4 >>> sc.pitchFromDegree(7) D5
- pitchesFromScaleDegrees(degreeTargets, minPitch=None, maxPitch=None, direction=ascending)¶
Given one or more scale degrees, return a list of all matches over the entire range.
>>> from music21 import * >>> sc = scale.MajorScale('e-') >>> sc.pitchesFromScaleDegrees([3,7]) [G4, D5] >>> sc.pitchesFromScaleDegrees([3,7], 'c2', 'c6') [D2, G2, D3, G3, D4, G4, D5, G5] >>> sc = scale.HarmonicMinorScale('a') >>> sc.pitchesFromScaleDegrees([3,7], 'c2', 'c6') [C2, G#2, C3, G#3, C4, G#4, C5, G#5, C6]
- romanNumeral(degree)¶
Return a RomanNumeral object built on the specified scale degree.
>>> from music21 import * >>> sc1 = scale.MajorScale('a-4') >>> h1 = sc1.romanNumeral(1) >>> h1.root() A-4 >>> h5 = sc1.romanNumeral(5) >>> h5.root() E-5 >>> h5 <music21.chord.Chord E-5 G5 B-5>
- transpose(value, inPlace=False)¶
Transpose this Scale by the given interval note: it does not makes sense to transpose an abstract scale; thus, only concrete scales can be transposed.
>>> from music21 import * >>> sc1 = scale.MajorScale('C') >>> sc2 = sc1.transpose('p5') >>> sc2 <music21.scale.MajorScale G major> >>> sc3 = sc2.transpose('p5') >>> sc3 <music21.scale.MajorScale D major>Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: Scale, Music21Object, JSONSerializer
An abstract scale is specific scale formation, but does not have a defined pitch collection or pitch reference. For example, all Major scales can be represented by an AbstractScale; a ConcreteScale, however, is a specific Major Scale, such as G Major. These classes provide an interface to, and create and manipulate, the stored IntervalNetwork object. Thus, they are rarely created or manipulated directly by most users. The AbstractScale additionally stores an _alteredNodes dictionary. Subclasses can define altered nodes in AbstractScale that are passed to the IntervalNetwork.
AbstractScale attributes
Attributes without Documentation: octaveDuplicating, tonicStep
Attributes inherited from Scale: directionSensitive, type
Attributes inherited from Music21Object: classSortOrder, id
AbstractScale properties
- networkxGraph¶
- Return a networks Graph object representing a realized version of this IntervalNetwork.
Properties inherited from Scale: isConcrete, name
Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
AbstractScale methods
- getNewTonicPitch(pitchReference, nodeName, direction=ascending, minPitch=None, maxPitch=None)¶
- Define a pitch target and a node.
- getPitchFromNodeStep(pitchReference, nodeName, nodeStepTarget, direction=ascending, minPitch=None, maxPitch=None)¶
- Get a pitch for desired scale degree.
- getRealization(pitchObj, stepOfPitch, minPitch=None, maxPitch=None, direction=ascending, reverse=False)¶
- Realize the abstract scale as a list of pitch objects, given a pitch object, the step of that pitch object, and a min and max pitch.
- getRelativeNodeStep(pitchReference, nodeName, pitchTarget, comparisonAttribute=pitchClass, direction=ascending)¶
- Expose functionality from IntervalNetwork, passing on the stored alteredNodes dictionary.
- getStepMaxUnique()¶
- Return the maximum number of scale steps, or the number to use as a modulus.
- nextPitch(pitchReference, nodeName, pitchOrigin, direction=ascending, stepSize=1, getNeighbor=True)¶
- Expose functionality from IntervalNetwork, passing on the stored alteredNodes dictionary.
- plot(*args, **keywords)¶
- Create and display a plot.
- realizePitchByStep(pitchReference, nodeId, nodeStepTargets, direction=ascending, minPitch=None, maxPitch=None)¶
- Given one or more scale degrees, return a list of all matches over the entire range.
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer
Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer
AbstractDiatonicScale attributes
Attributes without Documentation: relativeMinorStep, relativeMajorStep, dominantStep
Attributes inherited from AbstractScale: octaveDuplicating, tonicStep
Attributes inherited from Scale: directionSensitive, type
Attributes inherited from Music21Object: classSortOrder, id
AbstractDiatonicScale properties
Properties inherited from AbstractScale: networkxGraph
Properties inherited from Scale: isConcrete, name
Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
AbstractDiatonicScale methods
Methods inherited from AbstractScale: getNewTonicPitch(), getPitchFromNodeStep(), getRealization(), getRelativeNodeStep(), getStepMaxUnique(), nextPitch(), plot(), realizePitchByStep()
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer
A true bi-directional scale that with the augmented second to a leading tone.
AbstractHarmonicMinorScale attributes
Attributes without Documentation: dominantStep
Attributes inherited from AbstractScale: octaveDuplicating, tonicStep
Attributes inherited from Scale: directionSensitive, type
Attributes inherited from Music21Object: classSortOrder, id
AbstractHarmonicMinorScale properties
Properties inherited from AbstractScale: networkxGraph
Properties inherited from Scale: isConcrete, name
Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
AbstractHarmonicMinorScale methods
Methods inherited from AbstractScale: getNewTonicPitch(), getPitchFromNodeStep(), getRealization(), getRelativeNodeStep(), getStepMaxUnique(), nextPitch(), plot(), realizePitchByStep()
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer
A directional scale.
AbstractMelodicMinorScale attributes
Attributes without Documentation: dominantStep
Attributes inherited from AbstractScale: octaveDuplicating, tonicStep
Attributes inherited from Scale: directionSensitive, type
Attributes inherited from Music21Object: classSortOrder, id
AbstractMelodicMinorScale properties
Properties inherited from AbstractScale: networkxGraph
Properties inherited from Scale: isConcrete, name
Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
AbstractMelodicMinorScale methods
Methods inherited from AbstractScale: getNewTonicPitch(), getPitchFromNodeStep(), getRealization(), getRelativeNodeStep(), getStepMaxUnique(), nextPitch(), plot(), realizePitchByStep()
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer
Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer
Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer
A pseudo raga-scale.
AbstractRagAsawari attributes
Attributes without Documentation: dominantStep
Attributes inherited from AbstractScale: octaveDuplicating, tonicStep
Attributes inherited from Scale: directionSensitive, type
Attributes inherited from Music21Object: classSortOrder, id
AbstractRagAsawari properties
Properties inherited from AbstractScale: networkxGraph
Properties inherited from Scale: isConcrete, name
Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
AbstractRagAsawari methods
Methods inherited from AbstractScale: getNewTonicPitch(), getPitchFromNodeStep(), getRealization(), getRelativeNodeStep(), getStepMaxUnique(), nextPitch(), plot(), realizePitchByStep()
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer
A pseudo raga-scale.
AbstractRagMarwa attributes
Attributes without Documentation: dominantStep
Attributes inherited from AbstractScale: octaveDuplicating, tonicStep
Attributes inherited from Scale: directionSensitive, type
Attributes inherited from Music21Object: classSortOrder, id
AbstractRagMarwa properties
Properties inherited from AbstractScale: networkxGraph
Properties inherited from Scale: isConcrete, name
Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
AbstractRagMarwa methods
Methods inherited from AbstractScale: getNewTonicPitch(), getPitchFromNodeStep(), getRealization(), getRelativeNodeStep(), getStepMaxUnique(), nextPitch(), plot(), realizePitchByStep()
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer
A concrete cyclical scale, based on a cycle of intervals. These intervals do not have to be octave completing, and thus may produce scales that do no
>>> from music21 import *
>>> sc = scale.ChromaticScale('g2')
>>> sc.pitches
[G2, A-2, A2, B-2, C-3, C3, D-3, D3, E-3, F-3, F3, G-3, G3]
>>> sc.getPitches('g2', 'g6')
[G2, A-2, A2, B-2, C-3, C3, D-3, D3, E-3, F-3, F3, G-3, G3, A-3, A3, B-3, C-4, C4, D-4, D4, E-4, F-4, F4, G-4, G4, A-4, A4, B-4, C-5, C5, D-5, D5, E-5, F-5, F5, G-5, G5, A-5, A5, B-5, C-6, C6, D-6, D6, E-6, F-6, F6, G-6, G6]
>>> sc.abstract.getStepMaxUnique()
12
>>> sc.pitchFromDegree(1)
G2
>>> sc.pitchFromDegree(2)
A-2
>>> sc.pitchFromDegree(3)
A2
>>> sc.pitchFromDegree(8)
D3
>>> sc.pitchFromDegree(12)
G-3
>>> sc.getScaleDegreeFromPitch('g2')
1
>>> sc.getScaleDegreeFromPitch('F#6')
12
Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer
A concrete cyclical scale, based on a cycle of intervals. These intervals do not have to be octave completing, and thus may produce scales that do no
>>> from music21 import *
>>> sc = scale.CyclicalScale('c4', 'p5') # can give one list
>>> sc.pitches
[C4, G4]
>>> sc.getPitches('g2', 'g6')
[B-2, F3, C4, G4, D5, A5, E6]
>>> sc.getScaleDegreeFromPitch('g4') # as single interval cycle, all are 1
1
>>> sc.getScaleDegreeFromPitch('b-2', direction='bi')
1
Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer
A concrete diatonic scale. Assumes that all such scales have TODO:CHRIS:finish this doc?
DiatonicScale attributes
Attributes inherited from ConcreteScale: boundRange
Attributes inherited from Scale: directionSensitive, type
Attributes inherited from Music21Object: classSortOrder, id
DiatonicScale properties
- musicxml¶
- Return a complete musicxml representation.
Properties inherited from ConcreteScale: abstract, chord, isConcrete, name, pitches
Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
DiatonicScale methods
- getDominant()¶
Return the dominant.
>>> from music21 import * >>> sc = scale.MajorScale('e-') >>> sc.getDominant() B-4 >>> sc = scale.MajorScale('F#') >>> sc.getDominant() C#5
- getLeadingTone()¶
Return the leading tone.
>>> from music21 import * >>> sc = scale.MinorScale('c') >>> sc.pitchFromDegree(7) B-4 >>> sc.getLeadingTone() B4 >>> sc.getDominant() G4
- getParallelMajor()¶
Return a concrete relative major scale
>>> from music21 import * >>> sc1 = scale.MinorScale(pitch.Pitch('g')) >>> sc1.pitches [G4, A4, B-4, C5, D5, E-5, F5, G5] >>> sc2 = sc1.getParallelMajor() >>> sc2.pitches [G4, A4, B4, C5, D5, E5, F#5, G5]
- getParallelMinor()¶
Return a parallel minor scale based on this concrete major scale.
>>> from music21 import * >>> sc1 = scale.MajorScale(pitch.Pitch('a')) >>> sc1.pitches [A4, B4, C#5, D5, E5, F#5, G#5, A5] >>> sc2 = sc1.getParallelMinor() >>> sc2.pitches [A4, B4, C5, D5, E5, F5, G5, A5]
- getRelativeMajor()¶
Return a concrete relative major scale
>>> sc1 = MinorScale(pitch.Pitch('g')) >>> sc1.pitches [G4, A4, B-4, C5, D5, E-5, F5, G5] >>> sc2 = sc1.getRelativeMajor() >>> sc2.pitches [B-4, C5, D5, E-5, F5, G5, A5, B-5] >>> sc2 = DorianScale('d') >>> sc2.getRelativeMajor().pitches [C5, D5, E5, F5, G5, A5, B5, C6]
- getRelativeMinor()¶
Return a relative minor scale based on this concrete major scale.
>>> sc1 = MajorScale(pitch.Pitch('a')) >>> sc1.pitches [A4, B4, C#5, D5, E5, F#5, G#5, A5] >>> sc2 = sc1.getRelativeMinor() >>> sc2.pitches [F#5, G#5, A5, B5, C#6, D6, E6, F#6]
- getTonic()¶
Return the dominant.
>>> from music21 import * >>> sc = scale.MajorScale('e-') >>> sc.getDominant() B-4 >>> sc = scale.MajorScale('F#') >>> sc.getDominant() C#5Methods inherited from ConcreteScale: derive(), deriveByDegree(), deriveRanked(), findMissing(), getChord(), getPitches(), getScaleDegreeFromPitch(), match(), next(), pitchFromDegree(), pitchesFromScaleDegrees(), romanNumeral(), transpose()
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A natural minor scale, or the Aeolian mode.
>>> sc = DorianScale(pitch.Pitch('d'))
>>> sc.pitches
[D4, E4, F4, G4, A4, B4, C5, D5]
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A harmonic minor scale
>>> sc = HarmonicMinorScale('e4')
>>> sc.pitches
[E4, F#4, G4, A4, B4, C5, D#5, E5]
>>> sc.getTonic()
E4
>>> sc.getDominant()
B4
>>> sc.pitchFromDegree(1) # scale degree 1 is treated as lowest
E4
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A hypoaeolian scale
>>> sc = HypoaeolianScale(pitch.Pitch('a'))
>>> sc.pitches
[E4, F4, G4, A4, B4, C5, D5, E5]
>>> sc = HypoaeolianScale(pitch.Pitch('c'))
>>> sc.pitches
[G3, A-3, B-3, C4, D4, E-4, F4, G4]
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A hypodorian scale
>>> sc = HypodorianScale(pitch.Pitch('d'))
>>> sc.pitches
[A3, B3, C4, D4, E4, F4, G4, A4]
>>> sc = HypodorianScale(pitch.Pitch('c'))
>>> sc.pitches
[G3, A3, B-3, C4, D4, E-4, F4, G4]
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A hypolocrian scale
>>> sc = HypolocrianScale(pitch.Pitch('b'))
>>> sc.pitches
[F4, G4, A4, B4, C5, D5, E5, F5]
>>> sc = HypolocrianScale(pitch.Pitch('c'))
>>> sc.pitches
[G-3, A-3, B-3, C4, D-4, E-4, F4, G-4]
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A hypolydian scale
>>> sc = HypolydianScale(pitch.Pitch('f'))
>>> sc.pitches
[C4, D4, E4, F4, G4, A4, B4, C5]
>>> sc = HypolydianScale(pitch.Pitch('c'))
>>> sc.pitches
[G3, A3, B3, C4, D4, E4, F#4, G4]
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A hypolydian scale
>>> sc = HypomixolydianScale(pitch.Pitch('g'))
>>> sc.pitches
[D4, E4, F4, G4, A4, B4, C5, D5]
>>> sc = HypomixolydianScale(pitch.Pitch('c'))
>>> sc.pitches
[G3, A3, B-3, C4, D4, E4, F4, G4]
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A hypophrygian scale
>>> sc = HypophrygianScale(pitch.Pitch('e'))
>>> sc.abstract.octaveDuplicating
True
>>> sc.pitches
[B3, C4, D4, E4, F4, G4, A4, B4]
>>> sc.getTonic()
E4
>>> sc.getDominant()
A4
>>> sc.pitchFromDegree(1) # scale degree 1 is treated as lowest
B3
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A locrian scale
>>> sc = LocrianScale(pitch.Pitch('b'))
>>> sc.pitches
[B4, C5, D5, E5, F5, G5, A5, B5]
>>> sc = LocrianScale(pitch.Pitch('c'))
>>> sc.pitches
[C4, D-4, E-4, F4, G-4, A-4, B-4, C5]
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A lydian scale
>>> sc = LydianScale(pitch.Pitch('f'))
>>> sc.pitches
[F4, G4, A4, B4, C5, D5, E5, F5]
>>> sc = LydianScale(pitch.Pitch('c'))
>>> sc.pitches
[C4, D4, E4, F#4, G4, A4, B4, C5]
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A Major Scale
>>> sc = MajorScale(pitch.Pitch('d'))
>>> sc.pitchFromDegree(7).name
'C#'
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A melodic minor scale
>>> sc = MelodicMinorScale('e4')
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A natural minor scale, or the Aeolian mode.
>>> sc = MinorScale(pitch.Pitch('g'))
>>> sc.pitches
[G4, A4, B-4, C5, D5, E-5, F5, G5]
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A mixolydian scale
>>> sc = MixolydianScale(pitch.Pitch('g'))
>>> sc.pitches
[G4, A4, B4, C5, D5, E5, F5, G5]
>>> sc = MixolydianScale(pitch.Pitch('c'))
>>> sc.pitches
[C4, D4, E4, F4, G4, A4, B-4, C5]
Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer
Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer
A concrete cyclical scale, based on a cycle of intervals. These intervals do not have to be octave completing, and thus may produce scales that do no
>>> from music21 import *
>>> sc = scale.OctaveRepeatingScale('c4', ['m3', 'M3']) #
>>> sc.pitches
[C4, E-4, G4, C5]
>>> sc.getPitches('g2', 'g6')
[G2, C3, E-3, G3, C4, E-4, G4, C5, E-5, G5, C6, E-6, G6]
>>> sc.getScaleDegreeFromPitch('c4')
1
>>> sc.getScaleDegreeFromPitch('e-')
2
Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer
A phrygian scale
>>> sc = PhrygianScale(pitch.Pitch('e'))
>>> sc.pitches
[E4, F4, G4, A4, B4, C5, D5, E5]
Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer
A concrete pseudo-raga scale.
>>> from music21 import *
>>> sc = scale.RagAsawari('c2')
>>> sc.pitches
[C2, D2, F2, G2, A-2, C3]
>>> sc.getPitches(direction='descending')
[C3, B-2, A-2, G2, F2, E-2, D2, C2]
Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer
A concrete pseudo-raga scale.
>>> from music21 import *
>>> sc = scale.RagMarwa('c2')
>>> # this gets a pitch beyond the terminus b/c of descending form max
>>> sc.pitches
[C2, D-2, E2, F#2, A2, B2, A2, C3, D-3]
Inherits from: Music21Object, JSONSerializer
Generic base class for all scales, both abstract and concrete.
Scale attributes
Attributes without Documentation: directionSensitive, type
Attributes inherited from Music21Object: classSortOrder, id
Scale properties
- isConcrete¶
- To be concrete, a Scale must have a defined tonic. An abstract Scale is not Concrete, nor is a Concrete scale without a defined tonic.
- name¶
- Return or construct the name of this scale.
Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
Scale methods
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer
A scale created from a Xenakis sieve logical string, based on the Sieve object definition. The complete period of the sieve is realized as intervals and used to create a scale.
>>> from music21 import *
>>> sc = scale.SieveScale('c4', '3@0')
>>> sc.pitches
[C4, E-4]
>>> sc = scale.SieveScale('d4', '3@0')
>>> sc.pitches
[D4, F4]
>>> sc = scale.SieveScale('c2', '(-3@2 & 4) | (-3@1 & 4@1) | (3@2 & 4@2) | (-3 & 4@3)')
>>> sc.pitches
[C2, D2, E2, F2, G2, A2, B2, C3]
Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer
A concrete whole-tone scale.
>>> from music21 import *
>>> sc = scale.WholeToneScale('g2')
>>> sc.pitches
[G2, A2, B2, C#3, D#3, E#3, G3]
>>> sc.getPitches('g2', 'g6')
[G2, A2, B2, C#3, D#3, E#3, G3, A3, B3, C#4, D#4, E#4, G4, A4, B4, C#5, D#5, E#5, G5, A5, B5, C#6, D#6, E#6, G6]
>>> sc.abstract.getStepMaxUnique()
6
>>> sc.pitchFromDegree(1)
G2
>>> sc.pitchFromDegree(2)
A2
>>> sc.pitchFromDegree(6)
E#3
>>> sc.getScaleDegreeFromPitch('g2')
1
>>> sc.getScaleDegreeFromPitch('F6')
6