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

This module provides the core Voxta integration for Unreal Engine, handling state tracking, audio playback, and communication with the Voxta server.

Main components

UVoxtaClient

The main public-facing subsystem for Voxta integration. Manages:

  • Stateful connection to VoxtaServer
  • Chat session lifecycle
  • Audio input/output
  • Character state management
  • Event broadcasting

Access via:

UVoxtaClient* Client = GetWorld()->GetGameInstance()->GetSubsystem<UVoxtaClient>();
UVoxtaClient Main public-facing subsystem for Voxta integration.
Definition VoxtaClient.h:50

UVoxtaAudioPlayback

Component that handles audio playback and lipsync for AI character responses. Features:

  • Character-specific audio playback
  • Multiple lipsync types (OVRLipSync, Audio2Face, Custom)
  • Automatic audio download and processing
  • Sequence management for multi-chunk responses

UVoxtaAudioInput

Handles microphone input and streaming to the Voxta server:

  • Configurable input buffer and format settings
  • Automatic reconnection handling
  • Voice activity detection
  • Silent mode toggles

Sequence diagram

Example flow of authentication, starting chat, receiving a response and sending microphone data. Along with fetching the character thumbnail.
Depending on your use case, the sequence will differ ofc.

SequenceDiagramUnrealVoxta image

Getting Started (C++)

  1. Add the UnrealVoxta plugin to your project
  2. Add UVoxtaClient to your GameInstance subsystems
  3. Initialize connection to Voxta server:
    UVoxtaClient* m_voxtaClient = GetWorld()->GetGameInstance()->GetSubsystem<UVoxtaClient>();
    m_voxtaClient->StartConnection(FString(TEXT("127.0.0.1")), 5384);
    void StartConnection(const FString &ipv4Address, int port)
    Start the VoxtaClient and connect to the Voxta SignalR hub.
    Definition VoxtaClient.cpp:56
  4. Listen for connection and character events:
    // Character list available after connection
    Client->VoxtaClientStateChangedEvent.AddDynamic(this, &ThisClass::OnVoxtaStateChanged);
    Client->VoxtaClientCharacterRegisteredEvent.AddDynamic(this, &ThisClass::OnCharacterRegistered);
    // Implement handlers
    void OnVoxtaStateChanged(VoxtaClientState NewState)
    {
    if(NewState == VoxtaClientState::Idle)
    {
    // Connection ready, can start chats
    }
    }
    void OnCharacterRegistered(const FAiCharData& CharData)
    {
    // Store character info
    FString Name = CharData.GetName();
    FGuid CharId = CharData.GetId();
    // Can use CharId to start chats
    }
    VoxtaClientState
    VoxtaClientState Contains the possible states that can be reported by the VoxtaClient when polled.
    Definition VoxtaClientState.h:16
    FVoxtaClientCharacterRegistered VoxtaClientCharacterRegisteredEvent
    Event fired when the internal VoxtaClient has loaded the metadata of an AiCharData.
    Definition VoxtaClient.h:96
    FVoxtaClientStateChanged VoxtaClientStateChangedEvent
    Event fired when the internal VoxtaClient has finished transitioning to a different state.
    Definition VoxtaClient.h:90
    FAiCharData Read-only data struct containing all the relevant information for an AI character.
    Definition AiCharData.h:21
    FStringView GetName() const
    Definition BaseCharData.h:26
    const FGuid & GetId() const
    Definition BaseCharData.h:23
  5. Get available characters:
    // Get array of all available characters
    TArray<FAiCharData> Characters = Client->GetAvailableAiCharactersCopy();
    // Or find specific character
    for(const FAiCharData& Character : Characters)
    {
    if(Character.GetName() == "DesiredName")
    {
    // Found character
    StartChatWithCharacter(Character.GetId());
    }
    }
    TArray< FAiCharData > GetAvailableAiCharactersCopy() const
    Definition VoxtaClient.cpp:493
  6. Create chat sessions:
    // Start chat with optional context
    Client->StartChatWithCharacter(CharacterId, "Optional context");
    // Listen for chat events
    Client->VoxtaClientChatSessionStartedEvent.AddDynamic(this, &ThisClass::OnChatStarted);
    Client->VoxtaClientCharMessageAddedEvent.AddDynamic(this, &ThisClass::OnMessageReceived);
    void OnChatStarted(const FChatSession& Session)
    {
    // Chat session ready
    // Can now send messages
    Client->SendUserInput("Hello!", true); // true = generate AI reply
    }
    void OnMessageReceived(const FBaseCharData& Sender, const FChatMessage& Message)
    {
    FString Text = Message.GetTextContent();
    // Handle message...
    }
    void SendUserInput(const FString &inputText, bool generateReply=true, bool characterActionInference=false)
    Send user input text to the server as part of the current chat session.
    Definition VoxtaClient.cpp:186
    FVoxtaClientChatSessionStarted VoxtaClientChatSessionStartedEvent
    Event fired when the chat session has begun.
    Definition VoxtaClient.h:140
    void StartChatWithCharacter(const FGuid &charId, const FString &context=TEXT(""))
    Tell the server to initiate a chat session with the character of the provided ID.
    Definition VoxtaClient.cpp:121
    FVoxtaClientCharMessageAdded VoxtaClientCharMessageAddedEvent
    Event fired when the VoxtaClient is notified by the server that a message is added.
    Definition VoxtaClient.h:106
    FBaseCharData Read-only data struct containing all the universal information fields for a character.
    Definition BaseCharData.h:17
    FChatMessage Represents a single message in a chat conversation, containing both text and audio data.
    Definition ChatMessage.h:16
    FStringView GetTextContent() const
    Get the current text content of the message.
    Definition ChatMessage.h:43
    FChatSession Data struct containing all the relevant information regarding a chat session between the...
    Definition ChatSession.h:20
  7. Add audio playback for characters:
    // Add component to actor
    UVoxtaAudioPlayback* AudioComp = NewObject<UVoxtaAudioPlayback>(this);
    AudioComp->RegisterComponent();
    // Initialize for specific character
    AudioComp->Initialize(CharacterId);
    // Listen for playback events
    AudioComp->VoxtaMessageAudioPlaybackFinishedEvent.AddDynamic(this, &ThisClass::OnAudioFinished);

Events

The module provides extensive event systems for state changes:

  • VoxtaClientStateChangedEvent - Connection state changes
  • VoxtaClientCharacterRegisteredEvent - New character data loaded
  • VoxtaClientCharMessageAddedEvent - New chat messages
  • VoxtaClientChatSessionStartedEvent - Chat session lifecycle
  • VoxtaClientAudioPlaybackRegisteredEvent - Audio handler registration

Server Requirements

  • Requires a running Voxta server
  • Compatible with Voxta API version defined in VoxtaVersionData
  • Supports HTTP/WebSocket communication
  • Optional services: TextToSpeech, SpeechToText

Additional Features

  • Global audio fallback system
  • Character thumbnail caching
  • Automatic reconnection handling
  • Debug logging utilities
  • Audio format conversion

Dependencies

Licensing

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