def get_conversion_f0_factor(source_f0, target_median, source_median=None):
    """Align the median between source f0 and target f0

    Note: Here we use multiplication, whose factor is target_median/source_median

    Reference: Frequency and pitch interval
    http://blog.ccyg.studio/article/be12c2ee-d47c-4098-9782-ca76da3035e4/
    """
    if source_median is None:
        voiced_position = np.where(source_f0 != 0)
        source_median = np.median(source_f0[voiced_position])
    factor = target_median / source_median
    return source_median, factor
Align the median between source f0 and target f0

Note: Here we use multiplication, whose factor is target_median/source_median

Reference: Frequency and pitch interval
http://blog.ccyg.studio/article/be12c2ee-d47c-4098-9782-ca76da3035e4/
models/tts/debatts/utils/data_utils.py