@convai/web-sdk 0.3.1-beta.3 → 0.3.2-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.
Files changed (263) hide show
  1. package/README.md +535 -1077
  2. package/dist/core/AudioManager.d.ts.map +1 -0
  3. package/dist/core/AudioManager.js +262 -0
  4. package/dist/core/AudioManager.js.map +1 -0
  5. package/dist/core/BlendshapeQueue.d.ts +112 -0
  6. package/dist/core/BlendshapeQueue.d.ts.map +1 -0
  7. package/dist/core/BlendshapeQueue.js +172 -0
  8. package/dist/core/BlendshapeQueue.js.map +1 -0
  9. package/dist/{types/core → core}/ConvaiClient.d.ts +5 -15
  10. package/dist/core/ConvaiClient.d.ts.map +1 -0
  11. package/dist/core/ConvaiClient.js +602 -0
  12. package/dist/core/ConvaiClient.js.map +1 -0
  13. package/dist/core/EventEmitter.d.ts.map +1 -0
  14. package/dist/core/EventEmitter.js +68 -0
  15. package/dist/core/EventEmitter.js.map +1 -0
  16. package/dist/{types/core → core}/MessageHandler.d.ts +7 -0
  17. package/dist/core/MessageHandler.d.ts.map +1 -0
  18. package/dist/core/MessageHandler.js +332 -0
  19. package/dist/core/MessageHandler.js.map +1 -0
  20. package/dist/core/ScreenShareManager.d.ts.map +1 -0
  21. package/dist/core/ScreenShareManager.js +207 -0
  22. package/dist/core/ScreenShareManager.js.map +1 -0
  23. package/dist/core/VideoManager.d.ts.map +1 -0
  24. package/dist/core/VideoManager.js +205 -0
  25. package/dist/core/VideoManager.js.map +1 -0
  26. package/dist/{types/core → core}/index.d.ts +1 -0
  27. package/dist/core/index.d.ts.map +1 -0
  28. package/dist/core/index.js +14 -1970
  29. package/dist/core/index.js.map +1 -0
  30. package/dist/{types/core → core}/types.d.ts +9 -23
  31. package/dist/core/types.d.ts.map +1 -0
  32. package/dist/core/types.js +2 -0
  33. package/dist/core/types.js.map +1 -0
  34. package/dist/dev.d.ts +12 -0
  35. package/dist/dev.d.ts.map +1 -0
  36. package/dist/dev.js +12 -0
  37. package/dist/dev.js.map +1 -0
  38. package/dist/index.d.ts +4 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +6 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/lipsync-helpers/arkitOrder61.d.ts.map +1 -0
  43. package/dist/lipsync-helpers/arkitOrder61.js +287 -0
  44. package/dist/lipsync-helpers/arkitOrder61.js.map +1 -0
  45. package/dist/lipsync-helpers/createBlendshapeQueue.d.ts +86 -0
  46. package/dist/lipsync-helpers/createBlendshapeQueue.d.ts.map +1 -0
  47. package/dist/lipsync-helpers/createBlendshapeQueue.js +126 -0
  48. package/dist/lipsync-helpers/createBlendshapeQueue.js.map +1 -0
  49. package/dist/lipsync-helpers/declarativeMapping.d.ts +93 -0
  50. package/dist/lipsync-helpers/declarativeMapping.d.ts.map +1 -0
  51. package/dist/lipsync-helpers/declarativeMapping.js +228 -0
  52. package/dist/lipsync-helpers/declarativeMapping.js.map +1 -0
  53. package/dist/lipsync-helpers/index.d.ts +15 -0
  54. package/dist/lipsync-helpers/index.d.ts.map +1 -0
  55. package/dist/lipsync-helpers/index.js +31 -1164
  56. package/dist/lipsync-helpers/index.js.map +1 -0
  57. package/dist/lipsync-helpers/mappingTypes.d.ts +64 -0
  58. package/dist/lipsync-helpers/mappingTypes.d.ts.map +1 -0
  59. package/dist/lipsync-helpers/mappingTypes.js +28 -0
  60. package/dist/lipsync-helpers/mappingTypes.js.map +1 -0
  61. package/dist/lipsync-helpers/metahumanOrder251.d.ts +115 -0
  62. package/dist/lipsync-helpers/metahumanOrder251.d.ts.map +1 -0
  63. package/dist/lipsync-helpers/metahumanOrder251.js +432 -0
  64. package/dist/lipsync-helpers/metahumanOrder251.js.map +1 -0
  65. package/dist/lipsync-helpers/presetMappers.d.ts +24 -0
  66. package/dist/lipsync-helpers/presetMappers.d.ts.map +1 -0
  67. package/dist/lipsync-helpers/presetMappers.js +38 -0
  68. package/dist/lipsync-helpers/presetMappers.js.map +1 -0
  69. package/dist/react/components/ConvaiWidget.d.ts +68 -0
  70. package/dist/react/components/ConvaiWidget.d.ts.map +1 -0
  71. package/dist/react/components/ConvaiWidget.js +505 -0
  72. package/dist/react/components/ConvaiWidget.js.map +1 -0
  73. package/dist/react/components/index.d.ts +2 -0
  74. package/dist/react/components/index.d.ts.map +1 -0
  75. package/dist/react/components/index.js +3 -0
  76. package/dist/react/components/index.js.map +1 -0
  77. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts +10 -0
  78. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts.map +1 -0
  79. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js +316 -0
  80. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js.map +1 -0
  81. package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts +36 -0
  82. package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts.map +1 -0
  83. package/dist/react/components/rtc-widget/components/AudioVisualizer.js +259 -0
  84. package/dist/react/components/rtc-widget/components/AudioVisualizer.js.map +1 -0
  85. package/dist/react/components/rtc-widget/components/ConviMessage.d.ts +10 -0
  86. package/dist/react/components/rtc-widget/components/ConviMessage.d.ts.map +1 -0
  87. package/dist/react/components/rtc-widget/components/ConviMessage.js +14 -0
  88. package/dist/react/components/rtc-widget/components/ConviMessage.js.map +1 -0
  89. package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts +9 -0
  90. package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts.map +1 -0
  91. package/dist/react/components/rtc-widget/components/FloatingVideo.js +122 -0
  92. package/dist/react/components/rtc-widget/components/FloatingVideo.js.map +1 -0
  93. package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts +7 -0
  94. package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +1 -0
  95. package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +68 -0
  96. package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +1 -0
  97. package/dist/react/components/rtc-widget/components/MessageBubble.d.ts +10 -0
  98. package/dist/react/components/rtc-widget/components/MessageBubble.d.ts.map +1 -0
  99. package/dist/react/components/rtc-widget/components/MessageBubble.js +23 -0
  100. package/dist/react/components/rtc-widget/components/MessageBubble.js.map +1 -0
  101. package/dist/react/components/rtc-widget/components/MessageList.d.ts +11 -0
  102. package/dist/react/components/rtc-widget/components/MessageList.d.ts.map +1 -0
  103. package/dist/react/components/rtc-widget/components/MessageList.js +89 -0
  104. package/dist/react/components/rtc-widget/components/MessageList.js.map +1 -0
  105. package/dist/react/components/rtc-widget/components/UserMessage.d.ts +9 -0
  106. package/dist/react/components/rtc-widget/components/UserMessage.d.ts.map +1 -0
  107. package/dist/react/components/rtc-widget/components/UserMessage.js +15 -0
  108. package/dist/react/components/rtc-widget/components/UserMessage.js.map +1 -0
  109. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts +6 -0
  110. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts.map +1 -0
  111. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js +15 -0
  112. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js.map +1 -0
  113. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts +25 -0
  114. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts.map +1 -0
  115. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js +172 -0
  116. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js.map +1 -0
  117. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts +17 -0
  118. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts.map +1 -0
  119. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js +66 -0
  120. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js.map +1 -0
  121. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +12 -0
  122. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts.map +1 -0
  123. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js +68 -0
  124. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js.map +1 -0
  125. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts +12 -0
  126. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +1 -0
  127. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +255 -0
  128. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +1 -0
  129. package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts +6 -0
  130. package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts.map +1 -0
  131. package/dist/react/components/rtc-widget/components/conviComponents/index.js +6 -0
  132. package/dist/react/components/rtc-widget/components/conviComponents/index.js.map +1 -0
  133. package/dist/react/components/rtc-widget/components/index.d.ts +9 -0
  134. package/dist/react/components/rtc-widget/components/index.d.ts.map +1 -0
  135. package/dist/react/components/rtc-widget/components/index.js +15 -0
  136. package/dist/react/components/rtc-widget/components/index.js.map +1 -0
  137. package/dist/react/components/rtc-widget/index.d.ts +6 -0
  138. package/dist/react/components/rtc-widget/index.d.ts.map +1 -0
  139. package/dist/react/components/rtc-widget/index.js +9 -0
  140. package/dist/react/components/rtc-widget/index.js.map +1 -0
  141. package/dist/react/components/rtc-widget/styles/framerConfig.d.ts +116 -0
  142. package/dist/react/components/rtc-widget/styles/framerConfig.d.ts.map +1 -0
  143. package/dist/react/components/rtc-widget/styles/framerConfig.js +73 -0
  144. package/dist/react/components/rtc-widget/styles/framerConfig.js.map +1 -0
  145. package/dist/react/components/rtc-widget/styles/icons.d.ts +28 -0
  146. package/dist/react/components/rtc-widget/styles/icons.d.ts.map +1 -0
  147. package/dist/react/components/rtc-widget/styles/icons.js +257 -0
  148. package/dist/react/components/rtc-widget/styles/icons.js.map +1 -0
  149. package/dist/react/components/rtc-widget/styles/index.d.ts +6 -0
  150. package/dist/react/components/rtc-widget/styles/index.d.ts.map +1 -0
  151. package/dist/react/components/rtc-widget/styles/index.js +9 -0
  152. package/dist/react/components/rtc-widget/styles/index.js.map +1 -0
  153. package/dist/react/components/rtc-widget/styles/styledComponents.d.ts +90 -0
  154. package/dist/react/components/rtc-widget/styles/styledComponents.d.ts.map +1 -0
  155. package/dist/react/components/rtc-widget/styles/styledComponents.js +663 -0
  156. package/dist/react/components/rtc-widget/styles/styledComponents.js.map +1 -0
  157. package/dist/react/components/rtc-widget/styles/theme.d.ts +188 -0
  158. package/dist/react/components/rtc-widget/styles/theme.d.ts.map +1 -0
  159. package/dist/react/components/rtc-widget/styles/theme.js +290 -0
  160. package/dist/react/components/rtc-widget/styles/theme.js.map +1 -0
  161. package/dist/react/components/rtc-widget/types/index.d.ts +60 -0
  162. package/dist/react/components/rtc-widget/types/index.d.ts.map +1 -0
  163. package/dist/react/components/rtc-widget/types/index.js +2 -0
  164. package/dist/react/components/rtc-widget/types/index.js.map +1 -0
  165. package/dist/react/hooks/index.d.ts +4 -0
  166. package/dist/react/hooks/index.d.ts.map +1 -0
  167. package/dist/react/hooks/index.js +6 -0
  168. package/dist/react/hooks/index.js.map +1 -0
  169. package/dist/react/hooks/useCharacterInfo.d.ts +17 -0
  170. package/dist/react/hooks/useCharacterInfo.d.ts.map +1 -0
  171. package/dist/react/hooks/useCharacterInfo.js +60 -0
  172. package/dist/react/hooks/useCharacterInfo.js.map +1 -0
  173. package/dist/react/hooks/useConvaiClient.d.ts +35 -0
  174. package/dist/react/hooks/useConvaiClient.d.ts.map +1 -0
  175. package/dist/react/hooks/useConvaiClient.js +179 -0
  176. package/dist/react/hooks/useConvaiClient.js.map +1 -0
  177. package/dist/react/hooks/useLocalCameraTrack.d.ts +22 -0
  178. package/dist/react/hooks/useLocalCameraTrack.d.ts.map +1 -0
  179. package/dist/react/hooks/useLocalCameraTrack.js +34 -0
  180. package/dist/react/hooks/useLocalCameraTrack.js.map +1 -0
  181. package/dist/react/index.d.ts +7 -0
  182. package/dist/react/index.d.ts.map +1 -0
  183. package/dist/react/index.js +13 -0
  184. package/dist/react/index.js.map +1 -0
  185. package/dist/types/index.d.ts.map +1 -0
  186. package/dist/types/index.js +2 -0
  187. package/dist/types/index.js.map +1 -0
  188. package/dist/utils/LatencyMonitor.d.ts.map +1 -0
  189. package/dist/utils/LatencyMonitor.js +136 -0
  190. package/dist/utils/LatencyMonitor.js.map +1 -0
  191. package/dist/utils/logger.d.ts.map +1 -0
  192. package/dist/utils/logger.js +96 -0
  193. package/dist/utils/logger.js.map +1 -0
  194. package/dist/utils/speakerManagement.d.ts.map +1 -0
  195. package/dist/utils/speakerManagement.js +64 -0
  196. package/dist/utils/speakerManagement.js.map +1 -0
  197. package/dist/{types/vanilla → vanilla}/AudioRenderer.d.ts +5 -0
  198. package/dist/vanilla/AudioRenderer.d.ts.map +1 -0
  199. package/dist/vanilla/AudioRenderer.js +135 -0
  200. package/dist/vanilla/AudioRenderer.js.map +1 -0
  201. package/dist/{types/vanilla → vanilla}/ConvaiWidget.d.ts +13 -6
  202. package/dist/vanilla/ConvaiWidget.d.ts.map +1 -0
  203. package/dist/vanilla/ConvaiWidget.js +1823 -0
  204. package/dist/vanilla/ConvaiWidget.js.map +1 -0
  205. package/dist/vanilla/icons.d.ts.map +1 -0
  206. package/dist/vanilla/icons.js +222 -0
  207. package/dist/vanilla/icons.js.map +1 -0
  208. package/dist/{types/vanilla → vanilla}/index.d.ts +1 -3
  209. package/dist/vanilla/index.d.ts.map +1 -0
  210. package/dist/vanilla/index.js +20 -5509
  211. package/dist/vanilla/index.js.map +1 -0
  212. package/dist/vanilla/styles.d.ts.map +1 -0
  213. package/dist/vanilla/styles.js +287 -0
  214. package/dist/vanilla/styles.js.map +1 -0
  215. package/dist/vanilla/types.d.ts +63 -0
  216. package/dist/vanilla/types.d.ts.map +1 -0
  217. package/dist/vanilla/types.js +2 -0
  218. package/dist/vanilla/types.js.map +1 -0
  219. package/package.json +33 -38
  220. package/CHANGELOG.md +0 -165
  221. package/dist/core/index.cjs +0 -1977
  222. package/dist/lipsync-helpers/index.cjs +0 -1195
  223. package/dist/types/core/AudioManager.d.ts.map +0 -1
  224. package/dist/types/core/ConvaiClient.d.ts.map +0 -1
  225. package/dist/types/core/EventEmitter.d.ts.map +0 -1
  226. package/dist/types/core/MessageHandler.d.ts.map +0 -1
  227. package/dist/types/core/ScreenShareManager.d.ts.map +0 -1
  228. package/dist/types/core/VideoManager.d.ts.map +0 -1
  229. package/dist/types/core/index.d.ts.map +0 -1
  230. package/dist/types/core/types.d.ts.map +0 -1
  231. package/dist/types/lipsync-helpers/arkitBlendshapeHelpers.d.ts +0 -80
  232. package/dist/types/lipsync-helpers/arkitBlendshapeHelpers.d.ts.map +0 -1
  233. package/dist/types/lipsync-helpers/arkitOrder61.d.ts.map +0 -1
  234. package/dist/types/lipsync-helpers/arkitPhonemeReference.d.ts +0 -155
  235. package/dist/types/lipsync-helpers/arkitPhonemeReference.d.ts.map +0 -1
  236. package/dist/types/lipsync-helpers/index.d.ts +0 -9
  237. package/dist/types/lipsync-helpers/index.d.ts.map +0 -1
  238. package/dist/types/lipsync-helpers/neurosyncBlendshapeMapper.d.ts +0 -30
  239. package/dist/types/lipsync-helpers/neurosyncBlendshapeMapper.d.ts.map +0 -1
  240. package/dist/types/types/index.d.ts.map +0 -1
  241. package/dist/types/utils/LatencyMonitor.d.ts.map +0 -1
  242. package/dist/types/utils/logger.d.ts.map +0 -1
  243. package/dist/types/utils/speakerManagement.d.ts.map +0 -1
  244. package/dist/types/vanilla/AudioRenderer.d.ts.map +0 -1
  245. package/dist/types/vanilla/ConvaiWidget.d.ts.map +0 -1
  246. package/dist/types/vanilla/icons.d.ts.map +0 -1
  247. package/dist/types/vanilla/index.d.ts.map +0 -1
  248. package/dist/types/vanilla/styles.d.ts.map +0 -1
  249. package/dist/types/vanilla/types.d.ts +0 -106
  250. package/dist/types/vanilla/types.d.ts.map +0 -1
  251. package/dist/umd/convai.umd.js +0 -1
  252. package/dist/vanilla/index.cjs +0 -5559
  253. /package/dist/{types/core → core}/AudioManager.d.ts +0 -0
  254. /package/dist/{types/core → core}/EventEmitter.d.ts +0 -0
  255. /package/dist/{types/core → core}/ScreenShareManager.d.ts +0 -0
  256. /package/dist/{types/core → core}/VideoManager.d.ts +0 -0
  257. /package/dist/{types/lipsync-helpers → lipsync-helpers}/arkitOrder61.d.ts +0 -0
  258. /package/dist/types/{types/index.d.ts → index.d.ts} +0 -0
  259. /package/dist/{types/utils → utils}/LatencyMonitor.d.ts +0 -0
  260. /package/dist/{types/utils → utils}/logger.d.ts +0 -0
  261. /package/dist/{types/utils → utils}/speakerManagement.d.ts +0 -0
  262. /package/dist/{types/vanilla → vanilla}/icons.d.ts +0 -0
  263. /package/dist/{types/vanilla → vanilla}/styles.d.ts +0 -0
