codePublic API Reference

CrystalLipSyncController API

Namespace: CrystalLipSync

Properties

Property
Type
Description

Mood

LipSyncMood

Get/set the current emotional mood.

VisemeWeights

float[]

Current smoothed viseme weights (length 15). Read-only array, updated every frame.

DominantViseme

int

Index of the viseme with the highest weight.

CurrentVolume

float

Current RMS volume level of the analyzed audio.

SpectralCentroid

float

Spectral centroid of the current frame in Hz.

HighFreqRatio

float

Ratio of high-to-total frequency energy (0...1).

BandEnergies

float[]

Normalized energy per frequency band (6 bands).

IsActive

bool

Whether the AudioSource is assigned and playing.

Events

Event
Signature
Description

OnVisemeWeightsUpdated

Action<float[]>

Fired every frame after viseme weights are updated.

Methods

// Get or set the AudioSource at runtime
AudioSource GetAudioSource();
void SetAudioSource(AudioSource source);

// Assign or clear a profile at runtime
void SetProfile(CrystalLipSyncProfile newProfile);

// Set the mood at runtime
void SetMood(LipSyncMood newMood);

// Reinitialize the analyzer with a new FFT size
void ReinitializeAnalyzer(FFTSizeOption newFftSize);

CrystalLipSyncBlendshapeTarget API

Namespace: CrystalLipSync

Properties

Property
Type
Description

UseMoodMappings

bool

Whether mood-specific mappings are enabled (read-only).

Methods

Namespace: CrystalLipSync

Properties

Property
Type
Description

TargetMesh

SkinnedMeshRenderer

Get/set the blendshape mesh.

BlinkLeftIndex

int

Get/set the left eye blink blendshape index.

BlinkRightIndex

int

Get/set the right eye blink blendshape index.

BlinkBothIndex

int

Get/set the combined blink blendshape index.

Methods

CrystalTextLipSync API

Namespace: CrystalLipSync

Properties

Property
Type
Description

IsPlaying

bool

Whether a text viseme sequence is currently playing.

Methods

Example

CrystalMicrophoneLipSync API

Namespace: CrystalLipSync

Properties

Property
Type
Description

IsCapturing

bool

Whether the microphone is currently capturing.

DeviceName

string

Name of the microphone device in use (empty = default).

Events

Event
Signature
Description

OnCaptureStarted

Action

Fired when microphone capture begins.

OnCaptureStopped

Action

Fired when microphone capture ends.

Methods

Example

CrystalTextToViseme API

Namespace: CrystalLipSync Class: static CrystalTextToViseme

Duration normalization: By default, Generate() scales all entry durations so the total matches the typewriter reveal time. Without this, consonants (0.6x weight) and silences (0.4x weight) would cause the sequence to finish earlier than the text. The relative rhythm between vowels, consonants, and pauses is preserved.

VisemeEntry struct:

Field
Type
Description

viseme

VisemeType

The viseme to display.

duration

float

Seconds to hold this viseme.

Character mapping highlights:

  • Digraphs: th → TH, sh/ch → CH, ng → NN, ph → FF, ee → I, oo → U, ou → U, ai/ay → E, aw → O

  • Vowels: a → AA, e → E, i → I, o → O, u → U

  • Consonants: p/b/m → PP, f/v → FF, d/t → DD, k/g/c/q → KK, s/z → SS, n → NN, r → RR, j → CH, w → U, y → I

  • Spaces/punctuation → SIL (merged when consecutive)

CrystalLipSyncAutoMapper API

Namespace: CrystalLipSync Class: static CrystalLipSyncAutoMapper

Last updated