You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
803 B
Go
46 lines
803 B
Go
3 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
"time"
|
||
|
|
||
|
"gitlab.com/cinnamon/voiceagent/stt"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
|
||
|
//////////// file open start
|
||
|
file, err := os.Open("./9001-RX-1648533187911907029.pcm")
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
}
|
||
|
|
||
|
files, serr := file.Stat()
|
||
|
if serr != nil {
|
||
|
fmt.Println(serr)
|
||
|
}
|
||
|
|
||
|
defer file.Close()
|
||
|
//////////// file open end
|
||
|
|
||
|
//////////// stt connect start
|
||
|
fmt.Println("STT Stat ")
|
||
|
startTime := time.Now()
|
||
|
stts, cerr := stt.NewSTTS("220.86.110.194", 9500)
|
||
|
if cerr != nil {
|
||
|
fmt.Println("error : ", cerr)
|
||
|
}
|
||
|
|
||
|
defer stts.Close()
|
||
|
|
||
|
data1 := make([]byte, files.Size())
|
||
|
file.Read(data1)
|
||
|
result, serr1 := stts.SendSTT(data1)
|
||
|
if serr != nil {
|
||
|
fmt.Println(serr1)
|
||
|
}
|
||
|
fmt.Printf("stt result [%s]\n", result)
|
||
|
fmt.Printf("STT END\n Time duration %v\n", time.Since(startTime))
|
||
|
}
|