Open iAInNet opened 2 weeks ago
are you using the latest package?
please show.your complete logs which contain the version about sherpa-onnx-go-macos.
are you using the latest package?
Yes, I pulled the latest code from the master branch. I didn't switch to another branch.
please show.your complete logs which contain the version about sherpa-onnx-go-macos.
go: finding module for package github.com/csukuangfj/portaudio-go go: finding module for package github.com/spf13/pflag go: finding module for package github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx go: found github.com/csukuangfj/portaudio-go in github.com/csukuangfj/portaudio-go v1.0.4 go: found github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx in github.com/k2-fsa/sherpa-onnx-go v1.8.7 go: found github.com/spf13/pflag in github.com/spf13/pflag v1.0.5 go: finding module for package github.com/k2-fsa/sherpa-onnx-go-linux go: finding module for package github.com/k2-fsa/sherpa-onnx-go-macos go: finding module for package github.com/k2-fsa/sherpa-onnx-go-windows go: found github.com/k2-fsa/sherpa-onnx-go-linux in github.com/k2-fsa/sherpa-onnx-go-linux v1.10.11 go: found github.com/k2-fsa/sherpa-onnx-go-macos in github.com/k2-fsa/sherpa-onnx-go-macos v1.10.10 go: found github.com/k2-fsa/sherpa-onnx-go-windows in github.com/k2-fsa/sherpa-onnx-go-windows v1.10.10
As show above, I think the sherpa-onnx-go-macos is v1.10.10
I am also using macOS amd64 but I cannot produce your issue.
I have checked portaudio-go https://github.com/csukuangfj/portaudio-go/blob/e90d7285b794fb9359689370167ad9eb15633285/portaudio.go#L15
/*
#cgo !windows pkg-config: portaudio-2.0
#cgo windows CFLAGS: -I${SRCDIR}
#cgo windows !386 LDFLAGS: -L ${SRCDIR}/x86_64 -lsherpa-onnx-portaudio
#cgo windows !amd64 LDFLAGS: -L ${SRCDIR}/386 -lsherpa-onnx-portaudio
#include "portaudio.h"
extern PaStreamCallback* paStreamCallback;
*/
You can see that only windows will require -lsherpa-onnx-portaudio
I have checked portaudio-go https://github.com/csukuangfj/portaudio-go/blob/e90d7285b794fb9359689370167ad9eb15633285/portaudio.go#L15
/* #cgo !windows pkg-config: portaudio-2.0 #cgo windows CFLAGS: -I${SRCDIR} #cgo windows !386 LDFLAGS: -L ${SRCDIR}/x86_64 -lsherpa-onnx-portaudio #cgo windows !amd64 LDFLAGS: -L ${SRCDIR}/386 -lsherpa-onnx-portaudio #include "portaudio.h" extern PaStreamCallback* paStreamCallback; */
You can see that only windows will require
-lsherpa-onnx-portaudio
As you say, it should build with cgo !windows pkg-config: portaudio-2.0
, BUT on my machine it always fall into -lsherpa-onnx-portaudio
. So, I commented the following three lines.
#cgo windows CFLAGS: -I${SRCDIR}
#cgo windows !386 LDFLAGS: -L ${SRCDIR}/x86_64 -lsherpa-onnx-portaudio
#cgo windows !amd64 LDFLAGS: -L ${SRCDIR}/386 -lsherpa-onnx-portaudio
Then, it build success.
When I run the command:
./real-time-speech-recognition-from-microphone \
--encoder ./icefall-asr-zipformer-streaming-wenetspeech-20230615/exp/encoder-epoch-12-avg-4-chunk-16-left-128.onnx \
--decoder ./icefall-asr-zipformer-streaming-wenetspeech-20230615/exp/decoder-epoch-12-avg-4-chunk-16-left-128.onnx \
--joiner ./icefall-asr-zipformer-streaming-wenetspeech-20230615/exp/joiner-epoch-12-avg-4-chunk-16-left-128.onnx \
--tokens ./icefall-asr-zipformer-streaming-wenetspeech-20230615/data/lang_char/tokens.txt \
--model-type zipformer2
panic: Input overflowed
There may be a connection between these two issues.
Could you add some logs to check how many times
chk(s.Read())
is executed? Does it fail at the first run of the for loop?
is executed?
Yes, Recognizer created! Started! Please speak
Does it fail at the first run of the for loop?
No, about six times of loop. Then, it panic.
my audio input:
48K, 1 ch 16-bit integer
I modified the example code param.SampleRate = 16000
to param.SampleRate = 48000
, still not working. It report same error after six times of loop.
Do you use the builtin microphone or use a USB microphone?
Do you use the builtin microphone or use a USB microphone?
a USB microphone.
I switch to builtin microphone. audio input: 48K, 1 channel 32-bit float. It worked. When I use USB microphone, maybe I have to normalize the input samples to [-1, 1]. I will take a try.
Now, only one question remains. I have no clue why I have to comment out the following three lines when I run go build
?
#cgo windows CFLAGS: -I${SRCDIR}
#cgo windows !386 LDFLAGS: -L ${SRCDIR}/x86_64 -lsherpa-onnx-portaudio
#cgo windows !amd64 LDFLAGS: -L ${SRCDIR}/386 -lsherpa-onnx-portaudio
After 1 minute and half, the program still panic, same error at line 81 chk(s.Read())
panic: Input overflowed
it outputs some segment, then panic.
0: its a great its um a little bit no king i um and its a being a long process to get here
1: lifting you know chair out of the way broken glass alice senatory items i dont want to get into but a it was horrified to say the list
2: suppylo customs as usual a big list ear especially from recent movies like thor and the green london
3: set louis take load series open on the cool night his was forty nine degrees at the start off the game
4: the project to put them online is expected to be compilated by
5: twenty one sixteen
6: family leftware verm by boat bound by thailand basile bows was intercepted by parrot after ears of trying the father located his son in the talent
panic: Input overflowed
goroutine 1 [running]:
main.chk(...)
/Users/xxxx/repositories/sherpa-onnx/go-api-examples/real-time-speech-recognition-from-microphone/main.go:108
main.main()
/Users/xxxx/repositories/sherpa-onnx/go-api-examples/real-time-speech-recognition-from-microphone/main.go:81 +0xb10
What is the RTF of the current model on your Mac?
gcc -v
go env
pkg-config --cflags --libs portaudio-2.0
BUT, when I run
go build
orGOOS=darwin GOARCH=amd64 go build
. The error message is as follows:Could someone tell me what I'm missing?