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

The issue might be caused by an incorrect folder path in your configuration. Check that the path you have for your chime_tts.say_url is a valid absolute path to a publicly facing folder:

Hi, that folder does exist, and is empty.

/root/config/www/sounds/chime_tts

Try removing /root from the start of the folder path and try again.

If you’re still having the issue, I suggest you enable debug logging and share the debug log messages here - maybe there might be something useful there:

  1. Turn on debug logging:

    service: logger.set_level
    data:
      custom_components.chime_tts: debug
    
  2. Call the service chime_tts.say_url again.

  3. Check your log messages in Home Assistant:

    https://{YOUR_HOME_ASSISTANT_ADDRESS}:8123/config/logs?filter=chime_tts
    

    and click LOAD FULL LOGS


EDIT: The issue might instead be related to your permissions. You may need to add the path to the allowlist_external_dirs in your configuration.yaml file:

homeassistant:
  allowlist_external_dirs:
    - "/root/config/www"

This is fantastic, thanks!
I can get this to work:

service: media_player.play_media
target:
  entity_id: media_player.livingroomsatellite
data:
  media_content_id: media-source://media_source/local/temp/chime_tts/announcements/t_biykyn.mp3
  media_content_type: audio/mpeg
metadata:
  media_class: music
  children_media_class: null
  navigateIds:
    - {}
    - media_content_type: app
      media_content_id: media-source://media_source

But if I try to use the full url generated by Chime TTS: Say URL, I get an error.
Is there any way to truncate the url down to:
/temp/chime_tts/announcements/t_biykyn.mp3 instead of the full url of:
http://192.168.86.193:8123/media/temp/chime_tts/announcements/t_biykyn.mp3

Currently, you can call the chime_tts.say_url service and truncate the url value from the response object:

{{ chime_tts_say_url_response.split('http://192.168.86.193:8123/media')[1] }}

The next version of Chime TTS includes a media_content_id field in the chime_tts.say_url response object, which will allow you to use it more easily with the media_player.play_media service, for example.

1 Like

Thanks - if I use

    - "/root/config/www"

it tells me it’s not a directory, but I was able to use

    - "/config/www"

without it complaining. However, it’s still not saving the file to the directory. Weirdly, the logging thinks it is! Thanks for the help.

2024-03-18 20:50:40.235 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say URL Called. Version v0.13.0 -----

2024-03-18 20:50:40.235 DEBUG (MainThread) [custom_components.chime_tts.helpers] ----- General Parameters -----

2024-03-18 20:50:40.236 DEBUG (MainThread) [custom_components.chime_tts.helpers] * entity_ids = []

2024-03-18 20:50:40.236 DEBUG (MainThread) [custom_components.chime_tts.helpers] * cache = False

2024-03-18 20:50:40.236 DEBUG (MainThread) [custom_components.chime_tts.helpers] * offset = 450.0

2024-03-18 20:50:40.237 DEBUG (MainThread) [custom_components.chime_tts.helpers] * final_delay = 0.0

2024-03-18 20:50:40.237 DEBUG (MainThread) [custom_components.chime_tts.helpers] * message = hello hello

2024-03-18 20:50:40.237 DEBUG (MainThread) [custom_components.chime_tts.helpers] * tts_platform = google_translate

2024-03-18 20:50:40.237 DEBUG (MainThread) [custom_components.chime_tts.helpers] * tts_playback_speed = 100.0

2024-03-18 20:50:40.238 DEBUG (MainThread) [custom_components.chime_tts.helpers] * announce = False

2024-03-18 20:50:40.238 DEBUG (MainThread) [custom_components.chime_tts.helpers] * volume_level = -1.0

2024-03-18 20:50:40.238 DEBUG (MainThread) [custom_components.chime_tts.helpers] * join_players = False

2024-03-18 20:50:40.238 DEBUG (MainThread) [custom_components.chime_tts.helpers] * unjoin_players = False

2024-03-18 20:50:40.239 DEBUG (MainThread) [custom_components.chime_tts] async_get_playback_audio_path

2024-03-18 20:50:40.239 DEBUG (MainThread) [custom_components.chime_tts] async_request_tts_audio(tts_platform='google_translate', message='hello hello', tts_playback_speed=100.0, cache=False, language=None, options={})

2024-03-18 20:50:40.239 DEBUG (MainThread) [custom_components.chime_tts] - Generating TTS audio...

2024-03-18 20:50:40.882 DEBUG (MainThread) [custom_components.chime_tts] - ...TTS audio completed in 642.575 ms

2024-03-18 20:50:40.882 DEBUG (MainThread) [custom_components.chime_tts] - Final audio created. Duration: 1.392s

