Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.Audio.LipSync.LipSync Class Reference

Base class for lip synchronization. More...

Inheritance diagram for Dragengine.Audio.LipSync.LipSync:
Dragengine.Audio.LipSync.LipSyncJawFlaping Dragengine.Audio.LipSync.LipSyncSpectrogram

Classes

enum  Viseme
 Visemes. More...
class  VisemeResult
 Viseme result. More...

Public Member Functions

void forEachVisemeResult (Block ablock)
 Visit viseme results with block.
void forEachVisemeSubsetResult (Block ablock)
 Visit viseme subset results with block.
float getJawOpeness ()
 Get jaw openess in range 0 to 1.
OneEuroFilter getJawOpenessFilter ()
 Jaw openess filter.
float getJawOpenessSmooth ()
 Smoothed jaw openess in range 0 to 1.
float getUpdateInterval ()
 Update interval in seconds.
VisemeResult getVisemeResult (Viseme viseme)
 Viseme result.
LipSync new ()
 Create lip sync.
void setJawOpeness (float value)
 Set jaw openess in range 0 to 1.
void setJawOpenessSmooth (float value)
 Set smoothed jaw openess in range 0 to 1.
void setNoiseFloor (float noiseFloor)
 Set noise floor in RMS (root mean square) amplitude.
void setUpdateInterval (float updateInterval)
 Set update interval in seconds.

Public Attributes

AudioAnalyzer pAudioAnalyzer
float pJawOpeness
OneEuroFilter pJawOpenessFilter
float pNoiseFloor
Dictionary pVisemeResults

Protected Member Functions

void normalizeVisemes ()
 Normalize viseme weights.
void setJawOpenessFromVisemeSubset ()
 Set jaw openess from viseme subset results.
void setVisemeFullFromSubset ()
 Set full viseme results from viseme subset results.
void setVisemeSubsetFromFull ()
 Set viseme subset results from full viseme results.
void setVisemeSubsetFromJawOpeness ()
 Set viseme subset from jaw openess.

Detailed Description

Base class for lip synchronization.

Version
1.32

Lip synchronization analyzes user voice audio and provides either a mouth openess value for jaw flapping or viseme weights for more detailed mouth shapes. See subclass documentation to know which result data they provide. All subclasses are required to fill in all possible values so the user can choose which category of lip sync he wants to use.

Jaw flapping

This is the most basic form of lip synchronization best used for characters lacking complex mouth pose abilities. Typical example of this are beast type characters with elongated snouts. In this case designing convincing mouth shapes can be difficult unless the character is of a cartoon type where mouth shapes are often very squishy. Apply the getJawOpenessSmooth() to the character jaw bone.

Viseme subset (4 visemes)

This subset represents basic mouth shapes that can be easily distinguished. These viseme are provided:

Full viseme set (14 visemes)

The most detailed mode providing full set of viseme weights. This is best used for characters with complex mouth pose abilities.

Audio Analyzer

Lip synchronization uses an instance of AudioAnalyzer to analyze the audio. The subclasses configure the analyzer for their specific needs. The user is responsible to set the audio source if he does not want to use the default microphone.

Member Function Documentation

◆ forEachVisemeResult()

void Dragengine.Audio.LipSync.LipSync.forEachVisemeResult ( Block ablock)

Visit viseme results with block.

Block receives one argument of type VisemeResult.

References getUpdateInterval().

Referenced by Dragengine.Audio.LipSync.LipSyncSpectrogram.calculateVisemes(), and normalizeVisemes().

◆ forEachVisemeSubsetResult()

void Dragengine.Audio.LipSync.LipSync.forEachVisemeSubsetResult ( Block ablock)

Visit viseme subset results with block.

Block receives one argument of type VisemeResult.

References setUpdateInterval().

Referenced by normalizeVisemes().

◆ getJawOpeness()

float Dragengine.Audio.LipSync.LipSync.getJawOpeness ( )

Get jaw openess in range 0 to 1.

References pJawOpenessFilter, and pNoiseFloor.

Referenced by setVisemeSubsetFromJawOpeness().

◆ getJawOpenessFilter()

OneEuroFilter Dragengine.Audio.LipSync.LipSync.getJawOpenessFilter ( )

