rhasspy / piper

A fast, local neural text to speech system
https://rhasspy.github.io/piper-samples/
MIT License
4.38k stars 297 forks source link

Can it support asynchronous synthesis? #462

Open High-calcium-tiger opened 1 month ago

High-calcium-tiger commented 1 month ago

I find function synthesis use session.onnx.Run() to synthesis audio data in piper.cpp line386. this is synchronous. I want asynchronous to synthesis audio data.

I find function RunAsync() in onnxruntime_cxx_api.h in onnxruntime-main project source code. Can I understand that switching to this function will enable asynchronous support? Can give me a pitch fo asynchronous to synthesis audio data? thank you.

MikePooh commented 2 days ago

Let me join the question. I am using piper as library in my Qt/C++ programm. Using Qt's Qt::Concurrent::run API I can easilly start piper's textToAudio function in separate thread and get result once function finished. However this doesn't support cancellation. So in case of interruption computation of textToAudio function still going till the end.

Maybe there is an option to run this function in a manner of cycle? And on each iteration to check interruption flag and, optionally, signal progress.