UnrealVoxta 0.1.1
 
Loading...
Searching...
No Matches
VoxtaUtility_A2F Module

Overview

The VoxtaUtility_A2F module provides integration with NVIDIA's Audio2Face technology for high-quality facial animation from audio. It includes functionality for real-time playback of lip-sync data synchronized with audio, as well as REST-based communication with Audio2Face's headless mode for generating blend shape data.

Module Structure

Public API

Sequence diagrams

Rest api:
SequenceDiagramA2F_rest image

Runtime logic:
SequenceDiagramA2FRuntime image

Features

Audio2Face Playback

The module provides a playback system that ensures A2F data is played in sync with the audio component:

// Initialize the playback handler
UAudio2FacePlaybackHandler* PlaybackHandler = NewObject<UAudio2FacePlaybackHandler>();
PlaybackHandler->Initialize(AudioComponent);
// Play lip-sync data along with audio
PlaybackHandler->Play(LipSyncData);
// Stop playback when needed
PlaybackHandler->Stop();
UAudio2FacePlaybackHandler Handles synchronization and playback of Audio2Face lipsync data with audio...
Definition Audio2FacePlaybackHandler.h:20
void Initialize(UAudioComponent *audioComponent)
Register the AudioComponent that will be used to sync the A2F lipsync data.
Definition Audio2FacePlaybackHandler.cpp:65
void Play(const ULipSyncDataA2F *lipsyncData)
Begin playback of the A2F lipsync data along with the audio in the AudioComponent.
Definition Audio2FacePlaybackHandler.cpp:89
void Stop()
Stop the playback and return to a lipsync state (closed mouth).
Definition Audio2FacePlaybackHandler.cpp:113

Custom Animation Node

The module includes a custom animation node for applying predefined curves to ARKit mapping:

  • The node automatically finds the Audio2Face provider on the owning actor.
  • Updates happen in PreUpdate() and Evaluate_AnyThread().
  • The node applies A2F curve weights to the facial animation rig using ARKIT curve names.

Audio2Face REST Communication

For generating lip-sync data using Audio2Face's headless mode:

// Create a REST handler
TSharedPtr<Audio2FaceRESTHandler> RESTHandler = MakeShared<Audio2FaceRESTHandler>();
// Initialize A2F connection (this is asynchronous)
RESTHandler->TryInitialize();
// Check if A2F is ready
if (RESTHandler->IsAvailable())
{
// Generate blend shapes from audio file
RESTHandler->GetBlendshapes(
"VoiceLine.wav",
"/Output/Path/",
"LipSyncData.json",
[](const FString& Path, bool Success) {
// Handle result
}
);
}

LipSync Data Storage

The module provides a specialized data structure for storing and managing A2F lip-sync data:

// Create lip-sync data container (automatically added to root)
ULipSyncDataA2F* LipSyncData = NewObject<ULipSyncDataA2F>();
// Set curve weights (typically from generated data)
LipSyncData->SetA2FCurveWeights(SourceCurves, 30); // at 30 FPS
// Get curve data
const TArray<TArray<float>>& CurveWeights = LipSyncData->GetA2FCurveWeights();
int FPS = LipSyncData->GetFramePerSecond();
// Release data when no longer needed (removes from root)
LipSyncData->ReleaseData();
ULipSyncDataA2F UObject-based container for Audio2Face lipsync data.
Definition LipSyncDataA2F.h:18
void SetA2FCurveWeights(const TArray< TArray< float > > &sourceCurves, int framesPerSecond)
Register the genereated curves from A2F as part of this data object.
Definition LipSyncDataA2F.h:52
const TArray< TArray< float > > & GetA2FCurveWeights() const
Definition LipSyncDataA2F.h:65
virtual void ReleaseData() override
Clean up the A2F-lipsync data.
Definition LipSyncDataA2F.h:28
int GetFramePerSecond() const
Definition LipSyncDataA2F.h:59

Dependencies

Licensing

MIT license - copyright (c) 2025 grrimgrriefer & DZnnah. See LICENSE in root for details.