Phonon TTS: a 100% local voice for Gladys

Hello everyone,

Now that we can customize the voice in Gladys, I present to you Phonon TTS, an integration that gives Gladys an offline voice. The texts of your scenes « Play a notification » are synthesized directly on your Gladys machine, without cloud service or subscription. All this is possible thanks to the Open source models of Gradium, which I have already talked about here Service Gradium AI

:warning: The integration is in beta (version 0.1.x). It works on my machine, but it has been tested on few machines: there may be bugs, and things will still change. Avoid using it for critical announcements (alarm, security…) for now.

The Approach

Since Gladys 5.3, we can choose Gladys’ voice by installing an external integration of the « voice » (TTS) type. Here you have one that

  • runs locally, so that the spoken texts do not leave the house;
  • works without Internet once installed;
  • remains quite light even for a Raspberry Pi (see table).

The Phonon models of Gradium meet these three conditions. These are small models (40 and 31 million parameters) that run on a simple processor, without a graphics card.

How it works:

  • the integration (a Node.js container based on the Gladys integrations SDK) receives Gladys’ synthesis requests;
  • it drives a sub-container, the official ptts-openai-server image of Gradium, which generates the audio in MP3;
  • on the first launch, it downloads from Hugging Face only the model (~75 Mo) and the chosen voice. Then, no more need for Internet.

What you can choose:

  • 7 models: Phonon 40m in French, English, German, Spanish, Portuguese and multilingual, and Phonon 31m in English;
  • 102 voices from the Phonon catalog, the original voice of the model, or a custom voice created or cloned in Gradium Studio.

Why a separate website to test the voices?

:backhand_index_pointing_right: bertrandda.github.io/gladys-phonon

With 102 voices, choosing randomly from a dropdown list doesn’t make sense. However, Gladys’ configuration screen only displays a fixed list: you can’t listen to a sample there. Moreover, the integration only downloads the selected voice, to save disk space. Trying the voices one by one in Gladys would therefore require a download each time.

The demo page allows you to:

  • listen to a sample of each voice, spoken by Phonon 40m or 31m;
  • filter by language and gender, or search for a voice;
  • see the exact name to choose in the integration list (at the bottom of each card).

All voices work with all models, but they sound better in their own language.

Installation

Prerequisites

  • Gladys 5.3 or newer
  • about 1 GB of memory and 150 MB of disk free for the voice engine
  • for the 40m models: a free Hugging Face account, on which you accept the model’s terms (for example gradium/phonon-40m-fr; validation is immediate), and a read token. Phonon 31m (English) does not require an account.

Steps

  1. I haven’t officially released the integration yet, so install it in developer mode (Integrations › Install an integration › Developer mode) by pasting https://github.com/bertrandda/gladys-phonon in the GitHub repository URL.
  2. In the Configuration tab of the integration, choose a model (none is selected by default, and nothing is downloaded until you choose one). Then paste the Hugging Face token, choose the voice and save.
  3. Wait for the Ready status (download, then engine startup).
  4. Make Phonon TTS Gladys’ voice: Integrations › Artificial Intelligence › Voice.

Complete documentation: docs/fr.md

First Measurements

The indicator used is the generation speed: the duration of speech produced divided by the computation time.

Machine Generation Speed
MacBook M5 ×13: a 5-second phrase is ready in less than half a second
Raspberry Pi 4 ×0.8: a bit slower than real-time, it takes about 6 seconds to generate a 5-second phrase

Gladys waits for a synthesis for a maximum of 30 seconds. On a Raspberry Pi 4, a text of more than ~20 seconds of speech will therefore be cut, and only its beginning will be spoken. For short notifications, it works without any problem. With a more powerful machine, you can go much further, on my MacBook the walk of the duel of Cyrano de Bergerac, ~52s of audio generated in ~4s.

A first possible improvement of the core for a better user experience could be to allow streaming between the external integration and Gladys and thus have the audio that starts quickly while continuing the generation in parallel.

Your feedback is welcome :folded_hands:

This is the purpose of this beta! To be able to compare the feedback and study which machines allow the model to run best, please indicate if possible:

Machine and CPU: (ex. Raspberry Pi 5 8 Go, mini-PC Intel N100 16 Go, VM 2 vCPU…)
Phonon Model and Weight: (ex. Phonon 40m · French, q8)
Voice:
Response Time: (2 or 3 results of the "Test the voice" action, with a short phrase and a long phrase)
Feel (in the `Speak on a speaker` scenes): (voice quality and naturalness, pronunciation of numbers, times and proper nouns, delay before the speaker speaks, bugs…)

To measure the response times, the Test the voice action of the Configuration tab directly gives the two figures (you won’t hear anything). For example:
OK: 4.2 seconds of speech (33 KB of MP3) generated in 5.2 seconds by Phonon 40m · French → ×0.8

Known Limitations

  • A model speaks only one language (the language of the model, or the one chosen for multilingual).
  • The Phonon 40m models are under CC BY-NC 4.0 license (non-commercial use only).

Thanks in advance for your tests!

For those who don’t have a machine to run the service, another Gradium service going through their servers will follow soon, I’ll talk about it here Service Gradium AI

@bertrandda Hi Bertrand, quick question: Why are you going through Hugging Face? Gradium offers this directly on their homepage. Or did I miss something?

Best regards

Tom