Browse Source

Improved Stresstest, removed WebRTC EchoCancellation when Debug Play FIle, Added Environment

master
Tillman Staffen 1 month ago
parent
commit
ee8f4cf3a3
  1. BIN
      Unreal/Content/SPIE/BP/Mode/DA_Mode_SPIE_SpieInnovationDay.uasset
  2. 8
      Unreal/Content/Schema/SystemInstructions/Mode_DA_Mode_SPIE_SpieInnovationDay_Instructions.schema.json
  3. BIN
      Unreal/Plugins/AvatarCore_Manager/Content/Widgets/Debug/W_StressTester.uasset
  4. 8
      Unreal/Plugins/AvatarCore_STT/Source/AvatarCore_STT/Private/Recorder/STTRecorderDebugFile.cpp
  5. 85
      Unreal/Plugins/AvatarCore_STT/Source/AvatarCore_STT/Private/STTManagerBase.cpp
  6. 3
      Unreal/Plugins/AvatarCore_STT/Source/AvatarCore_STT/Public/Recorder/STTRecorderDebugFile.h
  7. 3
      Unreal/Plugins/AvatarCore_STT/Source/AvatarCore_STT/Public/STTManagerBase.h

BIN
Unreal/Content/SPIE/BP/Mode/DA_Mode_SPIE_SpieInnovationDay.uasset (Stored with Git LFS)

Binary file not shown.

8
Unreal/Content/Schema/SystemInstructions/Mode_DA_Mode_SPIE_SpieInnovationDay_Instructions.schema.json

@ -69,6 +69,14 @@
{ {
"Name": "User Options", "Name": "User Options",
"Instruction": "The user has no option or UI or menu to adjust settings or anything else, only the developers of the Avatar app can do that. Politely refer back to answering questions the user has." "Instruction": "The user has no option or UI or menu to adjust settings or anything else, only the developers of the Avatar app can do that. Politely refer back to answering questions the user has."
},
{
"Name": "Numbers",
"Instruction": "Always spell out numbers. 12:10 Uhr = Zwölf Uhr zehn | 2001 = Zweitausend eins | 15. Mai = Fünfzehnter Mai"
},
{
"Name": "Environment",
"Instruction": "You are in a futurisc, abstract environment depicting a wind turbine, a cell tower, a power pole and a city, there are glowing lines, a beautiful slightly clouded sky and some grass patches."
} }
] ]
} }

BIN
Unreal/Plugins/AvatarCore_Manager/Content/Widgets/Debug/W_StressTester.uasset (Stored with Git LFS)

Binary file not shown.

8
Unreal/Plugins/AvatarCore_STT/Source/AvatarCore_STT/Private/Recorder/STTRecorderDebugFile.cpp

@ -155,7 +155,6 @@ void USTTRecorderDebugFile::DebugPlayAudioFile(FString FilePath)
} }
STTManager->OnSTTFakeButtonStateChanged.Broadcast(true); STTManager->OnSTTFakeButtonStateChanged.Broadcast(true);
GetWorld()->GetTimerManager().SetTimer( GetWorld()->GetTimerManager().SetTimer(
PlaybackTimerHandle, // handle to cancel timer at a later time PlaybackTimerHandle, // handle to cancel timer at a later time
this, // the owning object this, // the owning object
@ -166,6 +165,13 @@ void USTTRecorderDebugFile::DebugPlayAudioFile(FString FilePath)
USTTRecorderDebugFile::SendChunk(); USTTRecorderDebugFile::SendChunk();
} }
void USTTRecorderDebugFile::DebugClearAudioFile()
{
STTManager->OnSTTFakeButtonStateChanged.Broadcast(false);
AudioComponent->Stop();
GetWorld()->GetTimerManager().ClearTimer(PlaybackTimerHandle);
}
void USTTRecorderDebugFile::SendChunk() void USTTRecorderDebugFile::SendChunk()
{ {
// Send the PCM data in chunks matching the timer interval (0.03s) // Send the PCM data in chunks matching the timer interval (0.03s)

85
Unreal/Plugins/AvatarCore_STT/Source/AvatarCore_STT/Private/STTManagerBase.cpp

@ -2,6 +2,7 @@
#include "STTManagerBase.h" #include "STTManagerBase.h"
#include "Recorder/STTRecorderDebugFile.h" #include "Recorder/STTRecorderDebugFile.h"
#include "Preprocessor/STTPreprocessorWebRTC.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
void USTTManagerBase::InitSTTManager(bool AutoInitModules, USTTBaseProcessorConfig* InProcessorConfig, bool DebugMode) void USTTManagerBase::InitSTTManager(bool AutoInitModules, USTTBaseProcessorConfig* InProcessorConfig, bool DebugMode)
@ -381,6 +382,12 @@ void USTTManagerBase::DebugPlayFileAsSTT(FString File)
FileRecorder->DebugPlayAudioFile(File); FileRecorder->DebugPlayAudioFile(File);
} }
void USTTManagerBase::DebugClearFilePlayback()
{
USTTRecorderDebugFile* FileRecorder = DebugGetFileRecorder();
FileRecorder->DebugClearAudioFile();
}
USTTRecorderDebugFile* USTTManagerBase::DebugGetFileRecorder() USTTRecorderDebugFile* USTTManagerBase::DebugGetFileRecorder()
{ {
@ -394,6 +401,44 @@ USTTRecorderDebugFile* USTTManagerBase::DebugGetFileRecorder()
FileRecorder->InitSTTRecorder(this, bDebugMode); FileRecorder->InitSTTRecorder(this, bDebugMode);
FileRecorder->OnChunkReceived.BindUFunction(STTPreprocessors[0], "OnChunkReceived"); FileRecorder->OnChunkReceived.BindUFunction(STTPreprocessors[0], "OnChunkReceived");
STTRecorder = FileRecorder; STTRecorder = FileRecorder;
// Disable echo cancellation on any WebRTC preprocessor in the chain
// (file playback has no real mic signal, so AEC would corrupt the audio)
for (int32 i = 0; i < STTPreprocessors.Num(); i++)
{
USTTPreprocessorWebRTC* WebRTCPP = Cast<USTTPreprocessorWebRTC>(STTPreprocessors[i]);
if (!WebRTCPP)
continue;
UClass* PPClass = WebRTCPP->GetClass();
// Unbind outgoing delegate and destroy old instance
WebRTCPP->OnChunkProcessed.Unbind();
WebRTCPP->DestroySTTPreprocessor();
WebRTCPP->RemoveFromRoot();
// Create a replacement with echo_canceller disabled
FSTTBaseSettings ModifiedSettings = ProcessorConfig->BaseSettings;
ModifiedSettings.WebRTCSettings.echo_canceller = false;
USTTPreprocessorWebRTC* NewWebRTCPP = NewObject<USTTPreprocessorWebRTC>(this, PPClass);
NewWebRTCPP->AddToRoot();
NewWebRTCPP->InitSTTPreprocessor(this, ModifiedSettings, bDebugMode);
// Re-bind incoming link
if (i == 0)
STTRecorder->OnChunkReceived.BindUFunction(NewWebRTCPP, "OnChunkReceived");
else
STTPreprocessors[i - 1]->OnChunkProcessed.BindUFunction(NewWebRTCPP, "OnChunkReceived");
// Re-bind outgoing link
if (i == STTPreprocessors.Num() - 1)
NewWebRTCPP->OnChunkProcessed.BindUFunction(STTProcessor, "OnChunkReceived");
else
NewWebRTCPP->OnChunkProcessed.BindUFunction(STTPreprocessors[i + 1], "OnChunkReceived");
STTPreprocessors[i] = NewWebRTCPP;
}
} }
return FileRecorder; return FileRecorder;
} }
@ -402,11 +447,41 @@ void USTTManagerBase::DebugResetRecorder()
{ {
STTRecorder->DestroySTTRecorder(); STTRecorder->DestroySTTRecorder();
STTRecorder->RemoveFromRoot(); STTRecorder->RemoveFromRoot();
USTTRecorderBase* FileRecorder = NewObject<USTTRecorderBase>(this, STTRecorderClass); USTTRecorderBase* NewRecorder = NewObject<USTTRecorderBase>(this, STTRecorderClass);
FileRecorder->AddToRoot(); NewRecorder->AddToRoot();
FileRecorder->InitSTTRecorder(this, bDebugMode); NewRecorder->InitSTTRecorder(this, bDebugMode);
FileRecorder->OnChunkReceived.BindUFunction(STTPreprocessors[0], "OnChunkReceived"); NewRecorder->OnChunkReceived.BindUFunction(STTPreprocessors[0], "OnChunkReceived");
STTRecorder = FileRecorder; STTRecorder = NewRecorder;
// Restore echo cancellation on any WebRTC preprocessor using original config
for (int32 i = 0; i < STTPreprocessors.Num(); i++)
{
USTTPreprocessorWebRTC* WebRTCPP = Cast<USTTPreprocessorWebRTC>(STTPreprocessors[i]);
if (!WebRTCPP)
continue;
UClass* PPClass = WebRTCPP->GetClass();
WebRTCPP->OnChunkProcessed.Unbind();
WebRTCPP->DestroySTTPreprocessor();
WebRTCPP->RemoveFromRoot();
USTTPreprocessorWebRTC* NewWebRTCPP = NewObject<USTTPreprocessorWebRTC>(this, PPClass);
NewWebRTCPP->AddToRoot();
NewWebRTCPP->InitSTTPreprocessor(this, ProcessorConfig->BaseSettings, bDebugMode);
if (i == 0)
STTRecorder->OnChunkReceived.BindUFunction(NewWebRTCPP, "OnChunkReceived");
else
STTPreprocessors[i - 1]->OnChunkProcessed.BindUFunction(NewWebRTCPP, "OnChunkReceived");
if (i == STTPreprocessors.Num() - 1)
NewWebRTCPP->OnChunkProcessed.BindUFunction(STTProcessor, "OnChunkReceived");
else
NewWebRTCPP->OnChunkProcessed.BindUFunction(STTPreprocessors[i + 1], "OnChunkReceived");
STTPreprocessors[i] = NewWebRTCPP;
}
} }
bool USTTManagerBase::IsSTTFullyInitialized() bool USTTManagerBase::IsSTTFullyInitialized()

