home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.74k stars 28.91k forks source link

Google TTS cuts off announcements #34632

Open fribse opened 4 years ago

fribse commented 4 years ago

The problem

Often the Google speakers cuts off prematurely from the generated senteces, so instead of 'alarm is now activated' it will say 'alarm is now activa' or the like. It's the normal Google TTS integration, sent out to google home mini, google hub and google home.

Environment

Problem-relevant configuration.yaml

tts:
  - platform: google_translate
    language: 'da'
    base_url: !secret tts-public-url

Traceback/Error logs

Additional information

probot-home-assistant[bot] commented 4 years ago

Hey there @awarecan, mind taking a look at this issue as its been labeled with a integration (google_translate) you are listed as a codeowner for? Thanks!

probot-home-assistant[bot] commented 4 years ago

Hey there @pvizeli, mind taking a look at this issue as its been labeled with a integration (tts) you are listed as a codeowner for? Thanks!

Moonbase59 commented 4 years ago

@fribse Is it possible that you use Logitech Media Server/SqueezeLite for output? I’ve had the same problem lately, and it turned out LMS couldn’t correctly handle short MP3/WAV files, such as those generated by Google Translate TTS or PicoTTS.

This has been fixed in the nightly 7.9.3 of June 3, 2020, and in LMS 8.

To verify, you might want to

fribse commented 4 years ago

Hi @Moonbase59 No, I'm using Google Home hub and Google Home mini. The 'worst' unit in this regard is the hub.

stale[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

fribse commented 3 years ago

I've seen some improvement on this lately, so I'll close this case.

JohnLahr commented 3 years ago

I am also noticing this issue on several Google Home 1st gen and Google Home Mini 1st gen devices. Happens with both Amazon Polly TTS and Google TTS. I first started noticing this towards the beginning of 2020, but it's becoming gradually more frequent.

Unfortunately, I can't find any logs around the time it happens, either. The only thing I do notice is that it only ever happens when the devices aren't currently playing anything (i.e. the Bluetooth broadcast "chime" comes in over the devices before they begin playing the TTS message), probably about 75% of the time now. However, I can execute the same automation that triggered the TTS message shortly after the first one, and there doesn't seem to be an issue.

When it does cut off, it seems to be very early in the message. For example, a message like this:

Good evening. In case you haven't looked outside lately, the light of the day has nearly gone.

Will cut off around here:

Good eveni-

I've tried isolating the issue by removing any other tasks from the automation, leaving only that TTS message, but it doesn't seem to make a difference. I've very confident it has something to do with the first message sent to the Home devices (when they do that connecting "chime").

Anything I can do to help, I'd be glad. Unfortunately, I'm completely out of ideas here having tried debugging this on and off for nearly a year.

rarroyo6 commented 3 years ago

I have been dealing with this issue for a while now with no solutions. It happens with Google TTS, Pico, and Amazon Poly, and I'm using a Pi with MPD as the media player (it also happens with LMS as the media player). The MP3 generated is correct, I can play it completely with a browser, so the problem is not with the speech generation, and it happens with different players, so the problem is not with the player either. It seems to be with the timing that HA sends the "ON" signal, then sends the url of the MP3, then sends the "OFF" signal to the players.

fribse commented 3 years ago

Apparently still a problem...

JohnLahr commented 3 years ago

I seem to have solved my own issue, although I'm not sure how applicable it will be to others.

tl;dr: Add a three-second delay between the TTS say action and any actions you're performing on the media players prior.

In my setup, I have a script that first sets an appropriate volume based on the time of day and a couple other factors, and then plays the TTS message. I noticed that a new Sonos One speaker I have did not seem to have the same message cutoff issues that my Google Homes were having, and it dawned on me that I had never included that speaker in the script that sets the volumes prior to playing the message.

What I believe is happening is a result of the actions being asynchronous: setting the volume is not always instant, and Home Assistant doesn't wait for confirmation of that having completed before moving on to the next action. So in practice, the command to change volume is sent, then the command to play the TTS message is sent, then the TTS message beings to play, and then the volume change command is executed, which cuts off the TTS message.

I was then able to completely solve my issue by adding a three-second delay between the volume set action and the TTS play action. Again, not sure if this is applicable to anyone else, but on the off-chance anyone is doing some sort of similar action on their media players prior to playing the TTS message, this could be what's going on.

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

rarroyo6 commented 2 years ago

The issue is still happening.

wishie commented 2 years ago

I have a very similar issue (Google speakers, but using tts.amazon_polly_say) and the start of the message is cut off.

Example "Access Granted. Welcome Home Girls" will only play as "ed. Welcome Home Girls" on my Google speakers

rarroyo6 commented 2 years ago

The issue is not with Google TTS, it does the same thing with Amazon Polly and with Pico TTS. The mp3 file generated is fine, if you play it from a browser, it plays complete. The problem is when HA sends it to a media player, it cuts off. I think it has to do with HA managing the media player asynchronously, it turns on the media player, plays the file, and turns off the media player. I think it's a timing issue with it not waiting for the player to be ready before it starts playing, or not waiting for it to finish playing before turning it off.

wishie commented 2 years ago

This only happens with my Google Nest Hub though. I'm using Amazon Polly TTS and all of my other Google media players work as expected.

manzari commented 2 years ago

I have the same issue using picotts with vlc via telnet in hassos. Speakers are plugged into the pi's audio jack. Longer texts are fully played with two short breaks where at the first one the playback would stop with a shorter text.

rarroyo6 commented 2 years ago

Issue is still happening as of HA 2022.4.3. When sending TTS from the new Media Browser to either MPD or to Logitech Media Server, it still cuts off.

nagyrobi commented 2 years ago

the start of the message is cut off

If TTS audio is being cut off at the beginning, this is likely because the player needs some time to switch on/change internal source to playing out the stream. The only good solution for this is to add a configurable amount of silence at the beginning of the audio stream, I've modified Google Translate TTS and VoiceRSS TTS to do this, they can be installed manually as custom components (built-in gets overridden).

Custom integrations that override core integrations are not accepted in HACS, but can can still be installed through it as custom repository.

wishie commented 2 years ago

This does not happen on all devices. I have checked firmware versions and other things too, and they are the same.On 23 Apr 2022 4:54 am, "H. Árkosi Róbert" @.***> wrote:

the start of the message is cut off

If TTS audio is being cut off at the beginning, this is likely because the player needs some time to switch on/change internal source to playing out the stream. The only good solution for this is to add a configurable amount of silence at the beginning of the audio stream, I've modified Google Translate and VoiceRSS to do this, they can be installed manually as custom components. Custom integrations that override core integrations are not accepted in HACS, but can can still be installed through it as custom repository.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

nagyrobi commented 2 years ago

I experience the same, that indeed, it doesn't happen always and on all devices. It's dependent on the actual internal state of the player in the moment when the TTS stream has to be played. It it was playing audio from another source, it happened more often. Same with Spotify or webradios and seems to also depend on the quality of these streams which were played while TTS request came in.

This is not HA's fault. I guess the player needs time to clear buffers, switch inputs, load other stream playback modules to play the TTS, crossfade or fade in, this time gap can be worked around by placing a bit of silence at the beginning. At least you can get a consistent experience with this.

These players were was not designed to promptly play streams from the very first audio frame.

wishie commented 2 years ago

I can reproduce the issue on my Nest Hub Mini or whatever its called (the small screen thing) but not on my Nest Mini (speaker)


From: H. Árkosi Róbert @.> Sent: Saturday, 23 April 2022 8:11 AM To: home-assistant/core @.> Cc: wishie @.>; Comment @.> Subject: Re: [home-assistant/core] Google TTS cuts off announcements (#34632)

I experience the same, that indeed, it doesn't happen always and on all devices. It's dependent on the actual internal state of the player in the moment when the TTS stream has to be played. It it was playing audio from another source, it happened more often. Same with Spotify or webradios and seems to also depend on the quality of these streams.

I guess the player needs time to clear buffers, load other stream playback modules to play the TTS, crossfade or fade in, this time gap can be worked around by placing a bit of silence at the beginning.

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/34632#issuecomment-1106932087, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAE3HRACPW6GAVZTB4HK2PLVGMPZ5ANCNFSM4MP24IXQ. You are receiving this because you commented.Message ID: @.***>

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

calisro commented 1 year ago

Still an issue. Just starting happening to me the past month.

EDIT: Interesting though. It sure seems related to the nest hub. I rebooted it and the rest of the broadcast group works again. This apears on google's side for me at least.

runningman84 commented 1 year ago

The same issue appears with esp home "Raspi Audio Muse Luxe", I miss a few nanoseconds of the beginning and more than half of the last word.

talormanda commented 1 year ago

Still an issue. Just starting happening to me the past month.

EDIT: Interesting though. It sure seems related to the nest hub. I rebooted it and the rest of the broadcast group works again. This appears on google's side for me at least.

Wondering if this is due to the fact that the hub gets taken over, and it has to display something on-screen...meaning that little bit of more effect adds some delay and screws everything up.

On a side-note. I started encountering this issue lately. It will cut out my TTS entirely or play the first letter of the first word and nothing else, but then I hear a nest hub in the other room playing the entire message fully.

neminat commented 1 year ago

I have been having this issue as well but oddly mine seems to be the opposite. I have a google home hub (with the screen) which works perfectly reliably and a Google Mini which appears to be the one with the issues.

Sadly 90+% of my TTS cuts off on he mini. For example I will send Front Door Open but it only gets about "Fron"

talormanda commented 1 year ago

I have been having this issue as well but oddly mine seems to be the opposite. I have a google home hub (with the screen) which works perfectly reliably and a Google Mini which appears to be the one with the issues.

Sadly 90+% of my TTS cuts off on he mini. For example I will send Front Door Open but it only gets about "Fron"

Just do what I do, create a speaker group with all speakers and another will all hubs, and then do a TTS to the speaker group, and a separate one to the hub group. It fixed my issues for the most part. The hubs are the devices that seem to be the issues for me. If it can't overtake them quick enough, they do that cut off thing. You could also use the.he broadcast command with the new Google SDK integration if you're broadcasting to every device in the house.

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

nagyrobi commented 1 year ago

bump

SiboutVanLoo commented 11 months ago

Similar issue here, but the end part is cut-off to soon. Will try delaying commands, but manually triggering a command generates the same behaviour. Playing the piper mp3 file cuts it off to. TTS: Piper Media players: MASS generated (Chromecast google home speakers, stereo pair and single ones.)

issue-triage-workflows[bot] commented 8 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

nagyrobi commented 8 months ago

Bump

Jasmine-Heights commented 8 months ago

Same issue in on my Google nest 2nd gen display, audio gets cut off. It looks like it need some time to wake up.

halytech commented 6 months ago

I also have this issue. It appears to be on any of my Google devices that also have a display. When I cast to a Google mini, max, or OG Google Home speaker, the messages play fine from all TTS services.

thiagoufg commented 4 months ago

Still an issue

npike commented 3 months ago

Still an issue

Ark9975 commented 3 months ago

I have the same issue with piper tts.

realjax commented 3 months ago

Come on guys. fix this once and for all please.

Ark9975 commented 1 month ago

This still seems to be an issue. It's been years...

steveb166 commented 1 month ago

Still an issue, although i have the issue much more often with piper than google translate. And as others have said its more often a problem for the hub than the mini.

fribse commented 1 month ago

I have switched all automations to cloud_say, and there I don't have cutoffs.

realjax commented 3 weeks ago

Still cuts off for me, also with cloud_say