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

Polly character limit for SSML? #32

Open dhardjono opened 11 months ago

dhardjono commented 11 months ago

Hi, I have an interesting phenomenon where locally I can only input relatively short text when calling Polly with TextType SSML. But after deploying it on a pretty powerful EC2 instance, I can input a much larger SSML text body to it - albeit still having a limit, but still much less than the theoretically possible 6000 characters according to Polly documentation.

What could be the reason here? It can't be that the Polly SDK uses local computing resource, right? If then, where can I find this statement in the official documentation?

Thanks in advance!

dhardjono commented 11 months ago

For normal text body, I can input a pretty large text to it. Downside is only that it will take much longer until Ada speaks. With long SSML text I get an error directly from the SDK (from PollyClient.SynthesizeSpeech) that says:

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

dhardjono commented 11 months ago

After further research, I found out that even longer text is fine, but as soon as I introduce 2 or 3 special characters (e.g. ä ü ö ß) then the SDK will return "Invalid SSML request"

dhardjono commented 11 months ago

I got the problem, but no solution. The problem lies in this function:

Aws::String UnrealAWSUtils::FStringToAwsString(const FString& UnrealString) {
    return Aws::String(TCHAR_TO_UTF8(UnrealString.GetCharArray().GetData()), UnrealString.Len());
}

TCHAR_TO_UTF8 somehow converts the text with umlaut incorrectly, so that when converting back the problematic SSML to string, the last > in the closing tag is missing.

image

(the first Invalid SSML Request warning is connected to the previous message which is outside the screenshot, the second one corresponds to the invalid SSML with missing closing tag >) Is there any suggestion on how to work with this?

Krxtopher commented 11 months ago

I'm guessing that's an Unreal Engine (or C++) question and not a Polly question. I suggest posting to the Unreal Engine dev forums for guidance.