aws-samples / amazon-polly-metahumans

This Unreal Engine sample project demonstrates how to bring Epic Games' MetaHuman digital characters to life using the Amazon Polly text-to-speech service from AWS. Use this project as a starting point for creating your own Unreal Engine applications that leverage Amazon Polly to give voice to your MetaHumans.
MIT No Attribution
178 stars 67 forks source link

SSML tags support #23

Closed DrinkSlurp closed 1 year ago

DrinkSlurp commented 1 year ago

Hi, I have been digging on the AWS Polly docs and see that the command CLI accepts SSML tags. While I can produce audio file that follow these tags with the CLI, I cannot make it work in UE4.

When I pass a text with such tags (between tag symbols), the metahuman simply speaks the tag as if it is normal text.

Is there any way for Polly CLI to accept these tags from UE?

Thanks!

DrinkSlurp commented 1 year ago

Hello, I keep testing this feature and, although it works when requested from the command CLI, it does not from the blueprints. Any ideas about this?

Krxtopher commented 1 year ago

@DrinkSlurp I don't have the project downloaded at the moment to test the exact syntax, but here is a general description of the changes you'll need to make in order to use SSML.

Open the Source/AmazonPollyMetaHuman/Private/SpeechComponent.cpp file for editing.

You'll want to edit the CreatePollyAudioRequest() function defined starting at line 160. Inside that function it sets a few properties on the PollyRequest object. You'll need to set one more. It will look something like this...

PollyRequest.SetTextType(Aws::Polly::Model::TextType::ssml);

That should be it. If you need more details on how the Polly C++ API works check the documentation for the PollyClient class found here.

DrinkSlurp commented 1 year ago

Hi @Krxtopher, thanks for your guide! I could modify the cpp file and recompile everything, but I get this error in the output log and no audio:

LogPollyMsg: Error: Polly failed to generate audio file. Error: Invalid SSML request

I have tried with the different possibilities in the TextType class (text, ssml and NOT_SET), but only text works. Being fairly new to C++ and UE, I am lost.

Any help?

DrinkSlurp commented 1 year ago

Sorry! My fault! I was using it for Spanish voice and it looks like some tags are not accepted in every language or voice type. Here is the complete list: https://docs.aws.amazon.com/polly/latest/dg/supportedtags.html Thanks!