Add Go API for speaker identification (#718)

This commit is contained in:
Fangjun Kuang
2024-03-29 19:25:55 +08:00
committed by GitHub
parent 2e0bccad36
commit 6da4a1c12f
25 changed files with 641 additions and 27 deletions

View File

@@ -102,7 +102,7 @@ func main() {
duration := float32(len(speechSegment.Samples)) / float32(config.SampleRate)
audio := &sherpa.GeneratedAudio{}
audio := &sherpa.Wave{}
audio.Samples = speechSegment.Samples
audio.SampleRate = config.SampleRate
@@ -118,7 +118,7 @@ func main() {
chk(s.Stop())
}
func decode(recognizer *sherpa.OfflineRecognizer, audio *sherpa.GeneratedAudio, id int) {
func decode(recognizer *sherpa.OfflineRecognizer, audio *sherpa.Wave, id int) {
stream := sherpa.NewOfflineStream(recognizer)
defer sherpa.DeleteOfflineStream(stream)
stream.AcceptWaveform(audio.SampleRate, audio.Samples)