Documentation Index
Fetch the complete documentation index at: https://dev.docs.inworld.ai/llms.txt
Use this file to discover all available pages before exploring further.
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
| Parameter | Type | Description |
|---|
| Audio | const FInworldData_Audio& | The audio data to break apart |
| OutWaveform | TArray<uint8>& | The raw PCM waveform bytes |
| OutSampleRate | int32& | 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
| Parameter | Type | Description |
|---|
| TTSOutput | const FInworldData_TTSOutput& | The TTS output containing phonetic timestamp data |
| OutPhoneSpans | TArray<FInworldPhoneSpan>& | The resulting flat array of phone spans |
CreateBooleanJinjaArgument
FJinjaArgument CreateBooleanJinjaArgument(bool Value)
Parameters
| Parameter | Type | Description |
|---|
| Value | bool | The boolean value to wrap |
Returns
Type: FJinjaArgument
CreateFloatJinjaArgument
FJinjaArgument CreateFloatJinjaArgument(float Value)
Parameters
| Parameter | Type | Description |
|---|
| Value | float | The float value to wrap |
Returns
Type: FJinjaArgument
CreateIntJinjaArgument
FJinjaArgument CreateIntJinjaArgument(int32 Value)
Parameters
| Parameter | Type | Description |
|---|
| Value | int32 | The integer value to wrap |
Returns
Type: FJinjaArgument
CreateInworldDataError
void CreateInworldDataError(
UScriptStruct* InworldDataStructType,
EInworldStatusCode StatusCode,
const FString& Reason,
int32& Data
)
Parameters
| Parameter | Type | Description |
|---|
| InworldDataStructType | UScriptStruct* | The struct type to wrap the error in |
| StatusCode | EInworldStatusCode | The status code indicating the error type |
| Reason | const FString& | Human-readable description of the error |
| Data | int32& | Output: the resulting error data handle |
CreateStringJinjaArgument
FJinjaArgument CreateStringJinjaArgument(FString Value)
Parameters
| Parameter | Type | Description |
|---|
| Value | FString | The string value to wrap |
Returns
Type: FJinjaArgument
CreateStructJinjaArgument
FJinjaArgument CreateStructJinjaArgument(const int32& Data)
Parameters
| Parameter | Type | Description |
|---|
| Data | const 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
| Parameter | Type | Description |
|---|
| TTSOutputStream | FInworldData_DataStream_TTSOutput | The 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
| Parameter | Type | Description |
|---|
| TTSOutputStream | const 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
| Parameter | Type | Description |
|---|
| PlaybackInfo | const FInworldVoiceAudioPlaybackInfo& | Current playback state, including elapsed duration |
| TTSOutput | const 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
| Parameter | Type | Description |
|---|
| PlaybackInfo | const FInworldVoiceAudioPlaybackInfo& | Current playback state, including elapsed duration |
| PhoneSpans | const 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
| Parameter | Type | Description |
|---|
| PlaybackInfo | const FInworldVoiceAudioPlaybackInfo& | Current playback state, including elapsed duration |
| TTSOutput | const 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
| Parameter | Type | Description |
|---|
| ProcessContext | UInworldProcessContext* | The process context to read from |
| Key | const FName& | The runtime data key to look up |
| ScriptStruct | UScriptStruct* | The expected struct type |
| Struct | int32& | Output: the retrieved struct value |
| Successful | bool& | 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
| Parameter | Type | Description |
|---|
| PlaybackInfo | const FInworldVoiceAudioPlaybackInfo& | Current playback state, including elapsed duration |
| PhoneSpans | const 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
| Parameter | Type | Description |
|---|
| PlaybackInfo | const FInworldVoiceAudioPlaybackInfo& | Current playback state, including elapsed duration |
| TTSOutput | const FInworldData_TTSOutput& | The TTS output containing phonetic timestamp data |
Returns
Type: FInworldVisemeBlends
MakeAudio
FInworldData_Audio MakeAudio(
const TArray<uint8>& Waveform,
int32 SampleRate
)
Parameters
| Parameter | Type | Description |
|---|
| Waveform | const TArray<uint8>& | Raw PCM waveform bytes |
| SampleRate | int32 | Sample 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
| Parameter | Type | Description |
|---|
| Template | const FString& | The Jinja2 template string |
| ArgMap | const TMap<FString, FJinjaArgument>& | Map of variable names to typed argument values |
| OutJinja | FString& | Output: the rendered string |
Returns
Type: bool — true 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
| Parameter | Type | Description |
|---|
| JinjaTemplate | const FString& | The Jinja2 template string |
| VariablesJson | const FString& | A JSON object string whose keys map to template variable names |
| OutRender | FString& | Output: the rendered string |
Returns
Type: bool — true 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
| Parameter | Type | Description |
|---|
| LLMOutputString | const FString& | The LLM output string to edit |
| OutTrimmedLLMOutputString | FString& | The result string with spaces and quotes removed |
UnwrapInworldDataHandle
void UnwrapInworldDataHandle(
const FInworldDataHandle& DataHandle,
UScriptStruct* ScriptStruct,
int32& Data,
bool& UnwrapSuccessful
)
Parameters
| Parameter | Type | Description |
|---|
| DataHandle | const FInworldDataHandle& | The data handle to unwrap |
| ScriptStruct | UScriptStruct* | The expected struct type |
| Data | int32& | Output: the unwrapped struct value |
| UnwrapSuccessful | bool& | Output: whether the unwrap succeeded |
WrapInworldData
FInworldDataHandle WrapInworldData(
UScriptStruct* ScriptStruct,
const int32& Data
)
Parameters
| Parameter | Type | Description |
|---|
| ScriptStruct | UScriptStruct* | The struct type of the data to wrap |
| Data | const int32& | The struct value to wrap (wildcard — accepts any USTRUCT) |
Returns
Type: FInworldDataHandle