cosyvoice.cpp icon indicating copy to clipboard operation
cosyvoice.cpp copied to clipboard

streaming audio generation support

Open nowading opened this issue 7 months ago • 7 comments

does it have a plan to enable streaming audio generation support in the future?

nowading avatar Apr 24 '26 17:04 nowading

This feature is not planned for the short term, but it's definitely something I might consider in the future. I can't give a definite timeline at the moment, but I'll keep your request in mind.

Lourdle avatar Apr 25 '26 00:04 Lourdle

Not having streaming support makes it a bit useless to be honest. I first of all looked at your onnx conversion, but that doesn't support streaming too, and then I looked at gguf but no streaming. So sad :( It's one of the main features of this model. I understand the technical challanges to support it, but I feel it's definitely worth the effort if you manage to get it working properly. I'll just have to use the original model, but my trust in running python scripts is really low, plus it makes it harder to deploy it to mobile like that and I'd have to quantize it myself, and having full model in onnx would easily allow for 2x inference speed decrease (less lag), which would be massive (at least from gpu tests). Honestly don't know why these researchers that release those models don't do the full conversion themselves, it would be quite easy for them, they make such good models and then they are so bad at providing a deployable version..

Razorex001 avatar Jun 21 '26 12:06 Razorex001

Not having streaming support makes it a bit useless to be honest. I first of all looked at your onnx conversion, but that doesn't support streaming too, and then I looked at gguf but no streaming. So sad :( It's one of the main features of this model. I understand the technical challanges to support it, but I feel it's definitely worth the effort if you manage to get it working properly. I'll just have to use the original model, but my trust in running python scripts is really low, plus it makes it harder to deploy it to mobile like that and I'd have to quantize it myself, and having full model in onnx would easily allow for 2x inference speed decrease (less lag), which would be massive (at least from gpu tests). Honestly don't know why these researchers that release those models don't do the full conversion themselves, it would be quite easy for them, they make such good models and then they are so bad at providing a deployable version..

I understand, and thanks for the detailed feedback.
At the moment, there are still some issues in the frontend that I need to fix first. I’m also busy with other work recently, so I won’t be able to spend much time on streaming right now. After about a week, once I finish the other tasks and ship a release with the frontend fixes, I’ll consider starting work on streaming support.

Lourdle avatar Jun 21 '26 13:06 Lourdle

Thank you, that's great to hear! And I suppose at some point in the near future they might open source the cosyvoice 3.5 version which should probably be able to use same streaming or similar streaming logic to the 3.0 one, so building it now for 3.0 will likely pay off in the long term too! Is there any chance that if you do end up managing to implement support for streaming, that you'll let us know here? The dream is full cosyvoice 3.5 onnx with streaming :D

Razorex001 avatar Jun 21 '26 16:06 Razorex001

@Razorex001, I've added initial streaming TTS support in PR #23. Note that this is still a work-in-progress draft; stability especially with longer inputs is being improved. Please follow PR #23 for progress and updates.

Lourdle avatar Jul 04 '26 16:07 Lourdle

That's great, thank you, will follow that pr :) Just to understand properly, that's streaming TTS support for the ONNX version?

Razorex001 avatar Jul 04 '26 19:07 Razorex001

@Razorex001 I originally built cosyvoice.cpp because ONNX imposed too many constraints — KV-cache management, flexible graph rebuilding are all much harder to do efficiently in ONNX. While streaming on ONNX is technically possible, key optimizations like persistent KV-cache across hop is difficult to apply without significant engineering. So the ONNX path would lack those performance improvements. I'm not planning to add ONNX streaming support at this time.

Lourdle avatar Jul 05 '26 02:07 Lourdle