Closed leafney closed 11 months ago
Upon further testing, I found that there is no issue with the situation in Node-Red. I apologize for the confusion, as it was my mistake.
The reason for loading the default configuration values was due to a type error in the parameters, as I directly used the provided sample code. The problem was resolved by changing "cache":"True",
to "cache":true,
.
msg.payload={
"chime_path":"custom_components/chime_tts/mp3s/ding_dong.mp3",
"delay":450,
"final_delay":50,
"message":"Hello World",
"tts_platform":"edge_tts",
"cache":false,
"announce":true
}
return msg;
Hi @leafney, I am glad you got it working!
If
cache=True
is set, when playing a TTS audio, it will first play the previously played audio or only start playing a part of it before playing the current audio content.If
cache=False
is set, the first time a TTS audio is played after that, it will also play the previously played audio once again before playing the latest TTS content. After that, the TTS audio will play normally without playing the previous audio content.
Thanks for your quick response. But this problem still exists.
I apologise. Can you please help me better understand the nature of the problem?
Does this happen with other TTS platforms, or only Microsoft Edge TTS?
Does this happen with other TTS platforms, or only Microsoft Edge TTS?
I'll try other platforms.
Does this happen with other TTS platforms, or only Microsoft Edge TTS?
I'll try other platforms.
I have tested other TTS platforms such as picotts
, when to set cache = true
, the previous audio will still be broadcast first. This issue should not be related to the TTS platform.
I am still not sure I understand the problem: Based on your messages I understand that you are hearing a partial duplication of the TTS audio...which is very odd given that the integration connects MP3 files together and does not change their content (unless you change thetts_playback_speed
value from 100%). Please correct me if I have misunderstood.
Are you able to download the generated temporary MP3 files onto another computer and play them? I wonder if the issue is with the MP3 files themselves, or if perhaps there is an issue with the hardware running your Home Assistant instance, or the speaker. Could you please share with me what hardware you are running your Home Assistant instance on? It might also help to have the generated temporary MP3 files as well.
I am still not sure I understand the problem: Based on your messages I understand that you are hearing a partial duplication of the TTS audio...which is very odd given that the integration connects MP3 files together and does not change their content (unless you change the
tts_playback_speed
value from 100%). Please correct me if I have misunderstood.Are you able to download the generated temporary MP3 files onto another computer and play them? I wonder if the issue is with the MP3 files themselves, or if perhaps there is an issue with the hardware running your Home Assistant instance, or the speaker. Could you please share with me what hardware you are running your Home Assistant instance on? It might also help to have the generated temporary MP3 files as well.
Sorry, the problem I described earlier was not very clear. Let me explain with a simple example.
First, without checking the cache
option, my configuration is as follows:
service: chime_tts.say
data:
chime_path: mp3_path_placeholder-ding_dong
delay: 450
final_delay: 0
tts_playback_speed: 100
volume_level: 1
tts_platform: picotts
message: Nice to meet you.
target:
entity_id: media_player.mopidy
This TTS output is normal. I hear the result as: ding dong Nice to meet you.
Then, I check the cache
option: cache: true
service: chime_tts.say
data:
chime_path: mp3_path_placeholder-ding_dong
delay: 450
final_delay: 0
tts_playback_speed: 100
volume_level: 1
tts_platform: picotts
message: I never consider ease and joyfulness the purpose of life itself.
cache: true
target:
entity_id: media_player.mopidy
Now, I hear: ding dong I never consider ease and joyfulness the purpose of life itself.
So far, everything is normal.
After that, I change the message
:
service: chime_tts.say
data:
chime_path: mp3_path_placeholder-ding_dong
delay: 450
final_delay: 0
tts_playback_speed: 100
volume_level: 1
tts_platform: picotts
cache: true
message: Hello World.
target:
entity_id: media_player.mopidy
I will hear: ding dong I never consider ease... ding dong hello world.
I change the message
again:
service: chime_tts.say
data:
chime_path: mp3_path_placeholder-ding_dong
delay: 450
final_delay: 0
tts_playback_speed: 100
volume_level: 1
tts_platform: picotts
cache: true
message: Courage is the ladder on which all the other virtues mount.
target:
entity_id: media_player.mopidy
I will hear: ding dong hello world ding dong Courage is the ladder on which all the other virtues mount.
Now, I uncheck the cache
option:
service: chime_tts.say
data:
chime_path: mp3_path_placeholder-ding_dong
delay: 450
final_delay: 0
tts_playback_speed: 100
volume_level: 1
tts_platform: picotts
message: Can I help you solve this problem?
target:
entity_id: media_player.mopidy
I will hear: ding dong ... ding dong Can I help you solve this problem?
I change the message
again:
service: chime_tts.say
data:
chime_path: mp3_path_placeholder-ding_dong
delay: 450
final_delay: 0
tts_playback_speed: 100
volume_level: 1
tts_platform: picotts
message: The weather is very nice today.
target:
entity_id: media_player.mopidy
I will hear: ding dong The weather is very nice today.
The subsequent outputs are normal.
Thank you for providing the full YAML and the explanations.
I ran an automation sequence on my instance where I first clear the Chime TTS cache: service: chime_tts.clear_cache
and then I ran the six service calls to chime_tts.say
you included in your last message.
I was unable to reproduce the issue.
For the instances where the playback you heard had issues, can you please copy those temporary MP3 files to your computer and play them there to see if the issue is within the MP3 itself? You can find the full paths to the temporary MP3s in the full debug logs.
Yes, I am currently running it in debug mode.
The generated MP3 files are fine, they are all single content.
I suspect that when cache: true
is enabled, it will play the last audio file generated before playing the current newly generated audio file.
However, since you cannot reproduce the issue on your end, I am starting to doubt if there is a problem with my environment. Give me some time, I will reconfigure the execution environment and try again.
Sorry for the late reply.
Unfortunately, I uninstalled the chime_tts
integration version v0.7.4-beta1
and reinstalled version v0.7.3
. After testing, the issue still persists. Following the testing steps I mentioned earlier still results in the problem.
I am also quite puzzled.
For now, I have set it to cache: false
, and it works without any issues.
You can close this issue for now, and if anyone else encounters a similar situation, it can be reopened.
Thank you.
Sorry to hear the issue persists for you. If anything changes please reopen this issue.
Checklist
Is your feature request related to a problem? Please describe.
This is a fantastic project. Thanks.
In the first scenario, when calling the service through HomeAssistant:
If
cache=True
is set, when playing a TTS audio, it will first play the previously played audio or only start playing a part of it before playing the current audio content.If
cache=False
is set, the first time a TTS audio is played after that, it will also play the previously played audio once again before playing the latest TTS content. After that, the TTS audio will play normally without playing the previous audio content.In the second scenario, when calling it in Node-Red:
The data passed is as follows:
The output log is as follows:
The problem is: although
cache=True
is set, it doesn't seem to work. The generated file/media/sounds/temp/chime_tts/l11vjl9d.mp3
cannot be found in the file system, but the TTS audio output is normal.Describe the solution you'd like
no.
Describe alternatives you've considered
I am also puzzled by the situation where it did not take effect in Node-Red. I will conduct further tests to find the reason.
Additional context
chime_tts version: v0.7.4-beta1 home-assistant version: 2023.10.3 home-assistant platform: docker node-red version: v3.0.2 node-red installed node-red-contrib-home-assistant-websocket version: v0.57.4