0

我想知道定义自定义比例的正确方法是引入“比例”类的属性吗?

我是否应该将我的课程包含在“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()

当我在 main.py 中定义 myScale 时,它​​似乎没有继承“deriveAll()”方法/函数。

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')

但是,没有定义deriveAll:

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'

任何帮助将不胜感激。

4

1 回答 1

3

deriveAll是在实例上定义的例程ConcreteScale。您试图在AbstractScale. 尝试在您的变量上调用它myScaleA,这是具体的。

于 2020-12-26T16:13:55.873 回答