|
|
@@ -31,7 +31,7 @@ class SpeechSignalProcessTest(unittest.TestCase): |
|
|
|
def setUp(self) -> None: |
|
|
|
pass |
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 1, 'skip test in current test level') |
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level') |
|
|
|
def test_aec(self): |
|
|
|
# Download audio files |
|
|
|
download(NEAREND_MIC_URL, NEAREND_MIC_FILE) |
|
|
@@ -41,10 +41,7 @@ class SpeechSignalProcessTest(unittest.TestCase): |
|
|
|
'nearend_mic': NEAREND_MIC_FILE, |
|
|
|
'farend_speech': FAREND_SPEECH_FILE |
|
|
|
} |
|
|
|
aec = pipeline( |
|
|
|
Tasks.acoustic_echo_cancellation, |
|
|
|
model=model_id, |
|
|
|
pipeline_name=Pipelines.speech_dfsmn_aec_psm_16k) |
|
|
|
aec = pipeline(Tasks.acoustic_echo_cancellation, model=model_id) |
|
|
|
output_path = os.path.abspath('output.wav') |
|
|
|
aec(input, output_path=output_path) |
|
|
|
print(f'Processed audio saved to {output_path}') |
|
|
@@ -87,15 +84,12 @@ class SpeechSignalProcessTest(unittest.TestCase): |
|
|
|
aec(inputs, output_path=output_path) |
|
|
|
print(f'Processed audio saved to {output_path}') |
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 1, 'skip test in current test level') |
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level') |
|
|
|
def test_ans(self): |
|
|
|
# Download audio files |
|
|
|
download(NOISE_SPEECH_URL, NOISE_SPEECH_FILE) |
|
|
|
model_id = 'damo/speech_frcrn_ans_cirm_16k' |
|
|
|
ans = pipeline( |
|
|
|
Tasks.acoustic_noise_suppression, |
|
|
|
model=model_id, |
|
|
|
pipeline_name=Pipelines.speech_frcrn_ans_cirm_16k) |
|
|
|
ans = pipeline(Tasks.acoustic_noise_suppression, model=model_id) |
|
|
|
output_path = os.path.abspath('output.wav') |
|
|
|
ans(NOISE_SPEECH_FILE, output_path=output_path) |
|
|
|
print(f'Processed audio saved to {output_path}') |
|
|
|