Amazon Polly TTS Output to Speaker Example?

No, not sure how to even do it.

Check to see if files are being created in the cache directory. Any reason you are switching from google to Polly?

Figured it out. Didn’t have quotes around my secret keys. The reason I wanted to switch was the voice sounds much more realistic imo.

Hey, my config works with google_say, but when I tried switching to Polly I get the following error, any idea’s?

2017-07-28 10:35:33 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/core.py", line 1023, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/tts/__init__.py", line 140, in async_say_handle
    options=options
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/tts/__init__.py", line 310, in async_get_url
    engine, key, message, use_cache, language, options)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/tts/__init__.py", line 324, in async_get_tts_audio
    message, language, options)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/tts/amazon_polly.py", line 177, in get_tts_audio
    VoiceId=voice_id
  File "/srv/homeassistant/lib/python3.4/site-packages/botocore/client.py", line 251, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/botocore/client.py", line 537, in _make_api_call
    raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidSsmlException) when calling the SynthesizeSpeech operation: Invalid SSML request

You have SSML set. You need to remove that from the config. Otherwise you need to wrap ALL text in tags.

Invalid SSML request

Nailed it!, thanks.

1 Like

Are you using Lexicons with Polly, I would like to soften up the voice a little, any idea how I would implement that?

I started using it but then ditched it… it wa too much work for too little payoff for me. But SSML is the way to go if you want to start messing with inflection and speed.

looking at that now.

Is “lang xml:lang=“en-US”” the same as the default Joanna voice?

Not Sure but I use the default Joanna voice. She sounds the closest to the Alexa Voice.

Thanks, I think I will stick with that for now, can’t figure out where or how to implement the SSML Tags.

That is the region name to change the voice see this:

For messing with SSML I use the AWS site and documentation

http://docs.aws.amazon.com/polly/latest/dg/supported-ssml.html

That way I can play with how it will sound prior to getting it into HA.

Not trying to change voice per say, but make it a little more subtle.

Thanks.

Been reading since, but still not sure where/how to implement it.

When I add the tags to my automation message, the tags get spoken as well.

Thanks.

Did you turn ssml back on in configuration?

Out for a few, I have to continue testing when I return.

The easiest way (I have found) is to get the message, with SSML tags, reading correctly in AWS and then copy over to the automation yaml. From there it should read the exact same and if not the configuration of the component has an issue.

Thanks, will followup shortly, kid duties.

Didn’t have time yet to setup SSML Tags, but just check my logs and found the following for two automations ran recently.

2017-07-28 21:09:01 ERROR (MainThread) [homeassistant.components.tts] Can't write 38ae3c8144e65e8fc69a567fed96a6a33e78305a_en-us_339415901_amazon_polly.mp3
2017-07-28 21:09:37 ERROR (MainThread) [homeassistant.components.tts] Can't write f0b8307d4e618bd94bb14c74227a74c1f7a23470_en-us_339415901_amazon_polly.mp3