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