def _outer_distance_mod_n(ref, est, modulus=12):
    """Compute the absolute outer distance modulo n.
    Using this distance, d(11, 0) = 1 (modulo 12)

    Parameters
    ----------
    ref : np.ndarray, shape=(n,)
        Array of reference values.
    est : np.ndarray, shape=(m,)
        Array of estimated values.
    modulus : int
        The modulus.
        12 by default for octave equivalence.

    Returns
    -------
    outer_distance : np.ndarray, shape=(n, m)
        The outer circular distance modulo n.

    """
    ref_mod_n = np.mod(ref, modulus)
    est_mod_n = np.mod(est, modulus)
    abs_diff = np.abs(np.subtract.outer(ref_mod_n, est_mod_n))
    return np.minimum(abs_diff, modulus - abs_diff)