Beispiel #1
0
def get_binary_KPDVE_note(kpdve):
    '''

    Parameters
    ----------
    kpdve
        a np.array(5) in form KPDVE

    Returns
    -------
    int
        a representation of a chord in binary (circle-of-fifths)

    7 of F Major 7 chord
    >>> get_binary_KPDVE_note(np.array([0,0,0,4,3]))
    64

    G a fifth above C as degree 1 in F lydian
    >>> get_binary_KPDVE_note(np.array([0,0,1,1,1]))
    512

    G V7 b9 -- dominant in C Harmonic minor... top note Ab
    >>> get_binary_KPDVE_note(np.array([0,4,2,4,4]))
    4

    '''

    return pt_utils.rotate_bits_right(
        apply_filter_for_p(get_binary_DVE_note(kpdve[2], kpdve[3], kpdve[4]),
                           kpdve[1]), kpdve[0])
Beispiel #2
0
def get_binary_P(p):
    """
    

    Parameters
    ----------
    p : TYPE
        DESCRIPTION.

    Returns
    -------
    int
        returns distortion byte 0b100000010000 at position P
        
    returns 0b100000010000
    >>> get_binary_P(0)
    2064
    
    returns 0b010000001000
    >>> get_binary_P(1)
    1032
    
    returns 0b000001000010
    >>> get_binary_P(10)
    66
    """

    return pt_utils.rotate_bits_right(pt_utils.P_PARSER, p)
Beispiel #3
0
def get_binary_K(k):
    """
    

    Parameters
    ----------
    k : int
        a value for Key

    Returns
    -------
    int
         returns binary number representing pitch classes for a given major key.

    
    (int) -> int

 
    returns 0b111111100000
    >>> get_binary_K(0)
    4064
    

    returns 0b011111110000
    >>> get_binary_K(1)
    2032

    returns 0b111110000011
    >>> get_binary_K(10)
    3971
    """

    return pt_utils.rotate_bits_right(pt_utils.C_M_FIFTHS, k)
Beispiel #4
0
def get_binary_KP(k, p):
    '''
    (int, int) -> int

    Apply the P displacement P(x) to the C Major grouping and return adjusted for key
    P must be between 0 and 6

    P allows all twelve notes to be part of a major key

    0 returns unaffected K
    1-3 return K^get_binary_p(p-1)
    4-6 return K^get_binary_p(p+5)

    this means  0:C Major
    (for CM)    1:G Major (Dominant)
                2:D Melodic Minor
                3:A Harmonic Minor (relative minor)
                4:C Harmonic Major
                5:C Melodic Minor (parallel minor)
                6:F Major (subdominant) 

    returns 0b111111100000
    >>> get_binary_KP(0, 0)
    4064

    returns 0b011111110000
    >>> get_binary_KP(0, 1)
    2032

    returns 0b010111110100
    >>> get_binary_KP(1, 2)
    1524

    returns 0b111111100000 CM as dominant
    >>> get_binary_KP(11, 1)
    4064

    returns 0b111111100000 CM as subdominant
    >>> get_binary_KP(1, 6)
    4064
    '''

    if p == 0:
        return get_binary_K(k)

    result = pt_utils.rotate_bits_right(
        apply_filter_for_p(pt_utils.C_M_FIFTHS, p), k)

    return result
Beispiel #5
0
def get_binary_DVE_note(d, v, e):
    '''
    (int, int, int)  -> int

    return the note at the end of the tunnel: a single bit, at the last extension of the DVE sequence
    this function takes care of the case for c major (where all transformations occur)

    >>> get_binary_DVE_note(0, 0, 0)
    2048

    return the fifth above D (A)
    >>> get_binary_DVE_note(3, 4, 2)
    128

    '''

    return pt_utils.rotate_bits_right(pt_utils.LEFT_BIT,
                                      DVE_linear_eq(d, v, e))