Skip to main content
Overview > Inworld Blueprint Function Library Class: UInworldBlueprintFunctionLibrary | Inherits from: UBlueprintFunctionLibrary

Methods

Reference

BreakAudio

void BreakAudio(
    const FInworldData_Audio& Audio,
    TArray<uint8>& OutWaveform,
    int32& OutSampleRate
)

Parameters

ParameterTypeDescription
Audioconst FInworldData_Audio&The audio data to break apart
OutWaveformTArray<uint8>&The raw PCM waveform bytes
OutSampleRateint32&The sample rate of the audio

BuildPhoneSpansFromTTSOutput

Builds a flat array of phone spans from a TTS output object. Extracts phonetic timing data from Timestamps → PhoneticDetails.Phones. Use this to cache lip-sync data from a completed TTS output before playback.
void BuildPhoneSpansFromTTSOutput(
    const FInworldData_TTSOutput& TTSOutput,
    TArray<FInworldPhoneSpan>& OutPhoneSpans
)

Parameters

ParameterTypeDescription
TTSOutputconst FInworldData_TTSOutput&The TTS output containing phonetic timestamp data
OutPhoneSpansTArray<FInworldPhoneSpan>&The resulting flat array of phone spans

CreateBooleanJinjaArgument

FJinjaArgument CreateBooleanJinjaArgument(bool Value)

Parameters

ParameterTypeDescription
ValueboolThe boolean value to wrap

Returns

Type: FJinjaArgument

CreateFloatJinjaArgument

FJinjaArgument CreateFloatJinjaArgument(float Value)

Parameters

ParameterTypeDescription
ValuefloatThe float value to wrap

Returns

Type: FJinjaArgument

CreateIntJinjaArgument

FJinjaArgument CreateIntJinjaArgument(int32 Value)

Parameters

ParameterTypeDescription
Valueint32The integer value to wrap

Returns

Type: FJinjaArgument

CreateInworldDataError

void CreateInworldDataError(
    UScriptStruct* InworldDataStructType,
    EInworldStatusCode StatusCode,
    const FString& Reason,
    int32& Data
)

Parameters

ParameterTypeDescription
InworldDataStructTypeUScriptStruct*The struct type to wrap the error in
StatusCodeEInworldStatusCodeThe status code indicating the error type
Reasonconst FString&Human-readable description of the error
Dataint32&Output: the resulting error data handle

CreateStringJinjaArgument

FJinjaArgument CreateStringJinjaArgument(FString Value)

Parameters

ParameterTypeDescription
ValueFStringThe string value to wrap

Returns

Type: FJinjaArgument

CreateStructJinjaArgument

FJinjaArgument CreateStructJinjaArgument(const int32& Data)

Parameters

ParameterTypeDescription
Dataconst int32&The struct value to wrap (wildcard — accepts any USTRUCT)

Returns

Type: FJinjaArgument

DataStreamTTSOutputGetNext

Retrieves the next TTS output chunk from a streaming TTS data stream. Should only be called when DataStreamTTSOutputHasNext returns true.
FInworldDataHandle DataStreamTTSOutputGetNext(FInworldData_DataStream_TTSOutput TTSOutputStream)

Parameters

ParameterTypeDescription
TTSOutputStreamFInworldData_DataStream_TTSOutputThe TTS data stream to read from

Returns

Type: FInworldDataHandle

DataStreamTTSOutputHasNext

Returns whether a streaming TTS data stream has more output chunks available.
bool DataStreamTTSOutputHasNext(const FInworldData_DataStream_TTSOutput& TTSOutputStream)

Parameters

ParameterTypeDescription
TTSOutputStreamconst FInworldData_DataStream_TTSOutput&The TTS data stream to check

Returns

Type: bool

GetCurrentWord

Returns the word currently being spoken at the given playback position. Compares PlaybackInfo.Utterance.PlayedDuration against each word’s StartTime and EndTime from the TTS output timestamps.
FInworldAudioVoiceWord GetCurrentWord(
    const FInworldVoiceAudioPlaybackInfo& PlaybackInfo,
    const FInworldData_TTSOutput& TTSOutput
)

Parameters

ParameterTypeDescription
PlaybackInfoconst FInworldVoiceAudioPlaybackInfo&Current playback state, including elapsed duration
TTSOutputconst FInworldData_TTSOutput&The TTS output containing word timestamp data

Returns

Type: FInworldAudioVoiceWord

GetPhonemeBlends

Calculates phoneme blend weights at the current playback position from a pre-built array of phone spans. Uses the same timing logic as GetVisemeBlends but returns phoneme codes instead of viseme categories. Use this when you need raw phoneme data rather than viseme mappings.
FInworldPhonemeBlends GetPhonemeBlends(
    const FInworldVoiceAudioPlaybackInfo& PlaybackInfo,
    const TArray<FInworldPhoneSpan>& PhoneSpans
)

Parameters

ParameterTypeDescription
PlaybackInfoconst FInworldVoiceAudioPlaybackInfo&Current playback state, including elapsed duration
PhoneSpansconst TArray<FInworldPhoneSpan>&Pre-built array of phone spans (from BuildPhoneSpansFromTTSOutput)

Returns

Type: FInworldPhonemeBlends

GetPhonemeBlendsTTS

Calculates phoneme blend weights directly from a TTS output object and current playback position. Combines BuildPhoneSpansFromTTSOutput and GetPhonemeBlends in a single call. Use GetPhonemeBlends with a cached span array if performance is a concern.
FInworldPhonemeBlends GetPhonemeBlendsTTS(
    const FInworldVoiceAudioPlaybackInfo& PlaybackInfo,
    const FInworldData_TTSOutput& TTSOutput
)

Parameters

ParameterTypeDescription
PlaybackInfoconst FInworldVoiceAudioPlaybackInfo&Current playback state, including elapsed duration
TTSOutputconst FInworldData_TTSOutput&The TTS output containing phonetic timestamp data

Returns

Type: FInworldPhonemeBlends

GetRuntimeStruct

void GetRuntimeStruct(
    UInworldProcessContext* ProcessContext,
    const FName& Key,
    UScriptStruct* ScriptStruct,
    int32& Struct,
    bool& Successful
)

Parameters

ParameterTypeDescription
ProcessContextUInworldProcessContext*The process context to read from
Keyconst FName&The runtime data key to look up
ScriptStructUScriptStruct*The expected struct type
Structint32&Output: the retrieved struct value
Successfulbool&Output: whether the retrieval succeeded

GetVisemeBlends

Calculates viseme blend weights for the current playback position from a pre-built array of phone spans. Smoothly interpolates between visemes. Build PhoneSpans once per utterance using BuildPhoneSpansFromTTSOutput and cache it for use each tick.
FInworldVisemeBlends GetVisemeBlends(
    const FInworldVoiceAudioPlaybackInfo& PlaybackInfo,
    const TArray<FInworldPhoneSpan>& PhoneSpans
)

Parameters

ParameterTypeDescription
PlaybackInfoconst FInworldVoiceAudioPlaybackInfo&Current playback state, including elapsed duration
PhoneSpansconst TArray<FInworldPhoneSpan>&Pre-built array of phone spans (from BuildPhoneSpansFromTTSOutput)

Returns

Type: FInworldVisemeBlends

GetVisemeBlendsTTS

Calculates viseme blend weights directly from a TTS output object and current playback position. Combines BuildPhoneSpansFromTTSOutput and GetVisemeBlends in a single call. Use GetVisemeBlends with a cached span array if performance is a concern.
FInworldVisemeBlends GetVisemeBlendsTTS(
    const FInworldVoiceAudioPlaybackInfo& PlaybackInfo,
    const FInworldData_TTSOutput& TTSOutput
)

Parameters

ParameterTypeDescription
PlaybackInfoconst FInworldVoiceAudioPlaybackInfo&Current playback state, including elapsed duration
TTSOutputconst FInworldData_TTSOutput&The TTS output containing phonetic timestamp data

Returns

Type: FInworldVisemeBlends

MakeAudio

FInworldData_Audio MakeAudio(
    const TArray<uint8>& Waveform,
    int32 SampleRate
)

Parameters

ParameterTypeDescription
Waveformconst TArray<uint8>&Raw PCM waveform bytes
SampleRateint32Sample rate of the audio data

Returns

Type: FInworldData_Audio

RenderJinjaWithArgMap

Renders a Jinja2 template string using a map of typed argument values. Returns true on success and writes the rendered output to OutJinja. Use CreateBooleanJinjaArgument, CreateStringJinjaArgument, etc. to build the argument map.
bool RenderJinjaWithArgMap(
    const FString& Template,
    const TMap<FString, FJinjaArgument>& ArgMap,
    FString& OutJinja
)

Parameters

ParameterTypeDescription
Templateconst FString&The Jinja2 template string
ArgMapconst TMap<FString, FJinjaArgument>&Map of variable names to typed argument values
OutJinjaFString&Output: the rendered string

Returns

Type: booltrue if rendering succeeded

RenderJinjaWithJson

Renders a Jinja2 template string using variables supplied as a JSON string. Returns true on success and writes the rendered output to OutRender.
bool RenderJinjaWithJson(
    const FString& JinjaTemplate,
    const FString& VariablesJson,
    FString& OutRender
)

Parameters

ParameterTypeDescription
JinjaTemplateconst FString&The Jinja2 template string
VariablesJsonconst FString&A JSON object string whose keys map to template variable names
OutRenderFString&Output: the rendered string

Returns

Type: booltrue if rendering succeeded

TrimLLMOutput

Removes leading and trailing quotes as well as getting rid of double spaces and other artifacts of LLM text generation.
void TrimLLMOutput(
    const FString& LLMOutputString,
    FString& OutTrimmedLLMOutputString
)

Parameters

ParameterTypeDescription
LLMOutputStringconst FString&The LLM output string to edit
OutTrimmedLLMOutputStringFString&The result string with spaces and quotes removed

UnwrapInworldDataHandle

void UnwrapInworldDataHandle(
    const FInworldDataHandle& DataHandle,
    UScriptStruct* ScriptStruct,
    int32& Data,
    bool& UnwrapSuccessful
)

Parameters

ParameterTypeDescription
DataHandleconst FInworldDataHandle&The data handle to unwrap
ScriptStructUScriptStruct*The expected struct type
Dataint32&Output: the unwrapped struct value
UnwrapSuccessfulbool&Output: whether the unwrap succeeded

WrapInworldData

FInworldDataHandle WrapInworldData(
    UScriptStruct* ScriptStruct,
    const int32& Data
)

Parameters

ParameterTypeDescription
ScriptStructUScriptStruct*The struct type of the data to wrap
Dataconst int32&The struct value to wrap (wildcard — accepts any USTRUCT)

Returns

Type: FInworldDataHandle