UEAzSpeech
UEAzSpeech copied to clipboard
Experimental: Support for MacOS Platform
This plugin currently does not support MacOS platforms. Note: I don't have an MacOS device to test, so this improvement will be experimental.
Hi, I tried all of your versions on MacOS Monterey 12.5 and there is the problem that after I enable the plugin in plugin settings nothing happens. There are no new blueprints available to add. I also tried to add a plugin while my project was open and sometimes I get that error:
failed to read file. invalid json token. line: 1 ch: 1 (/volumes/hotorel 1/foxforwork/projectsue5/azspeech_test/plugins/sphinx-ue4-master/plugins/speechrecognition/._speechrecognition.uplugin)
It would be nice if you can help me with it.
Hi @HOTOREL !
Unfortunately I don't have iOS and Mac devices to test, so it's hard to solve this, sorry :/
That's why I left it as experimental, too bad it didn't work. :(
If you want to try, there are some files where some implementations are made:
To work in the editor, it is necessary to load the libraries (I probably implemented it wrongly for MacOS/iOS in the branch feature/MAC-SUP-9, but as I have no way of testing it here, so it is difficult to adjust): https://github.com/lucoiso/UEAzSpeech/blob/main/Source/ThirdParty/AzureWrapper/AzureWrapper.Build.cs & https://github.com/lucoiso/UEAzSpeech/blob/main/Source/AzSpeech/Private/AzureSpeech.cpp
For android it was necessary to have an .xml file (UPL - Unreal Plugin Language): https://github.com/lucoiso/UEAzSpeech/blob/main/Source/ThirdParty/AzureWrapper/AzSpeech_UPL_Android.xml
Pushed an experimental branch: https://github.com/lucoiso/UEAzSpeech/tree/experimental/MULTI-PLATFORM
Pushed an experimental branch: https://github.com/lucoiso/UEAzSpeech/tree/experimental/MULTI-PLATFORM Testing on Mac M1 with Monterey and UE v5.0.3! Excited to see if it works!
Had another go at building the multiplatform version on my Mac M1 - here's the log: Build target TWD_Pathways_Build_2023-01-09T08-28-26.txt Seems something going wrong with the arm64 architecture thing?
@dom452 @HOTOREL
Commited a new try: https://github.com/lucoiso/UEAzSpeech/commit/7a7c0c4ab8fa02c6e82185bb0cfe067428bcab91 Set the .dylib file as both Public Additional Library and Runtime Dependency in AzureWrapper.Build.cs:
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
string libPath = isArm() ? "Arm64" : "x64";
string fullLibPath = Path.Combine(ModuleDirectory, "libs", "Mac", libPath, "libMicrosoft.CognitiveServices.Speech.core.dylib");
PublicAdditionalLibraries.Add(fullLibPath);
RuntimeDependencies.Add(fullLibPath);
}
And remove the .lib file due to error in log & other plugins not using .lib files for Mac:
ld: warning: ignoring file /Volumes/Macintosh HD/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM-2/Source/ThirdParty/AzureWrapper/libs/Mac/x64/Microsoft.CognitiveServices.Speech.core.lib, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Reasons:
Found these guys in engine source:
- FBX.Build.cs:
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
string FBxDllPath = FBXDLLDir + "Mac/libfbxsdk.dylib";
PublicAdditionalLibraries.Add(FBxDllPath);
RuntimeDependencies.Add(FBxDllPath);
}
- OpenColorIOLib.Build.cs:
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
PublicAdditionalLibraries.Add(Path.Combine(BinaryPath, "libOpenColorIO.2.1.dylib"));
RuntimeDependencies.Add(Path.Combine(BinaryPath, "libOpenColorIO.dylib"));
RuntimeDependencies.Add(Path.Combine(BinaryPath, "libOpenColorIO.2.1.dylib"));
PublicDefinitions.Add("WITH_OCIO=1");
}
You're going to love this one... Unreal 5.0.3 works on Monterey because it needs XCode 13. Unreal 5.1 works on the latest OS with XCode 14 but isn't really supported well. I have no idea what the story is with earlier Mac and Unreal Versions. So this error: Build target TWD_Pathways_Build_2023-01-10T08-51-54.txt might be some "fun."
I'm working in Monterey with 5.0.3 :)
You're going to love this one... Unreal 5.0.3 works on Monterey because it needs XCode 13. Unreal 5.1 works on the latest OS with XCode 14 but isn't really supported well. I have no idea what the story is with earlier Mac and Unreal Versions. So this error: Build target TWD_Pathways_Build_2023-01-10T08-51-54.txt might be some "fun."
I'm working in Monterey with 5.0.3 :)
Update: It works on the Mac M1! But only on unreal 5.1 with MacOs Ventura and Xcode 14.
Hello @dom452 !
Have you tried changing the build target on xCode? 👀
I've found this issue in the forums: https://forums.unrealengine.com/t/cant-compile-a-blank-project-on-m1-chip-macbook/478824/2?u=lucoiso
And the log that you sent ends with this warning:
ld: warning: dylib (/Volumes/Macintosh HD/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM-3/Source/ThirdParty/AzureWrapper/libs/Mac/x64/libMicrosoft.CognitiveServices.Speech.core.dylib) was built for newer macOS version (11.0) than being linked (10.15)
Also, the last referenced commit fix this part of AzSpeech.cpp:
#if PLATFORM_MAC_ARM64
const FString PreDir = FPaths::Combine(*PluginInterface->GetBaseDir(), TEXT("Source/ThirdParty/AzureWrapper/libs/Mac/Arm64/"));
#else
const FString PreDir = FPaths::Combine(*PluginInterface->GetBaseDir(), TEXT("Source/ThirdParty/AzureWrapper/libs/Mac/x64/"));
#endif
The PreDir was wrong and trying to load the lib inside the 'Runtime' folder, which didn't exist! xD
@dom452 good news!
I've updated the SDK to 1.25.0 and they added new libs for Mac:
- maccatalyst-arm64
- maccatalyst-x64
- osx-arm64
- osx-x64
@dom452 good news!
I've updated the SDK to 1.25.0 and they added new libs for Mac:
- maccatalyst-arm64
- maccatalyst-x64
- osx-arm64
- osx-x64
Thanks so much for staying active! Two little bugs popped up in the compile with this new version:
Line 53: ../Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Tasks/RecognitionMapCheckAsync.h:53:8 unknown type name 'FAzSpeechRecognitionMap'
Line 1701: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:1701:59 incomplete type 'UAzSpeechRecognizerTaskBase' used in type trait expression
Not sure why it's referencing that last one at all - since it's not in amongst the plugin - then I found this in the generateXcodeProject.bat log:
Library '/Volumes/Macintosh HD/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/ThirdParty/AzureWrapper/libs/Mac/x64/libMicrosoft.CognitiveServices.Speech.core.dylib' was not resolvable to a file when used in Module 'AzureWrapper', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
@dom452
Pushed a new commit:
- Add forward declaration: struct FAzSpeechRecognitionMap;
- Include files that implements both UAzSpeechRecognizerTaskBase and UAzSpeechSynthesizerTaskBase in AzSpeechRunnableBase.h (this file contains a template that check in a if constexpr the base class of the given params and compare with these classes hehehe)
Commit: https://github.com/lucoiso/UEAzSpeech/commit/d54cdb016fb406873a81b96a9415bdff13f90f86
About the libMicrosoft.CognitiveServices.Speech.core.dylib: This file was moved to AzureWrapper/libs/Mac/x64/Runtime, the plugin is now trying to copy and link this file in the Plugin's Binaries folder. It looks like the location has not been updated. Could you regenerate the project files and recompile? 👀
Not sure what to make of this... damn I wish I code actually code! No issues in the project file generation, but these instead when compiling in XCode ->
TWD_Pathways_Build /Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/AzSpeechRecognitionRunnable.h
/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/AzSpeechRecognitionRunnable.h:20:45 expected class name
/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/AzSpeechRecognitionRunnable.h:20:45 base class has incomplete type
/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/AzSpeechRecognitionRunnable.h:24:31 unknown type name 'UAzSpeechTaskBase'
/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/AzSpeechRecognitionRunnable.h:28:17 'Run' marked 'override' but does not override any member functions
/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/AzSpeechRecognitionRunnable.h:29:15 'Exit' marked 'override' but does not override any member functions
/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/AzSpeechRecognitionRunnable.h:40:15 'ClearSignals' marked 'override' but does not override any member functions
/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/AzSpeechRecognitionRunnable.h:41:15 'RemoveBindings' marked 'override' but does not override any member functions
/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/AzSpeechRecognitionRunnable.h:43:21 'ApplySDKSettings' marked 'override' but does not override any member functions
/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/AzSpeechRecognitionRunnable.h:45:15 'InitializeAzureObject' marked 'override' but does not override any member functions
/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/Bases/AzSpeechRunnableBase.h
/Users/Shared/UnrealEngine/TWD/Plugins/UEAzSpeech-experimental-MULTI-PLATFORM/Source/AzSpeech/Public/AzSpeech/Runnables/Bases/AzSpeechRunnableBase.h:117:41 unknown type name 'UAzSpeechRecognizerTaskBase'; did you mean 'UAzSpeechSynthesizerTaskBase'?
Update! Rolled back to the previous version and recompiled on Mac - worked without drama. Notifications were still there around the dylib being compiled for different targets - but I changed those targets in XCode and most of it went away.
However - it seems Unreal doesn't want to find my audio input devices on this Mac... Investigating further and will circle back.
MOAR UPDATE: Turns out it's a permissions issue with Unreal 5.1 and MacOS - packaging to see if it's persistent.
Fixed: So, on a mac there's a specific permission you need to set on the app (apparently) for when something wants to access the microphone. To get a Mac to ask for this permission and not shut down the program immediately, the info.plist inside the packaged .app needs to opened, and a new entry added. For the new entry, add "Privacy - Microphone Usage Description" from the Key dropdown list, and add in a description of what you need the microphone to do in the string section (e.g. "Speech recognition"). NOTE: Unreal Engine itself does NOT have this in the Editor.app - so there's no way to test if the plugin is working on a mac unless you go the UnrealEditor.app, open the package contents, edit the info.plist inside there and add the same thing.
Bright side - I can confirm that your plugin (the Version before the updated SDKs) works on Mac and packages without issue after doing this last little permission tweak! Congratulations and many thanks for all your support!
Made new changes to the function that was throwing the errors:
- Remove the template function that was throwing errors and transform the function in a member func which exists only in non-shipping builds
- Move the includes to source
- Remove 'if constexpr's and std::is_base_of; Now it's using IsChildOf<Type>() from Unreal's API to check the parent class and do a cast
About the PList: I'm searching how to include permissions in a MacOS environment, I haven't found something in the engine code. To add permission on iOS the plugin is already using AzSpeech_UPL_IOS.xml, but I don't know if it works for MacOS as well. 👀
@dom452
Created an experimental UPL file to check if it works on MacOS 👀 Also added a new line in Buld.cs to get the file:
AdditionalPropertiesForReceipt.Add("IOSPlugin", Path.Combine(ModuleDirectory, "AzSpeech_UPL_MacOS.xml"));
The UPL will try to add:
- NSMicrophoneUsageDescription
- NSFileProviderDomainUsageDescription
Still cannot build on any of 3 branches...
using command ./RunUAT.sh BuildPlugin -plugin=/Users/xxx/UEAzSpeech/AzSpeech.uplugin -package=/Users/xxx/azspeech
Building 6 actions with 6 processes...
[1/6] Compile SharedPCH.UnrealEd.ShadowErrors.h
[2/6] Compile Module.AzSpeechEditor.cpp
[3/6] Compile Module.AzSpeech.cpp
[4/6] Link UnrealEditor-AzSpeech.dylib
ld: file not found: /Users/Shared/Epic Games/UE_5.1/Engine/Source/libMicrosoft.CognitiveServices.Speech.core.dylib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[5/6] Link UnrealEditor-AzSpeechEditor.dylib cancelled
[6/6] WriteMetadata UnrealEditor.target cancelled
Took 51.564738s to run dotnet, ExitCode=6
UnrealBuildTool failed. See log for more details. (/Users/xxx/Library/Logs/Unreal Engine/LocalBuildLogs/UBT-UnrealEditor-Mac-Development.txt)
AutomationTool executed for 0h 0m 54s
AutomationTool exiting with ExitCode=6 (6)
RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: 6
Log file
...
CompilationResultException: Error: OtherCompilationError
at UnrealBuildTool.ActionGraph.ExecuteActions(BuildConfiguration BuildConfiguration, List`1 ActionsToExecute, List`1 TargetDescriptors, ILogger Logger) in /Users/build/Build/++UE5/Sync/Engine/Saved/CsTools/Engine/Source/Programs/UnrealBuildTool/System/ActionGraph.cs:line 387
at UnrealBuildTool.BuildMode.Build(TargetMakefile[] Makefiles, List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, BuildOptions Options, FileReference WriteOutdatedActionsFile, ILogger Logger) in /Users/build/Build/++UE5/Sync/Engine/Saved/CsTools/Engine/Source/Programs/UnrealBuildTool/Modes/BuildMode.cs:line 628
at UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments, ILogger Logger) in /Users/build/Build/++UE5/Sync/Engine/Saved/CsTools/Engine/Source/Programs/UnrealBuildTool/Modes/BuildMode.cs:line 242
at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in /Users/build/Build/++UE5/Sync/Engine/Saved/CsTools/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.cs:line 648
WriteFileIfChanged() wrote 8 changed files of 8 requested writes.
Timeline:
...
Using macOS 13.2.1, M1 chip, UE 5.1.1
Still cannot build on any of 3 branches...
using command
./RunUAT.sh BuildPlugin -plugin=/Users/xxx/UEAzSpeech/AzSpeech.uplugin -package=/Users/xxx/azspeech
Building 6 actions with 6 processes... [1/6] Compile SharedPCH.UnrealEd.ShadowErrors.h [2/6] Compile Module.AzSpeechEditor.cpp [3/6] Compile Module.AzSpeech.cpp [4/6] Link UnrealEditor-AzSpeech.dylib ld: file not found: /Users/Shared/Epic Games/UE_5.1/Engine/Source/libMicrosoft.CognitiveServices.Speech.core.dylib clang: error: linker command failed with exit code 1 (use -v to see invocation) [5/6] Link UnrealEditor-AzSpeechEditor.dylib cancelled [6/6] WriteMetadata UnrealEditor.target cancelled Took 51.564738s to run dotnet, ExitCode=6 UnrealBuildTool failed. See log for more details. (/Users/xxx/Library/Logs/Unreal Engine/LocalBuildLogs/UBT-UnrealEditor-Mac-Development.txt) AutomationTool executed for 0h 0m 54s AutomationTool exiting with ExitCode=6 (6) RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: 6
Log file
... CompilationResultException: Error: OtherCompilationError at UnrealBuildTool.ActionGraph.ExecuteActions(BuildConfiguration BuildConfiguration, List`1 ActionsToExecute, List`1 TargetDescriptors, ILogger Logger) in /Users/build/Build/++UE5/Sync/Engine/Saved/CsTools/Engine/Source/Programs/UnrealBuildTool/System/ActionGraph.cs:line 387 at UnrealBuildTool.BuildMode.Build(TargetMakefile[] Makefiles, List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, BuildOptions Options, FileReference WriteOutdatedActionsFile, ILogger Logger) in /Users/build/Build/++UE5/Sync/Engine/Saved/CsTools/Engine/Source/Programs/UnrealBuildTool/Modes/BuildMode.cs:line 628 at UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments, ILogger Logger) in /Users/build/Build/++UE5/Sync/Engine/Saved/CsTools/Engine/Source/Programs/UnrealBuildTool/Modes/BuildMode.cs:line 242 at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in /Users/build/Build/++UE5/Sync/Engine/Saved/CsTools/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.cs:line 648 WriteFileIfChanged() wrote 8 changed files of 8 requested writes. Timeline: ...
Using macOS 13.2.1, M1 chip, UE 5.1.1
Whooo, thanks for the logs and sorry for the delay. @kqkq I'll change the MacOS lib and try again. 👀
That's strange, the engine tried to get the lib from a different place:
ld: file not found: /Users/Shared/Epic Games/UE_5.1/Engine/Source/libMicrosoft.CognitiveServices.Speech.core.dylib
I don't know how it works on MacOS as i never had one mac hardware, but I'll try some changes using the same settings that worked a few months ago: Linking only the .a file as both lib and runtime dependency.
Hi @lucoiso ! Thank you for your response!
I tried the latest code. Similar issue:
ld: file not found: /Users/Shared/Epic Games/UE_5.1/Engine/Source/libMicrosoft.CognitiveServices.Speech.core.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
dylib
changed to a
Made new changes, can you try again? 👀
./RunUAT.command BuildPlugin -plugin=/Users/xxx/UEAzSpeech/AzSpeech.uplugin -package=/Users/xxx/azspeech
Running AutomationTool...
Running bundled mono, version: Mono JIT compiler version 5.16.0.220 (2018-06/bb3ae37d71a Fri Nov 16 17:12:11 EST 2018)
Setting up bundled DotNet SDK
/Users/Shared/Epic Games/UE_5.1/Engine/Build/BatchFiles/Mac/../../../Binaries/ThirdParty/DotNet/6.0.302/mac-arm64
Start UAT Interactively: dotnet AutomationTool.dll BuildPlugin -plugin=/Users/xxx/UEAzSpeech/AzSpeech.uplugin -package=/Users/xxx/azspeech
/Users/Shared/Epic Games/UE_5.1/Engine/Build/BatchFiles/Mac/../../../Binaries/ThirdParty/DotNet/6.0.302/mac-arm64/dotnet
Starting AutomationTool...
Parsing command line: BuildPlugin -plugin=/Users/xxx/UEAzSpeech/AzSpeech.uplugin -package=/Users/xxx/azspeech
Initializing script modules...
Total script module initialization time: 0.22 s.
Using xbuild. Install Mono 5.0 or greater for faster builds!
Executing commands...
Copying 437 file(s) using max 64 thread(s)
Reading plugin from /Users/xxx/azspeech/HostProject/Plugins/AzSpeech/AzSpeech.uplugin...
Building plugin for host platforms: Mac
Running: /Users/Shared/Epic Games/UE_5.1/Engine/Binaries/ThirdParty/DotNet/6.0.302/mac-arm64/dotnet "/Users/Shared/Epic Games/UE_5.1/Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.dll" UnrealEditor Mac Development -Project=/Users/xxx/azspeech/HostProject/HostProject.uproject -plugin=/Users/xxx/azspeech/HostProject/Plugins/AzSpeech/AzSpeech.uplugin -iwyu -noubtmakefiles -manifest=/Users/xxx/azspeech/HostProject/Saved/Manifest-UnrealEditor-Mac-Development.xml -nohotreload -log="/Users/xxx/Library/Logs/Unreal Engine/LocalBuildLogs/UBT-UnrealEditor-Mac-Development.txt"
Log file: /Users/xxx/Library/Logs/Unreal Engine/LocalBuildLogs/UBT-UnrealEditor-Mac-Development.txt
/Applications/Xcode.app/Contents/Developer
Parsing headers for UnrealEditor
Running Internal UnrealHeaderTool /Users/xxx/azspeech/HostProject/HostProject.uproject /Users/xxx/azspeech/HostProject/Intermediate/Build/Mac/x86_64/UnrealEditor/Development/UnrealEditor.uhtmanifest -WarningsAsErrors -installed
Total of 58 written
Reflection code generated for UnrealEditor in 1.7092908 seconds
Writing manifest to /Users/xxx/azspeech/HostProject/Saved/Manifest-UnrealEditor-Mac-Development.xml
Building UnrealEditor...
Determining max actions to execute in parallel (10 physical cores, 10 logical cores)
Executing up to 10 processes, one per physical core
Building 6 actions with 6 processes...
[1/6] Compile SharedPCH.UnrealEd.ShadowErrors.h
[2/6] Compile Module.AzSpeechEditor.cpp
[3/6] Compile Module.AzSpeech.cpp
[4/6] Link UnrealEditor-AzSpeech.dylib
ld: file not found: /Users/Shared/Epic Games/UE_5.1/Engine/Source/libMicrosoft.CognitiveServices.Speech.core.dylib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[5/6] Link UnrealEditor-AzSpeechEditor.dylib cancelled
[6/6] WriteMetadata UnrealEditor.target cancelled
Took 40.729563999999996s to run dotnet, ExitCode=6
UnrealBuildTool failed. See log for more details. (/Users/xxx/Library/Logs/Unreal Engine/LocalBuildLogs/UBT-UnrealEditor-Mac-Development.txt)
AutomationTool executed for 0h 0m 43s
AutomationTool exiting with ExitCode=6 (6)
RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: 6
I manually copied libMicrosoft.CognitiveServices.Speech.core.dylib
to /Users/Shared/Epic Games/UE_5.1/Engine
directory and it works!!! The compiled plugin can synthesis sound wave correctly. I believe there are only trivial issues of build settings. If you need some intermediate variables to be printed out, please let me know.