Jaw openess filter.

References pNoiseFloor.

Referenced by Dragengine.Audio.LipSync.LipSyncJawFlaping.new(), and normalizeVisemes().

◆ getJawOpenessSmooth()

float Dragengine.Audio.LipSync.LipSync.getJawOpenessSmooth ( )

Smoothed jaw openess in range 0 to 1.

Use this value for animating the character jaw bone.

Referenced by normalizeVisemes().

◆ getUpdateInterval()

float Dragengine.Audio.LipSync.LipSync.getUpdateInterval ( )

Update interval in seconds.

References pAudioAnalyzer, pJawOpeness, pJawOpenessFilter, pNoiseFloor, and pVisemeResults.

Referenced by forEachVisemeResult().

◆ getVisemeResult()

VisemeResult Dragengine.Audio.LipSync.LipSync.getVisemeResult ( Viseme viseme)

Viseme result.

References pNoiseFloor, and setNoiseFloor().

Referenced by normalizeVisemes().

◆ new()

LipSync Dragengine.Audio.LipSync.LipSync.new ( )

◆ normalizeVisemes()

◆ setJawOpeness()

void Dragengine.Audio.LipSync.LipSync.setJawOpeness ( float value)

Set jaw openess in range 0 to 1.

References pVisemeResults.

Referenced by setVisemeSubsetFromFull(), and Dragengine.Audio.LipSync.LipSyncJawFlaping.updateLipSync().

◆ setJawOpenessFromVisemeSubset()

void Dragengine.Audio.LipSync.LipSync.setJawOpenessFromVisemeSubset ( )
protected

Set jaw openess from viseme subset results.

Referenced by Dragengine.Audio.LipSync.LipSyncSpectrogram.calculateVisemes(), and normalizeVisemes().

◆ setJawOpenessSmooth()

void Dragengine.Audio.LipSync.LipSync.setJawOpenessSmooth ( float value)

Set smoothed jaw openess in range 0 to 1.

References pAudioAnalyzer.

Referenced by normalizeVisemes().

◆ setNoiseFloor()

void Dragengine.Audio.LipSync.LipSync.setNoiseFloor ( float noiseFloor)

Set noise floor in RMS (root mean square) amplitude.

Referenced by getVisemeResult().

◆ setUpdateInterval()

void Dragengine.Audio.LipSync.LipSync.setUpdateInterval ( float updateInterval)

Set update interval in seconds.

Referenced by forEachVisemeSubsetResult().

◆ setVisemeFullFromSubset()

void Dragengine.Audio.LipSync.LipSync.setVisemeFullFromSubset ( )
protected

Set full viseme results from viseme subset results.

Referenced by normalizeVisemes(), and Dragengine.Audio.LipSync.LipSyncJawFlaping.updateLipSync().

◆ setVisemeSubsetFromFull()

void Dragengine.Audio.LipSync.LipSync.setVisemeSubsetFromFull ( )
protected

Set viseme subset results from full viseme results.

References pJawOpeness, and setJawOpeness().

Referenced by Dragengine.Audio.LipSync.LipSyncSpectrogram.calculateVisemes(), and normalizeVisemes().

◆ setVisemeSubsetFromJawOpeness()

void Dragengine.Audio.LipSync.LipSync.setVisemeSubsetFromJawOpeness ( )
protected

Set viseme subset from jaw openess.

References getJawOpeness(), and pJawOpeness.

Referenced by normalizeVisemes(), and Dragengine.Audio.LipSync.LipSyncJawFlaping.updateLipSync().

Member Data Documentation

◆ pAudioAnalyzer

AudioAnalyzer Dragengine.Audio.LipSync.LipSync.pAudioAnalyzer

◆ pJawOpeness

float Dragengine.Audio.LipSync.LipSync.pJawOpeness

◆ pJawOpenessFilter

OneEuroFilter Dragengine.Audio.LipSync.LipSync.pJawOpenessFilter

◆ pNoiseFloor

float Dragengine.Audio.LipSync.LipSync.pNoiseFloor

◆ pVisemeResults

Dictionary Dragengine.Audio.LipSync.LipSync.pVisemeResults

The documentation for this class was generated from the following file: