@omnimedia/omnitool 1.1.0-1 → 1.1.0-100

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 (468) hide show
  1. package/README.md +556 -72
  2. package/package.json +20 -15
  3. package/s/context.ts +0 -7
  4. package/s/demo/demo.bundle.ts +104 -39
  5. package/s/demo/demo.css +246 -11
  6. package/s/demo/routines/export-test.ts +16 -0
  7. package/s/demo/routines/filmstrip-test.ts +23 -19
  8. package/s/demo/routines/load-video.ts +2 -3
  9. package/s/demo/routines/playback-test.ts +61 -0
  10. package/s/demo/routines/timeline-setup.ts +81 -0
  11. package/s/demo/routines/transcode-test.ts +21 -5
  12. package/s/demo/routines/transcriber-test.ts +34 -0
  13. package/s/demo/routines/transitions-test.ts +43 -0
  14. package/s/demo/routines/waveform-test.ts +35 -8
  15. package/s/driver/driver-worker.ts +9 -0
  16. package/s/driver/driver.test.ts +1 -1
  17. package/s/driver/driver.ts +52 -43
  18. package/s/driver/fns/host.ts +7 -6
  19. package/s/driver/fns/schematic.ts +69 -25
  20. package/s/driver/fns/work.ts +102 -214
  21. package/s/driver/parts/compositor.ts +319 -0
  22. package/s/driver/parts/machina.ts +19 -20
  23. package/s/driver/utils/find-pixi-filter.ts +24 -0
  24. package/s/driver/utils/load-decoder-source.ts +3 -4
  25. package/s/features/bg-remover/bg-remover.ts +26 -0
  26. package/s/features/bg-remover/default-spec.ts +11 -0
  27. package/s/features/bg-remover/types.ts +27 -0
  28. package/s/features/bg-remover/worker.bundle.ts +52 -0
  29. package/s/features/parts/expose-errors.ts +41 -0
  30. package/s/features/parts/load-pipe.ts +17 -0
  31. package/s/features/parts/types.ts +19 -0
  32. package/s/features/speech/transcribe/default-spec.ts +11 -0
  33. package/s/features/speech/transcribe/parts/prep-audio.ts +23 -0
  34. package/s/features/speech/transcribe/parts/transcribe.ts +70 -0
  35. package/s/features/speech/transcribe/transcriber.ts +46 -0
  36. package/s/features/speech/transcribe/types.ts +76 -0
  37. package/s/features/speech/transcribe/worker.bundle.ts +42 -0
  38. package/s/features/transition/parts/fragment.ts +24 -0
  39. package/s/features/transition/parts/types.ts +27 -0
  40. package/s/features/transition/parts/uniforms.ts +29 -0
  41. package/s/features/transition/parts/vertex.ts +31 -0
  42. package/s/features/transition/transition.ts +60 -0
  43. package/s/index.html.ts +103 -20
  44. package/s/index.ts +1 -0
  45. package/s/tests.bundle.ts +11 -0
  46. package/s/tests.html.ts +28 -0
  47. package/s/timeline/index.ts +17 -1
  48. package/s/timeline/parts/animations/make.ts +38 -0
  49. package/s/timeline/parts/animations/presets.ts +138 -0
  50. package/s/timeline/parts/animations/properties.ts +30 -0
  51. package/s/timeline/parts/animations/registry.ts +13 -0
  52. package/s/timeline/parts/animations/types.ts +80 -0
  53. package/s/timeline/parts/basics.ts +1 -1
  54. package/s/timeline/parts/captions.ts +91 -0
  55. package/s/timeline/parts/filmstrip.ts +43 -16
  56. package/s/timeline/parts/filters.ts +453 -0
  57. package/s/timeline/parts/item.ts +124 -11
  58. package/s/timeline/parts/media.ts +43 -1
  59. package/s/timeline/parts/resource-pool.ts +8 -5
  60. package/s/timeline/parts/resource.ts +3 -0
  61. package/s/timeline/parts/transitions.ts +102 -0
  62. package/s/timeline/parts/waveform/parts/collect.ts +72 -0
  63. package/s/timeline/parts/waveform/parts/render.ts +45 -0
  64. package/s/timeline/parts/waveform/parts/types.ts +24 -0
  65. package/s/timeline/parts/waveform/waveform.ts +161 -0
  66. package/s/timeline/renderers/export/parts/audio-gain.ts +17 -0
  67. package/s/timeline/renderers/export/parts/audio-mix.ts +133 -0
  68. package/s/timeline/renderers/export/parts/cursor.ts +291 -0
  69. package/s/timeline/renderers/export/parts/produce-audio.ts +64 -0
  70. package/s/timeline/renderers/export/parts/produce-video.ts +49 -0
  71. package/s/timeline/renderers/export/parts/resamplers.ts +48 -0
  72. package/s/timeline/renderers/export/produce.ts +28 -0
  73. package/s/timeline/renderers/parts/handy.ts +441 -0
  74. package/s/timeline/renderers/parts/samplers/audio/parts/find.ts +19 -0
  75. package/s/timeline/renderers/parts/samplers/audio/parts/init.ts +60 -0
  76. package/s/timeline/renderers/parts/samplers/audio/parts/sink.ts +38 -0
  77. package/s/timeline/renderers/parts/samplers/audio/parts/types.ts +16 -0
  78. package/s/timeline/renderers/parts/samplers/audio/sampler.ts +35 -0
  79. package/s/timeline/renderers/parts/samplers/visual/parts/defaults.ts +23 -0
  80. package/s/timeline/renderers/parts/samplers/visual/parts/image-sink.ts +51 -0
  81. package/s/timeline/renderers/parts/samplers/visual/parts/sample.ts +99 -0
  82. package/s/timeline/renderers/parts/samplers/visual/parts/sequence.ts +97 -0
  83. package/s/timeline/renderers/parts/samplers/visual/parts/transition.ts +28 -0
  84. package/s/timeline/renderers/parts/samplers/visual/parts/types.ts +11 -0
  85. package/s/timeline/renderers/parts/samplers/visual/parts/video-sink.ts +38 -0
  86. package/s/timeline/renderers/parts/samplers/visual/sampler.ts +31 -0
  87. package/s/timeline/renderers/parts/schedulers.ts +96 -0
  88. package/s/timeline/renderers/player/parts/playback.ts +213 -0
  89. package/s/timeline/renderers/player/player.ts +86 -0
  90. package/s/timeline/renderers/renderers.test.ts +403 -0
  91. package/s/timeline/sugar/helpers.ts +239 -0
  92. package/s/timeline/sugar/o.ts +443 -48
  93. package/s/timeline/sugar/omni.test.ts +210 -0
  94. package/s/timeline/sugar/omni.ts +38 -12
  95. package/s/timeline/types.ts +62 -0
  96. package/s/timeline/utils/anim.ts +63 -0
  97. package/s/timeline/utils/checksum.ts +5 -2
  98. package/s/timeline/utils/datafile.ts +15 -4
  99. package/s/timeline/utils/dummy-data.ts +3 -3
  100. package/s/timeline/utils/matrix.ts +54 -0
  101. package/s/timeline/utils/terps.ts +81 -0
  102. package/s/units/fps.ts +8 -0
  103. package/s/units/ms.ts +8 -0
  104. package/s/units/seconds.ts +8 -0
  105. package/x/WebGLRenderer-4CHIZDHY.js +2 -0
  106. package/x/WebGLRenderer-4CHIZDHY.js.map +7 -0
  107. package/x/WebGPURenderer-O6WXU2QR.js +2 -0
  108. package/x/WebGPURenderer-O6WXU2QR.js.map +7 -0
  109. package/x/browserAll-WNIOTNNP.js +2 -0
  110. package/x/browserAll-WNIOTNNP.js.map +7 -0
  111. package/x/chunk-23FOBGX6.js +2 -0
  112. package/x/chunk-23FOBGX6.js.map +7 -0
  113. package/x/chunk-73XOWA4F.js +393 -0
  114. package/x/chunk-73XOWA4F.js.map +7 -0
  115. package/x/chunk-IAWJKNX5.js +42 -0
  116. package/x/chunk-IAWJKNX5.js.map +7 -0
  117. package/x/chunk-KCMVLWBS.js +157 -0
  118. package/x/chunk-KCMVLWBS.js.map +7 -0
  119. package/x/chunk-MR32SQ27.js +2 -0
  120. package/x/chunk-MR32SQ27.js.map +7 -0
  121. package/x/chunk-VCUJJYRJ.js +327 -0
  122. package/x/chunk-VCUJJYRJ.js.map +7 -0
  123. package/x/chunk-XNIZ4L5W.js +269 -0
  124. package/x/chunk-XNIZ4L5W.js.map +7 -0
  125. package/x/chunk-ZLGNQFUI.js +15 -0
  126. package/x/chunk-ZLGNQFUI.js.map +7 -0
  127. package/x/context.d.ts +1 -4
  128. package/x/context.js +1 -5
  129. package/x/context.js.map +1 -1
  130. package/x/demo/WebGLRenderer-RSJAHIG2.js +2 -0
  131. package/x/demo/WebGLRenderer-RSJAHIG2.js.map +7 -0
  132. package/x/demo/WebGPURenderer-MGFAJCYY.js +2 -0
  133. package/x/demo/WebGPURenderer-MGFAJCYY.js.map +7 -0
  134. package/x/demo/browserAll-PTRBXBRP.js +2 -0
  135. package/x/demo/browserAll-PTRBXBRP.js.map +7 -0
  136. package/x/demo/chunk-CUYOGHWU.js +42 -0
  137. package/x/demo/chunk-CUYOGHWU.js.map +7 -0
  138. package/x/demo/chunk-DGTDNJ7W.js +2 -0
  139. package/x/demo/chunk-DGTDNJ7W.js.map +7 -0
  140. package/x/demo/chunk-FZ5BYF63.js +15 -0
  141. package/x/demo/chunk-FZ5BYF63.js.map +7 -0
  142. package/x/demo/chunk-KWN4NNES.js +269 -0
  143. package/x/demo/chunk-KWN4NNES.js.map +7 -0
  144. package/x/demo/chunk-OJ3FPXW7.js +157 -0
  145. package/x/demo/chunk-OJ3FPXW7.js.map +7 -0
  146. package/x/demo/chunk-PSLUOGTZ.js +393 -0
  147. package/x/demo/chunk-PSLUOGTZ.js.map +7 -0
  148. package/x/demo/chunk-VLCVEIFU.js +327 -0
  149. package/x/demo/chunk-VLCVEIFU.js.map +7 -0
  150. package/x/demo/chunk-ZWCPT5FR.js +2 -0
  151. package/x/demo/chunk-ZWCPT5FR.js.map +7 -0
  152. package/x/demo/demo.bundle.js +94 -36
  153. package/x/demo/demo.bundle.js.map +1 -1
  154. package/x/demo/demo.bundle.min.js +7359 -107
  155. package/x/demo/demo.bundle.min.js.map +4 -4
  156. package/x/demo/demo.css +246 -11
  157. package/x/demo/routines/export-test.d.ts +2 -0
  158. package/x/demo/routines/export-test.js +10 -0
  159. package/x/demo/routines/export-test.js.map +1 -0
  160. package/x/demo/routines/filmstrip-test.d.ts +1 -1
  161. package/x/demo/routines/filmstrip-test.js +21 -18
  162. package/x/demo/routines/filmstrip-test.js.map +1 -1
  163. package/x/demo/routines/load-video.d.ts +1 -1
  164. package/x/demo/routines/load-video.js +1 -2
  165. package/x/demo/routines/load-video.js.map +1 -1
  166. package/x/demo/routines/playback-test.d.ts +2 -0
  167. package/x/demo/routines/playback-test.js +51 -0
  168. package/x/demo/routines/playback-test.js.map +1 -0
  169. package/x/demo/routines/timeline-setup.d.ts +6 -0
  170. package/x/demo/routines/timeline-setup.js +59 -0
  171. package/x/demo/routines/timeline-setup.js.map +1 -0
  172. package/x/demo/routines/transcode-test.js +17 -5
  173. package/x/demo/routines/transcode-test.js.map +1 -1
  174. package/x/demo/routines/transcriber-test.d.ts +4 -0
  175. package/x/demo/routines/transcriber-test.js +33 -0
  176. package/x/demo/routines/transcriber-test.js.map +1 -0
  177. package/x/demo/routines/transitions-test.d.ts +5 -0
  178. package/x/demo/routines/transitions-test.js +35 -0
  179. package/x/demo/routines/transitions-test.js.map +1 -0
  180. package/x/demo/routines/waveform-test.d.ts +2 -1
  181. package/x/demo/routines/waveform-test.js +29 -8
  182. package/x/demo/routines/waveform-test.js.map +1 -1
  183. package/x/demo/webworkerAll-JENRT6BT.js +2 -0
  184. package/x/demo/webworkerAll-JENRT6BT.js.map +7 -0
  185. package/x/driver/driver-worker.d.ts +1 -0
  186. package/x/driver/driver-worker.js +6 -0
  187. package/x/driver/driver-worker.js.map +1 -0
  188. package/x/driver/driver.d.ts +24 -9
  189. package/x/driver/driver.js +51 -40
  190. package/x/driver/driver.js.map +1 -1
  191. package/x/driver/driver.test.js +1 -1
  192. package/x/driver/driver.test.js.map +1 -1
  193. package/x/driver/driver.worker.bundle.min.js +137 -1137
  194. package/x/driver/driver.worker.bundle.min.js.map +4 -4
  195. package/x/driver/fns/host.d.ts +12 -4
  196. package/x/driver/fns/host.js +3 -3
  197. package/x/driver/fns/host.js.map +1 -1
  198. package/x/driver/fns/schematic.d.ts +65 -25
  199. package/x/driver/fns/work.d.ts +14 -7
  200. package/x/driver/fns/work.js +83 -174
  201. package/x/driver/fns/work.js.map +1 -1
  202. package/x/driver/parts/compositor.d.ts +39 -0
  203. package/x/driver/parts/compositor.js +264 -0
  204. package/x/driver/parts/compositor.js.map +1 -0
  205. package/x/driver/parts/machina.d.ts +0 -20
  206. package/x/driver/parts/machina.js +6 -10
  207. package/x/driver/parts/machina.js.map +1 -1
  208. package/x/driver/utils/find-pixi-filter.d.ts +5 -0
  209. package/x/driver/utils/find-pixi-filter.js +13 -0
  210. package/x/driver/utils/find-pixi-filter.js.map +1 -0
  211. package/x/driver/utils/load-decoder-source.d.ts +2 -1
  212. package/x/driver/utils/load-decoder-source.js +2 -3
  213. package/x/driver/utils/load-decoder-source.js.map +1 -1
  214. package/x/features/bg-remover/bg-remover.d.ts +5 -0
  215. package/x/features/bg-remover/bg-remover.js +18 -0
  216. package/x/features/bg-remover/bg-remover.js.map +1 -0
  217. package/x/features/bg-remover/default-spec.d.ts +2 -0
  218. package/x/features/bg-remover/default-spec.js +6 -0
  219. package/x/features/bg-remover/default-spec.js.map +1 -0
  220. package/x/features/bg-remover/types.d.ts +20 -0
  221. package/x/features/bg-remover/types.js +2 -0
  222. package/x/features/bg-remover/types.js.map +1 -0
  223. package/x/features/bg-remover/worker.bundle.js +39 -0
  224. package/x/features/bg-remover/worker.bundle.js.map +1 -0
  225. package/x/features/bg-remover/worker.bundle.min.js +2916 -0
  226. package/x/features/bg-remover/worker.bundle.min.js.map +7 -0
  227. package/x/features/parts/expose-errors.d.ts +3 -0
  228. package/x/features/parts/expose-errors.js +32 -0
  229. package/x/features/parts/expose-errors.js.map +1 -0
  230. package/x/features/parts/load-pipe.d.ts +2 -0
  231. package/x/features/parts/load-pipe.js +13 -0
  232. package/x/features/parts/load-pipe.js.map +1 -0
  233. package/x/features/parts/types.d.ts +15 -0
  234. package/x/features/parts/types.js +2 -0
  235. package/x/features/parts/types.js.map +1 -0
  236. package/x/features/speech/transcribe/default-spec.d.ts +2 -0
  237. package/x/features/speech/transcribe/default-spec.js +8 -0
  238. package/x/features/speech/transcribe/default-spec.js.map +1 -0
  239. package/x/features/speech/transcribe/parts/prep-audio.d.ts +5 -0
  240. package/x/features/speech/transcribe/parts/prep-audio.js +21 -0
  241. package/x/features/speech/transcribe/parts/prep-audio.js.map +1 -0
  242. package/x/features/speech/transcribe/parts/transcribe.d.ts +5 -0
  243. package/x/features/speech/transcribe/parts/transcribe.js +56 -0
  244. package/x/features/speech/transcribe/parts/transcribe.js.map +1 -0
  245. package/x/features/speech/transcribe/transcriber.d.ts +5 -0
  246. package/x/features/speech/transcribe/transcriber.js +33 -0
  247. package/x/features/speech/transcribe/transcriber.js.map +1 -0
  248. package/x/features/speech/transcribe/types.d.ts +59 -0
  249. package/x/features/speech/transcribe/types.js +2 -0
  250. package/x/features/speech/transcribe/types.js.map +1 -0
  251. package/x/features/speech/transcribe/worker.bundle.js +35 -0
  252. package/x/features/speech/transcribe/worker.bundle.js.map +1 -0
  253. package/x/features/speech/transcribe/worker.bundle.min.js +2916 -0
  254. package/x/features/speech/transcribe/worker.bundle.min.js.map +7 -0
  255. package/x/features/transition/parts/fragment.d.ts +1 -0
  256. package/x/features/transition/parts/fragment.js +25 -0
  257. package/x/features/transition/parts/fragment.js.map +1 -0
  258. package/x/features/transition/parts/types.d.ts +23 -0
  259. package/x/features/transition/parts/types.js +2 -0
  260. package/x/features/transition/parts/types.js.map +1 -0
  261. package/x/features/transition/parts/uniforms.d.ts +31 -0
  262. package/x/features/transition/parts/uniforms.js +27 -0
  263. package/x/features/transition/parts/uniforms.js.map +1 -0
  264. package/x/features/transition/parts/vertex.d.ts +1 -0
  265. package/x/features/transition/parts/vertex.js +32 -0
  266. package/x/features/transition/parts/vertex.js.map +1 -0
  267. package/x/features/transition/transition.d.ts +5 -0
  268. package/x/features/transition/transition.js +50 -0
  269. package/x/features/transition/transition.js.map +1 -0
  270. package/x/index.d.ts +1 -0
  271. package/x/index.html +349 -30
  272. package/x/index.html.js +103 -19
  273. package/x/index.html.js.map +1 -1
  274. package/x/index.js +1 -0
  275. package/x/index.js.map +1 -1
  276. package/x/tests.bundle.d.ts +1 -0
  277. package/x/tests.bundle.js +8 -0
  278. package/x/tests.bundle.js.map +1 -0
  279. package/x/tests.bundle.min.js +7374 -0
  280. package/x/tests.bundle.min.js.map +7 -0
  281. package/x/tests.html +316 -0
  282. package/x/tests.html.d.ts +2 -0
  283. package/x/tests.html.js +22 -0
  284. package/x/tests.html.js.map +1 -0
  285. package/x/timeline/index.d.ts +16 -0
  286. package/x/timeline/index.js +16 -0
  287. package/x/timeline/index.js.map +1 -1
  288. package/x/timeline/parts/animations/make.d.ts +3 -0
  289. package/x/timeline/parts/animations/make.js +29 -0
  290. package/x/timeline/parts/animations/make.js.map +1 -0
  291. package/x/timeline/parts/animations/presets.d.ts +170 -0
  292. package/x/timeline/parts/animations/presets.js +135 -0
  293. package/x/timeline/parts/animations/presets.js.map +1 -0
  294. package/x/timeline/parts/animations/properties.d.ts +84 -0
  295. package/x/timeline/parts/animations/properties.js +25 -0
  296. package/x/timeline/parts/animations/properties.js.map +1 -0
  297. package/x/timeline/parts/animations/registry.d.ts +218 -0
  298. package/x/timeline/parts/animations/registry.js +11 -0
  299. package/x/timeline/parts/animations/registry.js.map +1 -0
  300. package/x/timeline/parts/animations/types.d.ts +60 -0
  301. package/x/timeline/parts/animations/types.js +2 -0
  302. package/x/timeline/parts/animations/types.js.map +1 -0
  303. package/x/timeline/parts/basics.d.ts +1 -1
  304. package/x/timeline/parts/captions.d.ts +41 -0
  305. package/x/timeline/parts/captions.js +55 -0
  306. package/x/timeline/parts/captions.js.map +1 -0
  307. package/x/timeline/parts/filmstrip.d.ts +4 -3
  308. package/x/timeline/parts/filmstrip.js +29 -10
  309. package/x/timeline/parts/filmstrip.js.map +1 -1
  310. package/x/timeline/parts/filters.d.ts +108 -0
  311. package/x/timeline/parts/filters.js +340 -0
  312. package/x/timeline/parts/filters.js.map +1 -0
  313. package/x/timeline/parts/item.d.ts +106 -12
  314. package/x/timeline/parts/item.js +11 -7
  315. package/x/timeline/parts/item.js.map +1 -1
  316. package/x/timeline/parts/media.d.ts +6 -0
  317. package/x/timeline/parts/media.js +35 -1
  318. package/x/timeline/parts/media.js.map +1 -1
  319. package/x/timeline/parts/resource-pool.d.ts +3 -0
  320. package/x/timeline/parts/resource-pool.js +7 -4
  321. package/x/timeline/parts/resource-pool.js.map +1 -1
  322. package/x/timeline/parts/resource.d.ts +3 -0
  323. package/x/timeline/parts/transitions.d.ts +15 -0
  324. package/x/timeline/parts/transitions.js +81 -0
  325. package/x/timeline/parts/transitions.js.map +1 -0
  326. package/x/timeline/parts/waveform/parts/collect.d.ts +11 -0
  327. package/x/timeline/parts/waveform/parts/collect.js +56 -0
  328. package/x/timeline/parts/waveform/parts/collect.js.map +1 -0
  329. package/x/timeline/parts/waveform/parts/render.d.ts +5 -0
  330. package/x/timeline/parts/waveform/parts/render.js +29 -0
  331. package/x/timeline/parts/waveform/parts/render.js.map +1 -0
  332. package/x/timeline/parts/waveform/parts/types.d.ts +21 -0
  333. package/x/timeline/parts/waveform/parts/types.js +2 -0
  334. package/x/timeline/parts/waveform/parts/types.js.map +1 -0
  335. package/x/timeline/parts/waveform/waveform.d.ts +19 -0
  336. package/x/timeline/parts/waveform/waveform.js +133 -0
  337. package/x/timeline/parts/waveform/waveform.js.map +1 -0
  338. package/x/timeline/renderers/export/parts/audio-gain.d.ts +1 -0
  339. package/x/timeline/renderers/export/parts/audio-gain.js +13 -0
  340. package/x/timeline/renderers/export/parts/audio-gain.js.map +1 -0
  341. package/x/timeline/renderers/export/parts/audio-mix.d.ts +21 -0
  342. package/x/timeline/renderers/export/parts/audio-mix.js +89 -0
  343. package/x/timeline/renderers/export/parts/audio-mix.js.map +1 -0
  344. package/x/timeline/renderers/export/parts/cursor.d.ts +35 -0
  345. package/x/timeline/renderers/export/parts/cursor.js +236 -0
  346. package/x/timeline/renderers/export/parts/cursor.js.map +1 -0
  347. package/x/timeline/renderers/export/parts/produce-audio.d.ts +6 -0
  348. package/x/timeline/renderers/export/parts/produce-audio.js +41 -0
  349. package/x/timeline/renderers/export/parts/produce-audio.js.map +1 -0
  350. package/x/timeline/renderers/export/parts/produce-video.d.ts +10 -0
  351. package/x/timeline/renderers/export/parts/produce-video.js +26 -0
  352. package/x/timeline/renderers/export/parts/produce-video.js.map +1 -0
  353. package/x/timeline/renderers/export/parts/resamplers.d.ts +12 -0
  354. package/x/timeline/renderers/export/parts/resamplers.js +29 -0
  355. package/x/timeline/renderers/export/parts/resamplers.js.map +1 -0
  356. package/x/timeline/renderers/export/produce.d.ts +13 -0
  357. package/x/timeline/renderers/export/produce.js +15 -0
  358. package/x/timeline/renderers/export/produce.js.map +1 -0
  359. package/x/timeline/renderers/parts/handy.d.ts +38 -0
  360. package/x/timeline/renderers/parts/handy.js +263 -0
  361. package/x/timeline/renderers/parts/handy.js.map +1 -0
  362. package/x/timeline/renderers/parts/samplers/audio/parts/find.d.ts +6 -0
  363. package/x/timeline/renderers/parts/samplers/audio/parts/find.js +15 -0
  364. package/x/timeline/renderers/parts/samplers/audio/parts/find.js.map +1 -0
  365. package/x/timeline/renderers/parts/samplers/audio/parts/init.d.ts +5 -0
  366. package/x/timeline/renderers/parts/samplers/audio/parts/init.js +40 -0
  367. package/x/timeline/renderers/parts/samplers/audio/parts/init.js.map +1 -0
  368. package/x/timeline/renderers/parts/samplers/audio/parts/sink.d.ts +8 -0
  369. package/x/timeline/renderers/parts/samplers/audio/parts/sink.js +24 -0
  370. package/x/timeline/renderers/parts/samplers/audio/parts/sink.js.map +1 -0
  371. package/x/timeline/renderers/parts/samplers/audio/parts/types.d.ts +14 -0
  372. package/x/timeline/renderers/parts/samplers/audio/parts/types.js +2 -0
  373. package/x/timeline/renderers/parts/samplers/audio/parts/types.js.map +1 -0
  374. package/x/timeline/renderers/parts/samplers/audio/sampler.d.ts +11 -0
  375. package/x/timeline/renderers/parts/samplers/audio/sampler.js +22 -0
  376. package/x/timeline/renderers/parts/samplers/audio/sampler.js.map +1 -0
  377. package/x/timeline/renderers/parts/samplers/visual/parts/defaults.d.ts +8 -0
  378. package/x/timeline/renderers/parts/samplers/visual/parts/defaults.js +14 -0
  379. package/x/timeline/renderers/parts/samplers/visual/parts/defaults.js.map +1 -0
  380. package/x/timeline/renderers/parts/samplers/visual/parts/image-sink.d.ts +11 -0
  381. package/x/timeline/renderers/parts/samplers/visual/parts/image-sink.js +36 -0
  382. package/x/timeline/renderers/parts/samplers/visual/parts/image-sink.js.map +1 -0
  383. package/x/timeline/renderers/parts/samplers/visual/parts/sample.d.ts +9 -0
  384. package/x/timeline/renderers/parts/samplers/visual/parts/sample.js +70 -0
  385. package/x/timeline/renderers/parts/samplers/visual/parts/sample.js.map +1 -0
  386. package/x/timeline/renderers/parts/samplers/visual/parts/sequence.d.ts +6 -0
  387. package/x/timeline/renderers/parts/samplers/visual/parts/sequence.js +63 -0
  388. package/x/timeline/renderers/parts/samplers/visual/parts/sequence.js.map +1 -0
  389. package/x/timeline/renderers/parts/samplers/visual/parts/transition.d.ts +3 -0
  390. package/x/timeline/renderers/parts/samplers/visual/parts/transition.js +18 -0
  391. package/x/timeline/renderers/parts/samplers/visual/parts/transition.js.map +1 -0
  392. package/x/timeline/renderers/parts/samplers/visual/parts/types.d.ts +9 -0
  393. package/x/timeline/renderers/parts/samplers/visual/parts/types.js +2 -0
  394. package/x/timeline/renderers/parts/samplers/visual/parts/types.js.map +1 -0
  395. package/x/timeline/renderers/parts/samplers/visual/parts/video-sink.d.ts +8 -0
  396. package/x/timeline/renderers/parts/samplers/visual/parts/video-sink.js +24 -0
  397. package/x/timeline/renderers/parts/samplers/visual/parts/video-sink.js.map +1 -0
  398. package/x/timeline/renderers/parts/samplers/visual/sampler.d.ts +7 -0
  399. package/x/timeline/renderers/parts/samplers/visual/sampler.js +20 -0
  400. package/x/timeline/renderers/parts/samplers/visual/sampler.js.map +1 -0
  401. package/x/timeline/renderers/parts/schedulers.d.ts +17 -0
  402. package/x/timeline/renderers/parts/schedulers.js +64 -0
  403. package/x/timeline/renderers/parts/schedulers.js.map +1 -0
  404. package/x/timeline/renderers/player/parts/playback.d.ts +39 -0
  405. package/x/timeline/renderers/player/parts/playback.js +160 -0
  406. package/x/timeline/renderers/player/parts/playback.js.map +1 -0
  407. package/x/timeline/renderers/player/player.d.ts +27 -0
  408. package/x/timeline/renderers/player/player.js +64 -0
  409. package/x/timeline/renderers/player/player.js.map +1 -0
  410. package/x/timeline/renderers/renderers.test.d.ts +33 -0
  411. package/x/timeline/renderers/renderers.test.js +321 -0
  412. package/x/timeline/renderers/renderers.test.js.map +1 -0
  413. package/x/timeline/sugar/helpers.d.ts +72 -0
  414. package/x/timeline/sugar/helpers.js +122 -0
  415. package/x/timeline/sugar/helpers.js.map +1 -0
  416. package/x/timeline/sugar/o.d.ts +59 -8
  417. package/x/timeline/sugar/o.js +326 -40
  418. package/x/timeline/sugar/o.js.map +1 -1
  419. package/x/timeline/sugar/omni.d.ts +11 -2
  420. package/x/timeline/sugar/omni.js +30 -9
  421. package/x/timeline/sugar/omni.js.map +1 -1
  422. package/x/timeline/sugar/omni.test.d.ts +27 -0
  423. package/x/timeline/sugar/omni.test.js +128 -0
  424. package/x/timeline/sugar/omni.test.js.map +1 -0
  425. package/x/timeline/types.d.ts +37 -0
  426. package/x/timeline/types.js +2 -0
  427. package/x/timeline/types.js.map +1 -0
  428. package/x/timeline/utils/anim.d.ts +3 -0
  429. package/x/timeline/utils/anim.js +40 -0
  430. package/x/timeline/utils/anim.js.map +1 -0
  431. package/x/timeline/utils/checksum.d.ts +3 -2
  432. package/x/timeline/utils/checksum.js +2 -1
  433. package/x/timeline/utils/checksum.js.map +1 -1
  434. package/x/timeline/utils/datafile.d.ts +5 -3
  435. package/x/timeline/utils/datafile.js +18 -5
  436. package/x/timeline/utils/datafile.js.map +1 -1
  437. package/x/timeline/utils/dummy-data.d.ts +1 -2
  438. package/x/timeline/utils/dummy-data.js +4 -2
  439. package/x/timeline/utils/dummy-data.js.map +1 -1
  440. package/x/timeline/utils/matrix.d.ts +17 -0
  441. package/x/timeline/utils/matrix.js +36 -0
  442. package/x/timeline/utils/matrix.js.map +1 -0
  443. package/x/timeline/utils/terps.d.ts +11 -0
  444. package/x/timeline/utils/terps.js +57 -0
  445. package/x/timeline/utils/terps.js.map +1 -0
  446. package/x/units/fps.d.ts +6 -0
  447. package/x/units/fps.js +2 -0
  448. package/x/units/fps.js.map +1 -0
  449. package/x/units/ms.d.ts +6 -0
  450. package/x/units/ms.js +2 -0
  451. package/x/units/ms.js.map +1 -0
  452. package/x/units/seconds.d.ts +6 -0
  453. package/x/units/seconds.js +2 -0
  454. package/x/units/seconds.js.map +1 -0
  455. package/x/webworkerAll-RLCTMSDD.js +2 -0
  456. package/x/webworkerAll-RLCTMSDD.js.map +7 -0
  457. package/s/tests.test.ts +0 -8
  458. package/s/timeline/parts/waveform.ts +0 -62
  459. package/s/timeline/sugar/omni-test.ts +0 -38
  460. package/x/tests.test.js +0 -6
  461. package/x/tests.test.js.map +0 -1
  462. package/x/timeline/parts/waveform.d.ts +0 -8
  463. package/x/timeline/parts/waveform.js +0 -51
  464. package/x/timeline/parts/waveform.js.map +0 -1
  465. package/x/timeline/sugar/omni-test.js +0 -22
  466. package/x/timeline/sugar/omni-test.js.map +0 -1
  467. /package/x/{tests.test.d.ts → features/bg-remover/worker.bundle.d.ts} +0 -0
  468. /package/x/{timeline/sugar/omni-test.d.ts → features/speech/transcribe/worker.bundle.d.ts} +0 -0
