Breadcrumbs

SG Com UE Functions

SGComBlueprintFunctionLibrary

These functions can be called from anywhere, but the Initialize and Shutdown functions should generally be used in a game mode or level blueprint, for example. This is in order to ensure that they can be called at the start and end of the game, before any SGComSessionComponent calls are made, and after all necessary SGComSessionComponent calls have been completed.

Initialize SGCom: Initializes the SG Com API. This should be called once, at the start of the game, before using any other SG Com functions.

Screenshot 2023-12-06 120735.png

Shutdown SGCom: Shuts down the SG Com API. This should be called once, at the end of the game, after all SG Com Sessions have been ended through EndSession().

Screenshot 2023-12-06 120911.png

Decompress SoundWave (Editor Only): Helper function. Decompresses SoundWave audio to Raw PCM data that can be passed to SG Com. Loading Behavior Override of the SoundWave needs to be set to Force Inline or the function will fail in packaged builds due to Audio Streaming Caching

Screenshot 2023-12-06 121032.png

Input SoundWave: Helper function. Suitable for packaged builds. Inputs a SoundWave to the SGComSessionComponent for processing and attaches FSourceEffectSGCom to the audio source. The SoundWave will be decompressed and the raw PCM data will be sent to the SGComSessionComponent. Calls InputAudio() on the SGComSessionComponent internally.


IMPORTANT: When using SourceComponents Unreal Engine provides raw audio in 32 bit float and a sample rate that depends on the current platform (in practice, it defaults to 48000Hz). You need to set your SG Com configuration accordingly, regardless of the audio file you are using.

image-20240322-150349.png


SGComSessionComponent

A “session” comprises a combination of SG Com Engine and Player for a single character (see Engines and Players). This component covers the majority of SG Com functionality, with the rest being part of the SGComBlueprintFunctionLibrary. A session component should be attached to any character in the scene that you intend to animate locally using SG Com.

Session management

Functions for managing individual SG Com sessions.

Start Session: Starts the SG Com session based on the provided configuration.

Screenshot 2023-12-06 121210.png

End Session: Ends the SG Com session.

Screenshot 2023-12-06 121343.png

Start Player-Only Session: Starts an SG Com session where the engine is remote.

Screenshot 2023-12-06 121548.png

End Player-Only Session: Ends the player-only SG Com session.

Screenshot 2023-12-06 121707.png

Audio input

Functions for managing SG Com Input.

Input Audio: Inputs an array of raw PCM audio data to the SGCom engine.

Screenshot 2023-12-06 121845.png

Animation control

Functions for managing animation generation and playback.

Reset: Resets the SG Com Engine, discarding all animation.

Screenshot 2023-12-06 142234-20231206-142311.png

Set Greedy Process Enabled: Enable/Disable greedy processing of audio. If enabled, the Engine will immediately process all available audio. Enabled by default.

Screenshot 2023-12-06 142403-20231206-142439.png

Set Current Animation Time: Sets the current animation time in seconds.

Screenshot 2023-12-06 143706-20231206-143740.png

Get Animation Range: Retrieves the time range of the available animation in seconds.

Screenshot 2023-12-06 143814-20231206-143842.png

SG Com Pose: Animation node that produces a pose based on the current SG Com Engine values. The values are applied to the Base Pose of the character

Screenshot 2023-12-06 150714-20231206-150745.png

Behavior Modes

Functions for using Behavior Modes.

Set Mode: Sets the behavior mode of the character. The input must be one of the available mode names.

Screenshot 2023-12-06 122814.png

Get Mode: Returns the current behavior mode of the character.

Screenshot 2023-12-06 123055.png

Get Mode Names: Returns an array of strings containing the available behavior modes of the character.

Screenshot 2023-12-06 124914.png

Auto Modes

Functions for using Auto modes.

Set Default Mode: Changes the default mode, which is the behavior mode that will be active if no other mode is automatically or explicitly set.

Screenshot 2023-12-06 125102-20231206-125142.png

Set Auto Mode: Maps an auto mode to a specific behavior mode of the character. If not specified, the auto mode will not trigger any change in behavior.

Screenshot 2023-12-06 125220-20231206-125257.png

Unset Auto Modes: Clears the auto mode mappings.

Screenshot 2023-12-06 125606-20231206-125637.png

Activate Auto Modes: Activates the auto modes system. Note that using Set Mode to explicitly set the behavior mode will automatically deactivate auto modes. Over the course of dectivation and reactivation, the previously set auto-mode mappings are preserved.

Screenshot 2023-12-06 125755-20231206-125821.png

Behavior Modifiers

Functions for using Behavior Modifiers.

Set Animation Scale: Sets the scale factor of muscle motion (default value: 1.0).

Screenshot 2023-12-06 144517-20231206-144559.png

Get Animation Scale: Gets the scale factor of muscle motion.

Screenshot 2023-12-06 145125-20231206-145212.png

Set Animation Speed: Sets the speed factor of muscle motion (default value: 1.0).

Screenshot 2023-12-06 145253-20231206-145320.png

Get Animation Speed: Gets the speed factor of muscle motion.

Screenshot 2023-12-06 145358-20231206-145427.png

Set Expression Frequency: Sets the frequency of expression change (default value: 1.0).

Screenshot 2023-12-06 145513-20231206-145541.png

Get Expression Frequency: Gets the frequency of expression change.

Screenshot 2023-12-06 145621-20231206-145648.png

Role

Functions for using SG Com Roles.

Set Role: Sets the session role (Speaking/Listening).

Screenshot 2023-12-06 150436-20231206-150513.png

Get Role: Gets the session role.

Screenshot 2023-12-06 150557-20231206-150623.png

Metadata updates

Event callbacks that can be be used for tracking or reacting to specific changes in SG Com algorithms. See Metadata updates.

On Mode Changed: Event callback that is triggered when the character's mode changes.

Screenshot 2023-12-06 151555-20231206-151629.png

On Expression Changed: Event callback that is triggered when the character's expression changes.

Screenshot 2023-12-06 151712-20231206-151752.png

On Voice Activity Changed: Event dispatcher that is triggered when voice activity change is detected. Returns "true" for voice and "false" for silence.

image-20240311-193625.png