def dist(spectrum, A, B):
    """
    Minimum number of steps along ring to get from one pitch to the next

    Parameters:
    -----------
        spectrum: list
            user-defined spectrum
        A: int
            first pitch
        B: int
            second pitch
    """
    length = len(spectrum)
    forward = abs(B - A) # Forward moving graph distance between pitches
    backward = abs(forward - length) # Backward moving distance... ...
    if forward <= backward:
        n = forward
    else:
        n = backward
    return n