Closed mrichar1 closed 8 months ago
I've just realised that instead of calling terminate()
on the process, it is better to use stdin.write_eof()
. aplay
will then play through all buffered audio before shutting itself down.
This is a good idea. Thanks!
Wyoming's
AsyncEventHandler
base class definesdisconnect
notdisconnected
method: https://github.com/rhasspy/wyoming/blob/master/wyoming/server.py#L40With this fixed,
self._stop_proc
is now called when the client disconnects, preventing stalecommand
processes.EDIT: It looks like this fix can cause the command to be terminated while still playing audio. I'm not sure of any way to 'know' that the command is safe to be terminated. The only approach I can think of is to refactor this module to match wyoming-mic-external and run a single long-running 'global' command at start.