mirror of
https://github.com/snakers4/silero-vad.git
synced 2026-02-05 18:09:22 +08:00
@@ -280,8 +280,8 @@
|
|||||||
"sample_rate = 16000\n",
|
"sample_rate = 16000\n",
|
||||||
"# convert ms in timestamps to samples\n",
|
"# convert ms in timestamps to samples\n",
|
||||||
"for timestamp in number_timestamps:\n",
|
"for timestamp in number_timestamps:\n",
|
||||||
" timestamp['start'] = int(timestamp['start'] * sample_rate)\n",
|
" timestamp['start'] = int(timestamp['start'] * sample_rate / 1000)\n",
|
||||||
" timestamp['end'] = int(timestamp['end'] * sample_rate)"
|
" timestamp['end'] = int(timestamp['end'] * sample_rate / 1000)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -601,6 +601,7 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"heading_collapsed": true,
|
||||||
"hidden": true,
|
"hidden": true,
|
||||||
"id": "5JHErdB7jsr0"
|
"id": "5JHErdB7jsr0"
|
||||||
},
|
},
|
||||||
@@ -640,8 +641,8 @@
|
|||||||
"sample_rate = 16000\n",
|
"sample_rate = 16000\n",
|
||||||
"# convert ms in timestamps to samples\n",
|
"# convert ms in timestamps to samples\n",
|
||||||
"for timestamp in number_timestamps:\n",
|
"for timestamp in number_timestamps:\n",
|
||||||
" timestamp['start'] = int(timestamp['start'] * sample_rate)\n",
|
" timestamp['start'] = int(timestamp['start'] * sample_rate / 1000)\n",
|
||||||
" timestamp['end'] = int(timestamp['end'] * sample_rate)"
|
" timestamp['end'] = int(timestamp['end'] * sample_rate / 1000)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
6
utils.py
6
utils.py
@@ -124,16 +124,16 @@ def get_number_ts(wav: torch.Tensor,
|
|||||||
for i, pred in enumerate(extended_preds):
|
for i, pred in enumerate(extended_preds):
|
||||||
if pred == 1:
|
if pred == 1:
|
||||||
if not triggered:
|
if not triggered:
|
||||||
cur_timing['start'] = (i * hop_length) / sample_rate
|
cur_timing['start'] = int((i * hop_length) / (sample_rate / 1000))
|
||||||
triggered = True
|
triggered = True
|
||||||
elif pred == 0:
|
elif pred == 0:
|
||||||
if triggered:
|
if triggered:
|
||||||
cur_timing['end'] = (i * hop_length) / sample_rate
|
cur_timing['end'] = int((i * hop_length) / (sample_rate / 1000))
|
||||||
timings.append(cur_timing)
|
timings.append(cur_timing)
|
||||||
cur_timing = {}
|
cur_timing = {}
|
||||||
triggered = False
|
triggered = False
|
||||||
if cur_timing:
|
if cur_timing:
|
||||||
cur_timing['end'] = len(wav) / sample_rate
|
cur_timing['end'] = int(len(wav) / (sample_rate / 1000))
|
||||||
timings.append(cur_timing)
|
timings.append(cur_timing)
|
||||||
return timings
|
return timings
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user