pocitacova mys ryba reprobedny letadlo cip
header

Text-to-speech: experience with AI and open source tools

December 2, 2026

Lang: en de es cs

On one of my projects I needed to convert longer texts into spoken word. The AI prototype worked well. But production deployment needed fine-tuning... In the end it took quite a lot of work and testing of other solutions. In this article I share my experience with text-to-speech using AI tools as well as classic text-to-speech solutions. I sum up my experience with Google Gemini AI, Microsoft Azure Speech and the open source tools Coqui TTS and Piper.

Text-to-speech: experience with AI and open source tools

Why look for a working text-to-speech solution

On one of my projects I needed to convert longer texts into spoken word. As is usual for me, I was not satisfied with a prototype that only works on a short demo; I wanted a solution that would hold up in production and under all kinds of circumstances – that is, with texts of any length, in multiple languages and reliably. I have not yet arrived at a fully ideal solution, but the path I went through and the options I tested can serve as a lesson for you too.

Google Gemini AI

Generating voice from text using AI has one fundamental weakness: if you want to convert a longer continuous text, the voice gradually becomes less clear during generation and its volume drops. So you are not able to generate an entire long text in a single request.

The solution is to split the text into several smaller parts. But that means more API calls (and therefore higher costs) and above all that the individual sections are generated separately – the resulting voice then differs between the individual parts and does not sound consistent.

On a short test sample the result can be very satisfying, but with a longer text you will not get a satisfying result, no matter how hard you try or how much you are willing to pay for the API.

This is how it works with Gemini AI; it is possible that voice models from other companies, or rather their APIs, allow you to select a specific voice and its tone. For example, probably elevenlabs.io.

Microsoft Azure Speech

I also wanted to try Microsoft's solution, but as usual with Microsoft products, I ran into problems right when setting up access. I did not even manage to get an API key – logging into the administration caused trouble, and when I finally succeeded, creating the text-to-speech service ended with an error.

It can be assumed that I would have run into the same two weaknesses as with Gemini AI. If someone could advise me on a working connection to Microsoft Azure Speech, I will be happy to try it.

In general, this confirms that Microsoft is better avoided.

Open source projects

So I decided to take the classic route and try existing open source projects for generating voice from text.

The first tip I got was The Festival Speech Synthesis System. I wanted to try it, but it turned out to be an outdated and no longer maintained project, so I did not try it at all.

Then there is whisper, which runs a local AI model, but it does the opposite – it converts voice to text.

Another option was the open source project Coqui TTS. However, it does not support languages like Vietnamese or Thai, and I have the impression it does not support Czech either, which I definitely needed for my project. In the end, I did not even try it.

I relatively successfully tested and eventually started using the open source project Piper. Out of the box it supports many common languages, including Czech and Vietnamese. A model for Thai can be downloaded as an unofficial package and it works too.

The voice is nowhere near as nice as when you generate it with Google Gemini. Piper sounds robotic. On the other hand, there is no need to split the input into sections, because even long texts are generated with the same quality and volume all the way through.

The problem arises when generating Thai voice – Piper needs a lot of memory for it. Either the generation of a long text never finishes, or it consumes a large amount of memory. So it did not make sense to deploy it on a production server – I would have to have a lot of memory constantly available there, which I would not use most of the time anyway.

And since I do not need to generate voice all the time, I solved it with a local worker (runner) that regularly connects to the application and checks whether new data for conversion is available. If so, it downloads the texts, converts them into Thai locally on a machine with 64 GB RAM (where consuming 8 GB of memory is no problem at all) and uploads the result back to the project, where the audio then remains permanently and publicly available.

Video

You can see what AI audio generation looks like in practice in this video (in Czech):

And a related video about generating articles with AI (in Czech):

Conclusion

The road to a working solution was demanding and quite thorny, but in the end I arrived at a result that is usable – even though the voices generated with Piper are not particularly high quality, since it is a robotic voice. Still, I am satisfied with it.

If users preferred a nicer voice, I would go the Gemini AI route – but that means paying for quality, because it takes a lot of tokens and API calls. The generated audio has a more pleasant voice, but it changes from one section of text to another. That is, after all, the reason why the voice also changes in AI-generated videos you can find on YouTube. In my solution I at least made it so that the voice always changes after logical blocks – typically before a new heading – so the voice does not change in the middle of a paragraph.

I have to admit that what AI enables in voice generation today is very interesting and high quality. Still, even after all that progress, it does not yet achieve the results I would expect – that is, the kind you see in some demos presented as AI output.

Articles on a similar topic

How I do frontend the backend way
How to automate software development with AI and autonomous agents
Vibecoding: How to program a good application with AI
How to speed up the web
Rector: upgrade PHP application
Go programming language
Analysis of assignment and pricing of software project development
Python program to control Docker using the API
How to use MailCatcher to test emails
Python OpenAI API
Creating a WebSocket web application and setting up a proxy
Project management: agile software development
How to run old PHP applications
What a good programmer should know
Rust programming language
NodeJS: development, server configuration
Nette security bug CVE-2020-15227
How to compare two identical databases?
REST API: platform API
Custom web and mail hosting with ISP Config software
Programming in SQL: PostgreSQL, MySQL/MariaDB
HTTPS: secure web
NoSQL database Mongo DB
Connecting to Microsoft SQL Server from Linux
What is the job description of a programmer
Python application localization
Which mail and web hosting to choose
How to make wireless low power Arduino
Digispark - Program Atmel ATtiny microcontroller with Arduino IDE
Program Roulette
Development for ARM processors with Arduino IDE
Wireless low power Arduino
UPS Monitor for Android
Wireless Battery-Powered WiFi Thermometer
How to program the ESP8266 WiFi processor
Comparison IQRF vs Wireless Arduino
What platform should I choose for my e-shop? For example, Prestashop
Development kits and gateways for wireless platform IQRF
Development kits and gateways for wireless platform IQRF

OpenStreetMap and GPS routes in the map on the web
Quickplay
Java Program for Clear Monitoring of Backup Power Sources
Java Card OpenPlatform Contact and Contactless Chip Cards
Open smartphone with Linux - Openmoko Neo FreeRunner
Development for wireless modules with PIC processor under GNU/Linux - IQRF
About Programming and Various Programs in Java, Python and Other Languages

Newsletter

If you are interested in receiving occasional news by email.
You can register by filling in your email news subscription.


+