2024-03-18 20:50:40.884 DEBUG (MainThread) [custom_components.chime_tts] - Saving mp3 file...

2024-03-18 20:50:41.089 DEBUG (MainThread) [custom_components.chime_tts.helpers] - File saved successfully

2024-03-18 20:50:41.089 DEBUG (MainThread) [custom_components.chime_tts.helpers] - File saved to path: /www/chime_tts/3wcs85cp.mp3

2024-03-18 20:50:41.089 DEBUG (MainThread) [custom_components.chime_tts] - Filepath = '/www/chime_tts/3wcs85cp.mp3'

2024-03-18 20:50:41.089 DEBUG (MainThread) [custom_components.chime_tts] - File saved successfully

2024-03-18 20:50:41.090 DEBUG (MainThread) [custom_components.chime_tts] - audio_dict = {'audio_path': '/www/chime_tts/3wcs85cp.mp3', 'audio_duration': 1.392}

2024-03-18 20:50:41.090 DEBUG (MainThread) [custom_components.chime_tts] Saving to chime_tts storage:

2024-03-18 20:50:41.090 DEBUG (MainThread) [custom_components.chime_tts] - key: "x"

2024-03-18 20:50:41.090 DEBUG (MainThread) [custom_components.chime_tts] - value: "{'audio_path': '/www/chime_tts/3wcs85cp.mp3', 'audio_duration': 1.392}"

2024-03-18 20:50:41.097 DEBUG (MainThread) [custom_components.chime_tts] Final URL = https://x.x.x:8123/local/chime_tts/3wcs85cp.mp3

2024-03-18 20:50:41.097 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say URL Completed in 861.758 ms -----

@Nimrod_Dolev Is it possible to include coding to mute the confirmation beep when changing volume levels with Alexa? There are a few articles that explain how to do it but that I found but I am not sure if you know of an easy way to do it yourself?

Reason: If I am watching a movie, I want the volume to increase on my alexa devices to alert me that someone is at the door. I don’t want to hear the BEEP prior to the chime playing, nor after when the volume is decreased.

Is this something you can implement in Chime TTS?

Hi @ColtonYYZ. I will look into it :+1:

1 Like

Something is wrong with your configuration set up. The media_content_id should be the FQN of your HA installation either through NabuCassa, DuckDNS, or your own private domain.

Sorry to bring this up again, but I’d love to be able to get access to the MP3 file. Any ideas anyone?

You’re able to get that by using the say_url function - it’l return the full url of the mp3 but you can parse it to find the location. Also look in the folder “/homeassistant/www/chime_tts”

sadly not!

I created an open issue in the github page for Chime_TTS a month ago, no response.

Also a request, add Elevenlabs_TTS to the available choices of platforms

Does your Chime_TTS look like this?

It looks like this, so the same apart from the chime TTS mp3s URL option.
I tried to amend it to include the “/config/”, but when I save, it switches it back!

Chime SAY works but Chime Say URL does not. But the logs are misleading because they say things are being saved which are not.

Working:

2024-03-25 15:44:08.690 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v0.13.1-beta13 -----
2024-03-25 15:44:08.691 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-03-25 15:44:08.691 DEBUG (MainThread) [custom_components.chime_tts.helpers] ``` is_say_url = False
2024-03-25 15:44:08.693 DEBUG (MainThread) [custom_components.chime_tts.helpers] ----- General Parameters -----
2024-03-25 15:44:08.693 DEBUG (MainThread) [custom_components.chime_tts.helpers] * entity_ids = ['media_player.vlc_telnet']
2024-03-25 15:44:08.693 DEBUG (MainThread) [custom_components.chime_tts.helpers] * cache = False
2024-03-25 15:44:08.694 DEBUG (MainThread) [custom_components.chime_tts.helpers] * offset = 450.0
2024-03-25 15:44:08.694 DEBUG (MainThread) [custom_components.chime_tts.helpers] * final_delay = 0.0
2024-03-25 15:44:08.694 DEBUG (MainThread) [custom_components.chime_tts.helpers] * message = Shamone!
2024-03-25 15:44:08.694 DEBUG (MainThread) [custom_components.chime_tts.helpers] * tts_platform = google_translate
2024-03-25 15:44:08.694 DEBUG (MainThread) [custom_components.chime_tts.helpers] * tts_playback_speed = 100.0
2024-03-25 15:44:08.695 DEBUG (MainThread) [custom_components.chime_tts.helpers] * announce = False
2024-03-25 15:44:08.695 DEBUG (MainThread) [custom_components.chime_tts.helpers] * volume_level = -1.0
2024-03-25 15:44:08.695 DEBUG (MainThread) [custom_components.chime_tts.helpers] * join_players = False
2024-03-25 15:44:08.695 DEBUG (MainThread) [custom_components.chime_tts.helpers] * unjoin_players = False
2024-03-25 15:44:08.698 DEBUG (MainThread) [custom_components.chime_tts] - Generating new TTS audio with parameters:
2024-03-25 15:44:08.698 DEBUG (MainThread) [custom_components.chime_tts] * tts_platform = 'google_translate'
2024-03-25 15:44:08.698 DEBUG (MainThread) [custom_components.chime_tts] * message = 'Shamone!'
2024-03-25 15:44:08.699 DEBUG (MainThread) [custom_components.chime_tts] * tts_playback_speed = 100.0
2024-03-25 15:44:08.699 DEBUG (MainThread) [custom_components.chime_tts] * cache = False
2024-03-25 15:44:08.699 DEBUG (MainThread) [custom_components.chime_tts] * language = 'None'
2024-03-25 15:44:08.699 DEBUG (MainThread) [custom_components.chime_tts] * options = {}
2024-03-25 15:44:09.367 DEBUG (MainThread) [custom_components.chime_tts] ...TTS audio completed in 668.8570000000001 ms
2024-03-25 15:44:09.367 DEBUG (MainThread) [custom_components.chime_tts] - Saving mp3 file to folder: /media/sounds/temp/chime_tts/...
2024-03-25 15:44:09.555 DEBUG (MainThread) [custom_components.chime_tts.helpers] - File saved to path: /media/sounds/temp/chime_tts/_jvu5x_c.mp3
2024-03-25 15:44:09.555 DEBUG (MainThread) [custom_components.chime_tts] - Chime TTS audio generated: {'audio_duration': 1.152, 'local_path': '/media/sounds/temp/chime_tts/_jvu5x_c.mp3', 'public_path': None}
2024-03-25 15:44:09.556 DEBUG (MainThread) [custom_components.chime_tts] - 1 Standard media player detected. Calling `media_player.play_media` service
2024-03-25 15:44:09.556 DEBUG (MainThread) [custom_components.chime_tts] Calling media_player.play_media with data:
2024-03-25 15:44:09.556 DEBUG (MainThread) [custom_components.chime_tts] - media_content_type: music
2024-03-25 15:44:09.556 DEBUG (MainThread) [custom_components.chime_tts] - media_content_id: media-source://media_source/local/sounds/temp/chime_tts/_jvu5x_c.mp3
2024-03-25 15:44:09.556 DEBUG (MainThread) [custom_components.chime_tts] - entity_id: ['media_player.vlc_telnet']
2024-03-25 15:44:09.557 DEBUG (MainThread) [custom_components.chime_tts] Waiting 1.152s for audio playback to complete...
2024-03-25 15:44:10.719 DEBUG (MainThread) [custom_components.chime_tts.helpers] - Waiting until media_player.vlc_telnet is no longer = playing...
2024-03-25 15:44:14.948 DEBUG (MainThread) [custom_components.chime_tts.helpers] ...media_player.vlc_telnet is now idle
2024-03-25 15:44:14.949 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 6257.627 ms -----

Not working:-

2024-03-25 15:47:08.912 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say URL Called. Version v0.13.1-beta13 -----
2024-03-25 15:47:08.913 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-03-25 15:47:08.913 DEBUG (MainThread) [custom_components.chime_tts.helpers] ``` is_say_url = True
2024-03-25 15:47:08.914 DEBUG (MainThread) [custom_components.chime_tts.helpers] ----- General Parameters -----
2024-03-25 15:47:08.914 DEBUG (MainThread) [custom_components.chime_tts.helpers] * entity_ids = []
2024-03-25 15:47:08.914 DEBUG (MainThread) [custom_components.chime_tts.helpers] * cache = False
2024-03-25 15:47:08.914 DEBUG (MainThread) [custom_components.chime_tts.helpers] * offset = 450.0
2024-03-25 15:47:08.915 DEBUG (MainThread) [custom_components.chime_tts.helpers] * final_delay = 0.0
2024-03-25 15:47:08.915 DEBUG (MainThread) [custom_components.chime_tts.helpers] * message = Awooga!
2024-03-25 15:47:08.915 DEBUG (MainThread) [custom_components.chime_tts.helpers] * tts_platform = google_translate
2024-03-25 15:47:08.915 DEBUG (MainThread) [custom_components.chime_tts.helpers] * tts_playback_speed = 100.0
2024-03-25 15:47:08.915 DEBUG (MainThread) [custom_components.chime_tts.helpers] * announce = False
2024-03-25 15:47:08.915 DEBUG (MainThread) [custom_components.chime_tts.helpers] * volume_level = -1.0
2024-03-25 15:47:08.915 DEBUG (MainThread) [custom_components.chime_tts.helpers] * join_players = False
2024-03-25 15:47:08.916 DEBUG (MainThread) [custom_components.chime_tts.helpers] * unjoin_players = False
2024-03-25 15:47:08.916 DEBUG (MainThread) [custom_components.chime_tts] - Generating new TTS audio with parameters:
2024-03-25 15:47:08.916 DEBUG (MainThread) [custom_components.chime_tts] * tts_platform = 'google_translate'
2024-03-25 15:47:08.916 DEBUG (MainThread) [custom_components.chime_tts] * message = 'Awooga!'
2024-03-25 15:47:08.917 DEBUG (MainThread) [custom_components.chime_tts] * tts_playback_speed = 100.0
2024-03-25 15:47:08.917 DEBUG (MainThread) [custom_components.chime_tts] * cache = False
2024-03-25 15:47:08.917 DEBUG (MainThread) [custom_components.chime_tts] * language = 'None'
2024-03-25 15:47:08.917 DEBUG (MainThread) [custom_components.chime_tts] * options = {}
2024-03-25 15:47:09.606 DEBUG (MainThread) [custom_components.chime_tts] ...TTS audio completed in 689.3399999999999 ms
2024-03-25 15:47:09.606 DEBUG (MainThread) [custom_components.chime_tts] - Saving mp3 file to folder: /www/chime_tts/...
2024-03-25 15:47:09.793 DEBUG (MainThread) [custom_components.chime_tts.helpers] - File saved to path: /www/chime_tts/z5p0l_ze.mp3
2024-03-25 15:47:09.800 DEBUG (MainThread) [custom_components.chime_tts] - Saving data to chime_tts storage:
2024-03-25 15:47:09.801 DEBUG (MainThread) [custom_components.chime_tts] - key: "fd67b1d08f43e83b402a01f18b05c91da8f3ba0043e238cdd4e04665a39fd950"
2024-03-25 15:47:09.801 DEBUG (MainThread) [custom_components.chime_tts] - value: "{'public_path': '/www/chime_tts/z5p0l_ze.mp3', 'audio_duration': 1.008}"
2024-03-25 15:47:09.873 DEBUG (MainThread) [custom_components.chime_tts] - Chime TTS audio generated: {'audio_duration': 1.008, 'local_path': None, 'public_path': '/www/chime_tts/z5p0l_ze.mp3'}
2024-03-25 15:47:09.874 DEBUG (MainThread) [custom_components.chime_tts] Final URL = /www/chime_tts/z5p0l_ze.mp3
2024-03-25 15:47:09.874 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say URL Completed in 960.592 ms -----

