-
Notifications
You must be signed in to change notification settings - Fork 318
Open
Description
code:
def clearvoice_extraction_by_offline(
input_wav, output_wav):
temp_audio_file = r"tempFileFolder/temp_16k.wav"
out_folder = r"tempFileFolder/extracted"
if os.path.exists(out_folder):
shutil.rmtree(out_folder)
os.makedirs(out_folder)
_, default_sr = librosa.load(input_wav, sr=None)
if default_sr != 16000:
cmd_line = "sox {} -r 16k -b 16 {}".format(input_wav, temp_audio_file)
print(cmd_line)
os.system(cmd_line)
else:
shutil.copyfile(input_wav, temp_audio_file)
cv_tse = ClearVoice(
task='target_speaker_extraction',
model_names=['AV_MossFormer2_TSE_16K']
)
cv_tse(
input_path=temp_audio_file,
online_write=True,
output_path=out_folder
)
out_wav = os.path.join(out_folder, 'extracted_speech.wav')
shutil.copyfile(out_wav, output_wav)
print(cmd_line)
os.system(cmd_line)
os.remove(temp_audio_file)
shutil.rmtree(out_folder)
temp_audio_file plays well, but triggered exception: 'charmap' codec can't decode byte 0x81 in position 652: character maps to .
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels