mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-10-18 13:17:59 +02:00
go : Enable VAD for Go bindings (#3563)
* reset context.n so that NextSegment can be called for multiple Process calls * enable VAD params
This commit is contained in:
@@ -80,6 +80,39 @@ func (context *context) SetTranslate(v bool) {
|
||||
context.params.SetTranslate(v)
|
||||
}
|
||||
|
||||
// Voice Activity Detection (VAD)
|
||||
func (context *context) SetVAD(v bool) {
|
||||
context.params.SetVAD(v)
|
||||
}
|
||||
|
||||
func (context *context) SetVADModelPath(path string) {
|
||||
context.params.SetVADModelPath(path)
|
||||
}
|
||||
|
||||
func (context *context) SetVADThreshold(t float32) {
|
||||
context.params.SetVADThreshold(t)
|
||||
}
|
||||
|
||||
func (context *context) SetVADMinSpeechMs(ms int) {
|
||||
context.params.SetVADMinSpeechMs(ms)
|
||||
}
|
||||
|
||||
func (context *context) SetVADMinSilenceMs(ms int) {
|
||||
context.params.SetVADMinSilenceMs(ms)
|
||||
}
|
||||
|
||||
func (context *context) SetVADMaxSpeechSec(s float32) {
|
||||
context.params.SetVADMaxSpeechSec(s)
|
||||
}
|
||||
|
||||
func (context *context) SetVADSpeechPadMs(ms int) {
|
||||
context.params.SetVADSpeechPadMs(ms)
|
||||
}
|
||||
|
||||
func (context *context) SetVADSamplesOverlap(sec float32) {
|
||||
context.params.SetVADSamplesOverlap(sec)
|
||||
}
|
||||
|
||||
func (context *context) SetSplitOnWord(v bool) {
|
||||
context.params.SetSplitOnWord(v)
|
||||
}
|
||||
|
||||
@@ -60,6 +60,15 @@ type Context interface {
|
||||
SetTemperature(t float32) // Set temperature
|
||||
SetTemperatureFallback(t float32) // Set temperature incrementation
|
||||
|
||||
SetVAD(v bool)
|
||||
SetVADModelPath(path string)
|
||||
SetVADThreshold(t float32)
|
||||
SetVADMinSpeechMs(ms int)
|
||||
SetVADMinSilenceMs(ms int)
|
||||
SetVADMaxSpeechSec(s float32)
|
||||
SetVADSpeechPadMs(ms int)
|
||||
SetVADSamplesOverlap(sec float32)
|
||||
|
||||
// Process mono audio data and return any errors.
|
||||
// If defined, newly generated segments are passed to the
|
||||
// callback function during processing.
|
||||
|
||||
Reference in New Issue
Block a user