File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ class VadOptions:
35
35
"""
36
36
37
37
threshold : float = 0.5
38
- neg_threshold : float = threshold - 0.15
38
+ neg_threshold : float = None
39
39
min_speech_duration_ms : int = 0
40
40
max_speech_duration_s : float = float ("inf" )
41
41
min_silence_duration_ms : int = 2000
@@ -63,6 +63,7 @@ def get_speech_timestamps(
63
63
vad_options = VadOptions (** kwargs )
64
64
65
65
threshold = vad_options .threshold
66
+ neg_threshold = vad_options .neg_threshold
66
67
min_speech_duration_ms = vad_options .min_speech_duration_ms
67
68
max_speech_duration_s = vad_options .max_speech_duration_s
68
69
min_silence_duration_ms = vad_options .min_silence_duration_ms
@@ -90,7 +91,8 @@ def get_speech_timestamps(
90
91
triggered = False
91
92
speeches = []
92
93
current_speech = {}
93
- neg_threshold = vad_options .neg_threshold
94
+ if neg_threshold is None :
95
+ neg_threshold = max (threshold - 0.15 , 0.01 )
94
96
95
97
# to save potential segment end (and tolerate some silence)
96
98
temp_end = 0
You can’t perform that action at this time.
0 commit comments