Add runtime support for wespeaker models (#516)

This commit is contained in:
Fangjun Kuang
2024-01-09 22:06:08 +08:00
committed by GitHub
parent 902b21894b
commit 55266918c8
27 changed files with 1291 additions and 4 deletions

View File

@@ -40,7 +40,9 @@ class VoiceActivityDetector::Impl {
for (int32_t i = 0; i != k; ++i, p += window_size) {
buffer_.Push(p, window_size);
is_speech = is_speech || model_->IsSpeech(p, window_size);
// NOTE(fangjun): Please don't use a very large n.
bool this_window_is_speech = model_->IsSpeech(p, window_size);
is_speech = is_speech || this_window_is_speech;
}
last_ = std::vector<float>(
@@ -102,6 +104,8 @@ class VoiceActivityDetector::Impl {
bool IsSpeechDetected() const { return start_ != -1; }
const VadModelConfig &GetConfig() const { return config_; }
private:
std::queue<SpeechSegment> segments_;
@@ -146,4 +150,8 @@ bool VoiceActivityDetector::IsSpeechDetected() const {
return impl_->IsSpeechDetected();
}
const VadModelConfig &VoiceActivityDetector::GetConfig() const {
return impl_->GetConfig();
}
} // namespace sherpa_onnx