Skip to content

Class UTryllVoiceInputComponent

ClassList > UTryllVoiceInputComponent

More...

  • #include <TryllVoiceInputComponent.h>

Inherits the following classes: UActorComponent

Public Attributes

Type Name
float HotwordsScore = 1.5f
FTryllStoragePath HotwordsStoragePath
int32 MaxUtteranceMs = 60000
FTryllModelName ModelName = TEXT("Whisper Tiny EN (int8)")
FOnTryllVoiceError OnError
FOnTryllTranscriptUpdate OnTranscriptUpdate
FOnTryllVoiceInputCreated OnVoiceInputCreated
UTryllAgentComponent * TargetAgent = nullptr
int32 VadMinSilenceMs = 500
int32 VadSpeechPadMs = 250
float VadThreshold = 0.5f
bool bAutoFinishOnSilence = true
bool bCreateOnConnect = true
bool bWaitForAgentReady = true

Public Functions

Type Name
void BeginUtterance (UTryllAgentComponent * AgentOverride=nullptr)
void CancelUtterance ()
void CreateVoiceInput ()
void DestroyVoiceInput ()
void EndUtterance ()
TSharedPtr< FTryllVoiceInput > GetVoiceInput () const
bool HasVoiceInput () const
bool IsUtteranceActive () const
UTryllVoiceInputComponent ()

Protected Functions

Type Name
virtual void BeginPlay () override
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason) override
virtual void TickComponent (float DeltaTime, ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) override

Detailed Description

Actor component: owns one FTryllVoiceInput (STT) handle and drives it from the system microphone. The Unreal counterpart to the Unity TryllVoiceInputComponent.

Capture model: on-demand. The microphone opens on BeginUtterance() and closes when the final transcript arrives (or on End / Cancel). The component ticks to drain captured PCM and forward it to the server.

Audio: the device-native sample rate is declared to the server, which resamples to the STT model's expected rate. Multi-channel input is downmixed to mono.

All delegates fire on the game thread.

Public Attributes Documentation

variable HotwordsScore

float UTryllVoiceInputComponent::HotwordsScore;

Logit-bias score applied to hotword tokens during decoding.


variable HotwordsStoragePath

FTryllStoragePath UTryllVoiceInputComponent::HotwordsStoragePath;

Plain string storage containing hotword / wake-word phrases (one per line). Relative to TryllRuntimeSettings::StorageDataFolder, e.g. "hotwords.txt". Leave empty to disable hotword boosting.


variable MaxUtteranceMs

int32 UTryllVoiceInputComponent::MaxUtteranceMs;

Hard timeout (ms) per utterance.


variable ModelName

FTryllModelName UTryllVoiceInputComponent::ModelName;

STT model — picked from the project's registered models (Model Manager).


variable OnError

FOnTryllVoiceError UTryllVoiceInputComponent::OnError;

Fired on protocol-level errors.


variable OnTranscriptUpdate

FOnTryllTranscriptUpdate UTryllVoiceInputComponent::OnTranscriptUpdate;

Fired for each transcript update (partial and final).


variable OnVoiceInputCreated

FOnTryllVoiceInputCreated UTryllVoiceInputComponent::OnVoiceInputCreated;

Fired when the VoiceInput handle has been created.


variable TargetAgent

UTryllAgentComponent* UTryllVoiceInputComponent::TargetAgent;

Agent that receives the final transcript. Leave unset to auto-use the UTryllAgentComponent on the same actor (the common case — the details panel can't pick sibling components, so this resolves in BeginPlay). Put the Voice component on an actor with no agent for transcribe-only mode.


variable VadMinSilenceMs

int32 UTryllVoiceInputComponent::VadMinSilenceMs;

Silence duration (ms) that closes a speech segment.


variable VadSpeechPadMs

int32 UTryllVoiceInputComponent::VadSpeechPadMs;

Padding (ms) added around detected speech.


variable VadThreshold

float UTryllVoiceInputComponent::VadThreshold;

Silero VAD speech-probability threshold.


variable bAutoFinishOnSilence

bool UTryllVoiceInputComponent::bAutoFinishOnSilence;

Let server VAD close the utterance on silence (stop-on-silence mode).


variable bCreateOnConnect

bool UTryllVoiceInputComponent::bCreateOnConnect;

Create the VoiceInput handle automatically once the session is ready (connected + configured); queues until OnCreateSessionComplete if it spawns earlier. (Name kept for compatibility; it fires on session-ready, not raw connect.)


variable bWaitForAgentReady

bool UTryllVoiceInputComponent::bWaitForAgentReady;

Sequence VoiceInput creation behind the sibling agent: wait for the agent's OnAgentReady before creating the VoiceInput, instead of creating as soon as the session is ready. This serialises first-run model auto-downloads so the STT/VAD fetch never overlaps the agent's LLM/TTS fetch — concurrent downloads deadlock the server's shared HuggingFace connection. Ignored when there is no TargetAgent (transcribe-only). Set false to restore the old concurrent behaviour.


Public Functions Documentation

function BeginUtterance

void UTryllVoiceInputComponent::BeginUtterance (
    UTryllAgentComponent * AgentOverride=nullptr
) 

Open a new utterance and start microphone capture. The final transcript is routed to AgentOverride when given, otherwise to TargetAgent; transcribe-only when both are null.


function CancelUtterance

void UTryllVoiceInputComponent::CancelUtterance () 

Cancel the current utterance without producing a transcript.


function CreateVoiceInput

void UTryllVoiceInputComponent::CreateVoiceInput () 

Create the server-side VoiceInput handle. Ignored when one already exists.


function DestroyVoiceInput

void UTryllVoiceInputComponent::DestroyVoiceInput () 

Destroy the handle and release the server-side session.


function EndUtterance

void UTryllVoiceInputComponent::EndUtterance () 

Commit the current utterance (push-to-talk release).


function GetVoiceInput

inline TSharedPtr< FTryllVoiceInput > UTryllVoiceInputComponent::GetVoiceInput () const

Live handle. Null until CreateVoiceInput completes.


function HasVoiceInput

bool UTryllVoiceInputComponent::HasVoiceInput () const

True once the server-side VoiceInput handle exists.


function IsUtteranceActive

bool UTryllVoiceInputComponent::IsUtteranceActive () const

True while an utterance is open.


function UTryllVoiceInputComponent

UTryllVoiceInputComponent::UTryllVoiceInputComponent () 

Protected Functions Documentation

function BeginPlay

virtual void UTryllVoiceInputComponent::BeginPlay () override

function EndPlay

virtual void UTryllVoiceInputComponent::EndPlay (
    const EEndPlayReason::Type EndPlayReason
) override

function TickComponent

virtual void UTryllVoiceInputComponent::TickComponent (
    float DeltaTime,
    ELevelTick TickType,
    FActorComponentTickFunction * ThisTickFunction
) override


The documentation for this class was generated from the following file C:/_tryll/_monorepo3/tryll/clients/unreal/Source/TryllClient/Public/TryllVoiceInputComponent.h