@@ -1,1166 +1,33 @@
1
1
  /**
2
- * ARKit 61-Element Custom Order Mapper
3
- * Maps the custom 61-element ARKit blendshape array to standard ARKit indices
2
+ * Lipsync Helpers
4
3
  *
5
- * This ordering includes:
6
- * - 52 standard ARKit facial blendshapes (in custom order)
7
- * - 9 additional values for head and eye rotations
8
- */
9
- /**
10
- * Custom ARKit 61-element ordering
11
- * This is the order in which blendshapes are received from the server
12
- */
13
- const ARKIT_ORDER_61 = [
14
- "EyeBlinkLeft", // 0
15
- "EyeLookDownLeft", // 1
16
- "EyeLookInLeft", // 2
17
- "EyeLookOutLeft", // 3
18
- "EyeLookUpLeft", // 4
19
- "EyeSquintLeft", // 5
20
- "EyeWideLeft", // 6
21
- "EyeBlinkRight", // 7
22
- "EyeLookDownRight", // 8
23
- "EyeLookInRight", // 9
24
- "EyeLookOutRight", // 10
25
- "EyeLookUpRight", // 11
26
- "EyeSquintRight", // 12
27
- "EyeWideRight", // 13
28
- "JawForward", // 14
29
- "JawRight", // 15
30
- "JawLeft", // 16
31
- "JawOpen", // 17 🔑 KEY for mouth opening
32
- "MouthClose", // 18 🔑 KEY for mouth closing
33
- "MouthFunnel", // 19 🔑 KEY for "O" sounds
34
- "MouthPucker", // 20 🔑 KEY for "U" sounds
35
- "MouthRight", // 21
36
- "MouthLeft", // 22
37
- "MouthSmileLeft", // 23 🔑 KEY for "ee" sounds
38
- "MouthSmileRight", // 24 🔑 KEY for "ee" sounds
39
- "MouthFrownLeft", // 25
40
- "MouthFrownRight", // 26
41
- "MouthDimpleLeft", // 27
42
- "MouthDimpleRight", // 28
43
- "MouthStretchLeft", // 29 🔑 KEY for wide mouth
44
- "MouthStretchRight", // 30 🔑 KEY for wide mouth
45
- "MouthRollLower", // 31
46
- "MouthRollUpper", // 32
47
- "MouthShrugLower", // 33
48
- "MouthShrugUpper", // 34
49
- "MouthPressLeft", // 35
50
- "MouthPressRight", // 36
51
- "MouthLowerDownLeft", // 37
52
- "MouthLowerDownRight", // 38
53
- "MouthUpperUpLeft", // 39
54
- "MouthUpperUpRight", // 40
55
- "BrowDownLeft", // 41
56
- "BrowDownRight", // 42
57
- "BrowInnerUp", // 43
58
- "BrowOuterUpLeft", // 44
59
- "BrowOuterUpRight", // 45
60
- "CheekPuff", // 46
61
- "CheekSquintLeft", // 47
62
- "CheekSquintRight", // 48
63
- "NoseSneerLeft", // 49
64
- "NoseSneerRight", // 50
65
- "TongueOut", // 51 🔑 KEY for "th" sounds
66
- "HeadYaw", // 52 - Head rotation left/right
67
- "HeadPitch", // 53 - Head rotation up/down
68
- "HeadRoll", // 54 - Head rotation tilt
69
- "LeftEyeYaw", // 55 - Left eye rotation left/right
70
- "LeftEyePitch", // 56 - Left eye rotation up/down
71
- "LeftEyeRoll", // 57 - Left eye rotation roll
72
- "RightEyeYaw", // 58 - Right eye rotation left/right
73
- "RightEyePitch", // 59 - Right eye rotation up/down
74
- "RightEyeRoll", // 60 - Right eye rotation roll
75
- ];
76
- /**
77
- * Standard ARKit blendshape order (52 elements)
78
- * This is Apple's official ordering
79
- */
80
- const STANDARD_ARKIT_ORDER = [
81
- "BrowDownLeft", // 0
82
- "BrowDownRight", // 1
83
- "BrowInnerUp", // 2
84
- "BrowOuterUpLeft", // 3
85
- "BrowOuterUpRight", // 4
86
- "CheekPuff", // 5
87
- "CheekSquintLeft", // 6
88
- "CheekSquintRight", // 7
89
- "EyeBlinkLeft", // 8
90
- "EyeBlinkRight", // 9
91
- "EyeLookDownLeft", // 10
92
- "EyeLookDownRight", // 11
93
- "EyeLookInLeft", // 12
94
- "EyeLookInRight", // 13
95
- "EyeLookOutLeft", // 14
96
- "EyeLookOutRight", // 15
97
- "EyeLookUpLeft", // 16
98
- "EyeLookUpRight", // 17
99
- "EyeSquintLeft", // 18
100
- "EyeSquintRight", // 19
101
- "EyeWideLeft", // 20
102
- "EyeWideRight", // 21
103
- "JawForward", // 22
104
- "JawLeft", // 23
105
- "JawOpen", // 24
106
- "JawRight", // 25
107
- "MouthClose", // 26
108
- "MouthDimpleLeft", // 27
109
- "MouthDimpleRight", // 28
110
- "MouthFrownLeft", // 29
111
- "MouthFrownRight", // 30
112
- "MouthFunnel", // 31
113
- "MouthLeft", // 32
114
- "MouthLowerDownLeft", // 33
115
- "MouthLowerDownRight", // 34
116
- "MouthPressLeft", // 35
117
- "MouthPressRight", // 36
118
- "MouthPucker", // 37
119
- "MouthRight", // 38
120
- "MouthRollLower", // 39
121
- "MouthRollUpper", // 40
122
- "MouthShrugLower", // 41
123
- "MouthShrugUpper", // 42
124
- "MouthSmileLeft", // 43
125
- "MouthSmileRight", // 44
126
- "MouthStretchLeft", // 45
127
- "MouthStretchRight", // 46
128
- "MouthUpperUpLeft", // 47
129
- "MouthUpperUpRight", // 48
130
- "NoseSneerLeft", // 49
131
- "NoseSneerRight", // 50
132
- "TongueOut", // 51
133
- ];
134
- /**
135
- * Mapping from custom 61-order indices to standard ARKit indices
136
- * Maps ARKIT_ORDER_61[i] -> STANDARD_ARKIT_ORDER[j]
137
- */
138
- const ORDER_61_TO_STANDARD_MAP = new Map();
139
- // Build the mapping at module initialization
140
- for (let i = 0; i < ARKIT_ORDER_61.length; i++) {
141
- const name = ARKIT_ORDER_61[i];
142
- // Only map the first 52 (standard ARKit blendshapes)
143
- if (i < 52) {
144
- const standardIndex = STANDARD_ARKIT_ORDER.indexOf(name);
145
- if (standardIndex !== -1) {
146
- ORDER_61_TO_STANDARD_MAP.set(i, standardIndex);
147
- }
148
- }
149
- }
150
- /**
151
- * Convert 61-element custom order array to standard 52-element ARKit array
152
- * @param values61 - 61-element array in custom order
153
- * @returns 52-element array in standard ARKit order
154
- */
155
- function convertOrder61ToStandard(values61) {
156
- const standardArray = new Array(52).fill(0);
157
- for (let i = 0; i < Math.min(52, values61.length); i++) {
158
- const standardIndex = ORDER_61_TO_STANDARD_MAP.get(i);
159
- if (standardIndex !== undefined) {
160
- standardArray[standardIndex] = values61[i];
161
- }
162
- }
163
- return standardArray;
164
- }
165
- /**
166
- * Map 61-element array to named object (all 61 values)
167
- * @param values61 - 61-element array in custom order
168
- * @returns Object with blendshape/rotation names as keys
169
- */
170
- function mapOrder61ToNames(values61) {
171
- const mapped = {};
172
- for (let i = 0; i < Math.min(values61.length, ARKIT_ORDER_61.length); i++) {
173
- // Convert to camelCase (lowercase first letter)
174
- const name = ARKIT_ORDER_61[i];
175
- const camelCaseName = name.charAt(0).toLowerCase() + name.slice(1);
176
- mapped[camelCaseName] = values61[i];
177
- }
178
- return mapped;
179
- }
180
- /**
181
- * Get specific blendshape value by name from 61-element array
182
- * @param values61 - 61-element array in custom order
183
- * @param name - Name of the blendshape (case-insensitive)
184
- * @returns The value, or 0 if not found
185
- */
186
- function getBlendshapeValueFromOrder61(values61, name) {
187
- const upperName = name.charAt(0).toUpperCase() + name.slice(1);
188
- const index = ARKIT_ORDER_61.indexOf(upperName);
189
- if (index !== -1 && index < values61.length) {
190
- return values61[index];
191
- }
192
- return 0;
193
- }
194
- /**
195
- * Extract head rotation values from 61-element array
196
- * @param values61 - 61-element array in custom order
197
- * @returns Object with head rotation values (yaw, pitch, roll)
198
- */
199
- function getHeadRotation(values61) {
200
- return {
201
- yaw: values61[52] || 0,
202
- pitch: values61[53] || 0,
203
- roll: values61[54] || 0,
204
- };
205
- }
206
- /**
207
- * Extract eye rotation values from 61-element array
208
- * @param values61 - 61-element array in custom order
209
- * @returns Object with left and right eye rotation values
210
- */
211
- function getEyeRotations(values61) {
212
- return {
213
- left: {
214
- yaw: values61[55] || 0,
215
- pitch: values61[56] || 0,
216
- roll: values61[57] || 0,
217
- },
218
- right: {
219
- yaw: values61[58] || 0,
220
- pitch: values61[59] || 0,
221
- roll: values61[60] || 0,
222
- },
223
- };
224
- }
225
- /**
226
- * Get key lip-sync blendshapes from 61-element array
227
- * These are the most important values for facial animation
228
- */
229
- function getLipSyncValuesFromOrder61(values61) {
230
- return {
231
- jawOpen: values61[17] || 0,
232
- mouthClose: values61[18] || 0,
233
- mouthFunnel: values61[19] || 0,
234
- mouthPucker: values61[20] || 0,
235
- mouthSmileLeft: values61[23] || 0,
236
- mouthSmileRight: values61[24] || 0,
237
- mouthStretchLeft: values61[29] || 0,
238
- mouthStretchRight: values61[30] || 0,
239
- mouthRollLower: values61[31] || 0,
240
- mouthRollUpper: values61[32] || 0,
241
- tongueOut: values61[51] || 0,
242
- };
243
- }
244
- /**
245
- * Get active blendshapes from 61-element array (above threshold)
246
- * @param values61 - 61-element array in custom order
247
- * @param threshold - Minimum value to consider "active" (default: 0.01)
248
- * @returns Sorted array of active blendshapes
249
- */
250
- function getActiveBlendshapesFromOrder61(values61, threshold = 0.01) {
251
- const active = [];
252
- for (let i = 0; i < Math.min(values61.length, ARKIT_ORDER_61.length); i++) {
253
- if (Math.abs(values61[i]) > threshold) {
254
- const name = ARKIT_ORDER_61[i];
255
- const camelCaseName = name.charAt(0).toLowerCase() + name.slice(1);
256
- active.push({
257
- name: camelCaseName,
258
- value: values61[i],
259
- index: i,
260
- });
261
- }
262
- }
263
- // Sort by absolute value (descending)
264
- return active.sort((a, b) => Math.abs(b.value) - Math.abs(a.value));
265
- }
266
- /**
267
- * Format 61-element array for logging
268
- * @param values61 - 61-element array in custom order
269
- * @param threshold - Only show values above this (default: 0.01)
270
- * @param maxEntries - Maximum entries to show (default: 20)
271
- */
272
- function formatOrder61ForLogging(values61, threshold = 0.01, maxEntries = 20) {
273
- const active = getActiveBlendshapesFromOrder61(values61, threshold)
274
- .slice(0, maxEntries)
275
- .reduce((acc, item) => {
276
- acc[item.name] = Number(item.value.toFixed(4));
277
- return acc;
278
- }, {});
279
- return {
280
- active,
281
- total: values61.length,
282
- activeCount: Object.keys(active).length,
283
- headRotation: getHeadRotation(values61),
284
- eyeRotations: getEyeRotations(values61),
285
- };
286
- }
287
-
288
- /**
289
- * ARKit Blendshape Helpers
290
- * Utilities for working with ARKit blendshape arrays (52-60 elements)
291
- *
292
- * ARKit Standard: 52 blendshapes (indices 0-51)
293
- * ARKit Extended: Up to 60 blendshapes with additional facial features
294
- */
295
- /**
296
- * ARKit Standard Blendshape Names (indices 0-51)
297
- */
298
- const ARKIT_BLENDSHAPE_NAMES = [
299
- "browDownLeft", // 0
300
- "browDownRight", // 1
301
- "browInnerUp", // 2
302
- "browOuterUpLeft", // 3
303
- "browOuterUpRight", // 4
304
- "cheekPuff", // 5
305
- "cheekSquintLeft", // 6
306
- "cheekSquintRight", // 7
307
- "eyeBlinkLeft", // 8
308
- "eyeBlinkRight", // 9
309
- "eyeLookDownLeft", // 10
310
- "eyeLookDownRight", // 11
311
- "eyeLookInLeft", // 12
312
- "eyeLookInRight", // 13
313
- "eyeLookOutLeft", // 14
314
- "eyeLookOutRight", // 15
315
- "eyeLookUpLeft", // 16
316
- "eyeLookUpRight", // 17
317
- "eyeSquintLeft", // 18
318
- "eyeSquintRight", // 19
319
- "eyeWideLeft", // 20
320
- "eyeWideRight", // 21
321
- "jawForward", // 22
322
- "jawLeft", // 23
323
- "jawOpen", // 24 🔑 KEY for mouth opening
324
- "jawRight", // 25
325
- "mouthClose", // 26 🔑 KEY for mouth closing
326
- "mouthDimpleLeft", // 27
327
- "mouthDimpleRight", // 28
328
- "mouthFrownLeft", // 29
329
- "mouthFrownRight", // 30
330
- "mouthFunnel", // 31 🔑 KEY for "O" sounds
331
- "mouthLeft", // 32
332
- "mouthLowerDownLeft", // 33
333
- "mouthLowerDownRight", // 34
334
- "mouthPressLeft", // 35
335
- "mouthPressRight", // 36
336
- "mouthPucker", // 37 🔑 KEY for "U" sounds
337
- "mouthRight", // 38
338
- "mouthRollLower", // 39
339
- "mouthRollUpper", // 40
340
- "mouthShrugLower", // 41
341
- "mouthShrugUpper", // 42
342
- "mouthSmileLeft", // 43 🔑 KEY for "ee" sounds
343
- "mouthSmileRight", // 44 🔑 KEY for "ee" sounds
344
- "mouthStretchLeft", // 45 🔑 KEY for wide mouth
345
- "mouthStretchRight", // 46 🔑 KEY for wide mouth
346
- "mouthUpperUpLeft", // 47
347
- "mouthUpperUpRight", // 48
348
- "noseSneerLeft", // 49
349
- "noseSneerRight", // 50
350
- "tongueOut", // 51 🔑 KEY for "th" sounds
351
- ];
352
- /**
353
- * Extended blendshapes (indices 52-59) - if provided
354
- * These are optional extensions beyond standard ARKit
355
- */
356
- const ARKIT_EXTENDED_NAMES = [
357
- "eyeDilation", // 52 - Pupil dilation
358
- "eyeConstriction", // 53 - Pupil constriction
359
- "mouthShrug", // 54 - Combined mouth shrug
360
- "lipSuckUpper", // 55 - Upper lip suck
361
- "lipSuckLower", // 56 - Lower lip suck
362
- "lipFunnel", // 57 - Lip funnel position
363
- "lipPress", // 58 - Lip press together
364
- "reserved", // 59 - Reserved for future use
365
- ];
366
- /**
367
- * Map ARKit blendshape array to named object (ARKit standard only: 0-51)
368
- * @param values - Array of blendshape values (length 52-60)
369
- * @returns Object with blendshape names as keys
370
- */
371
- function mapARKitBlendshapesToNames(values) {
372
- const mapped = {};
373
- // Map standard ARKit blendshapes (0-51)
374
- for (let i = 0; i < Math.min(values.length, ARKIT_BLENDSHAPE_NAMES.length); i++) {
375
- mapped[ARKIT_BLENDSHAPE_NAMES[i]] = values[i];
376
- }
377
- // Map extended blendshapes if available (52+)
378
- if (values.length > 52) {
379
- const extendedStart = 52;
380
- for (let i = 0; i < Math.min(values.length - extendedStart, ARKIT_EXTENDED_NAMES.length); i++) {
381
- mapped[ARKIT_EXTENDED_NAMES[i]] = values[extendedStart + i];
382
- }
383
- }
384
- return mapped;
385
- }
386
- /**
387
- * Get only active blendshapes (above threshold)
388
- * @param values - Array of blendshape values
389
- * @param threshold - Minimum value to consider "active" (default: 0.01)
390
- * @returns Sorted array of active blendshapes
391
- */
392
- function getActiveARKitBlendshapes(values, threshold = 0.01) {
393
- const active = [];
394
- // Check standard ARKit blendshapes
395
- for (let i = 0; i < Math.min(values.length, ARKIT_BLENDSHAPE_NAMES.length); i++) {
396
- if (Math.abs(values[i]) > threshold) {
397
- active.push({
398
- name: ARKIT_BLENDSHAPE_NAMES[i],
399
- value: values[i],
400
- index: i,
401
- });
402
- }
403
- }
404
- // Check extended blendshapes
405
- if (values.length > 52) {
406
- for (let i = 52; i < Math.min(values.length, 52 + ARKIT_EXTENDED_NAMES.length); i++) {
407
- if (Math.abs(values[i]) > threshold) {
408
- active.push({
409
- name: ARKIT_EXTENDED_NAMES[i - 52],
410
- value: values[i],
411
- index: i,
412
- });
413
- }
414
- }
415
- }
416
- // Sort by absolute value (descending)
417
- return active.sort((a, b) => Math.abs(b.value) - Math.abs(a.value));
418
- }
419
- /**
420
- * Get specific blendshape value by name
421
- * @param values - Array of blendshape values
422
- * @param name - Name of the blendshape
423
- * @returns The value, or 0 if not found
424
- */
425
- function getARKitBlendshapeValue(values, name) {
426
- const index = ARKIT_BLENDSHAPE_NAMES.indexOf(name);
427
- if (index !== -1 && index < values.length) {
428
- return values[index];
429
- }
430
- const extendedIndex = ARKIT_EXTENDED_NAMES.indexOf(name);
431
- if (extendedIndex !== -1) {
432
- const actualIndex = 52 + extendedIndex;
433
- if (actualIndex < values.length) {
434
- return values[actualIndex];
435
- }
436
- }
437
- return 0;
438
- }
439
- /**
440
- * Format ARKit blendshapes for logging
441
- * @param values - Array of blendshape values
442
- * @param threshold - Only show values above this (default: 0.01)
443
- * @param maxEntries - Maximum entries to show (default: 20)
444
- */
445
- function formatARKitBlendshapesForLogging(values, threshold = 0.01, maxEntries = 20) {
446
- const active = getActiveARKitBlendshapes(values, threshold)
447
- .slice(0, maxEntries)
448
- .reduce((acc, item) => {
449
- acc[item.name] = Number(item.value.toFixed(4));
450
- return acc;
451
- }, {});
452
- return {
453
- active,
454
- total: values.length,
455
- activeCount: Object.keys(active).length,
456
- };
457
- }
458
- /**
459
- * Get the most important facial features for speech
460
- * These are the key blendshapes for lip-sync
461
- */
462
- const KEY_LIPSYNC_BLENDSHAPES = {
463
- jaw: [24], // jawOpen
464
- lips: [26, 31, 37, 39, 40], // mouthClose, mouthFunnel, mouthPucker, mouthRollLower, mouthRollUpper
465
- smile: [43, 44, 45, 46], // mouthSmile*, mouthStretch*
466
- tongue: [51], // tongueOut
467
- };
468
- /**
469
- * Extract only lip-sync relevant blendshapes
470
- * @param values - Full blendshape array
471
- * @returns Object with categorized lip-sync blendshapes
472
- */
473
- function getLipSyncBlendshapes(values) {
474
- return {
475
- jaw: values[24] || 0,
476
- mouthClose: values[26] || 0,
477
- mouthFunnel: values[31] || 0,
478
- mouthPucker: values[37] || 0,
479
- mouthRollLower: values[39] || 0,
480
- mouthRollUpper: values[40] || 0,
481
- mouthSmileLeft: values[43] || 0,
482
- mouthSmileRight: values[44] || 0,
483
- mouthStretchLeft: values[45] || 0,
484
- mouthStretchRight: values[46] || 0,
485
- tongueOut: values[51] || 0,
486
- };
487
- }
488
-
489
- /**
490
- * ARKit Blendshape Reference Values for Phonemes/Visemes
491
- *
492
- * This file provides reference values for ARKit's 52 standard facial blendshapes
493
- * when forming different phonemes (speech sounds). These values are based on
494
- * industry standards from systems like OVR LipSync, Oculus Audio, and ARKit face tracking.
495
- *
496
- * All blendshape values range from 0.0 (no activation) to 1.0 (full activation)
497
- *
498
- * ARKit Blendshapes: Indices 0-51
499
- * Meta Human Extended: Indices 52-250
500
- */
501
- /**
502
- * Reference values for common phonemes
503
- * Based on International Phonetic Alphabet (IPA) and Arpabet standards
504
- */
505
- const ARKIT_PHONEME_REFERENCE_VALUES = {
506
- // ============================================
507
- // SILENCE / NEUTRAL
508
- // ============================================
509
- sil: {
510
- jawOpen: 0.0,
511
- mouthClose: 1.0,
512
- description: "Silence - mouth closed, neutral expression"
513
- },
514
- // ============================================
515
- // VOWELS
516
- // ============================================
517
- aa: {
518
- jawOpen: 0.7,
519
- mouthFunnel: 0.0,
520
- mouthPucker: 0.0,
521
- tongueOut: 0.1,
522
- description: "Open back vowel - 'ah' (father, hot)"
523
- },
524
- ae: {
525
- jawOpen: 0.5,
526
- mouthStretchLeft: 0.4,
527
- mouthStretchRight: 0.4,
528
- description: "Near-open front vowel - 'a' (cat, bat)"
529
- },
530
- E: {
531
- jawOpen: 0.4,
532
- mouthStretchLeft: 0.3,
533
- mouthStretchRight: 0.3,
534
- mouthSmileLeft: 0.2,
535
- mouthSmileRight: 0.2,
536
- description: "Open-mid front vowel - 'eh' (bed, get)"
537
- },
538
- I: {
539
- jawOpen: 0.1,
540
- mouthStretchLeft: 0.6,
541
- mouthStretchRight: 0.6,
542
- mouthSmileLeft: 0.5,
543
- mouthSmileRight: 0.5,
544
- mouthClose: 0.3,
545
- description: "Close front vowel - 'ee' (see, feet)"
546
- },
547
- ih: {
548
- jawOpen: 0.2,
549
- mouthStretchLeft: 0.4,
550
- mouthStretchRight: 0.4,
551
- mouthSmileLeft: 0.3,
552
- mouthSmileRight: 0.3,
553
- description: "Near-close front vowel - 'i' (sit, bit)"
554
- },
555
- O: {
556
- jawOpen: 0.5,
557
- mouthFunnel: 0.6,
558
- mouthPucker: 0.3,
559
- description: "Close-mid back rounded vowel - 'oh' (go, boat)"
560
- },
561
- aw: {
562
- jawOpen: 0.6,
563
- mouthFunnel: 0.4,
564
- mouthPucker: 0.2,
565
- description: "Open-mid back rounded vowel - 'aw' (thought, caught)"
566
- },
567
- U: {
568
- jawOpen: 0.2,
569
- mouthFunnel: 0.8,
570
- mouthPucker: 0.9,
571
- description: "Close back rounded vowel - 'oo' (food, boot)"
572
- },
573
- uh: {
574
- jawOpen: 0.25,
575
- mouthFunnel: 0.5,
576
- mouthPucker: 0.6,
577
- description: "Near-close back rounded vowel - 'u' (book, foot)"
578
- },
579
- er: {
580
- jawOpen: 0.35,
581
- mouthFunnel: 0.3,
582
- mouthPucker: 0.1,
583
- description: "R-colored mid-central vowel - 'er' (her, bird)"
584
- },
585
- ah: {
586
- jawOpen: 0.4,
587
- mouthFunnel: 0.1,
588
- description: "Open-mid back vowel - 'uh' (but, cup)"
589
- },
590
- // ============================================
591
- // DIPHTHONGS
592
- // ============================================
593
- ow: {
594
- jawOpen: 0.6,
595
- mouthFunnel: 0.3,
596
- mouthPucker: 0.2,
597
- description: "Diphthong - 'ow' (cow, house)"
598
- },
599
- ay: {
600
- jawOpen: 0.5,
601
- mouthStretchLeft: 0.3,
602
- mouthStretchRight: 0.3,
603
- description: "Diphthong - 'ai' (eye, my)"
604
- },
605
- oy: {
606
- jawOpen: 0.5,
607
- mouthFunnel: 0.4,
608
- mouthPucker: 0.3,
609
- description: "Diphthong - 'oy' (boy, coin)"
610
- },
611
- // ============================================
612
- // CONSONANTS - BILABIALS (both lips)
613
- // ============================================
614
- PP: {
615
- jawOpen: 0.0,
616
- mouthClose: 1.0,
617
- mouthPressLeft: 0.5,
618
- mouthPressRight: 0.5,
619
- description: "Bilabial stops/nasal - 'p', 'b', 'm' (pat, bat, mat)"
620
- },
621
- // ============================================
622
- // CONSONANTS - LABIODENTAL (teeth on lip)
623
- // ============================================
624
- FF: {
625
- jawOpen: 0.15,
626
- mouthRollLower: 0.6,
627
- mouthUpperUpLeft: 0.3,
628
- mouthUpperUpRight: 0.3,
629
- description: "Labiodental fricatives - 'f', 'v' (fat, vat)"
630
- },
631
- // ============================================
632
- // CONSONANTS - DENTAL/INTERDENTAL
633
- // ============================================
634
- TH: {
635
- jawOpen: 0.2,
636
- tongueOut: 0.4,
637
- mouthUpperUpLeft: 0.2,
638
- mouthUpperUpRight: 0.2,
639
- mouthRollLower: 0.2,
640
- description: "Dental fricatives - 'th' (think, this)"
641
- },
642
- // ============================================
643
- // CONSONANTS - ALVEOLAR (tongue to ridge)
644
- // ============================================
645
- DD: {
646
- jawOpen: 0.3,
647
- mouthClose: 0.2,
648
- description: "Alveolar stops - 't', 'd' (tap, dap)"
649
- },
650
- SS: {
651
- jawOpen: 0.15,
652
- mouthStretchLeft: 0.4,
653
- mouthStretchRight: 0.4,
654
- mouthClose: 0.4,
655
- description: "Alveolar sibilants - 's', 'z' (sap, zap)"
656
- },
657
- nn: {
658
- jawOpen: 0.2,
659
- mouthClose: 0.3,
660
- description: "Alveolar nasal - 'n' (nap)"
661
- },
662
- l: {
663
- jawOpen: 0.25,
664
- tongueOut: 0.2,
665
- description: "Alveolar lateral approximant - 'l' (lap)"
666
- },
667
- // ============================================
668
- // CONSONANTS - POSTALVEOLAR (behind ridge)
669
- // ============================================
670
- CH: {
671
- jawOpen: 0.2,
672
- mouthFunnel: 0.3,
673
- mouthPucker: 0.2,
674
- description: "Postalveolar affricates - 'ch', 'j' (church, judge)"
675
- },
676
- sh: {
677
- jawOpen: 0.2,
678
- mouthFunnel: 0.4,
679
- mouthPucker: 0.3,
680
- description: "Postalveolar fricatives - 'sh', 'zh' (shoe, measure)"
681
- },
682
- // ============================================
683
- // CONSONANTS - RETROFLEX
684
- // ============================================
685
- RR: {
686
- jawOpen: 0.3,
687
- mouthFunnel: 0.2,
688
- mouthPucker: 0.15,
689
- tongueOut: 0.1,
690
- description: "Alveolar approximant - 'r' (red)"
691
- },
692
- // ============================================
693
- // CONSONANTS - PALATAL
694
- // ============================================
695
- y: {
696
- jawOpen: 0.2,
697
- mouthStretchLeft: 0.35,
698
- mouthStretchRight: 0.35,
699
- mouthSmileLeft: 0.2,
700
- mouthSmileRight: 0.2,
701
- description: "Palatal approximant - 'y' (yes)"
702
- },
703
- // ============================================
704
- // CONSONANTS - VELAR (back of tongue)
705
- // ============================================
706
- kk: {
707
- jawOpen: 0.35,
708
- description: "Velar stops/nasal - 'k', 'g', 'ng' (kite, go, sing)"
709
- },
710
- // ============================================
711
- // CONSONANTS - GLOTTAL
712
- // ============================================
713
- hh: {
714
- jawOpen: 0.3,
715
- description: "Glottal fricative - 'h' (hat)"
716
- },
717
- // ============================================
718
- // CONSONANTS - LABIO-VELAR
719
- // ============================================
720
- w: {
721
- jawOpen: 0.15,
722
- mouthPucker: 0.8,
723
- mouthFunnel: 0.6,
724
- description: "Labio-velar approximant - 'w' (wet)"
725
- },
726
- };
727
- /**
728
- * ARKit Blendshape Indices (0-51)
729
- * These are Apple's standard 52 facial blendshapes
730
- */
731
- const ARKIT_BLENDSHAPE_INDICES = {
732
- browDownLeft: 0,
733
- browDownRight: 1,
734
- browInnerUp: 2,
735
- browOuterUpLeft: 3,
736
- browOuterUpRight: 4,
737
- cheekPuff: 5,
738
- cheekSquintLeft: 6,
739
- cheekSquintRight: 7,
740
- eyeBlinkLeft: 8,
741
- eyeBlinkRight: 9,
742
- eyeLookDownLeft: 10,
743
- eyeLookDownRight: 11,
744
- eyeLookInLeft: 12,
745
- eyeLookInRight: 13,
746
- eyeLookOutLeft: 14,
747
- eyeLookOutRight: 15,
748
- eyeLookUpLeft: 16,
749
- eyeLookUpRight: 17,
750
- eyeSquintLeft: 18,
751
- eyeSquintRight: 19,
752
- eyeWideLeft: 20,
753
- eyeWideRight: 21,
754
- jawForward: 22,
755
- jawLeft: 23,
756
- jawOpen: 24, // 🔑 KEY for mouth opening
757
- jawRight: 25,
758
- mouthClose: 26, // 🔑 KEY for mouth closing
759
- mouthDimpleLeft: 27,
760
- mouthDimpleRight: 28,
761
- mouthFrownLeft: 29,
762
- mouthFrownRight: 30,
763
- mouthFunnel: 31, // 🔑 KEY for "O" and "oo" sounds
764
- mouthLeft: 32,
765
- mouthLowerDownLeft: 33,
766
- mouthLowerDownRight: 34,
767
- mouthPressLeft: 35,
768
- mouthPressRight: 36,
769
- mouthPucker: 37, // 🔑 KEY for "U" and "w" sounds
770
- mouthRight: 38,
771
- mouthRollLower: 39,
772
- mouthRollUpper: 40,
773
- mouthShrugLower: 41,
774
- mouthShrugUpper: 42,
775
- mouthSmileLeft: 43, // 🔑 KEY for "ee" sounds
776
- mouthSmileRight: 44, // 🔑 KEY for "ee" sounds
777
- mouthStretchLeft: 45, // 🔑 KEY for wide mouth shapes
778
- mouthStretchRight: 46, // 🔑 KEY for wide mouth shapes
779
- mouthUpperUpLeft: 47,
780
- mouthUpperUpRight: 48,
781
- noseSneerLeft: 49,
782
- noseSneerRight: 50,
783
- tongueOut: 51 // 🔑 KEY for "th" and "l" sounds
784
- };
785
- /**
786
- * Generate a complete 251-length blendshape array for a specific phoneme
787
- * @param phoneme - The phoneme key from ARKIT_PHONEME_REFERENCE_VALUES
788
- * @returns Array of 251 blendshape values
789
- */
790
- function generatePhonemeBlendshapes(phoneme) {
791
- const blendshapes = new Array(251).fill(0);
792
- const values = ARKIT_PHONEME_REFERENCE_VALUES[phoneme];
793
- // Map phoneme values to ARKit indices (0-51)
794
- for (const [key, value] of Object.entries(values)) {
795
- if (key !== 'description' && key in ARKIT_BLENDSHAPE_INDICES) {
796
- const index = ARKIT_BLENDSHAPE_INDICES[key];
797
- blendshapes[index] = value;
798
- }
799
- }
800
- return blendshapes;
801
- }
802
- /**
803
- * Pre-generated sample blendshapes for testing and visualization
804
- * Use these to test your visualization system
805
- */
806
- const SAMPLE_PHONEME_TESTS = {
807
- 'Silence': generatePhonemeBlendshapes('sil'),
808
- 'A (ah - father)': generatePhonemeBlendshapes('aa'),
809
- 'E (eh - bed)': generatePhonemeBlendshapes('E'),
810
- 'I (ee - see)': generatePhonemeBlendshapes('I'),
811
- 'O (oh - go)': generatePhonemeBlendshapes('O'),
812
- 'U (oo - food)': generatePhonemeBlendshapes('U'),
813
- 'P/B/M': generatePhonemeBlendshapes('PP'),
814
- 'F/V': generatePhonemeBlendshapes('FF'),
815
- 'TH (think)': generatePhonemeBlendshapes('TH'),
816
- 'S/Z': generatePhonemeBlendshapes('SS'),
817
- 'SH (shoe)': generatePhonemeBlendshapes('sh'),
818
- 'CH (church)': generatePhonemeBlendshapes('CH'),
819
- 'W (wet)': generatePhonemeBlendshapes('w'),
820
- 'R (red)': generatePhonemeBlendshapes('RR'),
821
- 'L (lap)': generatePhonemeBlendshapes('l'),
822
- 'K/G': generatePhonemeBlendshapes('kk'),
823
- };
824
- /**
825
- * Get a formatted string showing active blendshapes for a phoneme
826
- * Useful for debugging and documentation
827
- */
828
- function getPhonemeDescription(phoneme) {
829
- const data = ARKIT_PHONEME_REFERENCE_VALUES[phoneme];
830
- const lines = [data.description, ''];
831
- for (const [key, value] of Object.entries(data)) {
832
- if (key !== 'description') {
833
- lines.push(` ${key}: ${value}`);
834
- }
835
- }
836
- return lines.join('\n');
837
- }
838
- /**
839
- * Quick reference guide for key blendshapes
840
- */
841
- const BLENDSHAPE_QUICK_GUIDE = {
842
- 'Open mouth': ['jawOpen'],
843
- 'Close mouth': ['mouthClose'],
844
- 'Round lips (O, oo)': ['mouthFunnel', 'mouthPucker'],
845
- 'Smile (ee)': ['mouthSmileLeft', 'mouthSmileRight', 'mouthStretchLeft', 'mouthStretchRight'],
846
- 'Lips pressed (p, b, m)': ['mouthPressLeft', 'mouthPressRight', 'mouthClose'],
847
- 'Teeth on lip (f, v)': ['mouthRollLower', 'mouthUpperUpLeft', 'mouthUpperUpRight'],
848
- 'Tongue visible (th, l)': ['tongueOut'],
849
- };
850
-
851
- /**
852
- * Neurosync Meta Human Blendshape Mapper
853
- * Maps 251 blendshape indices to their corresponding names
854
- * Based on Neurosync Meta Human specification
855
- */
856
- const NEUROSYNC_BLENDSHAPE_NAMES = [
857
- // 0-51: ARKit Standard Blendshapes
858
- "browDownLeft", // 0
859
- "browDownRight", // 1
860
- "browInnerUp", // 2
861
- "browOuterUpLeft", // 3
862
- "browOuterUpRight", // 4
863
- "cheekPuff", // 5
864
- "cheekSquintLeft", // 6
865
- "cheekSquintRight", // 7
866
- "eyeBlinkLeft", // 8
867
- "eyeBlinkRight", // 9
868
- "eyeLookDownLeft", // 10
869
- "eyeLookDownRight", // 11
870
- "eyeLookInLeft", // 12
871
- "eyeLookInRight", // 13
872
- "eyeLookOutLeft", // 14
873
- "eyeLookOutRight", // 15
874
- "eyeLookUpLeft", // 16
875
- "eyeLookUpRight", // 17
876
- "eyeSquintLeft", // 18
877
- "eyeSquintRight", // 19
878
- "eyeWideLeft", // 20
879
- "eyeWideRight", // 21
880
- "jawForward", // 22
881
- "jawLeft", // 23
882
- "jawOpen", // 24
883
- "jawRight", // 25
884
- "mouthClose", // 26
885
- "mouthDimpleLeft", // 27
886
- "mouthDimpleRight", // 28
887
- "mouthFrownLeft", // 29
888
- "mouthFrownRight", // 30
889
- "mouthFunnel", // 31
890
- "mouthLeft", // 32
891
- "mouthLowerDownLeft", // 33
892
- "mouthLowerDownRight", // 34
893
- "mouthPressLeft", // 35
894
- "mouthPressRight", // 36
895
- "mouthPucker", // 37
896
- "mouthRight", // 38
897
- "mouthRollLower", // 39
898
- "mouthRollUpper", // 40
899
- "mouthShrugLower", // 41
900
- "mouthShrugUpper", // 42
901
- "mouthSmileLeft", // 43
902
- "mouthSmileRight", // 44
903
- "mouthStretchLeft", // 45
904
- "mouthStretchRight", // 46
905
- "mouthUpperUpLeft", // 47
906
- "mouthUpperUpRight", // 48
907
- "noseSneerLeft", // 49
908
- "noseSneerRight", // 50
909
- "tongueOut", // 51
910
- // 52-250: Meta Human Extended Blendshapes
911
- "head_forward", // 52
912
- "head_upDown", // 53
913
- "head_tilt", // 54
914
- "head_turn", // 55
915
- "neck_stretch", // 56
916
- "neck_tilt", // 57
917
- "eyebrow_raiseInner_L", // 58
918
- "eyebrow_raiseInner_R", // 59
919
- "eyebrow_raiseOuter_L", // 60
920
- "eyebrow_raiseOuter_R", // 61
921
- "eyebrow_down_L", // 62
922
- "eyebrow_down_R", // 63
923
- "eye_blink_L", // 64
924
- "eye_blink_R", // 65
925
- "eye_wide_L", // 66
926
- "eye_wide_R", // 67
927
- "eye_squint_L", // 68
928
- "eye_squint_R", // 69
929
- "eye_look_up_L", // 70
930
- "eye_look_up_R", // 71
931
- "eye_look_down_L", // 72
932
- "eye_look_down_R", // 73
933
- "eye_look_in_L", // 74
934
- "eye_look_in_R", // 75
935
- "eye_look_out_L", // 76
936
- "eye_look_out_R", // 77
937
- "pupil_dilate_L", // 78
938
- "pupil_dilate_R", // 79
939
- "cheek_puff_L", // 80
940
- "cheek_puff_R", // 81
941
- "cheek_squint_L", // 82
942
- "cheek_squint_R", // 83
943
- "cheek_raiser_L", // 84
944
- "cheek_raiser_R", // 85
945
- "nose_wrinkle_L", // 86
946
- "nose_wrinkle_R", // 87
947
- "nose_nostril_raise_L", // 88
948
- "nose_nostril_raise_R", // 89
949
- "nose_nostril_compress_L", // 90
950
- "nose_nostril_compress_R", // 91
951
- "nose_nostril_dilate_L", // 92
952
- "nose_nostril_dilate_R", // 93
953
- "lip_upper_raise_L", // 94
954
- "lip_upper_raise_R", // 95
955
- "lip_upper_raiseInner_L", // 96
956
- "lip_upper_raiseInner_R", // 97
957
- "lip_upper_close", // 98
958
- "lip_lower_close", // 99
959
- "lip_lower_down_L", // 100
960
- "lip_lower_down_R", // 101
961
- "lip_lower_downInner_L", // 102
962
- "lip_lower_downInner_R", // 103
963
- "lip_corner_puller_L", // 104
964
- "lip_corner_puller_R", // 105
965
- "lip_corner_depressor_L", // 106
966
- "lip_corner_depressor_R", // 107
967
- "lip_stretcher_L", // 108
968
- "lip_stretcher_R", // 109
969
- "lip_funneler_LT", // 110
970
- "lip_funneler_RT", // 111
971
- "lip_funneler_LB", // 112
972
- "lip_funneler_RB", // 113
973
- "lip_pucker_L", // 114
974
- "lip_pucker_R", // 115
975
- "lip_press_L", // 116
976
- "lip_press_R", // 117
977
- "lip_tightener_L", // 118
978
- "lip_tightener_R", // 119
979
- "lip_suck_LT", // 120
980
- "lip_suck_RT", // 121
981
- "lip_suck_LB", // 122
982
- "lip_suck_RB", // 123
983
- "mouth_left", // 124
984
- "mouth_right", // 125
985
- "mouth_smile_L", // 126
986
- "mouth_smile_R", // 127
987
- "mouth_frown_L", // 128
988
- "mouth_frown_R", // 129
989
- "mouth_dimpler_L", // 130
990
- "mouth_dimpler_R", // 131
991
- "mouth_stretch_L", // 132
992
- "mouth_stretch_R", // 133
993
- "mouth_shrug_upper", // 134
994
- "mouth_shrug_lower", // 135
995
- "mouth_roll_upper_L", // 136
996
- "mouth_roll_upper_R", // 137
997
- "mouth_roll_lower_L", // 138
998
- "mouth_roll_lower_R", // 139
999
- "jaw_open", // 140
1000
- "jaw_forward", // 141
1001
- "jaw_left", // 142
1002
- "jaw_right", // 143
1003
- "jaw_clench", // 144
1004
- "jaw_thrust", // 145
1005
- "tongue_out", // 146
1006
- "tongue_up", // 147
1007
- "tongue_down", // 148
1008
- "tongue_wide", // 149
1009
- "tongue_narrow", // 150
1010
- "tongue_curl_up", // 151
1011
- "tongue_roll", // 152
1012
- "tongue_bulge_L", // 153
1013
- "tongue_bulge_R", // 154
1014
- "tongue_press", // 155
1015
- "midLipLowerDown_L", // 156
1016
- "midLipLowerDown_R", // 157
1017
- "midLipUpperUp_L", // 158
1018
- "midLipUpperUp_R", // 159
1019
- "midNostrilSharpener_L", // 160
1020
- "midNostrilSharpener_R", // 161
1021
- "viseme_sil", // 162
1022
- "viseme_PP", // 163
1023
- "viseme_FF", // 164
1024
- "viseme_TH", // 165
1025
- "viseme_DD", // 166
1026
- "viseme_kk", // 167
1027
- "viseme_CH", // 168
1028
- "viseme_SS", // 169
1029
- "viseme_nn", // 170
1030
- "viseme_RR", // 171
1031
- "viseme_aa", // 172
1032
- "viseme_E", // 173
1033
- "viseme_I", // 174
1034
- "viseme_O", // 175
1035
- "viseme_U", // 176
1036
- "lid_tightener_L", // 177
1037
- "lid_tightener_R", // 178
1038
- "eyelid_upper_raise_L", // 179
1039
- "eyelid_upper_raise_R", // 180
1040
- "eyelid_lower_down_L", // 181
1041
- "eyelid_lower_down_R", // 182
1042
- "eye_parallel_look_down", // 183
1043
- "eye_parallel_look_up", // 184
1044
- "innerBrow_raiser_L", // 185
1045
- "innerBrow_raiser_R", // 186
1046
- "outerBrow_raiser_L", // 187
1047
- "outerBrow_raiser_R", // 188
1048
- "lipCorner_down_L", // 189
1049
- "lipCorner_down_R", // 190
1050
- "lipCorner_wide_L", // 191
1051
- "lipCorner_wide_R", // 192
1052
- "lipLower_down_L", // 193
1053
- "lipLower_down_R", // 194
1054
- "lipUpper_up_L", // 195
1055
- "lipUpper_up_R", // 196
1056
- "wrinkler", // 197
1057
- "chin_raiser", // 198
1058
- "chin_raiser_T", // 199
1059
- "chin_raiser_B", // 200
1060
- "lips_toward", // 201
1061
- "lips_blow", // 202
1062
- "puff_suck_lower", // 203
1063
- "puff_suck_upper", // 204
1064
- "puff_suck_upper_L", // 205
1065
- "puff_suck_upper_R", // 206
1066
- "puff_suck_lower_L", // 207
1067
- "puff_suck_lower_R", // 208
1068
- "phone_aa", // 209
1069
- "phone_ow", // 210
1070
- "phone_ee", // 211
1071
- "phone_er", // 212
1072
- "phone_uw", // 213
1073
- "phone_l", // 214
1074
- "phone_w", // 215
1075
- "phone_m", // 216
1076
- "phone_f", // 217
1077
- "phone_th", // 218
1078
- "phone_s", // 219
1079
- "phone_sh", // 220
1080
- "phone_t", // 221
1081
- "phone_k", // 222
1082
- "phone_b", // 223
1083
- "phone_d", // 224
1084
- "phone_g", // 225
1085
- "phone_n", // 226
1086
- "phone_r", // 227
1087
- "phone_y", // 228
1088
- "expression_neutral", // 229
1089
- "expression_happy", // 230
1090
- "expression_sad", // 231
1091
- "expression_angry", // 232
1092
- "expression_surprised", // 233
1093
- "expression_disgusted", // 234
1094
- "expression_afraid", // 235
1095
- "expression_contempt", // 236
1096
- "occlusion_upper", // 237
1097
- "occlusion_lower", // 238
1098
- "teeth_upper", // 239
1099
- "teeth_lower", // 240
1100
- "teeth_fwdBack_upper", // 241
1101
- "teeth_fwdBack_lower", // 242
1102
- "teeth_width_upper", // 243
1103
- "teeth_width_lower", // 244
1104
- "gums_upper", // 245
1105
- "gums_lower", // 246
1106
- "tongue_tip", // 247
1107
- "tongue_thickness", // 248
1108
- "soft_palate", // 249
1109
- "emotion_intensity", // 250
1110
- ];
1111
- /**
1112
- * Maps blendshape values to their names
1113
- */
1114
- function mapBlendshapesToNames(values) {
1115
- const mapped = {};
1116
- values.forEach((value, index) => {
1117
- if (index < NEUROSYNC_BLENDSHAPE_NAMES.length) {
1118
- const name = NEUROSYNC_BLENDSHAPE_NAMES[index];
1119
- mapped[name] = value;
1120
- }
1121
- else {
1122
- // Handle any indices beyond our known names
1123
- mapped[`unknown_${index}`] = value;
1124
- }
1125
- });
1126
- return mapped;
1127
- }
1128
- /**
1129
- * Formats blendshapes for logging with filtering
1130
- * @param values - Array of 251 blendshape values
1131
- * @param threshold - Only log values above this threshold (default: 0.01)
1132
- * @param maxEntries - Maximum number of entries to log (default: 20)
1133
- */
1134
- function formatBlendshapesForLogging(values, threshold = 0.01, maxEntries = 20) {
1135
- const mapped = mapBlendshapesToNames(values);
1136
- // Filter values above threshold and sort by value (descending)
1137
- const activeBlendshapes = Object.entries(mapped)
1138
- .filter(([_, value]) => Math.abs(value) > threshold)
1139
- .sort(([, a], [, b]) => Math.abs(b) - Math.abs(a))
1140
- .slice(0, maxEntries)
1141
- .reduce((acc, [name, value]) => {
1142
- acc[name] = Number(value.toFixed(4));
1143
- return acc;
1144
- }, {});
1145
- return {
1146
- active: activeBlendshapes,
1147
- total: values.length,
1148
- activeCount: Object.keys(activeBlendshapes).length,
1149
- };
1150
- }
1151
- /**
1152
- * Gets the most significant blendshapes
1153
- */
1154
- function getTopBlendshapes(values, count = 10) {
1155
- return values
1156
- .map((value, index) => ({
1157
- name: NEUROSYNC_BLENDSHAPE_NAMES[index] || `unknown_${index}`,
1158
- value,
1159
- index,
1160
- }))
1161
- .filter((item) => Math.abs(item.value) > 0.001)
1162
- .sort((a, b) => Math.abs(b.value) - Math.abs(a.value))
1163
- .slice(0, count);
1164
- }
1165
-
1166
- export { ARKIT_BLENDSHAPE_INDICES, ARKIT_BLENDSHAPE_NAMES, ARKIT_EXTENDED_NAMES, ARKIT_ORDER_61, ARKIT_PHONEME_REFERENCE_VALUES, BLENDSHAPE_QUICK_GUIDE, KEY_LIPSYNC_BLENDSHAPES, NEUROSYNC_BLENDSHAPE_NAMES, SAMPLE_PHONEME_TESTS, STANDARD_ARKIT_ORDER, convertOrder61ToStandard, formatARKitBlendshapesForLogging, formatBlendshapesForLogging, formatOrder61ForLogging, generatePhonemeBlendshapes, getARKitBlendshapeValue, getActiveARKitBlendshapes, getActiveBlendshapesFromOrder61, getBlendshapeValueFromOrder61, getEyeRotations, getHeadRotation, getLipSyncBlendshapes, getLipSyncValuesFromOrder61, getPhonemeDescription, getTopBlendshapes, mapARKitBlendshapesToNames, mapBlendshapesToNames, mapOrder61ToNames };
4
+ * Essential blendshape order arrays for ARKit and MetaHuman formats.
5
+ * These define the order in which blendshape values are received from Convai's server.
6
+ */
7
+ // ============================================================================
8
+ // ARKIT FORMAT (61 elements: 52 blendshapes + 9 rotation values)
9
+ // ============================================================================
10
+ export {
11
+ // ARKit 61-element order array
12
+ ARKIT_ORDER_61,
13
+ // Standard ARKit 52-element order
14
+ STANDARD_ARKIT_ORDER,
15
+ // Helper functions
16
+ convertOrder61ToStandard, mapOrder61ToNames, getBlendshapeValueFromOrder61, getHeadRotation, getEyeRotations, getLipSyncValuesFromOrder61, getActiveBlendshapesFromOrder61, formatOrder61ForLogging, } from "./arkitOrder61";
17
+ // ============================================================================
18
+ // METAHUMAN FORMAT (251 CTRL_expressions_* blendshapes)
19
+ // ============================================================================
20
+ export {
21
+ // MetaHuman 251-element order array
22
+ METAHUMAN_ORDER_251,
23
+ // Category breakdown
24
+ METAHUMAN_CATEGORIES,
25
+ // Key lipsync blendshapes
26
+ KEY_METAHUMAN_LIPSYNC,
27
+ // Helper functions
28
+ getMetaHumanBlendshapeName, getMetaHumanBlendshapeIndex, getMetaHumanBlendshapesByCategory, formatMetaHumanBlendshapesForLogging, } from "./metahumanOrder251";
29
+ export { PRESET_MAPPINGS, } from "./mappingTypes";
30
+ export { arkitPassthroughMapper, metahumanPassthroughMapper, identityMapper, } from "./presetMappers";
31
+ export { createBlendshapeQueue, createARKitBlendshapeQueue, createMetaHumanBlendshapeQueue, createCustomBlendshapeQueue, createPassthroughBlendshapeQueue, inferMappingFromConfig, } from "./createBlendshapeQueue";
32
+ export { createARKitNameMapper, createMetaHumanNameMapper, getBlendshapeObject, } from "./declarativeMapping";
33
+ //# sourceMappingURL=index.js.map