Spaces:
Running
Running
File size: 733 Bytes
8c92a11 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# Copyright (c) 2023 Amphion.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from pymcd.mcd import Calculate_MCD
def extract_mcd(audio_ref, audio_deg, **kwargs):
"""Extract Mel-Cepstral Distance for a two given audio.
Args:
audio_ref: The given reference audio. It is an audio path.
audio_deg: The given synthesized audio. It is an audio path.
"""
# Load hyperparameters
kwargs = kwargs["kwargs"]
fs = kwargs["fs"]
mcd_toolbox = Calculate_MCD(MCD_mode="dtw_sl")
if fs != None:
mcd_toolbox.SAMPLING_RATE = fs
mcd_value = mcd_toolbox.calculate_mcd(audio_ref, audio_deg)
return mcd_value
|