Previous topic

music21.scala.base

Next topic

music21.search

Table Of Contents

Table Of Contents

music21.scale

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 BoundIntervalNetwork.

The main public interface to these resources are subclasses of ConcreteScale, 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]

ConcreteScale

Inherits from: Scale, Music21Object, JSONSerializer

class music21.scale.ConcreteScale(tonic=None, pitches=None)

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 can either be used directly or more commonly as a base class for all concrete scales.

Here we treat a diminished triad as a scale:

>>> from music21 import *
>>> myscale = scale.ConcreteScale(pitches = ["C4", "E-4", "G-4", "A4"])
>>> myscale.getTonic()
C4
>>> myscale.next("G-2")
A2
>>> myscale.getPitches("E-5","G-7")
[E-5, G-5, A5, C6, E-6, G-6, A6, C7, E-7, G-7]

A scale that lasts two octaves and uses quarter tones (D~)

>>> from music21 import *
>>> complexscale = scale.ConcreteScale(pitches = ["C#3", "E-3", "F3", "G3", "B3", "D~4", "F#4", "A4", "C#5"])
>>> complexscale.getTonic()
C#3
>>> complexscale.next("G3", direction=scale.DIRECTION_DESCENDING)
F3
>>> complexscale.getPitches("C3","C7")
[C#3, E-3, F3, G3, B3, D~4, F#4, A4, C#5, E-5, F5, G5, B5, D~6, F#6, A6]
>>> complexscale.getPitches("C7","C5")
[A6, F#6, D~6, B5, G5, F5, E-5, C#5]

ConcreteScale attributes

Attributes without Documentation: tonic, boundRange

Attributes inherited from Scale: type

Attributes inherited from Music21Object: classSortOrder, isSpanner, isStream, isVariant, hideObjectOnPrint, groups, 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 from this harmony over a default range. Use the getChord() method if you need greater control over the parameters of the chord.

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, derivationHierarchy, duration, isGrace, measureNumber, offset, priority, seconds

Properties inherited from JSONSerializer: json

ConcreteScale methods

derive(other, comparisonAttribute='pitchClass')

Return the closest-matching ConcreteScale based on the pitch collection provided as a Stream, a ConcreteScale, or a list of Pitch objects.

>>> 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, return a new ConcreteScale 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 ConcreteScale objects based on this AbstractScale, provided as a Stream, a ConcreteScale, or a list of Pitch objects. Returned integer values 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', alteredDegrees={})

Given another object of various forms (e.g., a Stream, a ConcreteScale, a list of Pitch objects), return a list of pitches that are found in this Scale but are not found in the provided object.

>>> 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', **keywords)

Return a realized chord containing all the pitches in this scale within a particular inclusive range defined by two pitches.

All keyword arguments are passed on to the Chord, permitting specification of quarterLength and similar parameters.

getDegreeMaxUnique()

Convenience routine to get this from the AbstractScale.

getPitches(minPitch=None, maxPitch=None, direction=None)

Return a list of Pitch objects, using a deepcopy of a cached version if available.

getScalaStorage()

Return a configured scale scale object

getScaleDegreeAndAccidentalFromPitch(pitchTarget, direction='ascending', comparisonAttribute='name')

Given a scale (or Key object) and a pitch, return a two-element tuple of the degree of the scale and an accidental (or None) needed to get this pitch.

>>> from music21 import *
>>> cmaj = key.Key('C')
>>> cmaj.getScaleDegreeAndAccidentalFromPitch(pitch.Pitch('E'))
(3, None)
>>> cmaj.getScaleDegreeAndAccidentalFromPitch(pitch.Pitch('E-'))
(3, <accidental flat>)

The Direction of a melodic minor scale is significant

>>> amin = scale.MelodicMinorScale('a')
>>> amin.getScaleDegreeAndAccidentalFromPitch(pitch.Pitch('G'), direction=scale.DIRECTION_DESCENDING)
(7, None)
>>> amin.getScaleDegreeAndAccidentalFromPitch(pitch.Pitch('G'), direction=scale.DIRECTION_ASCENDING)
(7, <accidental flat>)
>>> amin.getScaleDegreeAndAccidentalFromPitch(pitch.Pitch('G-'), direction=scale.DIRECTION_ASCENDING)
(7, <accidental double-flat>)

Returns (None, None) if for some reason this scale does not have this step (a whole-tone scale, for instance)

getScaleDegreeFromPitch(pitchTarget, direction='ascending', comparisonAttribute='name')

For a given pitch, return the appropriate scale degree. If no scale degree is available, None is returned.

Note – by default it will find based on note name not on PitchClass because this is used so commonly by tonal functions. So if it’s important that D# and E- are the same, set the comparisonAttribute to pitchClass

>>> 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.getScaleDegreeFromPitch('e') == None
True
>>> sc.getScaleDegreeFromPitch('e', comparisonAttribute='step')
1
>>> sc = scale.HarmonicMinorScale('a')
>>> sc.getScaleDegreeFromPitch('c')
3
>>> sc.getScaleDegreeFromPitch('g#')
7
>>> sc.getScaleDegreeFromPitch('g')
getTonic()

Return the tonic.

>>> from music21 import *
>>> sc = scale.ConcreteScale(tonic = 'e-4')
>>> sc.getTonic()
E-4
intervalBetweenDegrees(degreeStart, degreeEnd, direction='ascending', equateTermini=True)

Given two degrees, provide the interval as an interval.Interval object.

>>> from music21 import *
>>> sc = scale.MajorScale('e-')
>>> sc.intervalBetweenDegrees(3, 7)
<music21.interval.Interval P5>
isNext(other, pitchOrigin, direction='ascending', stepSize=1, getNeighbor=True, comparisonAttribute='name')

Given another pitch, as well as an origin and a direction, determine if this other pitch is in the next in the scale.

>>> from music21 import *
>>> sc1 = scale.MajorScale('g')
>>> sc1.isNext('d4', 'c4', 'ascending')
True
match(other, comparisonAttribute='pitchClass')

Given another object of various forms (e.g., a Stream, a ConcreteScale, a list of Pitch objects), 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=None, direction='ascending', stepSize=1, getNeighbor=True)

Get the next pitch above (or if direction is ‘descending’, below) a pitchOrigin or None. If the pitchOrigin is None, the tonic pitch is returned. This is useful when starting a chain of iterative calls.

The direction attribute may be either ascending or descending. Default is ascending. Optionally, positive or negative integers may be provided as directional stepSize scalars.

An optional stepSize argument can be used to set the number of scale steps that are stepped through. Thus, .next(stepSize=2) will give not the next pitch in the scale, but the next after this one.

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

This uses the getNeighbor attribute to find the next note above f#5 in the E-flat major scale:

>>> sc.next('f#5')
G5
>>> 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', equateTermini=True)

Given a scale degree, return a deepcopy of 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.roman.RomanNumeral V in A- major>
show(fmt=None, app=None, direction='ascending')

Show the scale in a format. Here, prepare scala format if requested.

solfeg(pitchTarget=None, direction='ascending', variant='music21', chromatic=True)

Returns the chromatic solfege (or diatonic if chromatic is False) for a given pitch in a given scale.

The variant method lets one specify either the default music21 or humdrum solfeg representation for altered notes.

>>> from music21 import *
>>> eflatMaj = key.Key('E-')
>>> eflatMaj.solfeg(pitch.Pitch('G'))
'mi'
>>> eflatMaj.solfeg(pitch.Pitch('A'))
'fi'
>>> eflatMaj.solfeg(pitch.Pitch('A'), chromatic=False)
'fa'
>>> eflatMaj.solfeg(pitch.Pitch('G#'), variant='music21') #default
'mis'
>>> eflatMaj.solfeg(pitch.Pitch('G#'), variant='humdrum')
'my'
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>
tune(streamObj, minPitch=None, maxPitch=None, direction=None)

Given a Stream object containing Pitches, match all pitch names and or pitch space values and replace the target pitch with copies of pitches stored in this scale.

This is always applied recursively to all sub-Streams.

write(fmt=None, fp=None, direction='ascending')

Write the scale in a format. Here, prepare scala format if requested.

Methods inherited from Music21Object: searchActiveSiteByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

AbstractScale

Inherits from: Scale, Music21Object, JSONSerializer

class music21.scale.AbstractScale

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 BoundIntervalNetwork object. Thus, they are rarely created or manipulated directly by most users.

The AbstractScale additionally stores an _alteredDegrees dictionary. Subclasses can define altered nodes in AbstractScale that are passed to the BoundIntervalNetwork.

AbstractScale attributes

Attributes without Documentation: octaveDuplicating, deterministic, tonicDegree

Attributes inherited from Scale: type

Attributes inherited from Music21Object: classSortOrder, isSpanner, isStream, isVariant, hideObjectOnPrint, groups, id

AbstractScale properties

networkxGraph

Return a networks Graph object representing a realized version of this BoundIntervalNetwork.

Properties inherited from Scale: isConcrete, name

Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, derivationHierarchy, duration, isGrace, measureNumber, offset, priority, seconds

Properties inherited from JSONSerializer: json

AbstractScale methods

buildNetworkFromPitches(pitchList)

Builds the network (list of motions) for an abstract scale from a list of pitch.Pitch objects. If the concluding note (usually the “octave”) is not given, then it’ll be created automatically.

Here we treat the augmented triad as a scale:

>>> from music21 import *
>>> p1 = pitch.Pitch("C4")
>>> p2 = pitch.Pitch("E4")
>>> p3 = pitch.Pitch("G#4")
>>> absc = scale.AbstractScale()
>>> absc.buildNetworkFromPitches([p1, p2, p3])
>>> absc.octaveDuplicating
True
>>> absc._net
<music21.intervalNetwork.BoundIntervalNetwork object at 0x...>

Now see it return a new “scale” of the augmentedTriad on D5

>>> absc._net.realizePitch('D5')
[D5, F#5, A#5, D6]
getDegreeMaxUnique()

Return the maximum number of scale steps, or the number to use as a modulus.

getIntervals(stepOfPitch=None, 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.

getNewTonicPitch(pitchReference, nodeName, direction='ascending', minPitch=None, maxPitch=None)

Define a pitch target and a node.

getPitchFromNodeDegree(pitchReference, nodeName, nodeDegreeTarget, direction='ascending', minPitch=None, maxPitch=None, equateTermini=True)

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.

getRelativeNodeDegree(pitchReference, nodeName, pitchTarget, comparisonAttribute='pitchClass', direction='ascending')

Expose functionality from BoundIntervalNetwork, passing on the stored alteredDegrees dictionary.

getScalaStorage(direction='ascending')

Get interval sequence

nextPitch(pitchReference, nodeName, pitchOrigin, direction='ascending', stepSize=1, getNeighbor=True)

Expose functionality from BoundIntervalNetwork, passing on the stored alteredDegrees dictionary.

plot(*args, **keywords)

Create and display a plot.

realizePitchByDegree(pitchReference, nodeId, nodeDegreeTargets, direction='ascending', minPitch=None, maxPitch=None)

Given one or more scale degrees, return a list of all matches over the entire range.

show(fmt=None, app=None, direction='ascending')

Show the scale in a format. Here, prepare scala format if requested.

write(fmt=None, fp=None, direction='ascending')

Write the scale in a format. Here, prepare scala format if requested.

Methods inherited from Music21Object: searchActiveSiteByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), next(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

AbstractCyclicalScale

Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer

class music21.scale.AbstractCyclicalScale(mode=None)

A scale of any size built with an interval list of any form. The resulting scale may be non octave repeating.

AbstractDiatonicScale

Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer

class music21.scale.AbstractDiatonicScale(mode=None)

AbstractDiatonicScale attributes

Attributes without Documentation: relativeMajorDegree, relativeMinorDegree, dominantDegree

Attributes inherited from AbstractScale: octaveDuplicating, deterministic, tonicDegree

Attributes inherited from Scale: type

Attributes inherited from Music21Object: classSortOrder, isSpanner, isStream, isVariant, hideObjectOnPrint, groups, id

AbstractDiatonicScale properties

Properties inherited from AbstractScale: networkxGraph

Properties inherited from Scale: isConcrete, name

Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, derivationHierarchy, duration, isGrace, measureNumber, offset, priority, seconds

Properties inherited from JSONSerializer: json

AbstractDiatonicScale methods

Methods inherited from AbstractScale: buildNetworkFromPitches(), getDegreeMaxUnique(), getIntervals(), getNewTonicPitch(), getPitchFromNodeDegree(), getRealization(), getRelativeNodeDegree(), getScalaStorage(), nextPitch(), plot(), realizePitchByDegree(), show(), write()

Methods inherited from Music21Object: searchActiveSiteByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), next(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

AbstractHarmonicMinorScale

Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer

class music21.scale.AbstractHarmonicMinorScale(mode=None)

A true bi-directional scale that with the augmented second to a leading tone.

AbstractHarmonicMinorScale attributes

Attributes without Documentation: dominantDegree

Attributes inherited from AbstractScale: octaveDuplicating, deterministic, tonicDegree

Attributes inherited from Scale: type

Attributes inherited from Music21Object: classSortOrder, isSpanner, isStream, isVariant, hideObjectOnPrint, groups, id

AbstractHarmonicMinorScale properties

Properties inherited from AbstractScale: networkxGraph

Properties inherited from Scale: isConcrete, name

Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, derivationHierarchy, duration, isGrace, measureNumber, offset, priority, seconds

Properties inherited from JSONSerializer: json

AbstractHarmonicMinorScale methods

Methods inherited from AbstractScale: buildNetworkFromPitches(), getDegreeMaxUnique(), getIntervals(), getNewTonicPitch(), getPitchFromNodeDegree(), getRealization(), getRelativeNodeDegree(), getScalaStorage(), nextPitch(), plot(), realizePitchByDegree(), show(), write()

Methods inherited from Music21Object: searchActiveSiteByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), next(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

AbstractMelodicMinorScale

Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer

class music21.scale.AbstractMelodicMinorScale(mode=None)

A directional scale.

AbstractMelodicMinorScale attributes

Attributes without Documentation: dominantDegree

Attributes inherited from AbstractScale: octaveDuplicating, deterministic, tonicDegree

Attributes inherited from Scale: type

Attributes inherited from Music21Object: classSortOrder, isSpanner, isStream, isVariant, hideObjectOnPrint, groups, id

AbstractMelodicMinorScale properties

Properties inherited from AbstractScale: networkxGraph

Properties inherited from Scale: isConcrete, name

Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, derivationHierarchy, duration, isGrace, measureNumber, offset, priority, seconds

Properties inherited from JSONSerializer: json

AbstractMelodicMinorScale methods

Methods inherited from AbstractScale: buildNetworkFromPitches(), getDegreeMaxUnique(), getIntervals(), getNewTonicPitch(), getPitchFromNodeDegree(), getRealization(), getRelativeNodeDegree(), getScalaStorage(), nextPitch(), plot(), realizePitchByDegree(), show(), write()

Methods inherited from Music21Object: searchActiveSiteByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), next(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

AbstractOctatonicScale

Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer

class music21.scale.AbstractOctatonicScale(mode=None)

Abstract scale representing the two octatonic scales.

AbstractOctaveRepeatingScale

Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer

class music21.scale.AbstractOctaveRepeatingScale(mode=None)

A scale of any size built with an interval list that assumes octave completion. An additional interval to complete the octave will be added to the provided intervals. This does not guarantee that the octave will be repeated in one octave, only the next octave above the last interval will be provided.

AbstractRagAsawari

Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer

class music21.scale.AbstractRagAsawari

A pseudo raga-scale.

AbstractRagAsawari attributes

Attributes without Documentation: dominantDegree

Attributes inherited from AbstractScale: octaveDuplicating, deterministic, tonicDegree

Attributes inherited from Scale: type

Attributes inherited from Music21Object: classSortOrder, isSpanner, isStream, isVariant, hideObjectOnPrint, groups, id

AbstractRagAsawari properties

Properties inherited from AbstractScale: networkxGraph

Properties inherited from Scale: isConcrete, name

Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, derivationHierarchy, duration, isGrace, measureNumber, offset, priority, seconds

Properties inherited from JSONSerializer: json

AbstractRagAsawari methods

Methods inherited from AbstractScale: buildNetworkFromPitches(), getDegreeMaxUnique(), getIntervals(), getNewTonicPitch(), getPitchFromNodeDegree(), getRealization(), getRelativeNodeDegree(), getScalaStorage(), nextPitch(), plot(), realizePitchByDegree(), show(), write()

Methods inherited from Music21Object: searchActiveSiteByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), next(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

AbstractRagMarwa

Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer

class music21.scale.AbstractRagMarwa

A pseudo raga-scale.

AbstractRagMarwa attributes

Attributes without Documentation: dominantDegree

Attributes inherited from AbstractScale: octaveDuplicating, deterministic, tonicDegree

Attributes inherited from Scale: type

Attributes inherited from Music21Object: classSortOrder, isSpanner, isStream, isVariant, hideObjectOnPrint, groups, id

AbstractRagMarwa properties

Properties inherited from AbstractScale: networkxGraph

Properties inherited from Scale: isConcrete, name

Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, derivationHierarchy, duration, isGrace, measureNumber, offset, priority, seconds

Properties inherited from JSONSerializer: json

AbstractRagMarwa methods

Methods inherited from AbstractScale: buildNetworkFromPitches(), getDegreeMaxUnique(), getIntervals(), getNewTonicPitch(), getPitchFromNodeDegree(), getRealization(), getRelativeNodeDegree(), getScalaStorage(), nextPitch(), plot(), realizePitchByDegree(), show(), write()

Methods inherited from Music21Object: searchActiveSiteByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), next(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

AbstractWeightedHexatonicBlues

Inherits from: AbstractScale, Scale, Music21Object, JSONSerializer

class music21.scale.AbstractWeightedHexatonicBlues

A dynamic, probabilistic mixture of minor pentatonic and a hexatonic blues scale

AbstractWeightedHexatonicBlues attributes

Attributes without Documentation: dominantDegree

Attributes inherited from AbstractScale: octaveDuplicating, deterministic, tonicDegree

Attributes inherited from Scale: type

Attributes inherited from Music21Object: classSortOrder, isSpanner, isStream, isVariant, hideObjectOnPrint, groups, id

AbstractWeightedHexatonicBlues properties

Properties inherited from AbstractScale: networkxGraph

Properties inherited from Scale: isConcrete, name

Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, derivationHierarchy, duration, isGrace, measureNumber, offset, priority, seconds

Properties inherited from JSONSerializer: json

AbstractWeightedHexatonicBlues methods

Methods inherited from AbstractScale: buildNetworkFromPitches(), getDegreeMaxUnique(), getIntervals(), getNewTonicPitch(), getPitchFromNodeDegree(), getRealization(), getRelativeNodeDegree(), getScalaStorage(), nextPitch(), plot(), realizePitchByDegree(), show(), write()

Methods inherited from Music21Object: searchActiveSiteByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), next(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

ChromaticScale

Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.ChromaticScale(tonic=None)

A concrete cyclical scale, based on a cycle of half steps. 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, B2, C3, C#3, D3, E-3, E3, F3, F#3, G3]
>>> sc.getPitches('g2', 'g6')
[G2, A-2, A2, B-2, B2, C3, C#3, D3, E-3, E3, F3, F#3, G3, A-3, A3, B-3, B3, C4, C#4, D4, E-4, E4, F4, F#4, G4, A-4, A4, B-4, B4, C5, C#5, D5, E-5, E5, F5, F#5, G5, A-5, A5, B-5, B5, C6, C#6, D6, E-6, E6, F6, F#6, G6]
>>> sc.abstract.getDegreeMaxUnique()
12
>>> sc.pitchFromDegree(1)
G2
>>> sc.pitchFromDegree(2)
A-2
>>> sc.pitchFromDegree(3)
A2
>>> sc.pitchFromDegree(8)
D3
>>> sc.pitchFromDegree(12)
F#3
>>> sc.getScaleDegreeFromPitch('g2', comparisonAttribute='pitchClass')
1
>>> sc.getScaleDegreeFromPitch('F#6', comparisonAttribute='pitchClass')
12

CyclicalScale

Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.CyclicalScale(tonic=None, intervalList=['m2'])

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

DiatonicScale

Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.DiatonicScale(tonic=None)

A concrete diatonic scale. Each DiatonicScale has one instance of a AbstractDiatonicScale.

DiatonicScale attributes

Attributes inherited from ConcreteScale: tonic, boundRange

Attributes inherited from Scale: type

Attributes inherited from Music21Object: classSortOrder, isSpanner, isStream, isVariant, hideObjectOnPrint, groups, 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, derivationHierarchy, duration, isGrace, measureNumber, offset, priority, seconds

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 tonic.

>>> from music21 import *
>>> sc = scale.MajorScale('e-')
>>> sc.getDominant()
B-4
>>> sc = scale.MajorScale('F#')
>>> sc.getDominant()
C#5

Methods inherited from ConcreteScale: derive(), deriveByDegree(), deriveRanked(), findMissing(), getChord(), getDegreeMaxUnique(), getPitches(), getScalaStorage(), getScaleDegreeAndAccidentalFromPitch(), getScaleDegreeFromPitch(), intervalBetweenDegrees(), isNext(), match(), next(), pitchFromDegree(), pitchesFromScaleDegrees(), romanNumeral(), show(), solfeg(), transpose(), tune(), write()

Methods inherited from Music21Object: searchActiveSiteByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

DorianScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.DorianScale(tonic=None)

A natural minor scale, or the Aeolian mode.

>>> sc = DorianScale(pitch.Pitch('d'))
>>> sc.pitches
[D4, E4, F4, G4, A4, B4, C5, D5]

HarmonicMinorScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.HarmonicMinorScale(tonic=None)

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

HypoaeolianScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.HypoaeolianScale(tonic=None)

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]

HypodorianScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.HypodorianScale(tonic=None)

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]

HypolocrianScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.HypolocrianScale(tonic=None)

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]

HypolydianScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.HypolydianScale(tonic=None)

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]

HypomixolydianScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.HypomixolydianScale(tonic=None)

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]

HypophrygianScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.HypophrygianScale(tonic=None)

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

LocrianScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.LocrianScale(tonic=None)

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]

LydianScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.LydianScale(tonic=None)

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]

MajorScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.MajorScale(tonic=None)

A Major Scale

>>> sc = MajorScale(pitch.Pitch('d'))
>>> sc.pitchFromDegree(7).name
'C#'

MelodicMinorScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.MelodicMinorScale(tonic=None)

A melodic minor scale

>>> sc = MelodicMinorScale('e4')

MinorScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.MinorScale(tonic=None)

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]

MixolydianScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.MixolydianScale(tonic=None)

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]

OctatonicScale

Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.OctatonicScale(tonic=None, mode=None)

A concrete Octatonic scale. Two modes

OctaveRepeatingScale

Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.OctaveRepeatingScale(tonic=None, intervalList=['m2', <music21.interval.Interval M7>, <music21.interval.Interval P1>])

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

PhrygianScale

Inherits from: DiatonicScale, ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.PhrygianScale(tonic=None)

A phrygian scale

>>> sc = PhrygianScale(pitch.Pitch('e'))
>>> sc.pitches
[E4, F4, G4, A4, B4, C5, D5, E5]

RagAsawari

Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.RagAsawari(tonic=None)

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]

RagMarwa

Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.RagMarwa(tonic=None)

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]

ScalaScale

Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.ScalaScale(tonic=None, scalaString=None)

A scale created from a Scala scale .scl file. Any file in the Scala archive can be given by name. Additionally, a file path to a Scala .scl file, or a raw string representation, can be used.

>>> sc = ScalaScale('g4', 'mbira banda')
>>> sc.pitches
[G4, A4(-15c), B4(-11c), C#5(-7c), D~5(+6c), E5(+14c), F~5(+1c), A-5(+2c)]

if only a single string is given and it’s too long to be a tonic or it ends in .scl, assume it’s the name of a scala scale and set the tonic to C4

>>> sc = ScalaScale('pelog_9')
>>> sc.pitches
[C4, D`4(-17c), D~4(+17c), F~4(-17c), G`4(+17c), A-4, A~4(-17c), C5]

If no scale with that name can be found then it raises an exception:

>>> sc = ScalaScale('badFileName.scl')
Traceback (most recent call last):
ScaleException: Could not find a file named badFileName.scl in the scala database

ScalaScale attributes

Attributes without Documentation: description

Attributes inherited from ConcreteScale: tonic, boundRange

Attributes inherited from Scale: type

Attributes inherited from Music21Object: classSortOrder, isSpanner, isStream, isVariant, hideObjectOnPrint, groups, id

ScalaScale properties

ScalaScale methods

Methods inherited from ConcreteScale: derive(), deriveByDegree(), deriveRanked(), findMissing(), getChord(), getDegreeMaxUnique(), getPitches(), getScalaStorage(), getScaleDegreeAndAccidentalFromPitch(), getScaleDegreeFromPitch(), getTonic(), intervalBetweenDegrees(), isNext(), match(), next(), pitchFromDegree(), pitchesFromScaleDegrees(), romanNumeral(), show(), solfeg(), transpose(), tune(), write()

Methods inherited from Music21Object: searchActiveSiteByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

Scale

Inherits from: Music21Object, JSONSerializer

class music21.scale.Scale

Generic base class for all scales, both abstract and concrete.

Scale attributes

Attributes without Documentation: type

Attributes inherited from Music21Object: classSortOrder, isSpanner, isStream, isVariant, hideObjectOnPrint, groups, 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, derivationHierarchy, duration, isGrace, measureNumber, offset, priority, seconds

Properties inherited from JSONSerializer: json

Scale methods

Methods inherited from Music21Object: searchActiveSiteByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndActiveSite(), freezeIds(), getAllContextsByClass(), getCommonSiteIds(), getCommonSites(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), getSpannerSites(), hasContext(), hasSite(), hasSpannerSite(), hasVariantSite(), isClassOrSubclass(), mergeAttributes(), next(), previous(), purgeLocations(), purgeOrphans(), purgeUndeclaredIds(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()

Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()

SieveScale

Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.SieveScale(tonic=None, sieveString='2@0', eld=1)

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]

WeightedHexatonicBlues

Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.WeightedHexatonicBlues(tonic=None)

A concrete scale based on a dynamic mixture of a minor pentatonic and the hexatonic blues scale.

>>> from music21 import *

WholeToneScale

Inherits from: ConcreteScale, Scale, Music21Object, JSONSerializer

class music21.scale.WholeToneScale(tonic=None)

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.getDegreeMaxUnique()
6
>>> sc.pitchFromDegree(1)
G2
>>> sc.pitchFromDegree(2)
A2
>>> sc.pitchFromDegree(6)
E#3
>>> sc.getScaleDegreeFromPitch('g2', comparisonAttribute='pitchClass')
1
>>> sc.getScaleDegreeFromPitch('F6', comparisonAttribute='pitchClass')
6