Closed DanDixon closed 7 months ago
Hey Dan,
Please try to catch the problem when you have debug logging enabled for Chime TTS:
Turn on debug logging:
service: logger.set_level
data:
custom_components.chime_tts: debug
Call chime_tts.say
and reproduce the issue.
Check your log messages in Home Assistant:
https://{YOUR_HOME_ASSISTANT_ADDRESS}:8123/config/logs?filter=chime_tts
and click LOAD FULL LOGS
I figured out how to make it reproducible. Looks like it's an issue with embedded quote marks:
I am generating strings with ChatGPT (which is why it was sparatic since every string was different) and noticed all the ones with errors included ' marks.
This causes the YAML error
variables:
say: >-
"Dans's test of a YAML error"
This works:
variables:
say: >-
"Dan is testing a YAML error"
It also works if you remove the -type: chime section.
service: chime_tts.say_url
data:
tts_platform: openai_tts
cache: true
message:
- type: chime
path: "{{chimefile}}"
- type: tts
message: "{{say}}"
response_variable: chime_tts
Does that help?
Hi @DanDixon,
Using the latest beta of Chime TTS, v0.13.1-beta5, I was able to call the following script without any issues:
sequence:
- variables:
say: "Dan's test of a YAML error"
- service: chime_tts.say
data:
chime_path: soft
offset: -1700
message:
- type: tts
message: "{{ say }}"
tts_platform: google_translate
target:
entity_id: media_player.kitchen
Please let me know if it is still not working for you.
To install the beta:
⋮
button in the top right↻ Redownload
optionShow beta versions
option (it may take a moment to update the list)v0.13.1-beta5
from the updated version drop-down listIn this version: v0.13.1-beta5
That seemed to fix the issue with apostrophes. Thank you!
data:
tts_platform: openai_tts
cache: true
message:
- type: chime
path: "{{chimefile}}"
- type: tts
message: "{{say}}"
response_variable: chime_tts
I have to remove:
- type: chime
path: "{{chimefile}}"
To get it to work.
In this version: v0.13.1-beta8
You forgot to include a TTS platform. Using google_translate
Even though I'm not using TTS:
service: chime_tts.say_url
data:
cache: true
message:
- type: chime
path: "{{chimefile}}"
- type: chime
path: "{{chimefile}}"
delay: "{{delay}}"
response_variable: chime_tts
I'm doing this to loop chimes to play multiple times in a row (like the chimes of a clock) (as an aside, a loop property would be great, as I'm using a choose with lots of conditionals for each loop.
Also in v0.13.1-beta8:
This is with the script from above.
Here's a log from that:
2024-02-19 22:00:02.622 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say URL Called. Version v0.13.1-beta8 -----
2024-02-19 22:00:02.622 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-02-19 22:00:02.626 DEBUG (MainThread) [custom_components.chime_tts.helpers] ----- General Parameters -----
2024-02-19 22:00:02.626 DEBUG (MainThread) [custom_components.chime_tts.helpers] * entity_ids = []
2024-02-19 22:00:02.627 DEBUG (MainThread) [custom_components.chime_tts.helpers] * cache = True
2024-02-19 22:00:02.627 DEBUG (MainThread) [custom_components.chime_tts.helpers] * offset = 450.0
2024-02-19 22:00:02.627 DEBUG (MainThread) [custom_components.chime_tts.helpers] * final_delay = 0.0
2024-02-19 22:00:02.627 DEBUG (MainThread) [custom_components.chime_tts.helpers] * message = [{'type': 'tts', 'message': "Neon glow at ten, city's span,\nYellow bananas, the cyber night began.", 'delay': -2500}]
2024-02-19 22:00:02.627 DEBUG (MainThread) [custom_components.chime_tts.helpers] * tts_platform = openai_tts
2024-02-19 22:00:02.627 DEBUG (MainThread) [custom_components.chime_tts.helpers] * tts_playback_speed = 100.0
2024-02-19 22:00:02.627 DEBUG (MainThread) [custom_components.chime_tts.helpers] * announce = False
2024-02-19 22:00:02.627 DEBUG (MainThread) [custom_components.chime_tts.helpers] * volume_level = -1.0
2024-02-19 22:00:02.627 DEBUG (MainThread) [custom_components.chime_tts.helpers] * join_players = False
2024-02-19 22:00:02.627 DEBUG (MainThread) [custom_components.chime_tts.helpers] * unjoin_players = False
2024-02-19 22:00:02.627 DEBUG (MainThread) [custom_components.chime_tts] - Attempting to retrieve previously cached audio...
2024-02-19 22:00:02.635 DEBUG (MainThread) [custom_components.chime_tts] - No cached audio found with hash cecf948dcba5e123dbb548554c3826ee179b9412e631a616aa085c79c4151420
2024-02-19 22:00:02.636 DEBUG (MainThread) [custom_components.chime_tts] ...no cached audio found
2024-02-19 22:00:02.636 DEBUG (MainThread) [custom_components.chime_tts] - Attempting to retrieve TTS audio from cache...
2024-02-19 22:00:02.639 DEBUG (MainThread) [custom_components.chime_tts] - No cached audio found with hash 73f6a3affcd84bb592011685187007f2d01d8b534a00bf630fcc91cef7a44bc0
2024-02-19 22:00:02.641 DEBUG (MainThread) [custom_components.chime_tts] ...no cached TTS audio found
2024-02-19 22:00:02.641 DEBUG (MainThread) [custom_components.chime_tts] - Generating new TTS audio with parameters:
2024-02-19 22:00:02.641 DEBUG (MainThread) [custom_components.chime_tts] * tts_platform = 'openai_tts'
2024-02-19 22:00:02.641 DEBUG (MainThread) [custom_components.chime_tts] * message = 'Neon glow at ten, city's span,
2024-02-19 22:00:02.641 DEBUG (MainThread) [custom_components.chime_tts] * tts_playback_speed = 100.0
2024-02-19 22:00:02.641 DEBUG (MainThread) [custom_components.chime_tts] * cache = True
2024-02-19 22:00:02.641 DEBUG (MainThread) [custom_components.chime_tts] * language = 'None'
2024-02-19 22:00:02.641 DEBUG (MainThread) [custom_components.chime_tts] * options = {}
2024-02-19 22:00:04.544 DEBUG (MainThread) [custom_components.chime_tts] ...TTS audio completed in 1903.0990000000002 ms
2024-02-19 22:00:04.544 DEBUG (MainThread) [custom_components.chime_tts] - Saving generated TTS audio to cache...
2024-02-19 22:00:04.743 DEBUG (MainThread) [custom_components.chime_tts.helpers] - File saved to path: /media/sounds/temp/chime_tts/sj3lzwjz.mp3
2024-02-19 22:00:04.743 DEBUG (MainThread) [custom_components.chime_tts] - Saving data to chime_tts storage:
2024-02-19 22:00:04.743 DEBUG (MainThread) [custom_components.chime_tts] - key: "73f6a3affcd84bb592011685187007f2d01d8b534a00bf630fcc91cef7a44bc0"
2024-02-19 22:00:04.744 DEBUG (MainThread) [custom_components.chime_tts] - value: "{'local_path': '/media/sounds/temp/chime_tts/sj3lzwjz.mp3', 'audio_duration': 4.176}"
2024-02-19 22:00:04.771 DEBUG (MainThread) [custom_components.chime_tts] ...TTS audio saved to cache
2024-02-19 22:00:04.771 DEBUG (MainThread) [custom_components.chime_tts] - Saving mp3 file to folder: /media/chime_tts/...
2024-02-19 22:00:04.919 DEBUG (MainThread) [custom_components.chime_tts.helpers] - File saved to path: /media/chime_tts/0kxqp2g6.mp3
2024-02-19 22:00:04.927 DEBUG (MainThread) [custom_components.chime_tts] - No cached audio found with hash cecf948dcba5e123dbb548554c3826ee179b9412e631a616aa085c79c4151420
2024-02-19 22:00:04.942 DEBUG (MainThread) [custom_components.chime_tts] - Saving data to chime_tts storage:
2024-02-19 22:00:04.942 DEBUG (MainThread) [custom_components.chime_tts] - key: "cecf948dcba5e123dbb548554c3826ee179b9412e631a616aa085c79c4151420"
2024-02-19 22:00:04.942 DEBUG (MainThread) [custom_components.chime_tts] - value: "{'public_path': '/media/chime_tts/0kxqp2g6.mp3', 'audio_duration': 4.176}"
In v0.13.1-beta7:
This doesn't fail, but it doesn't play the chime file anymore.
Some strings (see below) will include this to be included in what is said:
- type: chime
path: "{{chimefile}}"
audio_conversion: "-filter:a volume=0.8"
And will include 'delay' in what's said at the end.
If say is simpler then it doesn't say the extra stuff (but the chime still doesn't work anymore).
This is what I'm calling:
service: chime_tts.say_url
data:
tts_platform: openai_tts
cache: true
message:
- type: chime
path: "{{chimefile}}"
audio_conversion: "-filter:a volume=0.8"
- type: tts
message: "{{say}}"
delay: "{{delay}}"
response_variable: chime_tts
Here's what was submitted that generated this problem error (from the trace):
(ChatGPT wrote the text, I'm just passing it through without modification)
Executed: February 19, 2024 at 10:35:18 PM
Result:
params:
domain: chime_tts
service: say_url
service_data:
tts_platform: openai_tts
cache: true
message:
- type: chime
path: media/notify.mp3
audio_conversion: '-filter:a volume=0.8'
- type: tts
message: >-
"In the ever-evolving orbit of Neptune, remember--- it's the journey
of progress, not the illusion of perfection, that shapes the cosmos.
Embrace each phase like Neptune's 165-year orbit—constantly moving,
improving, and discovering."
delay: -800
target: {}
running_script: false
And here's the resulting mp3: (download and rename to remove the .txt - Github doesn't support mp3s) opikm2j4.mp3.txt
Thanks for the feedback. I've addressed the issues and released a new beta, v0.13.1-beta9
Can you please verify whether you're still experiencing the issues?
it doesn't seem to work with chimes in the message body anymore
This issue should have been fixed in v0.13.1-beta8. Is it still happening for you?
I'm getting this warning: You forgot to include a TTS platform. Using google_translate
This warning now only occurs if TTS is included in the request to Chime TTS
as an aside, a loop property would be great, as I'm using a choose with lots of conditionals for each loop
In this beta release I added support for using a repeat
parameter in message segments, allowing you to specify how many times a segment should be repeated:
service: chime_tts.say
data:
message:
- type: tts
message: "Sparky, count to 3"
- type: chime
path: https://cdn.pixabay.com/audio/2022/03/10/audio_126e737475.mp3
offset: -250
repeat: 3
- type: tts
message: "Who's a good boy?"
repeat: 2
tts_platform: google_translate
target:
entity_id: media_player.kitchen
5. >chime.say_url doesn't appear to be sharing the response variable chime_tts.url anymore
This issue should now be fixed.
6. >It doesn't play the chime file anymore.
>Some strings (see below) will include this to be included in what is said:
> \- type: chime
> path: "{{chimefile}}"
> audio_conversion: "-filter:a volume=0.8"
I wrote the following script and it generated audio as expected. Can you please also try it?
alias: Chime TTS Tests description: "" trigger: [] condition: [] action:
Overall it looks like the latest beta is working well (except for # 6)
In v0.13.1-beta12:
Fixed
Fixed. Don't see the warning anymore
Yay! The repeat feature really simplifies my code and works great (in my limited testing). And the delay is ignored if repeat ==1, exactly as expected). - Thank you so much for adding that! ✨
Here's how I'm using it:
service: chime_tts.say_url
data:
cache: true
message:
- type: chime
path: "{{chimefile}}"
delay: "{{delay}}"
repeat: "{{repeat}}"
response_variable: chime_tts
There is no spoon (or # 4)
Fixed. chime.say_url is working now!
Unfortunately, I found another edge case where it includes the chime info in the message. That said, the example you shared worked.
Here's a short message that causes the problem:
they said "we're"
Try using this as the message variable in the script:
variables:
message: |
they said "we're"
FYI, when I tried your script, after pasting it into Home Assistant, saving it, and reloading the script I got this (it removed the quotes and reformatted it).
variables:
message: >-
In the ever-evolving orbit of Neptune, remember--- it's the journey of
progress, not the illusion of perfection, that shapes the cosmos. Embrace
each phase like Neptune's 165-year orbit—constantly moving, improving, and
discovering.
And again, thank you for all the fixes. Being able to mix together mp3s as needed makes the audio experience of my smart home feel really great!
Using v1.0.0 2024-04-02
I assume you're aware, but I'm still having this issue when using a message like this:
they said "we're"
That aside, so many great changes in v1.0
Thank you again for all of your work on this.
Hi @DanDixon, thanks for your patience & kind words 👍
I have not fixed the issue but I hope to get to it shortly. Once I have a fix available to test I will let you know.
I had an idea for a solution that seems to have fixed the issue. I uploaded a new beta version, v1.0.1-beta2. Could you please upgrade to it and let me know if it resolves the issue for you?
To install the new beta version:
⋮
button in the top right↻ Redownload
optionShow beta versions
option (it may take a moment to update the list)v1.0.1-beta2
from the updated version drop-down listUsing v1.1.0-beta2
Awesome. Looks like it's fixed now.
I tried a number of different phrases that caused problems before, and it all seems to work without issue now!
Thank you again
Great! Happy to hear it’s now working for you 👍
Checklist
Is your feature request related to a problem? Please describe.
I'm using v0.13.1-beta3
Now, every ~20 times or so, it's fairly infrequent (it's happened 7 times now), the text converted into speech goes something like this: "type: chime path: media/notify.mp3, audio_conversion: "-filter:a volume=0.8", message: (and then the actual message too)"
Since posting about my last issue, I've switched to using OpenAI's TTS instead of Google. Here's the latest service call:
Any thoughts or things to try? It usually works; unfortunately, it's not clearly reproducible.
Describe the solution you'd like
Not getting those errors :)
Describe alternatives you've considered
I'm using the ability to overlap the chime and the voice mp3s, so using the simpler features might fix this.
Additional context
FYI, it just happened with chime_tts.say_url also.