Chime TTS - Play audio before/after TTS audio lag free

Hi @Nimrod_Dolev ,

This is my Chime TTS config


and this is the debug log message

I hope you can find the reason.

Thanks
Kris

Thanks Kris.

Please try changing the chime_tts.say_url folder path in the configuration to:
/config/www/chime_tts

Yes! That worked. I didnā€™t realize that it wasnā€™t already there because of signing up with cloud, but its there now, and it works. Thanks very much. Its been working great for my google speaker, so looking forward to putting it to use with the alexas. Thanks again for all your hard work! Can someone remind me how to mark this as a solution?

Great! Glad it worked out! Thank you as well :+1:

Hi @sri4iot. I can certainly add the ability to crossfade segments, but crossfading will quieten the overlapping audio.

Please be aware that you can already overlap segments over each other via the offset property when providing a negative value.

Hey @Nimrod_Dolev , have you gotten a chance to take a look at this? :slight_smile:

About six months ago volume support for Sonos devices was added to Chime TTS and confirmed as working. I donā€™t own any Sonos devices myself, so I canā€™t confirm personally, but perhaps other Sonos users can report here whether theyā€™re also having issues?

Can you please check if you can successfully call the Home Assistant media_player.play_media action to your Sonos speakers with the volume parameter? If you can, please provide me with the YAML you used?

Another user had the same issue and was able to resolve it by updating the Sonos firmware via the Sonos app.

The integration is working great for me, Iā€™m using v1.1.6-beta5, the only issue is that I need to set cache: true otherwise the file get deleted, I already reported the issue to the repo.

Iā€™m using HomePods and Alexas, and I love how this integration converts the MP3 to a format Alexa can play. Great work! For TTS, Iā€™m using OpenAI.

Iā€™m also using mini-media-player, this is how it can be configured

type: entities
entities:
  - type: custom:mini-media-player
    entity: media_player.kids_bedroom
    group: true
    source: icon
    info: short
    hide:
      power: true
      controls: true
    tts:
      platform: service
      data:
        service: chime_tts.say
        service_data:
          cache: true
        message: text
  - type: custom:mini-media-player
    entity: media_player.echo_pop
    group: true
    source: icon
    info: short
    hide:
      power: true
      controls: true
    tts:
      platform: service
      data:
        service: chime_tts.say
        service_data:
          audio_conversion: Alexa
          cache: true
        message: text
title: Wild Robot

@Nimrod_Dolev. Thanks for the direction. With -1500 Offset value I am able to hear the music before the TTS finishes. :+1:t3:

using the media_player.play_media action the volume parameter seems to work see YAML below

action: media_player.play_media
target:
  entity_id: media_player.living_room
data:
  announce: true
  media_content_type: "music"
  media_content_id: "http://192.168.8.85:8123/media/local/sounds/temp/chime_tts/__761ynx.mp3"
  extra:
    volume: 50

I did try updating my system but it was already up to date.

Thanks @pabla. I donā€™t yet understand why the volume_level parameter isnā€™t changing the volume for your Sonos media_player, given that under the hood of Chime TTS, I am using the same action call to media_player.play_media with the extra volume parameter, like in your YAML example.

Can you please upgrade to the latest version, v1.2.0, and let me know if the issue still occurrs for you?

Hi @Nimrod_Dolev, Iā€™m curious if this integration supports the following functionalities:

1. Play a Random Local MP3 File

Iā€™d like to select and play a random MP3 file from a list, either using media-source or direct URLs. Hereā€™s an example:

chime_path: >-
  {{ [
    "/media/ringtone/morning.mp3",
    "/media/ringtone/cheer.mp3",
  ] | random }}
2. Combine Multiple Texts Using Macros

Iā€™m trying to use Jinja2 macros to dynamically generate TTS messages. This works on Google Translate but doesnā€™t seem to function as expected in this integrationā€”it only processes static text.

For example, I have a macro defined in time.yaml:

{%- macro time() -%}
  {{ ["It's ", "Now is "] | random }} {{ now().hour }}
{%- endmacro -%}

Iā€™d like to use this macro in my action like this:

action: chime_tts.say
target:
  entity_id: media_player.speaker
data:
  message:
    - tts: !include speech/time.yaml
    - delay: 1000

FYI, I just updated to 1.2.0 and after restart, HA tells me:

The integration chime_tts could not be found. This happens when a (custom) integration was removed from Home Assistant, but there are still configurations for this integration . Please use the buttons below to either remove the previous configurations for chime_tts or ignore this.

I still see Chime in HACS. It says itā€™s installed. I also get 14 errors in all automations that use it. Iā€™m not seeing anything in the logs.

BTW, this is how I use chime_tts in my automations:

actions:
  - target:
      entity_id: media_player.kitchen_display
    data:
      delay: 450
      tts_playback_speed: 100
      chime_path: /media/sounds/temp/chime_tts/soft.mp3
      message: The dryer is done
      tts_platform: google_translate
      language: en
      volume_level: 1
      cache: true
    action: chime_tts.say

But it doesnā€™t always fire off. And when it does, it gives the HA chime, then waits 10 seconds then give the soft chime and then it talks.

unfortunately no luck with v1.2.0. Does it have something to do with the fact that chime tts sends volume as a decimal number while the media_player.play_media action sends it as a number from 0-100?

Hey Paul. I havenā€™t had this happen before so I donā€™t know what the answer is for your missing integration - but can you please try removing the integrarion (if it is in your list of added integrations) and adding it again?

Regarding the playback: you mentioned that you first heard a HA chime and then the announcement for Chime TTSā€¦Iā€™m not clear on what you mean here. What is the HA chime?

Chime TTS converts the audio_volume float 0-1 value to an int value between 0-100 for Sonos media_player devices, so thatā€™s not the issue.

Perhaps you could please enable debug logging and supply time with the debug logs so that I might better understand what might be going on?

I deleted Chime_tts integration.
I redownloaded Chime_tts from HACS
I restarted HA
Chime_tts is shown installed in HACS
I try to add integration Chime_tts but it isnā€™t found.
When I type search term: ā€œchimeā€ I see no responses.
Hmmmm

I still donā€™t understand why this is happening. Perhaps try making sure you have completely removed the integration and its data file before reinstalling it again by deleting Chime TTS integrationā€™s:

  1. Main ffolder: /config/custom_components/chime_tts
  2. Data file: /config/.storage/chime_tts_integration_data