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

@Nimrod_Dolev iT is actually the airport express AirPlay 2 devices that are having issues. I have found a workaround for the Sonos. See full log below

I can play other media with media_player.play_media with no issues only the chime tts has the problems.

2025-03-12 21:27:58.027 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╔══════════════════════════════════════╗
2025-03-12 21:27:58.027 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ║ Chime TTS Say Called. Version v1.2.2 ║
2025-03-12 21:27:58.027 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╚══════════════════════════════════════╝
2025-03-12 21:27:58.027 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╭────────────────────╮
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] │ General Parameters │
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╰────────────────────╯
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * entity_ids = [‘media_player.airport_lisette’]
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * chime_path = bright
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * cache = False
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * offset = 450.0
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * crossfade = 0
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * final_delay = 0.0
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * message = Wakker worden
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * language = nl
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_platform = google_translate
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_speed = 100.0
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_pitch = 0
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * announce = True
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * fade_audio = False
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * volume_level = 0.5
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * join_players = False
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * unjoin_players = False
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * media_players_array:
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 0: entity_id: media_player.airport_lisette
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] platform: apple_tv
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] initial volume: 0.3299999999999999
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] target volume: 0.5
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] now playing: False
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] join supported: False
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] announce supported: False
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╭─────────────────╮
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] │ Preparing Audio │
2025-03-12 21:27:58.028 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╰─────────────────╯
2025-03-12 21:27:58.032 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] Local path to chime: /config/custom_components/chime_tts/mp3s/bright.mp3
2025-03-12 21:27:58.032 DEBUG (MainThread) [custom_components.chime_tts] - Retrieving audio from path: “/config/custom_components/chime_tts/mp3s/bright.mp3”…
2025-03-12 21:27:58.128 DEBUG (MainThread) [custom_components.chime_tts] …audio retrieved. Duration: 0.637s
2025-03-12 21:27:58.394 DEBUG (MainThread) [custom_components.chime_tts.helpers.tts_audio_helper] …TTS audio generated in 260.0ms
2025-03-12 21:27:58.394 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] Adding gap of 450.0ms
2025-03-12 21:27:58.394 DEBUG (MainThread) [custom_components.chime_tts] - Saving mp3 file to local folder: /media/sounds/temp/chime_tts/…
2025-03-12 21:27:58.474 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] File saved to path: /media/sounds/temp/chime_tts/99019bffcf682be3c660402851c615f5.mp3
2025-03-12 21:27:58.572 DEBUG (MainThread) [custom_components.chime_tts] - Chime TTS audio generated:
2025-03-12 21:27:58.572 DEBUG (MainThread) [custom_components.chime_tts] * audio_duration = 2.287
2025-03-12 21:27:58.572 DEBUG (MainThread) [custom_components.chime_tts] * local_path = “/media/sounds/temp/chime_tts/99019bffcf682be3c660402851c615f5.mp3”
2025-03-12 21:27:58.572 DEBUG (MainThread) [custom_components.chime_tts] * public_path = None
2025-03-12 21:27:58.572 DEBUG (MainThread) [custom_components.chime_tts] * media_content_id = “media-source://media_source/local/sounds/temp/chime_tts/99019bffcf682be3c660402851c615f5.mp3”
2025-03-12 21:27:58.572 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╭──────────────────────╮
2025-03-12 21:27:58.572 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] │ Pre-Playback Actions │
2025-03-12 21:27:58.572 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╰──────────────────────╯
2025-03-12 21:27:58.572 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] Increasing media_player.airport_lisette’s volume from 0.3299999999999999 to 0.5
2025-03-12 21:27:58.572 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] - Setting media_player.airport_lisette’s volume to 0.5
2025-03-12 21:27:58.573 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] …waiting until new volume levels reached…
2025-03-12 21:27:58.573 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] - Retry setting media_player.airport_lisette’s volume to 0.5
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] …
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] - :heavy_check_mark: media_player.airport_lisette’s volume now 0.5
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╭────────────────────╮
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] │ Chime TTS playback │
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╰────────────────────╯
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts] 1 Regular media player detected:
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts] - media_player.airport_lisette
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts] Calling media_player.play_media with data:
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts] - entity_id: [‘media_player.airport_lisette’]
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts] - announce: True
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts] - media_content_type: music
2025-03-12 21:27:58.725 DEBUG (MainThread) [custom_components.chime_tts] - media_content_id: media-source://media_source/local/sounds/temp/chime_tts/99019bffcf682be3c660402851c615f5.mp3
2025-03-12 21:27:58.730 DEBUG (MainThread) [custom_components.chime_tts] - Waiting 2.287s for audio playback to complete…
2025-03-12 21:28:01.019 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] - Waiting until 1 media_player isn’t playing…
2025-03-12 21:28:01.019 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] :heavy_check_mark: media_player.airport_lisette
2025-03-12 21:28:01.019 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╭───────────────────────╮
2025-03-12 21:28:01.019 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] │ Post-Playback Actions │
2025-03-12 21:28:01.019 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╰───────────────────────╯
2025-03-12 21:28:01.019 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] Decreasing media_player.airport_lisette’s volume from 0.5 to 0.3299999999999999
2025-03-12 21:28:01.019 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] - Setting media_player.airport_lisette’s volume to 0.3299999999999999
2025-03-12 21:28:01.594 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall media_player.play_media (c:01JP60NRW5CP04P1QKEJQ9V19H): entity_id=[‘media_player.airport_lisette’], announce=True, extra=, media_type=music, media_id=media-source://media_source/local/sounds/temp/chime_tts/99019bffcf682be3c660402851c615f5.mp3>
2025-03-12 21:28:01.597 WARNING (MainThread) [custom_components.chime_tts.helpers.media_player_helper] Unable to set media_player.airport_lisette’s volume to 0.3299999999999999: connection was lost
2025-03-12 21:28:01.597 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] …waiting until new volume levels reached…
2025-03-12 21:28:01.597 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] - Retry setting media_player.airport_lisette’s volume to 0.3299999999999999
2025-03-12 21:28:01.750 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] …
2025-03-12 21:28:01.751 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] - :heavy_check_mark: media_player.airport_lisette’s volume now 0.3299999999999999
2025-03-12 21:28:01.751 DEBUG (MainThread) [custom_components.chime_tts] Removing temporary file:
2025-03-12 21:28:01.752 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] Deleting file /media/sounds/temp/chime_tts/99019bffcf682be3c660402851c615f5.mp3
2025-03-12 21:28:01.752 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╭───────────────────────────────────────────╮
2025-03-12 21:28:01.752 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] │──── Chime TTS Say Completed in 3.72 s ────│
2025-03-12 21:28:01.752 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╰───────────────────────────────────────────╯

Hi @Sebastiaan1. There are no clues in the logs, unfortunately.

I suggest you try enabling the cache option and copy the path to the generated file from the debug logs.
Try to call the media_player.play_media action using the copied path.

Hi @Nimrod_Dolev I made the following script with a cached mp3 from the chime TTS media folder and this plays without issues or errors.

alias: test media play
description: ""
sequence:
  - action: media_player.play_media
    metadata: {}
    data:
      media_content_id: /media/sounds/temp/chime_tts/2244e07096a73d62bfff2a48e0509955.mp3
      media_content_type: music
    target:
      entity_id: media_player.dynaudio_airplay

Hi all,
Hope somebody can help me: I have set-up the OpenAI TTS integration via HACS and that works fine “stand alone” from the developer tools.

However when I select OpenAI TTS as TTS platform in Chime TTS nothing happens and I get these kind of errors:

The openai_tts platform was not found. Please check that it has been configured correctly

Why can that be, did I overlook something? I removed and reinstalled OpenAI TTS, restarted a couple of time, but to no avail.
Need to use another OpenAI TTS integration?

Hey @Sebastiaan1 i’m surprised that it’s working as a standard media_player.play_media action outside of Chime TTS as they should be the same as far as Home Assistant is concerned (Chime TTS creates the MP3, and then plays it).
Clearly there’s no issue with the file generated, given that it plays correctly, but it’s still unclear to me what changes when played through the chime_tts.say action. Also, given that it was working initially, but stopped at some point suggests the issue might be related to a change unrelated to Chime TTS.

I’m afraid without further information I don’t know what else might be involved in the cause of the issue.

Perhaps other users have experienced and solved the same issue?

Hi @Bikey.

I just tested the OpenAI TTS integration from HACS and was able to use it with Chime TTS. I recommend you check that the tts_platform parameter value you use when calling the chime_tts.say, matches the OpenAI TTS’ entity_id.

To check the entity_id of your OpenAI TTS integration, go to:
Settings > Devices & Services > OpenAI TTS
Then select on the “1 entity” option, and note the entity_id value

Hi @Nimrod_Dolev
Thanks so much for validating and giving these pointers, that helped!

I was using the dropdown-list for the TTS providers that only give the generic names, “OpenAI TTS” while my entity was called tts.openai_sd

Changing that fixed that, but the dropdown list apperently is not populated with the names of actually configured TTS-providers with the proper naming.

Still having a strange thing; that if I provide a voice (using the option-field for that in Chime TTS) to override the configered voice from the OpenAI integration, it will giva an error:

Error calling tts.media_source.generate_media_source_id: Invalid options found: ['voice']

I can work around that by configuring multiple OpenAI TTS instances, but perhaps good to check if you can reproduce that if you have time.

Glad it worked for you @Bikey.

the dropdown list apperently is not populated with the names of actually configured TTS-providers with the proper naming.

In the next release I will try to limit the list of TTS platforms populated to only those installed, like you suggested :+1:

if I provide a voice (using the option-field for that in Chime TTS) to override the configered voice from the OpenAI integration, it will giva an error

You can change the OpenAI voice by setting the voice parameter (not the options YAML parameter.)
Also, I think you are limited to voices from the list of standard/default voices - but that might depend on your subscription from ElevenLabs, i’m not sure.

I’m not sure what you mean? Either using the voice parameter in the Chime TTS integration or using it the Developer tools/Action template results in an error:
So this does not work and gives the “invalid options found” error:


Changing the voice parameter in the Integration config of OpenAI TTS does work.
So this works, but it would be nice to be able to override that for specific automations:

Hey, can anyone help me with my post over on github? I didn’t want to hijack this thread (like I have before… it is kind of a smorgesborg of things now - so I posted in Discussions so that we can find these separate issues easier) but haven’t received any views. :frowning: Thank you!