nimroddolev / chime_tts

A custom Home Assistant integration to play combined audio files before and/or after text-to-speech (TTS) messages
https://nimroddolev.github.io/chime_tts/
MIT License
196 stars 14 forks source link

Chime TTS: Say - Audio cut off #131

Closed ajpalm closed 6 months ago

ajpalm commented 6 months ago

System Health details

System Information

version core-2024.5.2
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 6.6.25-haos
arch x86_64
timezone Australia/Sydney
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4887 Installed Version | 1.34.0 Stage | running Available Repositories | 1400 Downloaded Repositories | 13
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 12.2 -- | -- update_channel | stable supervisor_version | supervisor-2024.04.4 agent_version | 1.6.0 docker_version | 25.0.5 disk_total | 30.8 GB disk_used | 24.9 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | File editor (5.8.0), Duck DNS (1.17.0), Samba share (12.3.1), Home Assistant Google Drive Backup (0.112.1), Advanced SSH & Web Terminal (17.2.0), ESPHome (2024.4.2)
Dashboards dashboards | 10 -- | -- resources | 6 views | 48 mode | storage
Recorder oldest_recorder_run | 4 May 2024 at 00:05 -- | -- current_recorder_run | 7 May 2024 at 14:37 estimated_db_size | 1788.18 MiB database_engine | sqlite database_version | 3.44.2

Checklist

Describe the issue

Is using Chime TTS: Say to alert with only a Chime select, no message. The Chime is cut off early.

Reproduction steps

  1. Create a alert using Chime TTS: Say
  2. Select Mario Coin for the Chime Path
  3. Leave Message blank
  4. Run the alert
  5. Mario Coin will be cut off before completed ...

Debug logs

2024-05-07 14:46:48.196 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v1.0.0 -----
2024-05-07 14:46:48.196 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]  players found: [{'entity_id': 'media_player.home', 'should_change_volume': True, 'initial_volume_level': 1.0, 'group_members_supported': False, 'announce_supported': False, 'resume_media_player': False}]
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- General Parameters -----
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * entity_ids = ['media_player.home']
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * chime_path = mario_coin
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * cache = False
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * offset = 450.0
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * final_delay = 0.0
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_platform = google_translate
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_speed = 100.0
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_pitch = 0
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * announce = True
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * volume_level = 0.9
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * join_players = True
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * unjoin_players = True
2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts]  - Retrieving audio from path: "custom_components/chime_tts/mp3s/mario_coin.mp3"...
2024-05-07 14:46:48.293 DEBUG (MainThread) [custom_components.chime_tts]    ...audio retrieved. Duration: 0.917s
2024-05-07 14:46:48.293 DEBUG (MainThread) [custom_components.chime_tts]  - Saving mp3 file to folder: /media/sounds/temp/chime_tts/...
2024-05-07 14:46:48.350 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem]  - File saved to path: /media/sounds/temp/chime_tts/0_zh_qmi.mp3
2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts]  - Chime TTS audio generated:
2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts]    - audio_duration = 0.917
2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts]    - local_path = "/media/sounds/temp/chime_tts/0_zh_qmi.mp3"
2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts]    - public_path = None
2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts]    - media_content_id = "media-source://media_source/local/sounds/temp/chime_tts/0_zh_qmi.mp3"
2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts]  *** Pre-Playback Actions *** 
2024-05-07 14:46:48.444 WARNING (MainThread) [custom_components.chime_tts] Unable to join speakers. No supported media_players found.
2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts]  - Setting volume level to 0.9 for 1 non-fade in/out media_player
2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]  - Setting media_player.home's volume to 0.9
2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts]  *** Chime TTS playback ***
2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts]    1 Standard media player detected:
2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts]      - media_player.home
2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts]    Calling media_player.play_media with data:
2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts]      - media_content_type: music
2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts]      - media_content_id: media-source://media_source/local/sounds/temp/chime_tts/0_zh_qmi.mp3
2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts]      - announce: True
2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts]      - entity_id: ['media_player.home']
2024-05-07 14:46:48.457 DEBUG (MainThread) [custom_components.chime_tts]  - Waiting 0.917s for audio playback to complete...
2024-05-07 14:46:49.376 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]  - Waiting until 1 media_player isn't playing...
2024-05-07 14:46:49.978 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]    ✔ media_player.home
2024-05-07 14:46:49.978 DEBUG (MainThread) [custom_components.chime_tts]  *** Post-Playback Actions ***
2024-05-07 14:46:49.978 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]  - Setting media_player.home's volume to 1.0
2024-05-07 14:46:49.990 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 1.79 s -----

