|
|
@ -1,8 +1,6 @@
|
|
|
|
from resemblyzer import preprocess_wav, VoiceEncoder
|
|
|
|
from resemblyzer import preprocess_wav, VoiceEncoder
|
|
|
|
from pathlib import Path
|
|
|
|
from pathlib import Path
|
|
|
|
import numpy as np
|
|
|
|
import numpy as np
|
|
|
|
import soundfile as sf
|
|
|
|
|
|
|
|
import io
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 初始化声纹编码器
|
|
|
|
# 初始化声纹编码器
|
|
|
|
encoder = VoiceEncoder()
|
|
|
|
encoder = VoiceEncoder()
|
|
|
@ -89,7 +87,8 @@ if __name__ == "__main__":
|
|
|
|
load_known_speakers(speaker_folder)
|
|
|
|
load_known_speakers(speaker_folder)
|
|
|
|
|
|
|
|
|
|
|
|
# 要识别的音频文件路径
|
|
|
|
# 要识别的音频文件路径
|
|
|
|
test_audio_path = "huanghai_test.wav" # 替换为你要识别的音频文件路径
|
|
|
|
#test_audio_path = "huanghai_test.wav" # 替换为你要识别的音频文件路径
|
|
|
|
|
|
|
|
test_audio_path = "wubin_test.wav" # 替换为你要识别的音频文件路径
|
|
|
|
# 识别说话人
|
|
|
|
# 识别说话人
|
|
|
|
speaker, similarity = recognize_speaker_from_file(test_audio_path)
|
|
|
|
speaker, similarity = recognize_speaker_from_file(test_audio_path)
|
|
|
|
|
|
|
|
|
|
|
|