From 588812212259d2e2f63b9205124b35ded25dca3d Mon Sep 17 00:00:00 2001 From: lovemefan Date: Sun, 8 Oct 2023 14:27:05 +0800 Subject: [PATCH] add more control parameters of vad --- paraformerOnline/runtime/python/asr_all_in_one.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/paraformerOnline/runtime/python/asr_all_in_one.py b/paraformerOnline/runtime/python/asr_all_in_one.py index db8896f..3206149 100644 --- a/paraformerOnline/runtime/python/asr_all_in_one.py +++ b/paraformerOnline/runtime/python/asr_all_in_one.py @@ -29,6 +29,9 @@ def __init__( sv_threshold=0.6, sv_max_start_silence_time=3000, vad_speech_max_length=20000, + vad_speech_noise_thresh_low=-0.1, + vad_speech_noise_thresh_high=0.3, + vad_speech_noise_thresh=0.6, hot_words="", ): """ @@ -63,12 +66,22 @@ def __init__( self.vad = FSMNVadOnline() self.vad.vad.vad_opts.max_single_segment_time = vad_speech_max_length self.vad.vad.vad_opts.max_start_silence_time = sv_max_start_silence_time + self.vad.vad.vad_opts.speech_noise_thresh_low = vad_speech_noise_thresh_low + self.vad.vad.vad_opts.speech_noise_thresh_high = ( + vad_speech_noise_thresh_high + ) + self.vad.vad.vad_opts.speech_noise_thresh = vad_speech_noise_thresh self.punc = CttPunctuator(online=True) self.text_cache = "" elif mode == "file_transcription": self.asr_offline = ParaformerOffline() self.vad = FSMNVadOnline() + self.vad.vad.vad_opts.speech_noise_thresh_low = vad_speech_noise_thresh_low + self.vad.vad.vad_opts.speech_noise_thresh_high = ( + vad_speech_noise_thresh_high + ) + self.vad.vad.vad_opts.speech_noise_thresh = vad_speech_noise_thresh self.vad.vad.vad_opts.max_single_segment_time = vad_speech_max_length self.vad.vad.vad_opts.max_start_silence_time = sv_max_start_silence_time self.punc = CttPunctuator(online=False)