Skip to content

Commit

Permalink
add more control parameters of vad
Browse files Browse the repository at this point in the history
  • Loading branch information
lovemefan committed Oct 8, 2023
1 parent 2d6da90 commit 5888122
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions paraformerOnline/runtime/python/asr_all_in_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="",
):
"""
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5888122

Please sign in to comment.