The editor in HASS is wierd - try prepending the /www/chime_tts parameter with /config THEN press TAB. should take you to the next line without clearing your entry.
Then you should be able to save it.

also I’m puzzled by the line from your log output that says:

media_content_id: media-source://media_source/local/sounds/temp/chime_tts/_jvu5x_c.mp3

the media_content_id: should be a ip address or FQN do you have any network connection to your hass server from outside your network? Is media_source a network name?

this is what I get from mine:

https://xxxxxhome.duckdns.org:443/local/chime_tts/_75web41.mp3

not sure, might be because I’m using the VLC Media Player Telnet application as a target just to get it to generate the TTS MP3?

Sadly not. Might have to do this? chime_tts.say_url default save folder doesn't seem to exist, but works with modifications · Issue #86 · nimroddolev/chime_tts · GitHub Seems strange that only some of us have this issue.

But also the folder paths aren’t consistent - the /media/ one really is ‘above’ the ‘config’ directory but the ‘www’ one is beneath it.

I know that when I starting using this package, I had some false starts. I’ve completely deleted the whole thing including going to the /custom_components folder an making sure that there weren’t any residual pieces laying about. Then reinstalling from HACS and entering the values in the configuration as they are now.

Might be something to try.

I’ve been working on a substantial release which includes quite a few new features and bugfixes which include issues with the default folder paths for both chime_tts.say and chime_tts.say_url.

It’s not quite ready, and the documentation isn’t complete yet, but I would be grateful for feedback whether these issues persist for you in the new version or have been addressed so I have released a beta (v0.14.0-beta1).

To install the beta version:

  1. Open the Chime TTS repository in HACS

  2. Click on the button in the top right

  3. Select the ↻ Redownload option

  4. Enable the Show beta versions option (it may take a moment to update the list)

  5. Select version v0.14.0-beta1 from the updated version drop-down list

  6. Restart Home Assistant

1 Like