From 9fe20c14d6ece5bdf08a7e5562af5a449e67a6e9 Mon Sep 17 00:00:00 2001 From: Downupanddownup Date: Fri, 26 Apr 2024 16:27:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=9F=B3=E9=A2=91=E9=A2=84?= =?UTF-8?q?=E9=87=87=E6=A0=B7=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ref_Audio_Selector/config.ini | 2 ++ Ref_Audio_Selector/config_param/config_params.py | 2 ++ .../tool/speaker_verification/voice_similarity.py | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Ref_Audio_Selector/config.ini b/Ref_Audio_Selector/config.ini index 7507853..43b5ef6 100644 --- a/Ref_Audio_Selector/config.ini +++ b/Ref_Audio_Selector/config.ini @@ -21,6 +21,8 @@ time_log_print_dir = Ref_Audio_Selector/log/performance list_to_convert_reference_audio_dir = refer_audio_all # 音频相似度目录 audio_similarity_dir = similarity +# 是否开启基准音频预采样 true false +enable_pre_sample = true [Inference] # 默认测试文本位置 diff --git a/Ref_Audio_Selector/config_param/config_params.py b/Ref_Audio_Selector/config_param/config_params.py index de12d72..cd75c73 100644 --- a/Ref_Audio_Selector/config_param/config_params.py +++ b/Ref_Audio_Selector/config_param/config_params.py @@ -23,6 +23,8 @@ time_log_print_dir = config.get_log('time_log_print_dir') list_to_convert_reference_audio_dir = config.get_audio_sample('list_to_convert_reference_audio_dir') # 音频相似度目录 audio_similarity_dir = config.get_audio_sample('audio_similarity_dir') +# 是否开启基准音频预采样 true false +enable_pre_sample = config.get_audio_sample('enable_pre_sample') # [Inference] # 默认测试文本位置 diff --git a/Ref_Audio_Selector/tool/speaker_verification/voice_similarity.py b/Ref_Audio_Selector/tool/speaker_verification/voice_similarity.py index df9d7ee..bad0d3d 100644 --- a/Ref_Audio_Selector/tool/speaker_verification/voice_similarity.py +++ b/Ref_Audio_Selector/tool/speaker_verification/voice_similarity.py @@ -28,7 +28,10 @@ def compare_audio_and_generate_report(reference_audio_path, comparison_dir_path, # 改用torchaudio.transforms.Resample进行重采样,如果在非windows环境下,没有更改依赖包的采样方法的话, # 使用这段代码进行预采样会出现因为采样方法不同,而导致的模型相似度计算不准确的问题 # 当然如果在windows下,使用了其他的采样方法,也会出现不准确的问题 - reference_audio_16k = ensure_16k_wav(reference_audio_path) + if params.enable_pre_sample == 'true': + reference_audio_16k = ensure_16k_wav(reference_audio_path) + else: + reference_audio_16k = reference_audio_path else: reference_audio_16k = reference_audio_path