Closed dsouza95 closed 1 year ago
thanks for the report! I just looked into why we don't run into this in the serenade app, and it's because we also re-create the object instance each time: https://github.com/serenadeai/serenade/blob/master/client/src/main/stream/microphone.ts#L47. (at some point, I think we had a caching layer somewhere that prevented loading the VAD models multiple times?)
I skimmed through the source, and nothing jumps out at me yet. my first step would probably be to get a stack trace via gdb
in the C++ codebase—building https://github.com/serenadeai/speech-recorder/tree/master/lib via CMake creates a small test binary from test/main.cpp
you can use. my intuition is that either we're not closing out the portaudio stream correctly, not resetting some state in the stop functions, or there's a thread-related issue from stopping/starting again.
Oh, it's great to know that there is some caching, perhaps I can make see if I can make re-creating work for my case then. Otherwise, I will try debugging the parts you suggested. Thanks a lot!
@tmacwill re-creating the object instance is working like a charm now. Thanks!
Calling the
start
andstop
methods of the recorder instance works great the first time, however the second time the start method is called, a crash occurs on the cpp code. This means I am unable to reuse the same recorder instance, so I tried to create a new recorder instance before every start, but the VAD behaves erratically and there is some overhead from loading the VAD model again.@tmacwill any insights on what could be the issue here? I would be happy to make a PR to fix this, and any tips may speed up the process :)
For instance, the following example will lead to a crash when calling
recorder.start()
a second time: