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

I think I have seen this requested already but can I add my vote to the request to please support ssml.

I use google_cloud and if youi want to use onr of the decent voices it is required. I don’t know if other TTS services support ssml but with Google Cloud it is simply an extra config variable

(Google cloud HA reference)

image

And another one…

What is wrong with this?

image

Hi @klogg … I believe you need to have your device outside of your data parameters. Try this and it should work:

service: chime_tts.say
data:
  message: hello
  volume_level: 0.15
target:
  entity_id: media_player.sonos_kitchen

EDIT: I upgraded to the latest beta and that might have fixed it…


Thanks, I tried that and it does indeed work, as does

service: chime_tts.say
data:
  message: hello
  volume_level: 0.15
  entity_id: media_player.sonos_kitchen

Using target is a relatively new thing in HA and is always optional - although I have found at least one case using the Services (or Actions - I haven’t upgraded to 2024.08 yet) page that requires it.

HOWEVER
I specifically want to use the form shown in the docs

volume_level:
  - media_player.kitchen: 1.00
  - media_player.bedroom: 0.45
  - media_player.living_room: 0.75
  - media_player.study: 0.5

but whatever I try I still get the same error
image

:person_shrugging:

Were you able to confirm if using the latest beta fixed the issue? I’m still using beta 3 because beta 4 breaks my notifications with alexa devices. (you’re using sonos I see)

I am using Sonos and I think my issue is fixed.

I first used Chime TTS when it was first released but to my shame never got around to fully testing it.
I have a stupidly over engineered announcement package that I wrote to do a lot of what Chime TTS does and it has worked well for a many years so inertia took hold.

Chime TTS provides the same functionality and more all in one service call so I am currently migrating all my announcements.

It’s taking me a while as I’m writing a ‘wrapper’ so that I can generate a service call with as many or as few parameters as I like with defaults applied where necessary.

But yes the beta 4 seems stable albeit without any heavy testing yet.


I just hope development carries on with this or at least that @Nimrod_Dolev doesn’t abandon it and that a future HA release doesn’t break it beyond repair. I don’t usually choose to rely on custom components for important things but the advantages of Chime TTS are fairly compelling.

Nimrod_Dolev has been great in addressing issues that have come up! And yeah, I hope that he doesn’t abandon it either.

I think he might be on a break cause we haven’t heard from him as of recent, but that’s okay! Every now and then I walk away from HAss too! We all need breaks now and then. I for one really appreciate the work he’s put into it thus far! If only I knew more about this to help him out, I would.

Hey everyone, I just wanted to update that I’ve been busy with work recently and haven’t had much time for Chime TTS - but I am still here and plan to continue to maintain and extend the integration.

Thanks to everyone for your interest, cooperation and patience :+1:

5 Likes

I was sure I had this working yesterday… :person_shrugging:

EDIT: logs added

2024-08-14 21:12:32.952 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╔════════════════════════════════════════════╗
2024-08-14 21:12:32.952 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ║ Chime TTS Say Called. Version v1.1.4-beta4 ║
2024-08-14 21:12:32.952 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ╚════════════════════════════════════════════╝
2024-08-14 21:12:32.952 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-08-14 21:12:33.154 ERROR (MainThread) [custom_components.chime_tts.queue_manager] Service call failed: float() argument must be a string or a real number, not 'list'
2024-08-14 21:12:33.154 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Queue now empty
2024-08-14 21:12:33.154 ERROR (MainThread) [custom_components.chime_tts] Error calling chime_tts.say service: float() argument must be a string or a real number, not 'list'
2024-08-14 21:12:33.154 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Error for call_service at pos 1: float() argument must be a string or a real number, not 'list'
2024-08-14 21:12:33.154 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140171008720272] Error handling message: float() argument must be a string or a real number, not 'list' (home_assistant_error) Steve from 192.168.1.63 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0)

It’s not working for me either. It partially works (the message: Hello) sometimes happens, sometimes not. But the volume doesn’t change any time I run the service.

YAML:

data:
  message: hello!
  volume_level:
    entity_id:
      - eb6e6046a6c8b41db1f12f09f5811ae3: 0.9
      - cbe11566dd6ed0a334f41fc51566c1f1: 0.9
      - bec8cf8ad0fcf70965e8eb5cce0f4654: 0.9
      - 322edcdc4d150965cd83f89dbe656459: 0.9
target:
  device_id:
    - eb6e6046a6c8b41db1f12f09f5811ae3
    - cbe11566dd6ed0a334f41fc51566c1f1
    - bec8cf8ad0fcf70965e8eb5cce0f4654
    - 322edcdc4d150965cd83f89dbe656459
enabled: true
action: chime_tts.say

Logs:

2024-08-14 13:33:24.073 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v1.1.4-beta3 -----
2024-08-14 13:33:24.073 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- General Parameters -----
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * entity_ids:
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 0: media_player.colton_s_echo_show
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 1: media_player.bathroom_echo_show_5
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 2: media_player.kitchen_echo_plus_amz
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 3: media_player.apartment_door_echo_amz
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * cache = False
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * offset = 450.0
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * final_delay = 0.0
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * message = hello!
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_speed = 100.0
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_pitch = 0
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * announce = False
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * fade_audio = False
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * volume_level = {'entity_id': [{'eb6e6046a6c8b41db1f12f09f5811ae3': 0.9}, {'cbe11566dd6ed0a334f41fc51566c1f1': 0.9}, {'bec8cf8ad0fcf70965e8eb5cce0f4654': 0.9}, {'322edcdc4d150965cd83f89dbe656459': 0.9}]}
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * join_players = False
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * unjoin_players = False
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * audio_conversion = -y -ac 2 -codec:a libmp3lame -b:a 48k -ar 24000 -write_xing 0
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * media_players_array:
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 0: entity_id: media_player.colton_s_echo_show
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      platform: alexa_media
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      initial volume: 0.5
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      target volume: -1.0
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      now playing: False
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      join supported: False
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      announce supported: False
2024-08-14 13:33:24.078 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 1: entity_id: media_player.bathroom_echo_show_5
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      platform: alexa_media
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      initial volume: -1.0
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      target volume: -1.0
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      now playing: False
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      join supported: False
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      announce supported: False
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 2: entity_id: media_player.kitchen_echo_plus_amz
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      platform: alexa_media
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      initial volume: 0.5
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      target volume: -1.0
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      now playing: False
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      join supported: False
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      announce supported: False
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 3: entity_id: media_player.apartment_door_echo_amz
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      platform: alexa_media
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      initial volume: 0.5
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      target volume: -1.0
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      now playing: False
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      join supported: False
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      announce supported: False
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  --- Audio will be converted to Alexa-friendly format as Alexa speaker/s detected ---
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  - Using default TTS platform: 'amazon_polly'
2024-08-14 13:33:24.079 DEBUG (MainThread) [custom_components.chime_tts]  - Generating new TTS audio with parameters:
2024-08-14 13:33:24.080 DEBUG (MainThread) [custom_components.chime_tts]     * tts_platform = 'amazon_polly'
2024-08-14 13:33:24.080 DEBUG (MainThread) [custom_components.chime_tts]     * message = 'hello!'
2024-08-14 13:33:24.080 DEBUG (MainThread) [custom_components.chime_tts]     * cache = False
2024-08-14 13:33:24.080 DEBUG (MainThread) [custom_components.chime_tts]     * language = None
2024-08-14 13:33:24.080 DEBUG (MainThread) [custom_components.chime_tts]     * options = {}
2024-08-14 13:33:24.171 DEBUG (MainThread) [custom_components.chime_tts]    ...TTS audio generated in 90.0ms
2024-08-14 13:33:24.172 DEBUG (MainThread) [custom_components.chime_tts]  - Saving mp3 file to public folder: /config/www/chime_tts/...
2024-08-14 13:33:24.221 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] File saved to path: /config/www/chime_tts/qrbax23m.mp3
2024-08-14 13:33:24.221 DEBUG (MainThread) [custom_components.chime_tts]   - Performing FFmpeg audio conversion...
2024-08-14 13:33:24.221 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] Converting audio: "ffmpeg -i /config/www/chime_tts/qrbax23m.mp3 -y -ac 2 -codec:a libmp3lame -b:a 48k -ar 24000 -write_xing 0 /config/www/chime_tts/qrbax23m_converted.mp3"
2024-08-14 13:33:24.269 DEBUG (MainThread) [custom_components.chime_tts]     ...FFmpeg audio conversion completed.
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts]  - Chime TTS audio generated:
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts]    * audio_duration = 0.576
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts]    * local_path = None
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts]    * public_path = "https://8lrqd5sedc7tmv4pqljn3e6xi8485zqb.ui.nabu.casa//local/chime_tts/qrbax23m.mp3"
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts]    * media_content_id = None
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts] ****************************
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts] *** Pre-Playback Actions ***
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts] ****************************
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts] **************************
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts] *** Chime TTS playback ***
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts] **************************
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts]    4 Alexa media players detected:
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts]      - media_player.colton_s_echo_show
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts]      - media_player.bathroom_echo_show_5
2024-08-14 13:33:24.522 DEBUG (MainThread) [custom_components.chime_tts]      - media_player.kitchen_echo_plus_amz
2024-08-14 13:33:24.523 DEBUG (MainThread) [custom_components.chime_tts]      - media_player.apartment_door_echo_amz
2024-08-14 13:33:24.523 DEBUG (MainThread) [custom_components.chime_tts]    Calling notify.alexa_media with data:
2024-08-14 13:33:24.523 DEBUG (MainThread) [custom_components.chime_tts]      - message: <audio src="https://8lrqd5sedc7tmv4pqljn3e6xi8485zqb.ui.nabu.casa//local/chime_tts/qrbax23m.mp3"/>
2024-08-14 13:33:24.523 DEBUG (MainThread) [custom_components.chime_tts]      - data: {'type': 'tts'}
2024-08-14 13:33:24.523 DEBUG (MainThread) [custom_components.chime_tts]      - target: ['media_player.colton_s_echo_show', 'media_player.bathroom_echo_show_5', 'media_player.kitchen_echo_plus_amz', 'media_player.apartment_door_echo_amz']
2024-08-14 13:33:24.524 DEBUG (MainThread) [custom_components.chime_tts]  - Waiting 0.576s for audio playback to complete...
2024-08-14 13:33:25.100 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper]  - Waiting until 4 media_players aren't playing...
2024-08-14 13:33:25.101 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper]    ✔ media_player.colton_s_echo_show
2024-08-14 13:33:25.101 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper]    ✔ media_player.bathroom_echo_show_5
2024-08-14 13:33:25.101 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper]    ✔ media_player.kitchen_echo_plus_amz
2024-08-14 13:33:25.101 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper]    ✔ media_player.apartment_door_echo_amz
2024-08-14 13:33:25.101 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 1.03 s -----

I’m getting, “Sorry, I’m having trouble accessing your Simon Says NA Skill right now” even though I haven’t changed anything in Alexa Media Player. I can use notify.alexa_media just fine - IOW I don’t get the error like I do with chime_tts.say.

For Alexa users, Alexa Media Player has been having issues lately so I wonder we are still being affected by unknown reasons with AMP.


EDIT: Looking at the logs again, I see the public URL has an extra ’ / ’ just before “local”.

I checked and I didn’t add 2 of them at the end of my nabucasa url in AMP. So it’s being added by Chime TTS.

public_path = “https://< redacted >.ui.nabu.casa//local/chime_tts/qrbax23m.mp3”

1 Like

Absolutely no offence meant to anyone but it is slightly frustrating that I seem to have hit a block with a very minimal config especially as I am 99% certain it was working before.

I’ll wait and see what develops.

I’m now able to play the chimes again via Chime TTS - though no update was done. I think for me it had something to do with Alexa Media Player. There was an update to it today, and now I can play chimes via Chime TTS. I know you’re using Sonos. Just wanted to mention about my situation now.

Well despite considering it a fools errand your ‘success’ prompted me to try again despite as you say using Sonos not Alexa.

Well… I ‘mis-typed’ the Action as

image

instead of

image

And it worked. So something is up. Possibly the docs have a typo?

image

Or I’m missing something else obvious.

I haven’t had a chance to run round the house checking with more than one media player yet…

TTS does not work with the new OS 18 for HomePods…anyone can confirm this issue?

I am interested into Chime TTS because of its lag free feature, but I would like to play an MP3 without having to use also a TTS message.

Is this actually possible? :thinking:

Hi @Cr4z33! Yes, you can play MP3s but they need to be the following:

  • MPEG version 2
  • Bit rate needs to be 48 kbps
  • Total length cannot be larger than 240 seconds

Chime_TTS can automatically convert any mp3 you save (that’s under 240 secs) in your custom chime audio folder, to the correct parameters using the ‘Audio Conversion’ option shown in Chime_TTS.

Here are two examples (one local file and one internet hosted):

data:
  audio_conversion: Alexa
  chime_path: /config/www/mp3/ooh-that-feels-good.mp3
enabled: true
action: chime_tts.say
target:
  entity_id: media_player.colton_s_echo_show

Internet Hosted MP3:

data:
  audio_conversion: Alexa
  chime_path: https://s3.amazonaws.com/jovo-songs/song1.mp3
enabled: true
action: chime_tts.say
target:
  entity_id: media_player.colton_s_echo_show

**Note: you may receive an pop up error for timing out, but it doesn’t affect playing the mp3:

Error calling chime_tts.say service: Service call timed out after 20.08s (configured timeout = 20s)

time-out

@Nimrod_Dolev, is the timeout something that could be adjusted to match the audio duration of the selected mp3 file so that the error isn’t received? I tried adding a final_delay but it didn’t prevent the pop up error.

1 Like

Hello, this is not strictly related to Chime TTS, but I was wondering if anyone has any ideas:

I’m trying to tackle a specific use case: I want to fetch an online mp3 audio source and play it. The problem is that the audio is long and takes one or two seconds to load. (The source may be updated anytime and cannot be cached.)

Is there a way to play a chime as the audio source is being loaded, so as to hide the latency?

Hi @klogg ,
I’m also having some Sonos devices where I use ChimeTTS, but I’m interested in your ‘wrapper’. Is it possible to share your code

Kind Regards
Kris

Something strange since a few days.
In an automation , when a select “action : Chime TTS : say” I have no options.
So my HomePod mini doesn’t “say” anything.

(The problem exist for a new automation but also for old ones which worked fine before)
thanks