helgemor
(Helge)
March 13, 2024, 6:26pm
1
Hi all!
I have been trying for a long time and on several HA versions.
I can’t get tts.speak to work! I’m testing with wyoming and piper, default configuration.
My test service call is:
service: tts.speak
data:
cache: true
message: is it raining?
media_player_entity_id: media_player.stua
target:
entity_id: tts.piper
Not a sound can be heard. The player continues playing it’s music as if nothing has happened.
My media players are Sonos speakers and esphome media players.
The piper debug log says:
DEBUG:wyoming_piper.handler:Sent info
DEBUG:wyoming_piper.handler:Sent info
DEBUG:wyoming_piper.handler:Synthesize(text='Is it raining?', voice=SynthesizeVoice(name='en_US-kathleen-low', language=None, speaker=None))
DEBUG:wyoming_piper.handler:synthesize: raw_text=Is it raining?, text='Is it raining?'
DEBUG:wyoming_piper.handler:input: {'text': 'Is it raining?'}
DEBUG:wyoming_piper.handler:/tmp/tmp5ow2l6r8/1695039829057415081.wav
DEBUG:wyoming_piper.handler:Completed request
DEBUG:wyoming_piper.handler:Sent info
I have tried clear_cache as well as different languages/voices.
I must be making some silly mistake here?
I’m running version 2024.3.0, operating system 12.1 on an Intel NUC, latest versions of Wyoming and piper
Help, please?
Have you tried using the “announce” feature in the Sonos integration? This is supposed to pause playback for tts announcements.
1 Like
helgemor
(Helge)
March 13, 2024, 8:51pm
3
I have used announce in some cases with sonos, and that works fine. However, I don’t know how to use that in tts.speak
No, the docs aren’t very clear are they? The other option is snapshot - pause - restore, which is what I used to do before announce appeared.
your yaml looks correct to me. I have a sonos system that I pipe tts to, and your format works. I would suspect you have something else wrong.
have you already tried google_translate? that’ll help isolate if the issue is on the sonos side vs the tts side.
i presume you’ve already opened up /tmp/tmp5ow2l6r8/1695039829057415081.wav and verified it’s correct?
helgemor
(Helge)
March 20, 2024, 9:56am
6
Digging some more:
I have no directory /tmp/tmp5*.
Bu the sound files (now they’re mp3’s) are created in /config/tts, even if the piper log says they are placed in tmp/tmp5*
They’re not played on my media player.
How have I screwed this up? Any configuration setting that can help?
If I move the file to a folder under my media and call play_media, it works fine.
I also tried for a while to use tts.speak with Sonos and reached the conclusion that it was broken. You should be able to get the same result by calling play media with a TTS url.
You could try using the custom integration Chime TTS . It generates a new media file which might address your issues.
The wyoming satellites cannot do TTS yet. Use chime TTS as someone else suggested.
helgemor
(Helge)
March 20, 2024, 2:37pm
10
That explains a lot! The documentation has some holes…
helgemor
(Helge)
March 20, 2024, 2:42pm
11
I’ve started testing chime_tts. So far without success.
The log seems to be ok, but there is no sound!
Where do the sound files go? I can’t find them under /www/sounds/temp
Debug log:
2024-03-20 15:40:06.737 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v0.13.0 -----
2024-03-20 15:40:06.737 DEBUG (MainThread) [custom_components.chime_tts.helpers] ----- General Parameters -----
2024-03-20 15:40:06.737 DEBUG (MainThread) [custom_components.chime_tts.helpers] * entity_ids = ['media_player.terrassen']
2024-03-20 15:40:06.738 DEBUG (MainThread) [custom_components.chime_tts.helpers] * chime_path = bells
2024-03-20 15:40:06.738 DEBUG (MainThread) [custom_components.chime_tts.helpers] * cache = True
2024-03-20 15:40:06.738 DEBUG (MainThread) [custom_components.chime_tts.helpers] * offset = 450.0
2024-03-20 15:40:06.738 DEBUG (MainThread) [custom_components.chime_tts.helpers] * final_delay = 0.0
2024-03-20 15:40:06.738 DEBUG (MainThread) [custom_components.chime_tts.helpers] * message = crisis
2024-03-20 15:40:06.738 DEBUG (MainThread) [custom_components.chime_tts.helpers] * tts_platform = tts.piper
2024-03-20 15:40:06.738 DEBUG (MainThread) [custom_components.chime_tts.helpers] * tts_playback_speed = 100.0
2024-03-20 15:40:06.738 DEBUG (MainThread) [custom_components.chime_tts.helpers] * announce = False
2024-03-20 15:40:06.738 DEBUG (MainThread) [custom_components.chime_tts.helpers] * volume_level = 0.52
2024-03-20 15:40:06.738 DEBUG (MainThread) [custom_components.chime_tts.helpers] * join_players = False
2024-03-20 15:40:06.738 DEBUG (MainThread) [custom_components.chime_tts.helpers] * unjoin_players = False
2024-03-20 15:40:06.739 DEBUG (MainThread) [custom_components.chime_tts] async_get_playback_audio_path
2024-03-20 15:40:06.739 DEBUG (MainThread) [custom_components.chime_tts] Attempting to retrieve generated mp3 file from cache
2024-03-20 15:40:06.739 DEBUG (MainThread) [custom_components.chime_tts] - Audio data not found in cache.
2024-03-20 15:40:06.739 DEBUG (MainThread) [custom_components.chime_tts] - filepath_hash 87d32a720e6fb072a6e931bd9efab0ed1aa2d89e5f801aefb9e0b4b0032c1357 does not exist in the cache.
2024-03-20 15:40:06.739 DEBUG (MainThread) [custom_components.chime_tts] - No previously generated mp3 file found
2024-03-20 15:40:06.739 DEBUG (MainThread) [custom_components.chime_tts] Retrieving audio from path: "custom_components/chime_tts/mp3s/bells.mp3"
2024-03-20 15:40:06.856 DEBUG (MainThread) [custom_components.chime_tts] - Audio retrieved. Duration: 0.944s
2024-03-20 15:40:06.856 DEBUG (MainThread) [custom_components.chime_tts] - Attempting to retrieve TTS file from cache...
2024-03-20 15:40:06.856 DEBUG (MainThread) [custom_components.chime_tts] - Audio data not found in cache.
2024-03-20 15:40:06.856 DEBUG (MainThread) [custom_components.chime_tts] - filepath_hash 96a91593c0482e13604b8ae59f93cf0d22abf4baa0ccb92912a9a568f4a7bbd0 does not exist in the cache.
2024-03-20 15:40:06.856 DEBUG (MainThread) [custom_components.chime_tts] - ...cached TTS file not found
2024-03-20 15:40:06.857 DEBUG (MainThread) [custom_components.chime_tts] async_request_tts_audio(tts_platform='tts.piper', message='crisis', tts_playback_speed=100.0, cache=True, language=None, options={})
2024-03-20 15:40:06.857 DEBUG (MainThread) [custom_components.chime_tts] - Generating TTS audio...
2024-03-20 15:40:07.070 DEBUG (MainThread) [custom_components.chime_tts] - ...TTS audio completed in 213.70700000000002 ms
2024-03-20 15:40:07.071 DEBUG (MainThread) [custom_components.chime_tts.helpers] Performing delay of 450.0ms
2024-03-20 15:40:07.072 DEBUG (MainThread) [custom_components.chime_tts] Saving generated TTS audio to cache
2024-03-20 15:40:07.125 DEBUG (MainThread) [custom_components.chime_tts.helpers] - File saved successfully
2024-03-20 15:40:07.125 DEBUG (MainThread) [custom_components.chime_tts.helpers] - File saved to path: /www/sounds/temp/m1nh01et.mp3
2024-03-20 15:40:07.125 DEBUG (MainThread) [custom_components.chime_tts] Saving to chime_tts storage:
2024-03-20 15:40:07.125 DEBUG (MainThread) [custom_components.chime_tts] - key: "96a91593c0482e13604b8ae59f93cf0d22abf4baa0ccb92912a9a568f4a7bbd0"
2024-03-20 15:40:07.125 DEBUG (MainThread) [custom_components.chime_tts] - value: "{'audio_path': '/www/sounds/temp/m1nh01et.mp3', 'audio_duration': 0.943}"
2024-03-20 15:40:07.128 DEBUG (MainThread) [custom_components.chime_tts] - Final audio created. Duration: 2.337s
2024-03-20 15:40:07.128 DEBUG (MainThread) [custom_components.chime_tts] - Saving mp3 file...
2024-03-20 15:40:07.191 DEBUG (MainThread) [custom_components.chime_tts.helpers] - File saved successfully
2024-03-20 15:40:07.191 DEBUG (MainThread) [custom_components.chime_tts.helpers] - File saved to path: /www/sounds/temp/ge3se6ne.mp3
2024-03-20 15:40:07.192 DEBUG (MainThread) [custom_components.chime_tts] - Filepath = '/www/sounds/temp/ge3se6ne.mp3'
2024-03-20 15:40:07.192 DEBUG (MainThread) [custom_components.chime_tts] - File saved successfully
2024-03-20 15:40:07.192 DEBUG (MainThread) [custom_components.chime_tts] - audio_dict = {'audio_path': '/www/sounds/temp/ge3se6ne.mp3', 'audio_duration': 2.337}
2024-03-20 15:40:07.192 DEBUG (MainThread) [custom_components.chime_tts] - Setting 'media_player.terrassen' volume level to 0.52
2024-03-20 15:40:07.192 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level("media_player.terrassen", 0.52)
2024-03-20 15:40:07.192 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player "media_player.terrassen" to: 0.52
2024-03-20 15:40:07.215 DEBUG (MainThread) [custom_components.chime_tts] - Volume set
2024-03-20 15:40:07.215 DEBUG (MainThread) [custom_components.chime_tts] Calling media_player.play_media service with data:
2024-03-20 15:40:07.215 DEBUG (MainThread) [custom_components.chime_tts] - media_content_type: music
2024-03-20 15:40:07.215 DEBUG (MainThread) [custom_components.chime_tts] - media_content_id: /www/sounds/temp/ge3se6ne.mp3
2024-03-20 15:40:07.215 DEBUG (MainThread) [custom_components.chime_tts] - entity_id: ['media_player.terrassen']
2024-03-20 15:40:07.238 DEBUG (MainThread) [custom_components.chime_tts] ...media_player.play_media completed.
2024-03-20 15:40:07.238 DEBUG (MainThread) [custom_components.chime_tts] Waiting 2.337s for audio playback to complete...
2024-03-20 15:40:09.575 DEBUG (MainThread) [custom_components.chime_tts] Returning media_player.terrassen's volume level to 0.4
2024-03-20 15:40:09.576 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level("media_player.terrassen", 0.4)
2024-03-20 15:40:09.576 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player "media_player.terrassen" to: 0.4
2024-03-20 15:40:09.589 DEBUG (MainThread) [custom_components.chime_tts] - Volume set
2024-03-20 15:40:09.589 DEBUG (MainThread) [custom_components.chime_tts] Saving generated mp3 file to cache
2024-03-20 15:40:09.589 DEBUG (MainThread) [custom_components.chime_tts] Saving to chime_tts storage:
2024-03-20 15:40:09.589 DEBUG (MainThread) [custom_components.chime_tts] - key: "87d32a720e6fb072a6e931bd9efab0ed1aa2d89e5f801aefb9e0b4b0032c1357"
2024-03-20 15:40:09.589 DEBUG (MainThread) [custom_components.chime_tts] - value: "{'audio_path': '/www/sounds/temp/ge3se6ne.mp3', 'audio_duration': 2.337}"
2024-03-20 15:40:09.592 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 2854.66 ms -----
Try changing the public folder path in the integration’s configuration to:
/config/www/sounds/temp
EDIT: Also disable cache
when trying the same message, as it will then resave the file. Otherwise you’ll get the same issue.
Did you select the TTS service?
Here is some yaml that works on my Wyoming satellite.
service: chime_tts.say
metadata: {}
data:
chime_path: classical
end_chime_path: glockenspiel
offset: 450
final_delay: 0
tts_playback_speed: 100
volume_level: 0.23
message: This is a test
tts_platform: cloud
target:
entity_id: media_player.loftsatellite
helgemor
(Helge)
March 20, 2024, 6:23pm
14
It doesn’t seem to matter much what my chime_tts folder settings are.
If I specify a non existing folder, it will be created in the configuration.
According to the debug log, everything goes just fine. But there is no sound, and there are no sound files to be found in any of the specified folders.
I have given everyone full access to the folders, in case it’s a permission error.
It’s funny that the log says everything is beautiful when it isn’t. Is it caused by poor error checking?
temp_chimes_path = /config/www/sounds/temp/chimes/
temp_path = /config/www/sounds/temp/
www_path = /config/www/chime_tts/
media_dir = www/sounds
The media_dir
path looks incorrect (missing config/)
but I don’t think that’s the issue.
What is your HA setup? Are you running docker?
helgemor
(Helge)
March 20, 2024, 7:33pm
16
In fact, I haven’t included /config/ in any of the folders. chime_tts added that itself, except for the media_dir.
I added it there as well, but no change.
I’m running the HA 2024.3.1, HAOS 12.1 on an Intel NUC. No docker or anything extra.
Are you able to verify the root folder? I’m not familiar with your setup but I doubt that your www
folder is in the root directory
helgemor
(Helge)
March 20, 2024, 8:00pm
18
config is in the root folder. Actually, it’s a hard link to the folder /homeassistant.
Now my folders look like this, after editing in the configuration.
These folders are now exactly like I set them in the configuration.
temp_chimes_path = /config/www/sounds/temp/chimes/
temp_path = /config/www/sounds/temp/
www_path = /config/www/chime_tts/
media_dir = /config/www/sounds
The installation is (as far as I know) a 100% standard setup.
Actually, I have a similar installation at my cabin, and there this works very nice!
Can you post some yaml of the automation you are trying?
helgemor
(Helge)
March 20, 2024, 8:13pm
20
Not much of an automation, just testing in dev.tools:
service: chime_tts.say
target:
entity_id:
- media_player.terrassen
data:
chime_path: bells
offset: 450
final_delay: 0
tts_playback_speed: 100
volume_level: 0.52
tts_platform: tts.piper
message: crisis