Limit the maximum segment length for VAD. (#990)

This commit is contained in:
Fangjun Kuang
2024-06-12 10:49:37 +08:00
committed by GitHub
parent aac86847ad
commit 208da78343
4 changed files with 33 additions and 0 deletions

View File

@@ -190,6 +190,14 @@ class SileroVadModel::Impl {
int32_t MinSpeechDurationSamples() const { return min_speech_samples_; }
void SetMinSilenceDuration(float s) {
min_silence_samples_ = sample_rate_ * s;
}
void SetThreshold(float threshold) {
config_.silero_vad.threshold = threshold;
}
private:
void Init(void *model_data, size_t model_data_length) {
sess_ = std::make_unique<Ort::Session>(env_, model_data, model_data_length,
@@ -306,4 +314,12 @@ int32_t SileroVadModel::MinSpeechDurationSamples() const {
return impl_->MinSpeechDurationSamples();
}
void SileroVadModel::SetMinSilenceDuration(float s) {
impl_->SetMinSilenceDuration(s);
}
void SileroVadModel::SetThreshold(float threshold) {
impl_->SetThreshold(threshold);
}
} // namespace sherpa_onnx