From a57ddfb4ec789118e8a15058214cd51953e91553 Mon Sep 17 00:00:00 2001 From: Edresson Date: Fri, 26 Nov 2021 17:14:58 -0300 Subject: [PATCH] Add remove silence vad script Unit test --- .../test_remove_silence_vad_script.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/aux_tests/test_remove_silence_vad_script.py diff --git a/tests/aux_tests/test_remove_silence_vad_script.py b/tests/aux_tests/test_remove_silence_vad_script.py new file mode 100644 index 00000000..c934e065 --- /dev/null +++ b/tests/aux_tests/test_remove_silence_vad_script.py @@ -0,0 +1,29 @@ +import os +import unittest + +import torch + +from tests import get_tests_input_path, get_tests_output_path, run_cli + +torch.manual_seed(1) + +# pylint: disable=protected-access +class TestRemoveSilenceVAD(unittest.TestCase): + @staticmethod + def test(): + # set paths + wav_path = os.path.join(get_tests_input_path(), "../data/ljspeech/wavs") + output_path = os.path.join(get_tests_output_path(), "output_wavs_removed_silence/") + output_resample_path = os.path.join(get_tests_output_path(), "output_ljspeech_16khz/") + + # resample audios + run_cli( + f'CUDA_VISIBLE_DEVICES="" python TTS/bin/resample.py --input_dir "{wav_path}" --output_dir "{output_resample_path}" --output_sr 16000' + ) + + # run test + run_cli( + f'CUDA_VISIBLE_DEVICES="" python TTS/bin/remove_silence_using_vad.py --input_dir "{output_resample_path}" --output_dir "{output_path}"' + ) + run_cli(f'rm -rf "{output_resample_path}"') + run_cli(f'rm -rf "{output_path}"')