Diagnostics dump

2024-05-07 14:46:48.196 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v1.0.0 ----- 2024-05-07 14:46:48.196 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] ```Media players found: [{'entity_id': 'media_player.home', 'should_change_volume': True, 'initial_volume_level': 1.0, 'group_members_supported': False, 'announce_supported': False, 'resume_media_player': False}] 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- General Parameters ----- 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] entity_ids = ['media_player.home'] 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] chime_path = mario_coin 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] cache = False 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] offset = 450.0 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] final_delay = 0.0 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] tts_platform = google_translate 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] tts_speed = 100.0 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] tts_pitch = 0 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] announce = True 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] volume_level = 0.9 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] join_players = True 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] unjoin_players = True 2024-05-07 14:46:48.197 DEBUG (MainThread) [custom_components.chime_tts] - Retrieving audio from path: "custom_components/chime_tts/mp3s/mario_coin.mp3"... 2024-05-07 14:46:48.293 DEBUG (MainThread) [custom_components.chime_tts] ...audio retrieved. Duration: 0.917s 2024-05-07 14:46:48.293 DEBUG (MainThread) [custom_components.chime_tts] - Saving mp3 file to folder: /media/sounds/temp/chime_tts/... 2024-05-07 14:46:48.350 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] - File saved to path: /media/sounds/temp/chime_tts/0_zh_qmi.mp3 2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts] - Chime TTS audio generated: 2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts] - audio_duration = 0.917 2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts] - local_path = "/media/sounds/temp/chime_tts/0_zh_qmi.mp3" 2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts] - public_path = None 2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts] - media_content_id = "media-source://media_source/local/sounds/temp/chime_tts/0_zh_qmi.mp3" 2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts] Pre-Playback Actions 2024-05-07 14:46:48.444 WARNING (MainThread) [custom_components.chime_tts] Unable to join speakers. No supported media_players found. 2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts] - Setting volume level to 0.9 for 1 non-fade in/out media_player 2024-05-07 14:46:48.444 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Setting media_player.home's volume to 0.9 2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts] Chime TTS playback 2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts] 1 Standard media player detected: 2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts] - media_player.home 2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts] Calling media_player.play_media with data: 2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts] - media_content_type: music 2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts] - media_content_id: media-source://media_source/local/sounds/temp/chime_tts/0_zh_qmi.mp3 2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts] - announce: True 2024-05-07 14:46:48.456 DEBUG (MainThread) [custom_components.chime_tts] - entity_id: ['media_player.home'] 2024-05-07 14:46:48.457 DEBUG (MainThread) [custom_components.chime_tts] - Waiting 0.917s for audio playback to complete... 2024-05-07 14:46:49.376 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Waiting until 1 media_player isn't playing... 2024-05-07 14:46:49.978 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] ✔ media_player.home 2024-05-07 14:46:49.978 DEBUG (MainThread) [custom_components.chime_tts] Post-Playback Actions 2024-05-07 14:46:49.978 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Setting media_player.home's volume to 1.0 2024-05-07 14:46:49.990 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 1.79 s -----

nimroddolev commented 6 months ago

Hi @ajpalm, i'm sorry you've been experiencing issues.

Thank you for providing the debug log messages. I don't see an obvious cause for the audio cut off, and I haven't been able to reproduce the issue on my side.

Can you please share more information?

ajpalm commented 6 months ago

Hi @nimroddolev

Thanks for looking into this. Oddly I can't get the audio to cut off now either.

It was consistently failing over multiple days back when I logged the ticket. So not sure what happened. The only change since then was a HA update to the latest.

Again thanks for looking at it, but looks like it can be closed off.

ajpalm commented 6 months ago

Hi. Just a quick update on this.

Oddly the issue is back again after working for a while.

I had some time, so I did more testing, it seems to be an issue with 'Google home' and the way the audio is being played by the devices and not Chime TTS.

I was using a 'group' of speakers defined in Google home as the target for the audio, which was being cut off.

If I change the target device to be a single speaker it plays correctly over and over, but when changing back to a speaker group, the audio starts being cut off again. So that seems to be the issue.

Oddly I've found that my google home hub won't play the Chime sound at all unless there is text to play in the message field as well, while my Google home (cylindrical speaker) device, works perfectly.

More of a FYI for anyone else who might have this issue.