orbichord/chordinate.py
def standardSimplex(
    chord: Chord,
    scale: ConcreteScale,
    normalize: bool = True
) -> list:
    """Compute chord scale point in the standard simplex

    Parameters
    ----------
        chrod : Chrod
            Chord to estimate normal order
        scale : ConcreteScale
            Scale use as metric step
        normalize : int, optional
            Normalize coordinates by the number of scale degrees

    Return
    ------
        list
            List with scalar point within standard simplex

    Examples
    --------
    >>> from music21.chord import Chord
    >>> from music21.scale import ChromaticScale
    >>> from orbichord.chordinate import standardSimplex
    >>> scale = ChromaticScale('C')
    >>> chord = Chord('C E G')
    >>> standardSimplex(chord, scale)
    [0.9166666666666666, 0.3333333333333333, 0.25]
    >>> standardSimplex(chord, scale, normalize=False)
    [11, 4, 3]
    """
    # Get scale max degree and compute scalar point
    max_scale_degree = scale.getDegreeMaxUnique()
    point = scalePoint(chord, scale)
    # Reduce to the standard simplex
    dimension = len(point)
    sumchord = sum(point)
    point.sort()
    while sumchord >= max_scale_degree:
        last = point[-1]
        for index in range(1, dimension):
            point[dimension-index] = point[dimension-index-1]
        point[0] = last - max_scale_degree
        sumchord = sum(point)
    # Apply affine transformation
    previous = point[0]
    for index in range(1, dimension):
        interval = point[index] - previous
        previous = point[index]
        point[index] = interval
    point[0] = sumchord
    if normalize:
        for index in range(len(point)):
            point[index] /= max_scale_degree
    return point
Compute chord scale point in the standard simplex

    Parameters
    ----------
        chrod : Chrod
            Chord to estimate normal order
        scale : ConcreteScale
            Scale use as metric step
        normalize : int, optional
            Normalize coordinates by the number of scale degrees

    Return
    ------
        list
            List with scalar point within standard simplex

    Examples
    --------
    >>> from music21.chord import Chord
    >>> from music21.scale import ChromaticScale
    >>> from orbichord.chordinate import standardSimplex
    >>> scale = ChromaticScale('C')
    >>> chord = Chord('C E G')
    >>> standardSimplex(chord, scale)
    [0.9166666666666666, 0.3333333333333333, 0.25]
    >>> standardSimplex(chord, scale, normalize=False)
    [11, 4, 3]
    
Compute chord scale point in the standard simplex
Parameters

chrod : Chrod
Chord to estimate normal order
scale : ConcreteScale
Scale use as metric step
normalize : int, optional
Normalize coordinates by the number of scale degrees

Return

list
List with scalar point within standard simplex

Examples


Compute chord scale point in the standard simplex Parameters chrod : Chrod Chord to estimate normal order scale : ConcreteScale Scale use as metric step normalize : int optional Normalize coordinates by the number of scale degrees Return list List with scalar point within standard simplex Examples
def standardSimplex(
    chord: Chord,
    scale: ConcreteScale,
    normalize: bool = True
) -> list:
    max_scale_degree = scale.getDegreeMaxUnique()
    point = scalePoint(chord, scale)
    dimension = len(point)
    sumchord = sum(point)
    point.sort()
    while sumchord >= max_scale_degree:
        last = point[-1]
        for index in range(1, dimension):
            point[dimension-index] = point[dimension-index-1]
        point[0] = last - max_scale_degree
        sumchord = sum(point)
    previous = point[0]
    for index in range(1, dimension):
        interval = point[index] - previous
        previous = point[index]
        point[index] = interval
    point[0] = sumchord
    if normalize:
        for index in range(len(point)):
            point[index] /= max_scale_degree
    return point
def standardSimplex ( chord : Chord , scale : ConcreteScale , normalize : bool = True ) -> list : max_scale_degree = scale . getDegreeMaxUnique ( ) point = scalePoint ( chord , scale ) dimension = len ( point ) sumchord = sum ( point ) point . sort ( ) while sumchord >= max_scale_degree : last = point [ - 1 ] for index in range ( 1 , dimension ) : point [ dimension - index ] = point [ dimension - index - 1 ] point [ 0 ] = last - max_scale_degree sumchord = sum ( point ) previous = point [ 0 ] for index in range ( 1 , dimension ) : interval = point [ index ] - previous previous = point [ index ] point [ index ] = interval point [ 0 ] = sumchord if normalize : for index in range ( len ( point ) ) : point [ index ] /= max_scale_degree return point
Compute chord scale point in the standard simplex
Parameters
Compute chord scale point in the standard simplex Parameters
"""Compute chord scale point in the standard simplex

    Parameters
    ----------
        chrod : Chrod
            Chord to estimate normal order
        scale : ConcreteScale
            Scale use as metric step
        normalize : int, optional
            Normalize coordinates by the number of scale degrees

    Return
    ------
        list
            List with scalar point within standard simplex

    Examples
    --------
    >>> from music21.chord import Chord
    >>> from music21.scale import ChromaticScale
    >>> from orbichord.chordinate import standardSimplex
    >>> scale = ChromaticScale('C')
    >>> chord = Chord('C E G')
    >>> standardSimplex(chord, scale)
    [0.9166666666666666, 0.3333333333333333, 0.25]
    >>> standardSimplex(chord, scale, normalize=False)
    [11, 4, 3]
    """ # Get scale max degree and compute scalar point # Reduce to the standard simplex # Apply affine transformation
chord
Chord
scale
ConcreteScale
normalize
bool