@convai/web-sdk 0.3.2-beta.0 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/BlendshapeQueue.d.ts +75 -42
- package/dist/core/BlendshapeQueue.d.ts.map +1 -1
- package/dist/core/BlendshapeQueue.js +177 -103
- package/dist/core/BlendshapeQueue.js.map +1 -1
- package/dist/core/ConvaiClient.d.ts +0 -14
- package/dist/core/ConvaiClient.d.ts.map +1 -1
- package/dist/core/ConvaiClient.js +13 -24
- package/dist/core/ConvaiClient.js.map +1 -1
- package/dist/core/MessageHandler.d.ts.map +1 -1
- package/dist/core/MessageHandler.js +6 -3
- package/dist/core/MessageHandler.js.map +1 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/types.d.ts +29 -11
- package/dist/core/types.d.ts.map +1 -1
- package/dist/lipsync-helpers/createBlendshapeQueue.d.ts +86 -0
- package/dist/lipsync-helpers/createBlendshapeQueue.d.ts.map +1 -0
- package/dist/lipsync-helpers/createBlendshapeQueue.js +126 -0
- package/dist/lipsync-helpers/createBlendshapeQueue.js.map +1 -0
- package/dist/lipsync-helpers/declarativeMapping.d.ts +93 -0
- package/dist/lipsync-helpers/declarativeMapping.d.ts.map +1 -0
- package/dist/lipsync-helpers/declarativeMapping.js +228 -0
- package/dist/lipsync-helpers/declarativeMapping.js.map +1 -0
- package/dist/lipsync-helpers/index.d.ts +9 -4
- package/dist/lipsync-helpers/index.d.ts.map +1 -1
- package/dist/lipsync-helpers/index.js +24 -12
- package/dist/lipsync-helpers/index.js.map +1 -1
- package/dist/lipsync-helpers/mappingTypes.d.ts +64 -0
- package/dist/lipsync-helpers/mappingTypes.d.ts.map +1 -0
- package/dist/lipsync-helpers/mappingTypes.js +28 -0
- package/dist/lipsync-helpers/mappingTypes.js.map +1 -0
- package/dist/lipsync-helpers/presetMappers.d.ts +24 -0
- package/dist/lipsync-helpers/presetMappers.d.ts.map +1 -0
- package/dist/lipsync-helpers/presetMappers.js +38 -0
- package/dist/lipsync-helpers/presetMappers.js.map +1 -0
- package/dist/react/hooks/useConvaiClient.d.ts.map +1 -1
- package/dist/react/hooks/useConvaiClient.js +0 -4
- package/dist/react/hooks/useConvaiClient.js.map +1 -1
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/vanilla/ConvaiWidget.d.ts +13 -6
- package/dist/vanilla/ConvaiWidget.d.ts.map +1 -1
- package/dist/vanilla/ConvaiWidget.js +108 -70
- package/dist/vanilla/ConvaiWidget.js.map +1 -1
- package/dist/vanilla/types.d.ts +29 -2
- package/dist/vanilla/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/lipsync-helpers/arkitBlendshapeHelpers.d.ts +0 -80
- package/dist/lipsync-helpers/arkitBlendshapeHelpers.d.ts.map +0 -1
- package/dist/lipsync-helpers/arkitBlendshapeHelpers.js +0 -201
- package/dist/lipsync-helpers/arkitBlendshapeHelpers.js.map +0 -1
- package/dist/lipsync-helpers/arkitPhonemeReference.d.ts +0 -155
- package/dist/lipsync-helpers/arkitPhonemeReference.d.ts.map +0 -1
- package/dist/lipsync-helpers/arkitPhonemeReference.js +0 -362
- package/dist/lipsync-helpers/arkitPhonemeReference.js.map +0 -1
- package/dist/lipsync-helpers/neurosyncBlendshapeMapper.d.ts +0 -30
- package/dist/lipsync-helpers/neurosyncBlendshapeMapper.d.ts.map +0 -1
- package/dist/lipsync-helpers/neurosyncBlendshapeMapper.js +0 -315
- package/dist/lipsync-helpers/neurosyncBlendshapeMapper.js.map +0 -1
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Post-processor function that can modify blendshape frames
|
|
3
|
-
* @param frame - The blendshape frame to process
|
|
4
|
-
* @param frameIndex - Index of the frame in the sequence
|
|
5
|
-
* @param totalFrames - Total number of frames in the sequence
|
|
6
|
-
* @returns Modified frame
|
|
7
|
-
*/
|
|
8
|
-
export type BlendshapePostProcessor = (frame: Float32Array, frameIndex: number, totalFrames: number) => Float32Array;
|
|
9
1
|
/**
|
|
10
2
|
* BlendshapeQueue - Manages buffering and lifecycle of blendshape frames
|
|
11
3
|
*
|
|
@@ -16,26 +8,56 @@ export type BlendshapePostProcessor = (frame: Float32Array, frameIndex: number,
|
|
|
16
8
|
* 1. Blendshapes arrive in chunks and are buffered in the queue
|
|
17
9
|
* 2. bot-started-speaking triggers conversation start
|
|
18
10
|
* 3. Consumer reads frames from queue using time-based indexing (elapsed_time * 60fps)
|
|
19
|
-
* 4. blendshape-turn-stats
|
|
20
|
-
* 5.
|
|
11
|
+
* 4. blendshape-turn-stats provides total_audio_duration_ms and total_blendshapes
|
|
12
|
+
* 5. TimeLeft event emitted during playback based on remaining frames
|
|
13
|
+
* 6. ConversationEnded event emitted when all frames played
|
|
14
|
+
* 7. Queue drains remaining frames and resets for next conversation
|
|
21
15
|
*
|
|
22
|
-
*
|
|
23
|
-
* -
|
|
24
|
-
* -
|
|
25
|
-
* -
|
|
16
|
+
* Mapping:
|
|
17
|
+
* - Supports optional mapping of blendshape data via a mapper function
|
|
18
|
+
* - Mapper is applied when frames are added to the queue
|
|
19
|
+
* - Common use cases: ARKit 61 → ARKit 52, MetaHuman 251 → Custom format
|
|
26
20
|
*/
|
|
21
|
+
export interface TurnStats {
|
|
22
|
+
fps: number;
|
|
23
|
+
total_audio_bytes: number;
|
|
24
|
+
total_audio_duration_ms: number;
|
|
25
|
+
total_blendshapes: number;
|
|
26
|
+
total_turn_duration_ms: number;
|
|
27
|
+
}
|
|
27
28
|
export declare class BlendshapeQueue {
|
|
28
29
|
private queue;
|
|
29
30
|
private conversationActive;
|
|
30
31
|
private conversationEnded;
|
|
31
|
-
private
|
|
32
|
-
private
|
|
32
|
+
private mapper?;
|
|
33
|
+
private turnStats;
|
|
34
|
+
private framesConsumed;
|
|
35
|
+
private interrupted;
|
|
36
|
+
private interruptedAtFrame;
|
|
33
37
|
private static readonly TARGET_FPS;
|
|
38
|
+
/**
|
|
39
|
+
* Create a new BlendshapeQueue
|
|
40
|
+
* @param mapper - Optional function to map/transform blendshape data as it's added
|
|
41
|
+
*/
|
|
42
|
+
constructor(mapper?: (input: number[] | Float32Array) => Float32Array);
|
|
34
43
|
/**
|
|
35
44
|
* Add a chunk of blendshapes to the queue
|
|
36
45
|
* @param blendshapes - Array of blendshape frames (each frame is an array of numbers)
|
|
37
46
|
*/
|
|
38
47
|
addChunk(blendshapes: number[][]): void;
|
|
48
|
+
/**
|
|
49
|
+
* Set or update the mapper function
|
|
50
|
+
* @param mapper - Function to map/transform blendshape data
|
|
51
|
+
*/
|
|
52
|
+
setMapper(mapper: (input: number[] | Float32Array) => Float32Array): void;
|
|
53
|
+
/**
|
|
54
|
+
* Clear the mapper function (passthrough mode)
|
|
55
|
+
*/
|
|
56
|
+
clearMapper(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Check if a mapper is configured
|
|
59
|
+
*/
|
|
60
|
+
hasMapper(): boolean;
|
|
39
61
|
/**
|
|
40
62
|
* Get all frames currently in the queue
|
|
41
63
|
* @returns Array of blendshape frames as Float32Arrays
|
|
@@ -47,6 +69,14 @@ export declare class BlendshapeQueue {
|
|
|
47
69
|
* @returns The frame at the given index, or null if out of bounds
|
|
48
70
|
*/
|
|
49
71
|
getFrame(index: number): Float32Array | null;
|
|
72
|
+
/**
|
|
73
|
+
* Get a frame with fade-in/fade-out alpha multiplier applied
|
|
74
|
+
* First 10 frames: fade in from 0 to 1 (starts with bot-started-speaking)
|
|
75
|
+
* Last 10 frames: fade out from 1 to 0 (normal end or interruption)
|
|
76
|
+
* @param index - Frame index within the current queue
|
|
77
|
+
* @returns The frame with alpha applied, or null if out of bounds
|
|
78
|
+
*/
|
|
79
|
+
getFrameWithAlpha(index: number): Float32Array | null;
|
|
50
80
|
/**
|
|
51
81
|
* Remove frames from the beginning of the queue (consume frames)
|
|
52
82
|
* @param count - Number of frames to remove
|
|
@@ -70,52 +100,52 @@ export declare class BlendshapeQueue {
|
|
|
70
100
|
isConversationEnded(): boolean;
|
|
71
101
|
/**
|
|
72
102
|
* Mark conversation start (called when bot-started-speaking)
|
|
103
|
+
* Clears any remaining frames from previous conversation
|
|
73
104
|
*/
|
|
74
105
|
startConversation(): void;
|
|
75
106
|
/**
|
|
76
|
-
* Mark conversation end
|
|
77
|
-
*
|
|
107
|
+
* Mark conversation end with turn stats
|
|
108
|
+
* Called when blendshape-turn-stats received
|
|
109
|
+
* Note: We keep accepting frames even after stats arrive, because blendshapes
|
|
110
|
+
* can arrive late due to network timing. We only stop when all frames consumed.
|
|
78
111
|
*/
|
|
79
|
-
endConversation(): void;
|
|
112
|
+
endConversation(stats?: TurnStats): void;
|
|
80
113
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
114
|
+
* Handle interruption - mark for fade out
|
|
115
|
+
* Keeps last 10 frames in queue and fades them out
|
|
83
116
|
*/
|
|
84
|
-
|
|
117
|
+
interrupt(): void;
|
|
85
118
|
/**
|
|
86
|
-
*
|
|
119
|
+
* Get turn stats
|
|
87
120
|
*/
|
|
88
|
-
|
|
121
|
+
getTurnStats(): TurnStats | null;
|
|
89
122
|
/**
|
|
90
|
-
*
|
|
123
|
+
* Get number of frames consumed
|
|
91
124
|
*/
|
|
92
|
-
|
|
125
|
+
getFramesConsumed(): number;
|
|
93
126
|
/**
|
|
94
|
-
*
|
|
127
|
+
* Calculate time left in milliseconds based on turn stats
|
|
128
|
+
* Returns null if stats not available
|
|
95
129
|
*/
|
|
96
|
-
|
|
130
|
+
getTimeLeftMs(): number | null;
|
|
97
131
|
/**
|
|
98
|
-
*
|
|
132
|
+
* Check if all frames have been consumed based on turn stats
|
|
133
|
+
*/
|
|
134
|
+
isAllFramesConsumed(): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Reset queue for new conversation
|
|
137
|
+
* Should be called after all frames have been consumed
|
|
99
138
|
*/
|
|
100
|
-
|
|
139
|
+
reset(): void;
|
|
101
140
|
/**
|
|
102
|
-
* Get
|
|
141
|
+
* Get frame at specified time
|
|
103
142
|
* @param elapsedTime - Elapsed time in seconds
|
|
104
|
-
* @returns
|
|
143
|
+
* @returns Frame data
|
|
105
144
|
*/
|
|
106
|
-
|
|
145
|
+
getFrameAtTime(elapsedTime: number): {
|
|
107
146
|
frame: Float32Array;
|
|
108
147
|
frameIndex: number;
|
|
109
|
-
isBlendingToZero: boolean;
|
|
110
148
|
} | null;
|
|
111
|
-
/**
|
|
112
|
-
* Interpolate between two frames
|
|
113
|
-
*/
|
|
114
|
-
private interpolate;
|
|
115
|
-
/**
|
|
116
|
-
* Get the zero frame (neutral pose)
|
|
117
|
-
*/
|
|
118
|
-
static getZeroFrame(): Float32Array;
|
|
119
149
|
/**
|
|
120
150
|
* Get debug info about the queue state
|
|
121
151
|
*/
|
|
@@ -123,6 +153,9 @@ export declare class BlendshapeQueue {
|
|
|
123
153
|
frameCount: number;
|
|
124
154
|
conversationActive: boolean;
|
|
125
155
|
conversationEnded: boolean;
|
|
156
|
+
framesConsumed: number;
|
|
157
|
+
turnStats: TurnStats | null;
|
|
158
|
+
timeLeftMs: number | null;
|
|
126
159
|
};
|
|
127
160
|
}
|
|
128
161
|
//# sourceMappingURL=BlendshapeQueue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlendshapeQueue.d.ts","sourceRoot":"","sources":["../../src/core/BlendshapeQueue.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BlendshapeQueue.d.ts","sourceRoot":"","sources":["../../src/core/BlendshapeQueue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,MAAM,C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AS,GAAG,IAAI;IAUxC;;;OAGG;IACH,SAAS,IAAI,IAAI;IAYjB;;OAEG;IACH,YAAY,IAAI,SAAS,GAAG,IAAI;IAIhC;;OAEG;IACH,iBAAiB,IAAI,MAAM;IAI3B;;;OAGG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;IAiB9B;;OAEG;IACH,mBAAmB,IAAI,OAAO;IAK9B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAQb;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG;QACnC,KAAK,EAAE,YAAY,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI;IAiBR;;OAEG;IACH,YAAY,IAAI;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,iBAAiB,EAAE,OAAO,CAAC;QAC3B,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;QAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B;CAUF"}
|
|
@@ -8,33 +8,72 @@
|
|
|
8
8
|
* 1. Blendshapes arrive in chunks and are buffered in the queue
|
|
9
9
|
* 2. bot-started-speaking triggers conversation start
|
|
10
10
|
* 3. Consumer reads frames from queue using time-based indexing (elapsed_time * 60fps)
|
|
11
|
-
* 4. blendshape-turn-stats
|
|
12
|
-
* 5.
|
|
11
|
+
* 4. blendshape-turn-stats provides total_audio_duration_ms and total_blendshapes
|
|
12
|
+
* 5. TimeLeft event emitted during playback based on remaining frames
|
|
13
|
+
* 6. ConversationEnded event emitted when all frames played
|
|
14
|
+
* 7. Queue drains remaining frames and resets for next conversation
|
|
13
15
|
*
|
|
14
|
-
*
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
17
|
-
* -
|
|
16
|
+
* Mapping:
|
|
17
|
+
* - Supports optional mapping of blendshape data via a mapper function
|
|
18
|
+
* - Mapper is applied when frames are added to the queue
|
|
19
|
+
* - Common use cases: ARKit 61 → ARKit 52, MetaHuman 251 → Custom format
|
|
18
20
|
*/
|
|
19
21
|
export class BlendshapeQueue {
|
|
20
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Create a new BlendshapeQueue
|
|
24
|
+
* @param mapper - Optional function to map/transform blendshape data as it's added
|
|
25
|
+
*/
|
|
26
|
+
constructor(mapper) {
|
|
21
27
|
this.queue = [];
|
|
22
28
|
this.conversationActive = false;
|
|
23
29
|
this.conversationEnded = false;
|
|
24
|
-
|
|
25
|
-
this.
|
|
30
|
+
this.turnStats = null;
|
|
31
|
+
this.framesConsumed = 0;
|
|
32
|
+
this.interrupted = false; // Track if conversation was interrupted
|
|
33
|
+
this.interruptedAtFrame = 0; // Frame number when interrupted
|
|
34
|
+
this.mapper = mapper;
|
|
26
35
|
}
|
|
27
36
|
/**
|
|
28
37
|
* Add a chunk of blendshapes to the queue
|
|
29
38
|
* @param blendshapes - Array of blendshape frames (each frame is an array of numbers)
|
|
30
39
|
*/
|
|
31
40
|
addChunk(blendshapes) {
|
|
41
|
+
// Only accept frames if conversation is active
|
|
42
|
+
// Keep accepting even after conversationEnded=true, because frames can arrive late
|
|
43
|
+
if (!this.conversationActive) {
|
|
44
|
+
console.log(`[BlendshapeQueue] ❌ Ignoring ${blendshapes.length} frames - conversation not active`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
32
47
|
const before = this.queue.length;
|
|
33
48
|
for (let i = 0; i < blendshapes.length; i++) {
|
|
34
|
-
|
|
49
|
+
const rawFrame = blendshapes[i];
|
|
50
|
+
// Apply mapper if provided, otherwise convert to Float32Array directly
|
|
51
|
+
const mappedFrame = this.mapper
|
|
52
|
+
? this.mapper(rawFrame)
|
|
53
|
+
: new Float32Array(rawFrame);
|
|
54
|
+
this.queue.push(mappedFrame);
|
|
35
55
|
}
|
|
36
56
|
const after = this.queue.length;
|
|
37
|
-
|
|
57
|
+
console.log(`[BlendshapeQueue] ✅ Added ${blendshapes.length} frames. Queue: ${before} -> ${after}, Total consumed so far: ${this.framesConsumed}`);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Set or update the mapper function
|
|
61
|
+
* @param mapper - Function to map/transform blendshape data
|
|
62
|
+
*/
|
|
63
|
+
setMapper(mapper) {
|
|
64
|
+
this.mapper = mapper;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Clear the mapper function (passthrough mode)
|
|
68
|
+
*/
|
|
69
|
+
clearMapper() {
|
|
70
|
+
this.mapper = undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Check if a mapper is configured
|
|
74
|
+
*/
|
|
75
|
+
hasMapper() {
|
|
76
|
+
return this.mapper !== undefined;
|
|
38
77
|
}
|
|
39
78
|
/**
|
|
40
79
|
* Get all frames currently in the queue
|
|
@@ -54,6 +93,52 @@ export class BlendshapeQueue {
|
|
|
54
93
|
}
|
|
55
94
|
return this.queue[index];
|
|
56
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Get a frame with fade-in/fade-out alpha multiplier applied
|
|
98
|
+
* First 10 frames: fade in from 0 to 1 (starts with bot-started-speaking)
|
|
99
|
+
* Last 10 frames: fade out from 1 to 0 (normal end or interruption)
|
|
100
|
+
* @param index - Frame index within the current queue
|
|
101
|
+
* @returns The frame with alpha applied, or null if out of bounds
|
|
102
|
+
*/
|
|
103
|
+
getFrameWithAlpha(index) {
|
|
104
|
+
const frame = this.getFrame(index);
|
|
105
|
+
if (!frame)
|
|
106
|
+
return null;
|
|
107
|
+
let alpha = 1.0;
|
|
108
|
+
// Calculate absolute frame number (frames consumed + current index in queue)
|
|
109
|
+
const absoluteFrameNumber = this.framesConsumed + index;
|
|
110
|
+
// Fade in: first 10 frames (0 to 1) - starts when bot-started-speaking
|
|
111
|
+
if (absoluteFrameNumber < 10) {
|
|
112
|
+
alpha = absoluteFrameNumber / 10;
|
|
113
|
+
}
|
|
114
|
+
// Fade out for interruptions: last 10 frames of remaining queue
|
|
115
|
+
if (this.interrupted) {
|
|
116
|
+
const remainingFrames = this.queue.length;
|
|
117
|
+
const frameIndexInQueue = index;
|
|
118
|
+
// Apply fade out to last 10 frames in queue
|
|
119
|
+
if (frameIndexInQueue >= remainingFrames - 10) {
|
|
120
|
+
const framesFromEnd = remainingFrames - frameIndexInQueue;
|
|
121
|
+
alpha = Math.min(alpha, framesFromEnd / 10);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Fade out for normal end: last 10 frames based on turn stats
|
|
125
|
+
else if (this.turnStats) {
|
|
126
|
+
const totalFrames = this.turnStats.total_blendshapes;
|
|
127
|
+
const framesFromEnd = totalFrames - absoluteFrameNumber;
|
|
128
|
+
if (framesFromEnd <= 10) {
|
|
129
|
+
alpha = Math.min(alpha, framesFromEnd / 10);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// Apply alpha to all morph values
|
|
133
|
+
if (alpha < 1.0) {
|
|
134
|
+
const fadedFrame = new Float32Array(frame.length);
|
|
135
|
+
for (let i = 0; i < frame.length; i++) {
|
|
136
|
+
fadedFrame[i] = frame[i] * alpha;
|
|
137
|
+
}
|
|
138
|
+
return fadedFrame;
|
|
139
|
+
}
|
|
140
|
+
return frame;
|
|
141
|
+
}
|
|
57
142
|
/**
|
|
58
143
|
* Remove frames from the beginning of the queue (consume frames)
|
|
59
144
|
* @param count - Number of frames to remove
|
|
@@ -61,7 +146,10 @@ export class BlendshapeQueue {
|
|
|
61
146
|
consumeFrames(count) {
|
|
62
147
|
if (count <= 0)
|
|
63
148
|
return;
|
|
64
|
-
|
|
149
|
+
const actualConsumed = Math.min(count, this.queue.length);
|
|
150
|
+
this.queue.splice(0, actualConsumed);
|
|
151
|
+
this.framesConsumed += actualConsumed;
|
|
152
|
+
console.log(`[BlendshapeQueue] 🔄 Consumed ${actualConsumed} frames. Total consumed: ${this.framesConsumed}, Queue left: ${this.queue.length}`);
|
|
65
153
|
}
|
|
66
154
|
/**
|
|
67
155
|
* Get the number of frames currently in the queue
|
|
@@ -89,129 +177,113 @@ export class BlendshapeQueue {
|
|
|
89
177
|
}
|
|
90
178
|
/**
|
|
91
179
|
* Mark conversation start (called when bot-started-speaking)
|
|
180
|
+
* Clears any remaining frames from previous conversation
|
|
92
181
|
*/
|
|
93
182
|
startConversation() {
|
|
183
|
+
console.log(`[BlendshapeQueue] 🎬 Starting new conversation - clearing ${this.queue.length} leftover frames`);
|
|
184
|
+
// Clear any leftover frames from previous conversation
|
|
185
|
+
this.queue = [];
|
|
94
186
|
this.conversationActive = true;
|
|
95
187
|
this.conversationEnded = false;
|
|
188
|
+
this.framesConsumed = 0; // Reset frame counter for new conversation
|
|
189
|
+
this.turnStats = null; // Clear old stats
|
|
190
|
+
this.interrupted = false; // Reset interruption flag
|
|
191
|
+
this.interruptedAtFrame = 0;
|
|
96
192
|
}
|
|
97
193
|
/**
|
|
98
|
-
* Mark conversation end
|
|
99
|
-
*
|
|
194
|
+
* Mark conversation end with turn stats
|
|
195
|
+
* Called when blendshape-turn-stats received
|
|
196
|
+
* Note: We keep accepting frames even after stats arrive, because blendshapes
|
|
197
|
+
* can arrive late due to network timing. We only stop when all frames consumed.
|
|
100
198
|
*/
|
|
101
|
-
endConversation() {
|
|
199
|
+
endConversation(stats) {
|
|
200
|
+
console.log(`[BlendshapeQueue] 🏁 Turn stats received:`, stats);
|
|
201
|
+
console.log(`[BlendshapeQueue] Total consumed: ${this.framesConsumed}, Queue remaining: ${this.queue.length}`);
|
|
202
|
+
// Don't set conversationActive = false yet! Keep accepting late frames
|
|
102
203
|
this.conversationEnded = true;
|
|
103
|
-
|
|
204
|
+
if (stats) {
|
|
205
|
+
this.turnStats = stats;
|
|
206
|
+
}
|
|
104
207
|
}
|
|
105
208
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
209
|
+
* Handle interruption - mark for fade out
|
|
210
|
+
* Keeps last 10 frames in queue and fades them out
|
|
108
211
|
*/
|
|
109
|
-
|
|
110
|
-
this.queue
|
|
111
|
-
this.
|
|
112
|
-
this.
|
|
212
|
+
interrupt() {
|
|
213
|
+
console.log(`[BlendshapeQueue] ⚠️ Interruption - keeping last 10 frames for fade out. Current queue: ${this.queue.length}`);
|
|
214
|
+
this.interrupted = true;
|
|
215
|
+
this.interruptedAtFrame = this.framesConsumed + this.queue.length;
|
|
216
|
+
this.conversationActive = false; // Stop accepting new frames
|
|
217
|
+
// Keep only last 10 frames for fade out
|
|
218
|
+
if (this.queue.length > 10) {
|
|
219
|
+
this.queue = this.queue.slice(-10);
|
|
220
|
+
}
|
|
113
221
|
}
|
|
114
222
|
/**
|
|
115
|
-
*
|
|
223
|
+
* Get turn stats
|
|
116
224
|
*/
|
|
117
|
-
|
|
118
|
-
this.
|
|
225
|
+
getTurnStats() {
|
|
226
|
+
return this.turnStats;
|
|
119
227
|
}
|
|
120
228
|
/**
|
|
121
|
-
*
|
|
229
|
+
* Get number of frames consumed
|
|
122
230
|
*/
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (index !== -1) {
|
|
126
|
-
this.postProcessors.splice(index, 1);
|
|
127
|
-
}
|
|
231
|
+
getFramesConsumed() {
|
|
232
|
+
return this.framesConsumed;
|
|
128
233
|
}
|
|
129
234
|
/**
|
|
130
|
-
*
|
|
235
|
+
* Calculate time left in milliseconds based on turn stats
|
|
236
|
+
* Returns null if stats not available
|
|
131
237
|
*/
|
|
132
|
-
|
|
133
|
-
this.
|
|
238
|
+
getTimeLeftMs() {
|
|
239
|
+
if (!this.turnStats)
|
|
240
|
+
return null;
|
|
241
|
+
const { total_audio_duration_ms, total_blendshapes } = this.turnStats;
|
|
242
|
+
// Calculate time per frame
|
|
243
|
+
const msPerFrame = total_audio_duration_ms / total_blendshapes;
|
|
244
|
+
// Calculate remaining frames
|
|
245
|
+
const remainingFrames = total_blendshapes - this.framesConsumed;
|
|
246
|
+
// Calculate time left
|
|
247
|
+
const timeLeftMs = remainingFrames * msPerFrame;
|
|
248
|
+
return Math.max(0, timeLeftMs);
|
|
134
249
|
}
|
|
135
250
|
/**
|
|
136
|
-
*
|
|
251
|
+
* Check if all frames have been consumed based on turn stats
|
|
137
252
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
253
|
+
isAllFramesConsumed() {
|
|
254
|
+
if (!this.turnStats)
|
|
255
|
+
return false;
|
|
256
|
+
return this.framesConsumed >= this.turnStats.total_blendshapes;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Reset queue for new conversation
|
|
260
|
+
* Should be called after all frames have been consumed
|
|
261
|
+
*/
|
|
262
|
+
reset() {
|
|
263
|
+
this.queue = [];
|
|
264
|
+
this.conversationActive = false;
|
|
265
|
+
this.conversationEnded = false;
|
|
266
|
+
this.turnStats = null;
|
|
267
|
+
this.framesConsumed = 0;
|
|
140
268
|
}
|
|
141
269
|
/**
|
|
142
|
-
* Get
|
|
270
|
+
* Get frame at specified time
|
|
143
271
|
* @param elapsedTime - Elapsed time in seconds
|
|
144
|
-
* @returns
|
|
272
|
+
* @returns Frame data
|
|
145
273
|
*/
|
|
146
|
-
|
|
274
|
+
getFrameAtTime(elapsedTime) {
|
|
147
275
|
if (this.queue.length === 0) {
|
|
148
276
|
return null;
|
|
149
277
|
}
|
|
150
|
-
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
let endFrame;
|
|
155
|
-
let alpha;
|
|
156
|
-
let frameIndex;
|
|
157
|
-
let isBlendingToZero = false;
|
|
158
|
-
// Beginning: blend from zero to first frame
|
|
159
|
-
if (elapsedTime <= halfFrameDuration) {
|
|
160
|
-
startFrame = BlendshapeQueue.ZERO_FRAME;
|
|
161
|
-
endFrame = this.queue[0];
|
|
162
|
-
alpha = elapsedTime / halfFrameDuration;
|
|
163
|
-
frameIndex = 0;
|
|
164
|
-
}
|
|
165
|
-
// End: blend from last frame to zero
|
|
166
|
-
else if (elapsedTime >= totalDuration - halfFrameDuration) {
|
|
167
|
-
startFrame = this.queue[this.queue.length - 1];
|
|
168
|
-
endFrame = BlendshapeQueue.ZERO_FRAME;
|
|
169
|
-
alpha =
|
|
170
|
-
(elapsedTime - (totalDuration - halfFrameDuration)) / halfFrameDuration;
|
|
171
|
-
frameIndex = this.queue.length - 1;
|
|
172
|
-
isBlendingToZero = true;
|
|
173
|
-
}
|
|
174
|
-
// Middle: normal interpolation
|
|
175
|
-
else {
|
|
176
|
-
const adjustedTime = elapsedTime - halfFrameDuration;
|
|
177
|
-
const currentFrameIndex = Math.floor(adjustedTime / frameDuration);
|
|
178
|
-
const nextFrameIndex = Math.min(currentFrameIndex + 1, this.queue.length - 1);
|
|
179
|
-
startFrame = this.queue[currentFrameIndex];
|
|
180
|
-
endFrame = this.queue[nextFrameIndex];
|
|
181
|
-
alpha = (adjustedTime % frameDuration) / frameDuration;
|
|
182
|
-
frameIndex = currentFrameIndex;
|
|
183
|
-
}
|
|
184
|
-
// Always interpolate for smooth animation
|
|
185
|
-
let resultFrame = this.interpolate(startFrame, endFrame, alpha);
|
|
186
|
-
// Apply post-processing
|
|
187
|
-
if (this.postProcessors.length > 0) {
|
|
188
|
-
resultFrame = this.applyPostProcessing(resultFrame, frameIndex);
|
|
189
|
-
}
|
|
278
|
+
// Calculate frame index based on elapsed time and target FPS
|
|
279
|
+
const frameIndex = Math.floor(elapsedTime * BlendshapeQueue.TARGET_FPS);
|
|
280
|
+
// Clamp to valid range
|
|
281
|
+
const clampedIndex = Math.min(frameIndex, this.queue.length - 1);
|
|
190
282
|
return {
|
|
191
|
-
frame:
|
|
192
|
-
frameIndex,
|
|
193
|
-
isBlendingToZero,
|
|
283
|
+
frame: this.queue[clampedIndex],
|
|
284
|
+
frameIndex: clampedIndex,
|
|
194
285
|
};
|
|
195
286
|
}
|
|
196
|
-
/**
|
|
197
|
-
* Interpolate between two frames
|
|
198
|
-
*/
|
|
199
|
-
interpolate(start, end, alpha) {
|
|
200
|
-
const result = new Float32Array(Math.max(start.length, end.length));
|
|
201
|
-
const minLength = Math.min(start.length, end.length);
|
|
202
|
-
for (let i = 0; i < minLength; i++) {
|
|
203
|
-
const startVal = start[i] || 0;
|
|
204
|
-
const endVal = end[i] || 0;
|
|
205
|
-
result[i] = startVal + (endVal - startVal) * alpha;
|
|
206
|
-
}
|
|
207
|
-
return result;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Get the zero frame (neutral pose)
|
|
211
|
-
*/
|
|
212
|
-
static getZeroFrame() {
|
|
213
|
-
return new Float32Array(BlendshapeQueue.ZERO_FRAME);
|
|
214
|
-
}
|
|
215
287
|
/**
|
|
216
288
|
* Get debug info about the queue state
|
|
217
289
|
*/
|
|
@@ -220,10 +292,12 @@ export class BlendshapeQueue {
|
|
|
220
292
|
frameCount: this.queue.length,
|
|
221
293
|
conversationActive: this.conversationActive,
|
|
222
294
|
conversationEnded: this.conversationEnded,
|
|
295
|
+
framesConsumed: this.framesConsumed,
|
|
296
|
+
turnStats: this.turnStats,
|
|
297
|
+
timeLeftMs: this.getTimeLeftMs(),
|
|
223
298
|
};
|
|
224
299
|
}
|
|
225
300
|
}
|
|
226
301
|
// Constants
|
|
227
|
-
BlendshapeQueue.ZERO_FRAME = new Float32Array(52).fill(0);
|
|
228
302
|
BlendshapeQueue.TARGET_FPS = 60;
|
|
229
303
|
//# sourceMappingURL=BlendshapeQueue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlendshapeQueue.js","sourceRoot":"","sources":["../../src/core/BlendshapeQueue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BlendshapeQueue.js","sourceRoot":"","sources":["../../src/core/BlendshapeQueue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAUH,MAAM,OAAO,eAAe;IAa1B;;;OAGG;IACH,YAAY,MAAyD;QAhB7D,UAAK,GAAmB,EAAE,CAAC;QAC3B,uBAAkB,GAAY,KAAK,CAAC;QACpC,sBAAiB,GAAY,KAAK,CAAC;QAEnC,cAAS,GAAqB,IAAI,CAAC;QACnC,mBAAc,GAAW,CAAC,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C,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,WAAmB;QAIhC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,6DAA6D;QAC7D,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QAExE,uBAAuB;QACvB,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAEjE,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;YAC/B,UAAU,EAAE,YAAY;SACzB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,YAAY;QAQV,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YAC7B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE;SACjC,CAAC;IACJ,CAAC;;AA/TD,YAAY;AACY,0BAAU,GAAG,EAAE,AAAL,CAAM"}
|
|
@@ -139,19 +139,5 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
139
139
|
* Toggle text-to-speech on or off
|
|
140
140
|
*/
|
|
141
141
|
toggleTts(enabled: boolean): void;
|
|
142
|
-
/**
|
|
143
|
-
* Add a post-processor to modify blendshape frames during playback
|
|
144
|
-
* @param processor - Function that processes blendshape frames
|
|
145
|
-
*/
|
|
146
|
-
addLipsyncPostProcessor(processor: import("./BlendshapeQueue").BlendshapePostProcessor): void;
|
|
147
|
-
/**
|
|
148
|
-
* Remove a post-processor
|
|
149
|
-
* @param processor - The processor function to remove
|
|
150
|
-
*/
|
|
151
|
-
removeLipsyncPostProcessor(processor: import("./BlendshapeQueue").BlendshapePostProcessor): void;
|
|
152
|
-
/**
|
|
153
|
-
* Clear all post-processors
|
|
154
|
-
*/
|
|
155
|
-
clearLipsyncPostProcessors(): void;
|
|
156
142
|
}
|
|
157
143
|
//# sourceMappingURL=ConvaiClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConvaiClient.d.ts","sourceRoot":"","sources":["../../src/core/ConvaiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAa,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,WAAW,EAEX,aAAa,EACb,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAKjB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConvaiClient.d.ts","sourceRoot":"","sources":["../../src/core/ConvaiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAa,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,WAAW,EAEX,aAAa,EACb,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAKjB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,YAAa,SAAQ,YAAa,YAAW,aAAa;IACrE,OAAO,CAAC,KAAK,CAAO;IACpB,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,e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