Tts How create small delays between sentences?

Hi everyone,

it is still not possible to insert small pauses between sentences when I use tts?

Here is an excerpt from a script, unfortunately I have not yet found a way to insert a short pause between the individual sentences.
I have highlighted with stars where I need a little pause:

Guten Morgen Sascha.

***here a pause 1-2sec.***

"{% set weekdays = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"] %} {% set months = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"] %} {{ "Heute ist " + weekdays[now().weekday()] + ", der " + now().strftime("%-d") + ". " + months[now().month - 1] + " " +  now().strftime("%Y") }} und es ist {{ now().timestamp() | timestamp_custom(' %H:%M ') }}"

***here a pause 1-2sec.***

Hier ist das Wetter für heute!

***here a pause 1-2sec.***

Die aktuelle Temperatur beträgt{{ states('sensor.temperatursensor_terrasse_temperatur', 'temperature')
  }}Grad

***here a pause 1-2sec.***

{% set weather_condition = {
       'clear': 'klar',
       'clear-night': 'und klare Nacht',
       'cloudy': 'bewölkt',
       'exceptional': 'außergewöhnlich',
       'fog': 'nebelig',
       'hail': 'mit Hagel',
       'lightning': 'mit Gewitter',
       'lightning-rainy': 'mit Gewitter und Regen',
       'partlycloudy': 'teilweise bewölkt',
       'pouring': 'und strömender Regen',
       'rainy': 'regnerisch',
       'snowy': 'verschneit',
       'snowy-rainy': 'verschneit und regnerisch',
       'sunny': 'sonnig',
       'windy': 'windig',
       'windy-variant': 'windig und wolkig'
     } %}  
 Heute ist das Wetter voraussichtlich {{ weather_condition[wettermemmingen['weather.memmingen'].forecast[0].condition]  }}, mit einer Höchsttemperatur von {{
 wettermemmingen['weather.memmingen'].forecast[0].temperature }} Grad und einer Tiefsttemperatur von {{wettermemmingen['weather.memmingen'].forecast[0].templow }} Grad. 
 Die maximale Windgeschwindigkeit wird bei {{
 wettermemmingen['weather.memmingen'].forecast[0].wind_speed }} km/h liegen.
 
 Die Regenwahrscheinlichkeit liegt bei ca. {{ states('sensor.memmingen_niederschlagswahrscheinlichkeit') | float }}%.

I have already tried that, but it didn’t work:

Please note, i don’t want to go the way of a regular delay between several tts actions.

Perhaps someone else has an idea how this could be achieved.

I am very grateful for any help.

Edit: i use tts.cloud_say

I think you have to, to give the first tts time to process.

    - action: tts.cloud say
      data:
        message: Guten Morgen Sascha
    - delay:
        seconds: 3
    - action: tts.cloud_say
        message: Hier ist das Wetter für heute!

You get the same issue with media player - successive “plays” need delays to allow for the play time.

I don’t think there’s a tts equivalent of silence.

The other methods suggested may work with some tts engines, but they’re not universal. Punctuation often affects stress patters and intonation. but pauses are minimal.

Edit: It’s going to be a bit hit and miss, because the whole tts sentence usually has to be compiled before it can be spoken, so there will be a bit of a pause already with long messages like your weather summary.

You can use the custom integration Chime TTS which supports combining multiple TTS segments with multiple breaks.

2 Likes

Hadn’t seen that. It’s intended for announcements, presumably? Should certainly work for the OP.

Which TTS engine are you using?

Some support SSML (Speech Synthesis Markup Language) which allows you to embed various commands to control speech, such as pauses.

Good morning! <break time="2s"/> Today is Friday.

Great, with Chime TTS it works perfectly! Thanks a lot

action: chime_tts.say
metadata: {}
data:
  chime_path: chord
  end_chime_path: chord
  volume_level: 0.3
  message:
    - tts: Das ist ein Test
    - delay: 1000
    - tts: Mal sehen ob es funktioniert
    - delay: 1000
    - tts: Die aktuelle Temperatur beträgt{{ states('sensor.temperatursensor_terrasse_temperatur', 'temperature')
        }}Grad
    - delay: 1000
  tts_platform: cloud
target:
  device_id: 56168fda228bad573e0aa661867be27c
1 Like

I use tts.home_assistant_cloud

Based on the following post, Nabu Casa’s TTS service is provided by Microsoft’s Azure TTS. Although Azure TTS supports SSML, Nabu Casa’s implementation of it does not.

In comparison, other TTS engines, such as Google Cloud and Elevenlabs, do support SSML.


For future reference, SSML not only lets you introduce pauses in speech, it permits you to control how words are pronounced, how fast it’s spoken, emphasis, etc.

1 Like

I have to say I am delighted with the custom integration Chime TTS! :slight_smile:

It solves quite a few problems.

I have now tried a few things and everything works exactly as I imagined.

If anyone is interested here is the entire automation for my morning routine in the bathroom:

alias: Morgenroutine Badezimmer Sascha
description: ""
triggers:
  - entity_id:
      - light.badezimmer
    to: "on"
    for:
      hours: 0
      minutes: 0
      seconds: 0
    enabled: true
    trigger: state
    id: Morgenroutine aktivieren
    from: "off"
conditions:
  - condition: and
    conditions:
      - condition: template
        value_template: >-
          {{ state_attr('automation.morgenroutine_badezimmer_sascha',
          'last_triggered') | default(today_at(), true) < today_at('5:00') }}
        enabled: true
      - condition: time
        after: "05:00:00"
        before: "10:00:00"
        enabled: true
      - condition: and
        conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: binary_sensor.bett_shi
                state: "on"
              - condition: state
                entity_id: person.shi_liu
                state: not_home
              - condition: state
                entity_id: zone.shi_arbeit
                state: "1"
          - condition: state
            entity_id: person.sascha_wunder
            state: home
        enabled: true
      - type: is_not_occupied
        condition: device
        device_id: 567c17986a82eb1abee6aeb83020e9de
        entity_id: 268251e4a003342850490e4519401235
        domain: binary_sensor
    enabled: true
actions:
  - metadata: {}
    data:
      type: daily
    target:
      entity_id:
        - weather.memmingen
    response_variable: wettermemmingen
    action: weather.get_forecasts
  - action: chime_tts.say
    metadata: {}
    data:
      chime_path: chord
      volume_level: 0.3
      message:
        - tts: Guten Morgen Sascha!
        - delay: 1000
        - tts: >-
            {% set weekdays = ["Montag", "Dienstag", "Mittwoch", "Donnerstag",
            "Freitag", "Samstag", "Sonntag"] %} {% set months = ["Januar",
            "Februar", "März", "April", "Mai", "Juni", "Juli", "August",
            "September", "Oktober", "November", "Dezember"] %} {{ "Heute ist " +
            weekdays[now().weekday()] + ", der " + now().strftime("%-d") + ". "
            + months[now().month - 1] + " " +  now().strftime("%Y") }} und es
            ist {{ now().timestamp() | timestamp_custom(' %H:%M ') }}
        - delay: 1000
        - tts: Hier ist das Wetter von heute.
        - delay: 1000
        - tts: >-
            Die aktuelle Temperatur beträgt{{
            states('sensor.temperatursensor_terrasse_temperatur', 'temperature')
            }}Grad
        - delay: 1000
        - tts: >-
            {% set weather_condition = {
                'clear': 'klar',
                'clear-night': 'und klare Nacht',
                'cloudy': 'bewölkt',
                'exceptional': 'außergewöhnlich',
                'fog': 'nebelig',
                'hail': 'mit Hagel',
                'lightning': 'mit Gewitter',
                'lightning-rainy': 'mit Gewitter und Regen',
                'partlycloudy': 'teilweise bewölkt',
                'pouring': 'und strömender Regen',
                'rainy': 'regnerisch',
                'snowy': 'verschneit',
                'snowy-rainy': 'verschneit und regnerisch',
                'sunny': 'sonnig',
                'windy': 'windig',
                'windy-variant': 'windig und wolkig'
            } %}   Heute ist das Wetter voraussichtlich {{
            weather_condition[wettermemmingen['weather.memmingen'].forecast[0].condition] 
            }}, mit einer Höchsttemperatur von {{
            wettermemmingen['weather.memmingen'].forecast[0].temperature }} Grad
            und einer Tiefsttemperatur von
            {{wettermemmingen['weather.memmingen'].forecast[0].templow }} Grad. 
            Die maximale Windgeschwindigkeit wird bei {{
            wettermemmingen['weather.memmingen'].forecast[0].wind_speed }} km/h
            liegen. Die Regenwahrscheinlichkeit liegt bei ca. {{
            states('sensor.memmingen_niederschlagswahrscheinlichkeit') | float
            }}%.
      tts_platform: cloud
      announce: true
      offset: 500
    target:
      device_id:
        - 56168fda228bad573e0aa661867be27c
  - if:
      - type: is_moist
        condition: device
        device_id: 2eda8077e5237cf6d6ae1a66474e33c6
        entity_id: a77a4b0b6efa9f57b3afa12ebb18e8e8
        domain: binary_sensor
    then:
      - action: chime_tts.say
        metadata: {}
        data:
          volume_level: 0.3
          tts_platform: cloud
          message: >-
            Im Moment regnet es und es ist nass, nimm besser einen Regenschirm
            mit!
          announce: true
        target:
          device_id: 56168fda228bad573e0aa661867be27c
    else:
      - action: chime_tts.say
        metadata: {}
        data:
          volume_level: 0.3
          tts_platform: cloud
          message: Im Moment ist es trocken.
          announce: true
        target:
          device_id: 56168fda228bad573e0aa661867be27c
  - if:
      - condition: or
        conditions:
          - condition: state
            entity_id: calendar.geburtstage
            state: "on"
          - condition: state
            entity_id: calendar.kalender_sascha
            state: "on"
    then:
      - action: chime_tts.say
        metadata: {}
        data:
          volume_level: 0.3
          tts_platform: cloud
          message: Hier sind noch weitere Benachrichtigungen.
          announce: true
          final_delay: 1000
        target:
          device_id: 56168fda228bad573e0aa661867be27c
      - sequence:
          - if:
              - condition: state
                entity_id: calendar.geburtstage
                state: "on"
            then:
              - action: chime_tts.say
                metadata: {}
                data:
                  message: |-
                    {{
                      state_attr('calendar.geburtstage', 'message')
                      }}hat heute Geburtstag.
                  volume_level: 0.3
                  announce: true
                  tts_platform: cloud
                  final_delay: 500
                target:
                  device_id: 56168fda228bad573e0aa661867be27c
          - if:
              - condition: state
                entity_id: calendar.kalender_sascha
                state: "on"
            then:
              - action: chime_tts.say
                metadata: {}
                data:
                  message: |-
                    {{
                      state_attr('calendar.kalender_sascha', 'message')
                      }}
                  volume_level: 0.3
                  announce: true
                  tts_platform: cloud
                  final_delay: 500
                target:
                  device_id: 56168fda228bad573e0aa661867be27c
  - action: chime_tts.say
    metadata: {}
    data:
      volume_level: 0.3
      announce: true
      message: Ich wünsche dir einen stressfreien und schönen Tag.
      end_chime_path: chord
      tts_platform: cloud
    target:
      device_id: 56168fda228bad573e0aa661867be27c
mode: single

Thank you very much for this great custom integration and all the effort you have put into it.

Best regards

1 Like

It would be nice if Nabu Casa also made this available in the future.
Thank you for your help. :slight_smile: