Beispiel #1
0
    def __init__(self):
        super().__init__()
        self.size: interval.IntervalBase = interval.GenericInterval(2)

        self.placement = 'above'
        self.nachschlag = False  # play little notes at the end of the trill?
        self.tieAttach = 'all'
        self.quarterLength = 0.125
        self._setAccidentalFromKeySig = True
def base40DeltaToInterval(delta):
    '''
    Returns a music21 Interval between two Base40 pitch numbers
    given the delta (difference) between them.

    Raises a Base40 Exception if the interval is not handled by Base40.
    Base40 can only handle major, minor, perfect, augmented,
    and diminished intervals. Although not for certain, it seems
    that the engineers that designed this system assumed that
    other intervals (doubly augmented intervals, for instance)
    would be of a very rare occurrence, and extreme intervals
    which would trigger an incorrect answer (C-- to C##, for
    instance, would return a diminished second, even though it's
    a quadruple augmented unison) just would not occur.


    >>> musedata.base40.base40DeltaToInterval(4)
    <music21.interval.Interval d2>
    >>> musedata.base40.base40DeltaToInterval(11)
    <music21.interval.Interval m3>
    >>> musedata.base40.base40DeltaToInterval(23)
    <music21.interval.Interval P5>
    >>> musedata.base40.base40DeltaToInterval(-23)
    <music21.interval.Interval P-5>
    >>> musedata.base40.base40DeltaToInterval(52)
    <music21.interval.Interval M10>
    >>> musedata.base40.base40DeltaToInterval(-52)
    <music21.interval.Interval M-10>
    >>> musedata.base40.base40DeltaToInterval(77)
    Traceback (most recent call last):
    music21.musedata.base40.Base40Exception: Interval not handled by Base40 37
    '''

    direction = 1
    if delta < 0:
        direction = -1

    simpleDelta = abs(delta) % 40

    try:
        simpleIntervalName = base40IntervalTable[simpleDelta]
        simpleInterval = interval.Interval(simpleIntervalName)
    except KeyError:
        raise Base40Exception('Interval not handled by Base40 ' +
                              str(simpleDelta))

    numOctaves = abs(delta) // 40

    sgi = simpleInterval.generic  # Simple generic interval
    # Compound generic interval
    cgi = interval.GenericInterval(direction * (sgi.value + 7 * numOctaves))
    sdi = simpleInterval.diatonic  # Simple diatonic interval

    newInterval = interval.convertSpecifier(sdi.specifier)[1] + str(cgi.value)

    return interval.Interval(newInterval)
Beispiel #3
0
 def __init__(self):
     super().__init__()
     self.direction = ''  # up or down
     self.size = None  # interval.Interval (General, etc.) class
     self.quarterLength = 0.125  # 32nd note default
     self.size = interval.GenericInterval(2)
Beispiel #4
0
 def __init__(self):
     super().__init__()
     self.size = interval.GenericInterval(2)
     self.placement = 'above'
     self.tieAttach = 'all'
     self.quarterLength = 0.25
Beispiel #5
0
 def __init__(self):
     super().__init__()
     self.size = interval.GenericInterval(2)
     self.quarterLength = 0.25