3
Unreal/Plugins/AvatarCore_STT/Source/AvatarCore_STT/Public/Recorder/STTRecorderDebugFile.h

@ -29,6 +29,9 @@ public:
UFUNCTION(BlueprintCallable, Category = STTManager) UFUNCTION(BlueprintCallable, Category = STTManager)
void DebugPlayAudioFile(FString FilePath); void DebugPlayAudioFile(FString FilePath);
UFUNCTION(BlueprintCallable, Category = STTManager)
void DebugClearAudioFile();
private: private:

3
Unreal/Plugins/AvatarCore_STT/Source/AvatarCore_STT/Public/STTManagerBase.h

@ -168,6 +168,9 @@ public:
UFUNCTION(BlueprintCallable, Category = "AvatarCoreSTT") UFUNCTION(BlueprintCallable, Category = "AvatarCoreSTT")
void DebugPlayFileAsSTT(FString File); void DebugPlayFileAsSTT(FString File);
UFUNCTION(BlueprintCallable, Category = "AvatarCoreSTT")
void DebugClearFilePlayback();
USTTRecorderDebugFile* DebugGetFileRecorder(); USTTRecorderDebugFile* DebugGetFileRecorder();
UFUNCTION(BlueprintCallable, Category = "AvatarCoreSTT") UFUNCTION(BlueprintCallable, Category = "AvatarCoreSTT")

Loading…
Cancel
Save