Spaces:
Running
Running
update
Browse files- silero_vad/main.go +4 -6
silero_vad/main.go
CHANGED
@@ -14,12 +14,14 @@ func main() {
|
|
14 |
filenamePtr := flag.String("filename", "", "input wav audio file")
|
15 |
silenceTimePtr := flag.Float64("silence_time", 0.1, "in the end of each speech chunk wait for min_silence_duration_ms before separating it")
|
16 |
speechPadTimePtr := flag.Float64("speech_pad_time", 0.03, "final speech chunks are padded by speech_pad_ms each side")
|
|
|
17 |
flag.Parse()
|
18 |
|
19 |
var modelPath string = *modelPathPtr
|
20 |
var filename string = *filenamePtr
|
21 |
var silenceTime float32 = float32(*silenceTimePtr)
|
22 |
var speechPadTime float32 = float32(*speechPadTimePtr)
|
|
|
23 |
fmt.Println(filename)
|
24 |
|
25 |
var silenceTimeMs int = int(silenceTime * 1e3)
|
@@ -27,7 +29,7 @@ func main() {
|
|
27 |
|
28 |
sd, err := speech.NewDetector(speech.DetectorConfig{
|
29 |
ModelPath: modelPath,
|
30 |
-
SampleRate:
|
31 |
Threshold: 0.5,
|
32 |
MinSilenceDurationMs: silenceTimeMs,
|
33 |
SpeechPadMs: speechPadTimeMs,
|
@@ -36,11 +38,7 @@ func main() {
|
|
36 |
log.Fatalf("failed to create speech detector: %s", err)
|
37 |
}
|
38 |
|
39 |
-
|
40 |
-
log.Fatalf("invalid arguments provided: expecting one file path")
|
41 |
-
}
|
42 |
-
|
43 |
-
f, err := os.Open(os.Args[1])
|
44 |
if err != nil {
|
45 |
log.Fatalf("failed to open sample audio file: %s", err)
|
46 |
}
|
|
|
14 |
filenamePtr := flag.String("filename", "", "input wav audio file")
|
15 |
silenceTimePtr := flag.Float64("silence_time", 0.1, "in the end of each speech chunk wait for min_silence_duration_ms before separating it")
|
16 |
speechPadTimePtr := flag.Float64("speech_pad_time", 0.03, "final speech chunks are padded by speech_pad_ms each side")
|
17 |
+
sampleRatePtr := flag.Int("sample_rate", 8000, "sample rate")
|
18 |
flag.Parse()
|
19 |
|
20 |
var modelPath string = *modelPathPtr
|
21 |
var filename string = *filenamePtr
|
22 |
var silenceTime float32 = float32(*silenceTimePtr)
|
23 |
var speechPadTime float32 = float32(*speechPadTimePtr)
|
24 |
+
var sampleRate int = float32(*sampleRatePtr)
|
25 |
fmt.Println(filename)
|
26 |
|
27 |
var silenceTimeMs int = int(silenceTime * 1e3)
|
|
|
29 |
|
30 |
sd, err := speech.NewDetector(speech.DetectorConfig{
|
31 |
ModelPath: modelPath,
|
32 |
+
SampleRate: sampleRate,
|
33 |
Threshold: 0.5,
|
34 |
MinSilenceDurationMs: silenceTimeMs,
|
35 |
SpeechPadMs: speechPadTimeMs,
|
|
|
38 |
log.Fatalf("failed to create speech detector: %s", err)
|
39 |
}
|
40 |
|
41 |
+
f, err := os.Open(filename)
|
|
|
|
|
|
|
|
|
42 |
if err != nil {
|
43 |
log.Fatalf("failed to open sample audio file: %s", err)
|
44 |
}
|