Google Translate (TTS)

Google Translate (TTS)

dominikkdominikk Posts: 2Member

Hi guys,

great to see the new Audio Notification API. I tested it but can't get it working with Google Translate. I think it's because you are sending not a proper Agent information when retrieving the data from Google Translate.

Here is the URL I tried:

http://translate.google.com/translate_tts?ie=UTF-8&tl=de&client=tw-ob&q=Das ist ein SoundTouch Test

Would be great if you could send some generic agent string like "Mozilla Agent..." to get it working. I assume that's the problem.

As long as the Notification API was not there, I had two more feature in place which were great and maybe you could implement them as well.

  • relative volume (+10 => increase current volume level by 10)

  • off after speak (power off the speaker after the notification)

Would be great if you could help me at least with the Google Translate, as that is a very important feature in home automation for the users. As long as that is not in place, I unfortunately can't use the new API.

Thanks,
Dominik

Comments

  • edited 02/05/2018 - 17:25
    Zach@Bose[email protected] Posts: 156Admin

    Hi Dominik,

    This is a known issue, but there is a workaround! Encode your translate url as XML, and it should work. So, the link you posted would instead become:

    http://translate.google.com/translate_tts?ie=UTF-8&tl=de&client=tw-ob&q=Das ist ein SoundTouch Test

    I created that using this tool, which may be helpful for prototyping. The root cause of this we believe is the speaker not playing well with unencoded '&' symbols. If this doesn't work let me know and we can investigate further.

  • dominikkdominikk Posts: 2Member

    Thanks for the quick reply. I replaced all & with & and now it's working :) Great!

    Could it be that the first word is a little bit quieter than the rest? I think its some kind of slow volume increase instead of starting at full volume.

  • Zach@Bose[email protected] Posts: 156Admin

    Glad it is now working! We have heard intermittent reports about the first word starting quietly; this may be unavoidable in the current architecture, but we'll be looking into it further as a potential future improvement.

  • TimDonovanTimDonovan Posts: 4Member

    How are you achieving this? I just get "media referenced by url is not supported by speaker" for Google TTS just because the URL doesn't end in mp3. Surely the API should look at the Content-Type header and not the URL ending....

  • edited 02/04/2018 - 12:11
    Zach@Bose[email protected] Posts: 156Admin

    Hi TimDonovan,

    Can you share the URL you are using, so I might be able to better help troubleshoot? It definitely does not need to end in .mp3 -- as noted in my above post from 12/10/2017, there are some encoding tricks with the URL to consider, but there's an example of a working translate.google.com TTS URL in that post which does not end in any media extension.

  • TimDonovanTimDonovan Posts: 4Member

    Hey Zach thanks for getting back so quickly. Actually I just noticed what happened - the XML formatted URL you posted got reverted back (I guess the forum strips xml encoding) to be identical to the one dominikk posted. So even though I copied your google translate link it was not XML formatted. I've run it through the encoding tool and it's working now. Thank you :)

  • Zach@Bose[email protected] Posts: 156Admin

    Glad it is working now!! I had not realized that I had ended up posting the same link... I think it did have to do with the forum re-encoding upon posting. I edited the post above to remedy that! Thanks much for the tip.

Sign In or Register to comment.