Queue for audiosink/GoogleTTS

  • Platform information:
    • Hardware: ThinkCenter i7/16GB
    • OS: Portailner/Docker
    • 17
    • openHAB version: 4.1.1
  • Issue of the topic: Queue for TTS

Hi,
I am owner of 4 echo Flex I used only for TTS over my house.
Now I decided to switch so any (first catch was a G-Nest mini Gen2) audio sink in combination of GoogleTTS (5000 charactes free each month)

The Problem is/was that echo flex is terrible in sound quality and more annoying stops working suddenly every 2-3 moth. (Even if I use correct SAML instead of simple text)

So registered for GoogleCloud and its working perfekt…
Ok not not so hasty :laughing:
→ Firering Strings to the old Amazon TTS (mostly generated with forloops in my rules)

"This is a status for living", "that is a status for kitchen", "door in xyz is open"

results in a marathon of outputs (mostly with a small speaking break. (Something I can live with)
Triggering the new TTS in Google results in

"This ...", "that i....", "door..."

So the service might be to fast? (how can I test if audio generation is finished for whole sentenses?

Now my reak question: How can I generate a queue with on-board resources to get a nice output at sink?
(I dont want to concatenate all Strings and send it to GoogleTTS, regarding the caching in Binding and the 5000 free characters)

Any Suggestions? How do you work with frequently TTS in your system? (Might there be a busy flag in chromcast I can wait for and how can I prevent starting TTS-result to send directly to audio-sink If that flag is still true?)

Thanks a lot! David

I don’t do tts much any more. The family thought it was creepy. But I do know that what I used to do and what people used to recommend was to add in delays between command to tts to give it time to finish. A quick count of words can be used as a reasonable factor.

Centralize all the commands to tts in one role using the Command Item approach from Design Pattern: Separation of Behaviors and then use Design Pattern: Gate Keeper to queue up and space out the calls to tts. You can add a limit there too to count the number of characters sent for the month and generate an error when you get over 5000.

nice

I allready thought about that, but in case I do not understand how much the cache of binding will optimize I have to check/read GoogleCloud-api for quota (hopefully they have)
Btw. how to simply do a rest-call and write result in an item? (which prefered binding?)

I don’t know. I assumed if you send 200 characters to the API it counts as 200 characters. So you just need to keep the sum of all characters sent in an Item that you reset at the end of the billing month.

If there is an API you’ll have to work through the details based on the documentation for that API. Authentication is usually that hardest part. You can use the HTTP binding or the [sendHttp request Actions](Actions | openHAB
0 to make the request.

Frankly, it would be easier to either assume one-to-one or to independently calculate the number of characters following the same algorithm that Google uses. It should be deterministic.