piper icon indicating copy to clipboard operation
piper copied to clipboard

stopping speech?

Open tvraman opened this issue 1 year ago • 5 comments

Is there a call to stop speech once synthesis has started, other than chopping it off at the knees by killing the audio player?

tvraman avatar Mar 13 '24 18:03 tvraman

What do you mean by "call"?

If you are piping the output of piper to your audio player (as in the streaming audio example), then kill the whole thing (Ctrl-c in most common shells). Technically, you can kill the audio player (e.g. pkill aplayer in another terminal), which will close the pipe and cause piper to also terminate.

If you are writing to a file / not streaming the output in real-time, then naturally just kill piper.

jn64 avatar Mar 24 '24 15:03 jn64

The problem is not with the killing the whole pipeline. The problem is that if that's the only way to stop speech, then the next utterance requires the whole engine to start up again, and that implies latency; not a huge problem for Home Assistant like uses, but not acceptable for projects like Emacspeak that provide auditory feedback for all of one's actions

--

tvraman avatar Mar 24 '24 18:03 tvraman

Well, that's a completely different problem from your initial question.

See #376, #90

jn64 avatar Mar 24 '24 18:03 jn64

No, it is not different problem.

@tvraman is correct.

I think the simple fix would be to return from callback and if return code will be not 0, stop synthesis of next utterance.

@synesthesiam what do you think about that?

beqabeqa473 avatar Mar 28 '24 13:03 beqabeqa473

Of course it's a different problem. "How to stop synthesis" (Ctrl-c, kill, pkill, various TUI/GUI task managers) is different from "how to stop synthesis and continue using the same instance of Piper to synthesise multiple times, to reduce startup latency".

The latter might be better discussed in the context of #376.

jn64 avatar Mar 28 '24 14:03 jn64