What is the proper way to define a custom scale that inherits the attributes of the scale
class?
Should I include my class in music21/scale/__init__.py
class myAbastract(AbstractScale):
'''
A pseudo my-scale.
'''
def __init__(self):
super().__init__()
self.type = 'Abstract My Name'
self.octaveDuplicating = True
self.dominantDegree: int = -1
self.buildNetwork()
When I defined myScale in the main.py, it seems it doesn't inherit "deriveAll()" method/function.
pitchListStrs = 'a b` c d e f g a'.split()
pitchList = [pitch.Pitch(p) for p in pitchListStrs]
myScaleA = scale.ConcreteScale(pitches=pitchList)
[str(p) for p in myScaleA.getPitches('E-5', 'G-7')]
myScale = myScaleA.abstract
mySol =scale.ConcreteScale()
mySol.tonic = pitch.Pitch('D')
But then, deriveAll is not defined:
myScale.deriveAll(['E5', 'F5', 'G5', 'A5', 'B`5', 'C6', 'D6', 'E6'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'AbstractScale' object has no attribute 'deriveAll'
deriveAll
is a routine defined on ConcreteScale
instances. You attempted to call it on an instance of AbstractScale
. Try calling it on your variable myScaleA
, which is concrete.