@@ -0,0 +1,24 @@
1
+ import {
2
+ AlphaFilter,
3
+ BlurFilter,
4
+ ColorMatrixFilter,
5
+ NoiseFilter,
6
+ Filter,
7
+ } from "pixi.js"
8
+ import * as PixiFilters from "pixi-filters"
9
+
10
+ import type {FilterType} from "../../timeline/parts/filters.js"
11
+
12
+ type FilterConstructor = new (options?: any) => Filter
13
+
14
+ const pixiFilters: Partial<Record<FilterType, FilterConstructor>> = {
15
+ AlphaFilter,
16
+ BlurFilter,
17
+ ColorMatrixFilter,
18
+ NoiseFilter,
19
+ ...PixiFilters
20
+ }
21
+
22
+ export function findPixiFilter(type: FilterType) {
23
+ return pixiFilters[type]
24
+ }
@@ -2,10 +2,9 @@ import {BlobSource, UrlSource} from "mediabunny"
2
2
  import {DecoderSource} from "../fns/schematic.js"
3
3
 
4
4
  // only streamable sources
5
- export async function loadDecoderSource(source: DecoderSource) {
6
- if(source instanceof FileSystemFileHandle) {
7
- const file = await source.getFile()
8
- return new BlobSource(file)
5
+ export async function loadDecoderSource(source: DecoderSource): Promise<UrlSource | BlobSource> {
6
+ if(source instanceof Blob) {
7
+ return new BlobSource(source)
9
8
  } else {
10
9
  return new UrlSource(source)
11
10
  }
@@ -0,0 +1,26 @@
1
+ import {queue} from "@e280/stz"
2
+ import {Comrade, LoggerTap, tune} from "@e280/comrade"
3
+
4
+ import {BgRemoverOptions, BgRemoverSchematic, RemoverOptions} from "./types.js"
5
+
6
+
7
+ export async function makeBgRemover({spec, workerUrl, onLoading}: BgRemoverOptions) {
8
+ const thread = await Comrade.thread<BgRemoverSchematic>({
9
+ label: "OmnitoolBgRemover",
10
+ workerUrl,
11
+ tap: new LoggerTap(),
12
+ setupHost: () => ({
13
+ loading: async loading => onLoading(loading),
14
+ }),
15
+ })
16
+
17
+ await thread.work.prepare(spec)
18
+
19
+ return {
20
+ remove: queue(async(input: RemoverOptions) =>
21
+ await thread.work.remove[tune]({transfer: [input.frame]})(input.frame)
22
+ ),
23
+ dispose: () => thread.terminate()
24
+ }
25
+ }
26
+
@@ -0,0 +1,11 @@
1
+
2
+ import {PipelineSpec} from "../parts/types.js"
3
+
4
+
5
+ export const defaultBgRemoverSpec = (): PipelineSpec => ({
6
+ model: "Xenova/modnet",
7
+ dtype: "auto",
8
+ device: "webgpu"
9
+ })
10
+
11
+
@@ -0,0 +1,27 @@
1
+
2
+ import {AsSchematic} from "@e280/comrade"
3
+ import {Loading, PipelineSpec} from "../parts/types.js"
4
+
5
+ export type BgRemoverSchematic = AsSchematic<{
6
+ work: {
7
+ prepare(spec: PipelineSpec): Promise<void>
8
+ remove(request: VideoFrame): Promise<VideoFrame>
9
+ },
10
+
11
+ host: {
12
+ loading(load: Loading): Promise<void>
13
+ }
14
+ }>
15
+
16
+ export type RemoverOptions = {
17
+ frame: VideoFrame
18
+ }
19
+
20
+ export type BgRemoverModels = "onnx-community/ISNet-ONNX" | "Xenova/modnet" | "briaai/RMBG-1.4"
21
+
22
+ export type BgRemoverOptions = {
23
+ spec: PipelineSpec
24
+ workerUrl: URL | string
25
+ onLoading: (loading: Loading) => void
26
+ }
27
+
@@ -0,0 +1,52 @@
1
+
2
+ import {defer, once} from "@e280/stz"
3
+ import {Comrade, Host} from "@e280/comrade"
4
+ import {BackgroundRemovalPipeline} from "@huggingface/transformers"
5
+
6
+ import {PipelineSpec} from "../parts/types.js"
7
+ import {BgRemoverSchematic} from "./types.js"
8
+ import {loadPipe} from "../parts/load-pipe.js"
9
+ import {exposeErrors} from "../parts/expose-errors.js"
10
+
11
+ const deferred = defer<{spec: PipelineSpec, pipe: BackgroundRemovalPipeline}>()
12
+ const makePrepare = (host: Host<BgRemoverSchematic>) => once(async(spec: PipelineSpec) => {
13
+ deferred.resolve({
14
+ spec,
15
+ pipe: await loadPipe({
16
+ spec,
17
+ task: "background-removal",
18
+ onLoading: loading => host.loading(loading),
19
+ }) as BackgroundRemovalPipeline
20
+ })
21
+ })
22
+
23
+ const canvas = new OffscreenCanvas(1920, 1080)
24
+ const ctx = canvas.getContext("2d")
25
+
26
+ await Comrade.worker<BgRemoverSchematic>(shell => {
27
+ const prepare = makePrepare(shell.host)
28
+ return {
29
+ prepare: exposeErrors(prepare),
30
+ remove: exposeErrors(async(request) => {
31
+ const {pipe} = await deferred.promise
32
+
33
+ canvas.width = request.displayWidth
34
+ canvas.height = request.displayHeight
35
+ ctx?.drawImage(request, 0, 0)
36
+
37
+ const output = await pipe(canvas)
38
+ const mask = output[0]
39
+
40
+ const frame = new VideoFrame(mask.toCanvas(), {
41
+ timestamp: request.timestamp,
42
+ duration: request.duration ?? undefined,
43
+ })
44
+
45
+ request.close()
46
+ shell.transfer = [frame]
47
+ return frame
48
+ })
49
+ }
50
+ })
51
+
52
+
@@ -0,0 +1,41 @@
1
+ import {ExposedError} from "@e280/renraku"
2
+
3
+ export function exposeError(error: unknown) {
4
+ if (error instanceof ExposedError)
5
+ return error
6
+
7
+ const exposed = new ExposedError(errorToString(error))
8
+
9
+ if (error instanceof Error)
10
+ exposed.stack = error.stack
11
+
12
+ return exposed
13
+ }
14
+
15
+ export function exposeErrors<Args extends unknown[], Result>(
16
+ fn: (...args: Args) => Result | Promise<Result>
17
+ ) {
18
+ return async(...args: Args) => {
19
+ try {
20
+ return await fn(...args)
21
+ }
22
+ catch (error) {
23
+ throw exposeError(error)
24
+ }
25
+ }
26
+ }
27
+
28
+ function errorToString(error: unknown) {
29
+ if (error instanceof Error)
30
+ return error.message
31
+
32
+ if (typeof error === "string")
33
+ return error
34
+
35
+ try {
36
+ return JSON.stringify(error) ?? String(error)
37
+ }
38
+ catch {
39
+ return String(error)
40
+ }
41
+ }
@@ -0,0 +1,17 @@
1
+
2
+ import {pipeline} from "@huggingface/transformers"
3
+ import {PipeOptions} from "./types.js"
4
+
5
+ export async function loadPipe(options: PipeOptions) {
6
+ const {spec, onLoading} = options
7
+
8
+ const pipe = await pipeline(options.task, spec.model, {
9
+ device: spec.device,
10
+ dtype: spec.dtype,
11
+ progress_callback: (data: any) => {
12
+ onLoading({total: data.total, progress: data.progress})
13
+ },
14
+ })
15
+
16
+ return pipe
17
+ }
@@ -0,0 +1,19 @@
1
+
2
+ import {DataType, DeviceType, TaskType} from "@huggingface/transformers"
3
+
4
+ export type Loading = {
5
+ total: number
6
+ progress: number
7
+ }
8
+
9
+ export type PipelineSpec<Extras extends object = {}> = {
10
+ model: string
11
+ dtype: DataType
12
+ device: DeviceType
13
+ } & Extras
14
+
15
+ export type PipeOptions = {
16
+ spec: PipelineSpec
17
+ task: TaskType
18
+ onLoading: (loading: Loading) => void
19
+ }
@@ -0,0 +1,11 @@
1
+
2
+ import {TranscriberSpec} from "./types.js"
3
+
4
+ export const defaultTranscriberSpec = (): TranscriberSpec => ({
5
+ model: "onnx-community/whisper-tiny_timestamped",
6
+ dtype: "auto",
7
+ device: "webgpu",
8
+ chunkLength: 20,
9
+ strideLength: 3,
10
+ })
11
+
@@ -0,0 +1,23 @@
1
+
2
+ import {Driver} from "../../../../driver/driver.js"
3
+
4
+ export async function prepAudio(driver: Driver, source: Blob) {
5
+ const arrayBuffer = await source.arrayBuffer()
6
+ const audioCTX = new AudioContext({sampleRate: 16000})
7
+ const audioData = await audioCTX.decodeAudioData(arrayBuffer)
8
+ let audio: Float32Array
9
+ if (audioData.numberOfChannels === 2) {
10
+ const SCALING_FACTOR = Math.sqrt(2)
11
+ const left = audioData.getChannelData(0)
12
+ const right = audioData.getChannelData(1)
13
+ audio = new Float32Array(left.length)
14
+ for (let i = 0; i < audioData.length; ++i) {
15
+ audio[i] = (SCALING_FACTOR * (left[i] + right[i])) / 2
16
+ }
17
+ } else {
18
+ audio = audioData.getChannelData(0)
19
+ }
20
+ const duration = await driver.getAudioDuration(source)
21
+ return {audio, duration}
22
+ }
23
+
@@ -0,0 +1,70 @@
1
+
2
+ import {WhisperTextStreamer} from "@huggingface/transformers"
3
+ import {TranscribeOptions} from "../types.js"
4
+
5
+ export async function transcribe(options: TranscribeOptions) {
6
+ const {pipe, spec, request, callbacks} = options
7
+
8
+ if (!pipe.processor.feature_extractor)
9
+ throw new Error("no feature_extractor")
10
+
11
+ const timePrecision = (
12
+ pipe.processor.feature_extractor?.config.chunk_length /
13
+ // @ts-ignore
14
+ pipe.model.config.max_source_positions
15
+ )
16
+
17
+ let chunkCount = 0
18
+ let startTime: number | null = null
19
+ let tokenCount = 0
20
+ let tokensPerSecond = 0
21
+
22
+ const chunkDuration = spec.chunkLength - spec.strideLength
23
+
24
+ const calculateProgress = () => {
25
+ const audioProgressSeconds = chunkCount * chunkDuration
26
+ return Math.min(audioProgressSeconds / request.duration, 1)
27
+ }
28
+
29
+ // TODO type error on pipe.tokenizer
30
+ const tokenizer = pipe.tokenizer as any
31
+
32
+ const streamer = new WhisperTextStreamer(tokenizer, {
33
+ time_precision: timePrecision,
34
+ token_callback_function: () => {
35
+ startTime ??= performance.now()
36
+ if (++tokenCount > 1) {
37
+ tokensPerSecond = (tokenCount / (performance.now() - startTime)) * 1000
38
+ }
39
+ },
40
+ callback_function: (textChunk: any) => {
41
+ // TODO
42
+ callbacks.onTranscription(textChunk)
43
+ callbacks.onReport({tokensPerSecond, progress: calculateProgress()})
44
+ },
45
+ on_finalize: () => {
46
+ startTime = null
47
+ tokenCount = 0
48
+ chunkCount++
49
+ callbacks.onReport({tokensPerSecond, progress: calculateProgress()})
50
+ },
51
+ })
52
+
53
+ const result = await pipe(new Float32Array(request.audio), {
54
+ top_k: 0,
55
+ do_sample: false,
56
+ chunk_length_s: spec.chunkLength,
57
+ stride_length_s: spec.strideLength,
58
+ language: request.language,
59
+ task: "transcribe",
60
+ return_timestamps: "word", // if using "word" the on_chunk_start & end is not called thus we cant retrieve timestamps, only after whole thing finishes
61
+ force_full_sequences: false,
62
+ streamer,
63
+ })
64
+
65
+ return {
66
+ text: result.text,
67
+ chunks: result.chunks
68
+ }
69
+ }
70
+
@@ -0,0 +1,46 @@
1
+
2
+ import {Comrade} from "@e280/comrade"
3
+ import {coalesce, queue, sub} from "@e280/stz"
4
+
5
+ import {prepAudio} from "./parts/prep-audio.js"
6
+ import {TranscriberOptions, TranscriberSchematic, TranscriptionOptions, TranscriptionReport} from "./types.js"
7
+
8
+ export async function makeTranscriber({driver, spec, workerUrl, onLoading}: TranscriberOptions) {
9
+ const onReport = sub<[report: TranscriptionReport]>()
10
+ const onTranscription = sub<[transcription: string]>()
11
+
12
+ const thread = await Comrade.thread<TranscriberSchematic>({
13
+ label: "OmnitoolSpeechTranscriber",
14
+ workerUrl,
15
+ setupHost: () => ({
16
+ loading: async loading => onLoading(loading),
17
+ deliverReport: async report => onReport.pub(report),
18
+ deliverTranscription: async transcription => onTranscription.pub(transcription),
19
+ }),
20
+ })
21
+
22
+ await thread.work.prepare(spec)
23
+
24
+ return {
25
+ transcribe: queue(async(info: TranscriptionOptions) => {
26
+ const {source, language} = info
27
+ const {audio, duration} = await prepAudio(driver, source)
28
+
29
+ const detachCallbacks = coalesce(
30
+ onReport(info.onReport),
31
+ onTranscription(info.onTranscription),
32
+ )
33
+
34
+ const result = await thread.work.transcribe({
35
+ duration,
36
+ language,
37
+ audio: audio.buffer,
38
+ })
39
+
40
+ detachCallbacks()
41
+ return result
42
+ }),
43
+ dispose: () => thread.terminate()
44
+ }
45
+ }
46
+
@@ -0,0 +1,76 @@
1
+
2
+ import {AsSchematic} from "@e280/comrade"
3
+ import {Pipeline} from "@huggingface/transformers"
4
+
5
+ import {Loading, PipelineSpec} from "../../parts/types.js"
6
+ import {Driver} from "../../../driver/driver.js"
7
+
8
+ export type TranscriberSchematic = AsSchematic<{
9
+ work: {
10
+ prepare(spec: TranscriberSpec): Promise<void>
11
+ transcribe(request: TranscriptionRequest): Promise<Transcription>
12
+ },
13
+
14
+ host: {
15
+ loading(load: Loading): Promise<void>
16
+ deliverReport(report: TranscriptionReport): Promise<void>
17
+ deliverTranscription(transcription: string): Promise<void>
18
+ }
19
+ }>
20
+
21
+ export type TranscribeOptions = {
22
+ pipe: Pipeline
23
+ spec: TranscriberSpec
24
+ request: TranscriptionRequest
25
+ callbacks: TranscriptionCallbacks
26
+ }
27
+
28
+ export type SpeechTime = [start: number, end: number]
29
+
30
+ export type TranscriptWord = {
31
+ text: string
32
+ timestamp: SpeechTime
33
+ }
34
+
35
+ export type TranscriptSegment = TranscriptWord
36
+
37
+ export type Transcription = {
38
+ text: string
39
+ chunks: TranscriptWord[]
40
+ }
41
+
42
+ export type TranscriberModels = "onnx-community/whisper-tiny_timestamped"
43
+
44
+ export type TranscriberSpec = PipelineSpec<{
45
+ chunkLength: number
46
+ strideLength: number
47
+ }>
48
+
49
+ export type TranscriptionOptions = {
50
+ source: Blob
51
+ language: string | null
52
+ } & TranscriptionCallbacks
53
+
54
+ export type TranscriptionRequest = {
55
+ audio: ArrayBufferLike
56
+ language: string | null
57
+ duration: number
58
+ }
59
+
60
+ export type TranscriptionReport = {
61
+ progress: number
62
+ tokensPerSecond: number
63
+ }
64
+
65
+ export type TranscriptionCallbacks = {
66
+ onReport: (report: TranscriptionReport) => void
67
+ onTranscription: (transcription: string) => void
68
+ }
69
+
70
+ export type TranscriberOptions = {
71
+ driver: Driver
72
+ spec: TranscriberSpec
73
+ workerUrl: URL | string
74
+ onLoading: (loading: Loading) => void
75
+ }
76
+
@@ -0,0 +1,42 @@
1
+
2
+ import {defer, once} from "@e280/stz"
3
+ import {Comrade, Host} from "@e280/comrade"
4
+ import {AutomaticSpeechRecognitionPipeline, Pipeline} from "@huggingface/transformers"
5
+
6
+ import {loadPipe} from "../../parts/load-pipe.js"
7
+ import {transcribe} from "./parts/transcribe.js"
8
+ import {exposeErrors} from "../../parts/expose-errors.js"
9
+ import {TranscriberSchematic, TranscriberSpec} from "./types.js"
10
+
11
+ const deferred = defer<{pipe: Pipeline, spec: TranscriberSpec}>()
12
+
13
+ const makePrepare = (host: Host<TranscriberSchematic>) => once(async(spec: TranscriberSpec) => {
14
+ deferred.resolve({
15
+ spec,
16
+ pipe: await loadPipe({
17
+ spec,
18
+ task: "automatic-speech-recognition",
19
+ onLoading: loading => host.loading(loading),
20
+ }) as AutomaticSpeechRecognitionPipeline
21
+ })
22
+ })
23
+
24
+ await Comrade.worker<TranscriberSchematic>(shell => {
25
+ const prepare = makePrepare(shell.host)
26
+ return {
27
+ prepare: exposeErrors(prepare),
28
+ transcribe: exposeErrors(async(request) => {
29
+ const {pipe, spec} = await deferred.promise
30
+ return transcribe({
31
+ pipe,
32
+ spec,
33
+ request,
34
+ callbacks: {
35
+ onReport: report => shell.host.deliverReport(report),
36
+ onTranscription: transcription => shell.host.deliverTranscription(transcription),
37
+ },
38
+ })
39
+ })
40
+ }
41
+ })
42
+
@@ -0,0 +1,24 @@
1
+ export const fragment = (glsl: string) => `
2
+ precision highp float;
3
+ varying vec2 vTextureCoord;
4
+ varying vec2 _uv;
5
+ uniform sampler2D from, to;
6
+ uniform float progress, ratio, _fromR, _toR;
7
+ uniform float customUniform;
8
+
9
+ vec4 getFromColor(vec2 uv){
10
+ return texture2D(from, .5+(uv-.5)*vec2(max(ratio/_fromR,1.), max(_fromR/ratio,1.)));
11
+ }
12
+ vec4 getToColor(vec2 uv){
13
+ return texture2D(to, .5+(uv-.5)*vec2(max(ratio/_toR,1.), max(_toR/ratio,1.)));
14
+ }
15
+
16
+ // gl-transition code here
17
+ ${glsl}
18
+ // gl-transition code end
19
+
20
+ void main(){
21
+ vec2 uv = vTextureCoord.xy;
22
+ gl_FragColor = transition(vTextureCoord);
23
+ }
24
+ `
@@ -0,0 +1,27 @@
1
+ import {Renderer} from "pixi.js"
2
+ import {TransitionName} from "../../../timeline/parts/transitions.js"
3
+
4
+ export interface TransitionOptions {
5
+ name: TransitionName
6
+ renderer: Renderer
7
+ }
8
+
9
+ export interface TransitionRendererOptions {
10
+ from: VideoFrame
11
+ to: VideoFrame
12
+ progress: number
13
+ width: number
14
+ height: number
15
+ }
16
+
17
+ export interface GLTransition {
18
+ author: string
19
+ createdAt: string
20
+ glsl: string
21
+ license: string
22
+ name: TransitionName
23
+ updatedAt: string
24
+ defaultParams: any
25
+ paramsTypes: any
26
+ }
27
+
@@ -0,0 +1,29 @@
1
+ import {GLTransition} from "./types.js"
2
+
3
+ export const uniforms = {
4
+ custom: (transition: GLTransition) => Object.fromEntries(
5
+ Object.entries(transition.defaultParams).map(([name, value]) => [
6
+ name,
7
+ {
8
+ value,
9
+ type: getUniformType(transition.paramsTypes[name])
10
+ }
11
+ ])
12
+ ),
13
+ basics: {
14
+ _fromR: {value: 1, type: "f32"},
15
+ _toR: {value: 1, type: "f32"},
16
+ ratio: {value: 1, type: "f32"},
17
+ progress: {value: 0, type: "f32"},
18
+ customUniform: {value: 0, type: "f32"},
19
+ }
20
+ }
21
+
22
+ const getUniformType = (type: string) => {
23
+ if(type === "f32" || type === "i32") {
24
+ return type
25
+ } else if(type === "float") {
26
+ return "f32"
27
+ }
28
+ else return `${type}<f32>`
29
+ }
@@ -0,0 +1,31 @@
1
+ export const vertex = `
2
+ in vec2 aPosition;
3
+ varying vec2 _uv; // gl-transition
4
+ uniform mat3 projectionMatrix;
5
+ uniform vec4 uInputSize;
6
+ uniform vec4 uOutputFrame;
7
+ out vec2 vTextureCoord;
8
+ uniform vec4 uOutputTexture;
9
+
10
+ vec4 filterVertexPosition( void )
11
+ {
12
+ vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
13
+
14
+ position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
15
+ position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
16
+
17
+ return vec4(position, 0.0, 1.0);
18
+ }
19
+
20
+ vec2 filterTextureCoord( void )
21
+ {
22
+ return aPosition * (uOutputFrame.zw * uInputSize.zw);
23
+ }
24
+
25
+ void main(void)
26
+ {
27
+ gl_Position = filterVertexPosition();
28
+ vTextureCoord = filterTextureCoord();
29
+ _uv = vec2(0.5, 0.5) * (aPosition +vec2(1.0, 1.0)); // gl-transition
30
+ }
31
+ `
@@ -0,0 +1,60 @@
1
+ //@ts-ignore
2
+ import transitions from "gl-transitions"
3
+ import {Filter, GlProgram, Sprite, Texture, ImageSource} from "pixi.js"
4
+
5
+ import {vertex} from "./parts/vertex.js"
6
+ import {uniforms} from "./parts/uniforms.js"
7
+ import {fragment} from "./parts/fragment.js"
8
+ import {GLTransition, TransitionOptions, TransitionRendererOptions} from "./parts/types.js"
9
+
10
+ export function makeTransition({name, renderer}: TransitionOptions) {
11
+ const transition = transitions.find((t: GLTransition) => t.name === name) as GLTransition
12
+ const transitionSprite = new Sprite()
13
+ const transitionTexture = new Texture()
14
+ const sourceFrom = new ImageSource({})
15
+ const sourceTo = new ImageSource({})
16
+
17
+ const filter = new Filter({
18
+ glProgram: new GlProgram({
19
+ vertex,
20
+ fragment: fragment(transition.glsl),
21
+ }),
22
+ resources: {
23
+ from: sourceFrom,
24
+ to: sourceTo,
25
+ uniforms: {
26
+ ...uniforms.basics,
27
+ ...uniforms.custom(transition)
28
+ }
29
+ }
30
+ })
31
+
32
+ transitionSprite.filters = [filter]
33
+
34
+ return {
35
+ render({width, height, from, to, progress}: TransitionRendererOptions) {
36
+ if(transitionSprite.width !== width || transitionSprite.height !== height) {
37
+ transitionSprite.setSize({width, height})
38
+ transitionTexture.source.resize(width, height)
39
+ }
40
+
41
+ sourceFrom.resource = from
42
+ sourceTo.resource = to
43
+ sourceFrom.update()
44
+ sourceTo.update()
45
+
46
+ filter.resources.uniforms.uniforms.progress = progress
47
+
48
+ renderer.render({
49
+ container: transitionSprite,
50
+ target: transitionTexture,
51
+ clear: false,
52
+ width,
53
+ height
54
+ })
55
+
56
+ return transitionTexture
57
+ }
58
+ }
59
+ }
60
+