def get_pitch_median(wav, sr: int):
    """Get the median pitch of a waveform

    Args:
        wav (np.ndarray/torch.Tensor): waveform of shape (n_channels, n_samples)
        sr (int, optional): sampling rate.

    Returns:
        parselmouth.Pitch, float: a parselmouth.Pitch object and the median pitch
    """
    if not isinstance(wav, parselmouth.Sound):
        sound = wav_to_Sound(wav, sr)
    else:
        sound = wav
    pitch_median = PRAAT_CHANGEGENDER_PITCHMEDIAN_DEFAULT

    # To Pitch: Time step(s)(standard value: 0.0), Pitch floor (Hz)(standard value: 75), Pitch ceiling (Hz)(standard value: 600.0)
    pitch = parselmouth.praat.call(sound, "To Pitch", 0.8 / 75, 75, 600)
    # Get quantile: From time (s), To time (s), Quantile(0.5 is then the 50% quantile, i.e., the median), Units (Hertz or Bark)
    pitch_median = parselmouth.praat.call(pitch, "Get quantile", 0.0, 0.0, 0.5, "Hertz")

    return pitch, pitch_median
Get the median pitch of a waveform

Args:
wav (np.ndarray/torch.Tensor): waveform of shape (n_channels, n_samples)
sr (int, optional): sampling rate.

Returns:
parselmouth.Pitch, float: a parselmouth.Pitch object and the median pitch
processors/data_augment.py