TenVadModelConfig.java
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright 2025 Xiaomi Corporation
package com.k2fsa.sherpa.onnx;
public class TenVadModelConfig {
private final String model;
private final float threshold;
private final float minSilenceDuration;
private final float minSpeechDuration;
private final int windowSize;
private final float maxSpeechDuration;
private TenVadModelConfig(Builder builder) {
this.model = builder.model;
this.threshold = builder.threshold;
this.minSilenceDuration = builder.minSilenceDuration;
this.minSpeechDuration = builder.minSpeechDuration;
this.windowSize = builder.windowSize;
this.maxSpeechDuration = builder.maxSpeechDuration;
}
public static Builder builder() {
return new Builder();
}
public String getModel() {
return model;
}
public float getThreshold() {
return threshold;
}
public float getMinSilenceDuration() {
return minSilenceDuration;
}
public float getMinSpeechDuration() {
return minSpeechDuration;
}
public int getWindowSize() {
return windowSize;
}
public float getMaxSpeechDuration() {
return maxSpeechDuration;
}
public static class Builder {
private String model = "";
private float threshold = 0.5f;
private float minSilenceDuration = 0.25f;
private float minSpeechDuration = 0.25f;
private int windowSize = 256;
private float maxSpeechDuration = 5.0f;
public TenVadModelConfig build() {
return new TenVadModelConfig(this);
}
public Builder setModel(String model) {
this.model = model;
return this;
}
public Builder setThreshold(float threshold) {
this.threshold = threshold;
return this;
}
public Builder setMinSilenceDuration(float minSilenceDuration) {
this.minSilenceDuration = minSilenceDuration;
return this;
}
public Builder setMinSpeechDuration(float minSpeechDuration) {
this.minSpeechDuration = minSpeechDuration;
return this;
}
public Builder setWindowSize(int windowSize) {
this.windowSize = windowSize;
return this;
}
public Builder setMaxSpeechDuration(float maxSpeechDuration) {
this.maxSpeechDuration = maxSpeechDuration;
return this;
}
}
}