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

UE4.26 crashes when trying to trigger Speak function from a Remote API Call #31

Closed dhardjono closed 1 year ago

dhardjono commented 1 year ago

Hi, when combining this sample project with Unreal's Remote Control API , the whole UE4.26 crashes completely.

My function is called ReadMessage, defined solely in the blueprint:

image

And this is the request:

POST http://127.0.0.1:30010/remote/object/call
{
    "objectPath": "/Game/AmazonPollyMetaHuman/Scene/MetaHumanScene.MetaHumanScene:PersistentLevel.BP_Ada2_2",
    "functionName": "ReadMessage",
    "parameters": {
        "messageToRead": "Hello I'm Ada, how are you doing?"
    }
}

The error message that I got is:

LoginId:<redacted>
EpicAccountId:<redacted>

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000000

UE4Editor_AmazonPollyMetaHuman_3538!USpeechComponent::SynthesizeAudio() [D:\Repositories\amazon-polly-metahumans\Source\AmazonPollyMetaHuman\Private\SpeechComponent.cpp:124]
UE4Editor_AmazonPollyMetaHuman_3538!USpeechComponent::GenerateSpeechSync() [D:\Repositories\amazon-polly-metahumans\Source\AmazonPollyMetaHuman\Private\SpeechComponent.cpp:118]
UE4Editor_AmazonPollyMetaHuman_3538!<lambda_71e7cd1c01ca36e3ca6a661652370fe3>::operator()() [D:\Repositories\amazon-polly-metahumans\Source\AmazonPollyMetaHuman\Private\GenerateSpeechAction.cpp:39]
UE4Editor_Core!TGraphTask<FAsyncGraphTask>::ExecuteTask() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:886]
UE4Editor_Core!FTaskThreadAnyThread::ProcessTasks() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:1065]
UE4Editor_Core!FTaskThreadAnyThread::ProcessTasksUntilQuit() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:888]
UE4Editor_Core!FTaskThreadAnyThread::Run() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:965]
UE4Editor_Core!FRunnableThreadWin::Run() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\Windows\WindowsRunnableThread.cpp:86]

To clarify, I did manage to successfully make Ada talk if I add UEDPIE_0_ prefix before the Scene name / Object Path inside the POST body, so that it becomes "objectPath": "/Game/AmazonPollyMetaHuman/Scene/UEDPIE_0_MetaHumanScene.MetaHumanScene:PersistentLevel.BP_Ada2_2",.

But the issue is when I try to run it as standalone game, e.g. for Pixel Streaming, the UEDPIE_0_ isn't relevant anymore (since it's not Play In Editor, aka PIE), and when calling the function without the prefix, the whole UE4.26 crashes.

Can someone help me further with this?

Thanks a lot in advance!!

dhardjono commented 1 year ago

Found the problem, it was because Port 30010 was already in use by my Unreal Editor itself, so the Standalone app cannot use it. Therefore it ran into memory error because there was no instance of the speech running in the editor. After closing all apps and starting the standalone project, it works wonderfully.