@nodetool-ai/timeline 0.8.18 → 0.8.20

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 (383) hide show
  1. package/dist/.nodetool-build-stamp +1 -1
  2. package/dist/animation/custom.d.ts.map +1 -1
  3. package/dist/animation/custom.js +35 -0
  4. package/dist/animation/custom.js.map +1 -1
  5. package/dist/animation/sample.d.ts +14 -0
  6. package/dist/animation/sample.d.ts.map +1 -1
  7. package/dist/animation/sample.js +22 -1
  8. package/dist/animation/sample.js.map +1 -1
  9. package/dist/animation/types.d.ts +8 -1
  10. package/dist/animation/types.d.ts.map +1 -1
  11. package/dist/animation/types.js +31 -3
  12. package/dist/animation/types.js.map +1 -1
  13. package/dist/authoredStyles.d.ts +7 -1
  14. package/dist/authoredStyles.d.ts.map +1 -1
  15. package/dist/authoredStyles.js +6 -1
  16. package/dist/authoredStyles.js.map +1 -1
  17. package/dist/autoCrossfade.d.ts +30 -0
  18. package/dist/autoCrossfade.d.ts.map +1 -0
  19. package/dist/autoCrossfade.js +130 -0
  20. package/dist/autoCrossfade.js.map +1 -0
  21. package/dist/automation.d.ts +32 -1
  22. package/dist/automation.d.ts.map +1 -1
  23. package/dist/automation.js +78 -1
  24. package/dist/automation.js.map +1 -1
  25. package/dist/automationRanges.d.ts +375 -0
  26. package/dist/automationRanges.d.ts.map +1 -0
  27. package/dist/automationRanges.js +375 -0
  28. package/dist/automationRanges.js.map +1 -0
  29. package/dist/clipAudio.d.ts +3 -1
  30. package/dist/clipAudio.d.ts.map +1 -1
  31. package/dist/clipAudio.js.map +1 -1
  32. package/dist/clipLoop.d.ts +67 -0
  33. package/dist/clipLoop.d.ts.map +1 -0
  34. package/dist/clipLoop.js +339 -0
  35. package/dist/clipLoop.js.map +1 -0
  36. package/dist/clipSpeed.d.ts.map +1 -1
  37. package/dist/clipSpeed.js +7 -0
  38. package/dist/clipSpeed.js.map +1 -1
  39. package/dist/defaults.d.ts.map +1 -1
  40. package/dist/defaults.js +9 -0
  41. package/dist/defaults.js.map +1 -1
  42. package/dist/dropResolve.d.ts.map +1 -1
  43. package/dist/dropResolve.js +56 -17
  44. package/dist/dropResolve.js.map +1 -1
  45. package/dist/finish-storyboard.d.ts.map +1 -1
  46. package/dist/finish-storyboard.js +6 -1
  47. package/dist/finish-storyboard.js.map +1 -1
  48. package/dist/harmony/chordChart.d.ts +25 -0
  49. package/dist/harmony/chordChart.d.ts.map +1 -0
  50. package/dist/harmony/chordChart.js +99 -0
  51. package/dist/harmony/chordChart.js.map +1 -0
  52. package/dist/harmony/chordRange.d.ts +9 -0
  53. package/dist/harmony/chordRange.d.ts.map +1 -0
  54. package/dist/harmony/chordRange.js +32 -0
  55. package/dist/harmony/chordRange.js.map +1 -0
  56. package/dist/harmony/chordSymbols.d.ts +28 -0
  57. package/dist/harmony/chordSymbols.d.ts.map +1 -0
  58. package/dist/harmony/chordSymbols.js +147 -0
  59. package/dist/harmony/chordSymbols.js.map +1 -0
  60. package/dist/harmony/chordTrack.d.ts +13 -0
  61. package/dist/harmony/chordTrack.d.ts.map +1 -0
  62. package/dist/harmony/chordTrack.js +11 -0
  63. package/dist/harmony/chordTrack.js.map +1 -0
  64. package/dist/harmony/detect.d.ts +35 -0
  65. package/dist/harmony/detect.d.ts.map +1 -0
  66. package/dist/harmony/detect.js +138 -0
  67. package/dist/harmony/detect.js.map +1 -0
  68. package/dist/harmony/detectAudio.d.ts +62 -0
  69. package/dist/harmony/detectAudio.d.ts.map +1 -0
  70. package/dist/harmony/detectAudio.js +226 -0
  71. package/dist/harmony/detectAudio.js.map +1 -0
  72. package/dist/harmony/expand.d.ts +7 -12
  73. package/dist/harmony/expand.d.ts.map +1 -1
  74. package/dist/harmony/expand.js +63 -11
  75. package/dist/harmony/expand.js.map +1 -1
  76. package/dist/harmony/index.d.ts +7 -0
  77. package/dist/harmony/index.d.ts.map +1 -1
  78. package/dist/harmony/index.js +7 -0
  79. package/dist/harmony/index.js.map +1 -1
  80. package/dist/harmony/progressionLibrary.d.ts +33 -0
  81. package/dist/harmony/progressionLibrary.d.ts.map +1 -0
  82. package/dist/harmony/progressionLibrary.js +71 -0
  83. package/dist/harmony/progressionLibrary.js.map +1 -0
  84. package/dist/harmony/summary.d.ts +4 -0
  85. package/dist/harmony/summary.d.ts.map +1 -0
  86. package/dist/harmony/summary.js +22 -0
  87. package/dist/harmony/summary.js.map +1 -0
  88. package/dist/index.d.ts +8 -0
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +8 -0
  91. package/dist/index.js.map +1 -1
  92. package/dist/interchange.d.ts.map +1 -1
  93. package/dist/interchange.js +3 -0
  94. package/dist/interchange.js.map +1 -1
  95. package/dist/keyframes.d.ts +12 -2
  96. package/dist/keyframes.d.ts.map +1 -1
  97. package/dist/keyframes.js +24 -1
  98. package/dist/keyframes.js.map +1 -1
  99. package/dist/loopWindow.d.ts +17 -0
  100. package/dist/loopWindow.d.ts.map +1 -0
  101. package/dist/loopWindow.js +34 -0
  102. package/dist/loopWindow.js.map +1 -0
  103. package/dist/midi/cacheKey.d.ts +11 -2
  104. package/dist/midi/cacheKey.d.ts.map +1 -1
  105. package/dist/midi/cacheKey.js +69 -9
  106. package/dist/midi/cacheKey.js.map +1 -1
  107. package/dist/midi/controllerEdit.d.ts +35 -0
  108. package/dist/midi/controllerEdit.d.ts.map +1 -0
  109. package/dist/midi/controllerEdit.js +94 -0
  110. package/dist/midi/controllerEdit.js.map +1 -0
  111. package/dist/midi/controllerRange.d.ts +13 -0
  112. package/dist/midi/controllerRange.d.ts.map +1 -0
  113. package/dist/midi/controllerRange.js +13 -0
  114. package/dist/midi/controllerRange.js.map +1 -0
  115. package/dist/midi/controllers.d.ts +95 -0
  116. package/dist/midi/controllers.d.ts.map +1 -0
  117. package/dist/midi/controllers.js +421 -0
  118. package/dist/midi/controllers.js.map +1 -0
  119. package/dist/midi/curveCut.d.ts +17 -0
  120. package/dist/midi/curveCut.d.ts.map +1 -0
  121. package/dist/midi/curveCut.js +45 -0
  122. package/dist/midi/curveCut.js.map +1 -0
  123. package/dist/midi/edit.d.ts +13 -1
  124. package/dist/midi/edit.d.ts.map +1 -1
  125. package/dist/midi/edit.js +19 -3
  126. package/dist/midi/edit.js.map +1 -1
  127. package/dist/midi/engines/bl1.d.ts +10 -1
  128. package/dist/midi/engines/bl1.d.ts.map +1 -1
  129. package/dist/midi/engines/bl1.js +26 -6
  130. package/dist/midi/engines/bl1.js.map +1 -1
  131. package/dist/midi/engines/dr1.d.ts +11 -1
  132. package/dist/midi/engines/dr1.d.ts.map +1 -1
  133. package/dist/midi/engines/dr1.js +21 -3
  134. package/dist/midi/engines/dr1.js.map +1 -1
  135. package/dist/midi/engines/dsp.d.ts +1 -1
  136. package/dist/midi/engines/dsp.d.ts.map +1 -1
  137. package/dist/midi/engines/dsp.js +10 -2
  138. package/dist/midi/engines/dsp.js.map +1 -1
  139. package/dist/midi/engines/wt1.d.ts +10 -1
  140. package/dist/midi/engines/wt1.d.ts.map +1 -1
  141. package/dist/midi/engines/wt1.js +28 -5
  142. package/dist/midi/engines/wt1.js.map +1 -1
  143. package/dist/midi/events.d.ts +13 -4
  144. package/dist/midi/events.d.ts.map +1 -1
  145. package/dist/midi/events.js +33 -6
  146. package/dist/midi/events.js.map +1 -1
  147. package/dist/midi/expression.d.ts +25 -0
  148. package/dist/midi/expression.d.ts.map +1 -0
  149. package/dist/midi/expression.js +69 -0
  150. package/dist/midi/expression.js.map +1 -0
  151. package/dist/midi/index.d.ts +8 -0
  152. package/dist/midi/index.d.ts.map +1 -1
  153. package/dist/midi/index.js +8 -0
  154. package/dist/midi/index.js.map +1 -1
  155. package/dist/midi/instrument.d.ts.map +1 -1
  156. package/dist/midi/instrument.js +4 -0
  157. package/dist/midi/instrument.js.map +1 -1
  158. package/dist/midi/noteFunctions.d.ts +29 -0
  159. package/dist/midi/noteFunctions.d.ts.map +1 -0
  160. package/dist/midi/noteFunctions.js +213 -0
  161. package/dist/midi/noteFunctions.js.map +1 -0
  162. package/dist/midi/notes.d.ts +7 -1
  163. package/dist/midi/notes.d.ts.map +1 -1
  164. package/dist/midi/notes.js +43 -1
  165. package/dist/midi/notes.js.map +1 -1
  166. package/dist/midi/notesEdit.d.ts +13 -0
  167. package/dist/midi/notesEdit.d.ts.map +1 -1
  168. package/dist/midi/notesEdit.js +73 -2
  169. package/dist/midi/notesEdit.js.map +1 -1
  170. package/dist/midi/presets.d.ts +1 -1
  171. package/dist/midi/regionParams.d.ts +41 -0
  172. package/dist/midi/regionParams.d.ts.map +1 -0
  173. package/dist/midi/regionParams.js +164 -0
  174. package/dist/midi/regionParams.js.map +1 -0
  175. package/dist/midi/sampler.d.ts +2 -2
  176. package/dist/midi/sampler.d.ts.map +1 -1
  177. package/dist/midi/sampler.js +99 -21
  178. package/dist/midi/sampler.js.map +1 -1
  179. package/dist/midi/stepEditor.d.ts +50 -0
  180. package/dist/midi/stepEditor.d.ts.map +1 -0
  181. package/dist/midi/stepEditor.js +118 -0
  182. package/dist/midi/stepEditor.js.map +1 -0
  183. package/dist/midi/stepPattern.d.ts +173 -0
  184. package/dist/midi/stepPattern.d.ts.map +1 -0
  185. package/dist/midi/stepPattern.js +1390 -0
  186. package/dist/midi/stepPattern.js.map +1 -0
  187. package/dist/midi/stepPatternExpand.d.ts +149 -0
  188. package/dist/midi/stepPatternExpand.d.ts.map +1 -0
  189. package/dist/midi/stepPatternExpand.js +1068 -0
  190. package/dist/midi/stepPatternExpand.js.map +1 -0
  191. package/dist/midi/stepPatternLibrary.d.ts +65 -0
  192. package/dist/midi/stepPatternLibrary.d.ts.map +1 -0
  193. package/dist/midi/stepPatternLibrary.js +640 -0
  194. package/dist/midi/stepPatternLibrary.js.map +1 -0
  195. package/dist/midi/tempo.d.ts.map +1 -1
  196. package/dist/midi/tempo.js +3 -0
  197. package/dist/midi/tempo.js.map +1 -1
  198. package/dist/midi/voice.d.ts +51 -5
  199. package/dist/midi/voice.d.ts.map +1 -1
  200. package/dist/midi/voice.js +191 -21
  201. package/dist/midi/voice.js.map +1 -1
  202. package/dist/model3d.d.ts +132 -8
  203. package/dist/model3d.d.ts.map +1 -1
  204. package/dist/model3d.js +230 -7
  205. package/dist/model3d.js.map +1 -1
  206. package/dist/model3dBake.d.ts +41 -11
  207. package/dist/model3dBake.d.ts.map +1 -1
  208. package/dist/model3dBake.js +58 -21
  209. package/dist/model3dBake.js.map +1 -1
  210. package/dist/model3dBlockout.d.ts +62 -0
  211. package/dist/model3dBlockout.d.ts.map +1 -0
  212. package/dist/model3dBlockout.js +59 -0
  213. package/dist/model3dBlockout.js.map +1 -0
  214. package/dist/model3dCameraDescription.d.ts +32 -0
  215. package/dist/model3dCameraDescription.d.ts.map +1 -0
  216. package/dist/model3dCameraDescription.js +253 -0
  217. package/dist/model3dCameraDescription.js.map +1 -0
  218. package/dist/model3dCameraKeys.d.ts +47 -0
  219. package/dist/model3dCameraKeys.d.ts.map +1 -0
  220. package/dist/model3dCameraKeys.js +156 -0
  221. package/dist/model3dCameraKeys.js.map +1 -0
  222. package/dist/model3dCameraMoves.d.ts +97 -0
  223. package/dist/model3dCameraMoves.d.ts.map +1 -0
  224. package/dist/model3dCameraMoves.js +329 -0
  225. package/dist/model3dCameraMoves.js.map +1 -0
  226. package/dist/model3dReference.d.ts +96 -0
  227. package/dist/model3dReference.d.ts.map +1 -0
  228. package/dist/model3dReference.js +113 -0
  229. package/dist/model3dReference.js.map +1 -0
  230. package/dist/music/align.d.ts +111 -0
  231. package/dist/music/align.d.ts.map +1 -0
  232. package/dist/music/align.js +282 -0
  233. package/dist/music/align.js.map +1 -0
  234. package/dist/music/cut.d.ts +33 -0
  235. package/dist/music/cut.d.ts.map +1 -0
  236. package/dist/music/cut.js +50 -0
  237. package/dist/music/cut.js.map +1 -0
  238. package/dist/music/frames.d.ts +51 -0
  239. package/dist/music/frames.d.ts.map +1 -0
  240. package/dist/music/frames.js +110 -0
  241. package/dist/music/frames.js.map +1 -0
  242. package/dist/music/gain.d.ts +24 -0
  243. package/dist/music/gain.d.ts.map +1 -0
  244. package/dist/music/gain.js +38 -0
  245. package/dist/music/gain.js.map +1 -0
  246. package/dist/music/index.d.ts +9 -0
  247. package/dist/music/index.d.ts.map +1 -0
  248. package/dist/music/index.js +9 -0
  249. package/dist/music/index.js.map +1 -0
  250. package/dist/music/plan.d.ts +106 -0
  251. package/dist/music/plan.d.ts.map +1 -0
  252. package/dist/music/plan.js +304 -0
  253. package/dist/music/plan.js.map +1 -0
  254. package/dist/music/process.d.ts +9 -0
  255. package/dist/music/process.d.ts.map +1 -0
  256. package/dist/music/process.js +9 -0
  257. package/dist/music/process.js.map +1 -0
  258. package/dist/music/roles.d.ts +14 -0
  259. package/dist/music/roles.d.ts.map +1 -0
  260. package/dist/music/roles.js +30 -0
  261. package/dist/music/roles.js.map +1 -0
  262. package/dist/music/splice.d.ts +37 -0
  263. package/dist/music/splice.d.ts.map +1 -0
  264. package/dist/music/splice.js +67 -0
  265. package/dist/music/splice.js.map +1 -0
  266. package/dist/music/tempoRules.d.ts +41 -0
  267. package/dist/music/tempoRules.d.ts.map +1 -0
  268. package/dist/music/tempoRules.js +59 -0
  269. package/dist/music/tempoRules.js.map +1 -0
  270. package/dist/ops/apply.d.ts.map +1 -1
  271. package/dist/ops/apply.js +1009 -230
  272. package/dist/ops/apply.js.map +1 -1
  273. package/dist/ops/automation.d.ts +6 -0
  274. package/dist/ops/automation.d.ts.map +1 -0
  275. package/dist/ops/automation.js +217 -0
  276. package/dist/ops/automation.js.map +1 -0
  277. package/dist/ops/barTime.d.ts +14 -0
  278. package/dist/ops/barTime.d.ts.map +1 -0
  279. package/dist/ops/barTime.js +33 -0
  280. package/dist/ops/barTime.js.map +1 -0
  281. package/dist/ops/chords.d.ts +43 -0
  282. package/dist/ops/chords.d.ts.map +1 -0
  283. package/dist/ops/chords.js +691 -0
  284. package/dist/ops/chords.js.map +1 -0
  285. package/dist/ops/groupBake.d.ts +24 -0
  286. package/dist/ops/groupBake.d.ts.map +1 -0
  287. package/dist/ops/groupBake.js +81 -0
  288. package/dist/ops/groupBake.js.map +1 -0
  289. package/dist/ops/index.d.ts +7 -0
  290. package/dist/ops/index.d.ts.map +1 -1
  291. package/dist/ops/index.js +5 -0
  292. package/dist/ops/index.js.map +1 -1
  293. package/dist/ops/join.d.ts +20 -0
  294. package/dist/ops/join.d.ts.map +1 -0
  295. package/dist/ops/join.js +265 -0
  296. package/dist/ops/join.js.map +1 -0
  297. package/dist/ops/loop.d.ts +29 -0
  298. package/dist/ops/loop.d.ts.map +1 -0
  299. package/dist/ops/loop.js +107 -0
  300. package/dist/ops/loop.js.map +1 -0
  301. package/dist/ops/midiMix.d.ts +41 -0
  302. package/dist/ops/midiMix.d.ts.map +1 -0
  303. package/dist/ops/midiMix.js +522 -0
  304. package/dist/ops/midiMix.js.map +1 -0
  305. package/dist/ops/op.d.ts +94 -11
  306. package/dist/ops/op.d.ts.map +1 -1
  307. package/dist/ops/op.js +62 -1
  308. package/dist/ops/op.js.map +1 -1
  309. package/dist/ops/parse.d.ts.map +1 -1
  310. package/dist/ops/parse.js +316 -4
  311. package/dist/ops/parse.js.map +1 -1
  312. package/dist/ops/pasteRange.d.ts +46 -0
  313. package/dist/ops/pasteRange.d.ts.map +1 -0
  314. package/dist/ops/pasteRange.js +276 -0
  315. package/dist/ops/pasteRange.js.map +1 -0
  316. package/dist/ops/plugin.d.ts +57 -0
  317. package/dist/ops/plugin.d.ts.map +1 -0
  318. package/dist/ops/plugin.js +875 -0
  319. package/dist/ops/plugin.js.map +1 -0
  320. package/dist/ops/sections.d.ts +98 -0
  321. package/dist/ops/sections.d.ts.map +1 -0
  322. package/dist/ops/sections.js +930 -0
  323. package/dist/ops/sections.js.map +1 -0
  324. package/dist/ops/serialize.d.ts +79 -1
  325. package/dist/ops/serialize.d.ts.map +1 -1
  326. package/dist/ops/serialize.js +85 -3
  327. package/dist/ops/serialize.js.map +1 -1
  328. package/dist/ops/stepPattern.d.ts +44 -0
  329. package/dist/ops/stepPattern.d.ts.map +1 -0
  330. package/dist/ops/stepPattern.js +2106 -0
  331. package/dist/ops/stepPattern.js.map +1 -0
  332. package/dist/ops/stepPatternFolders.d.ts +54 -0
  333. package/dist/ops/stepPatternFolders.d.ts.map +1 -0
  334. package/dist/ops/stepPatternFolders.js +299 -0
  335. package/dist/ops/stepPatternFolders.js.map +1 -0
  336. package/dist/ops/types.d.ts +260 -2
  337. package/dist/ops/types.d.ts.map +1 -1
  338. package/dist/render/index.d.ts +1 -0
  339. package/dist/render/index.d.ts.map +1 -1
  340. package/dist/render/index.js +1 -0
  341. package/dist/render/index.js.map +1 -1
  342. package/dist/render/model3dReferenceSamples.d.ts +25 -0
  343. package/dist/render/model3dReferenceSamples.d.ts.map +1 -0
  344. package/dist/render/model3dReferenceSamples.js +25 -0
  345. package/dist/render/model3dReferenceSamples.js.map +1 -0
  346. package/dist/render/sceneModel.d.ts +1 -1
  347. package/dist/render/sceneModel.d.ts.map +1 -1
  348. package/dist/render/sceneModel.js +10 -5
  349. package/dist/render/sceneModel.js.map +1 -1
  350. package/dist/rippleEdit.d.ts +5 -1
  351. package/dist/rippleEdit.d.ts.map +1 -1
  352. package/dist/rippleEdit.js +24 -9
  353. package/dist/rippleEdit.js.map +1 -1
  354. package/dist/scene.d.ts +1 -0
  355. package/dist/scene.d.ts.map +1 -1
  356. package/dist/scene.js +1 -0
  357. package/dist/scene.js.map +1 -1
  358. package/dist/shotLink.d.ts +35 -0
  359. package/dist/shotLink.d.ts.map +1 -1
  360. package/dist/shotLink.js +100 -0
  361. package/dist/shotLink.js.map +1 -1
  362. package/dist/splitClip.d.ts +29 -1
  363. package/dist/splitClip.d.ts.map +1 -1
  364. package/dist/splitClip.js +231 -1
  365. package/dist/splitClip.js.map +1 -1
  366. package/dist/testing/host-ops.js +3 -3
  367. package/dist/testing/host-ops.js.map +1 -1
  368. package/dist/testing/ops.d.ts +6 -1
  369. package/dist/testing/ops.d.ts.map +1 -1
  370. package/dist/testing/ops.js +872 -13
  371. package/dist/testing/ops.js.map +1 -1
  372. package/dist/timeRemap.d.ts +2 -2
  373. package/dist/timeRemap.d.ts.map +1 -1
  374. package/dist/timeRemap.js +18 -0
  375. package/dist/timeRemap.js.map +1 -1
  376. package/dist/trimClip.d.ts +1 -1
  377. package/dist/trimClip.d.ts.map +1 -1
  378. package/dist/trimClip.js +41 -7
  379. package/dist/trimClip.js.map +1 -1
  380. package/dist/types.d.ts +331 -15
  381. package/dist/types.d.ts.map +1 -1
  382. package/dist/types.js.map +1 -1
  383. package/package.json +11 -5
@@ -0,0 +1,96 @@
1
+ /**
2
+ * The Blockout reference of a `model3d` clip: a grey render of the clip's span
3
+ * that a video model follows when a storyboard shot is generated.
4
+ *
5
+ * Nothing here renders. This module holds what every host has to agree on: the
6
+ * passes a reference can be drawn in, the fixed look it is drawn with, the
7
+ * size it is drawn at, and the hash that decides whether a stored reference
8
+ * still shows the clip. The per-frame sample list is
9
+ * `computeModel3DReferenceFrames` in `render/`, because it samples the clip's
10
+ * animation curves through the scene model.
11
+ */
12
+ import type { Model3DBakeSequence } from "./model3dBake.js";
13
+ import type { ClipModel3DAnimation, ClipModel3DStyle, TimelineClip } from "./types.js";
14
+ /** What a reference frame draws. See `Model3DRenderPass` in the render core. */
15
+ export type Model3DReferencePass = "clay" | "depth" | "normal";
16
+ export declare const MODEL3D_REFERENCE_PASSES: readonly ["clay", "depth", "normal"];
17
+ export declare const DEFAULT_MODEL3D_REFERENCE_PASS: Model3DReferencePass;
18
+ /** Whether a value names a reference pass. */
19
+ export declare function isModel3DReferencePass(value: unknown): value is Model3DReferencePass;
20
+ /**
21
+ * The background every reference is drawn on. Opaque, neutral and darker than
22
+ * the lit clay grey, so a figure reads against it whatever background the clip
23
+ * itself uses.
24
+ */
25
+ export declare const MODEL3D_REFERENCE_BACKGROUND = "#3c3c3c";
26
+ /** The longest side of a reference frame, in pixels. */
27
+ export declare const MODEL3D_REFERENCE_MAX_SIDE = 1280;
28
+ /** The renderer settings a reference fixes, in the shape a render session takes. */
29
+ export interface Model3DReferenceSession {
30
+ lighting: "studio";
31
+ lightIntensity: 1;
32
+ background: {
33
+ transparent: false;
34
+ color: string;
35
+ };
36
+ animation: ClipModel3DAnimation;
37
+ }
38
+ /**
39
+ * The session a reference is rendered with. The lighting and the background
40
+ * are constants: the clip's own lighting, intensity and background are look
41
+ * choices for the timeline picture and must not change what the video model
42
+ * is shown. Only the animation selection comes from the clip.
43
+ */
44
+ export declare function model3dReferenceSession(style: Pick<ClipModel3DStyle, "animation">): Model3DReferenceSession;
45
+ /**
46
+ * The pixel size of a reference frame: the sequence's aspect ratio, scaled
47
+ * down so the longest side is at most {@link MODEL3D_REFERENCE_MAX_SIDE}, with
48
+ * both sides even because H.264 4:2:0 needs that.
49
+ */
50
+ export declare function model3dReferenceSize(sequence: Pick<Model3DBakeSequence, "width" | "height">): {
51
+ width: number;
52
+ height: number;
53
+ };
54
+ /**
55
+ * The hash a reference is stored under.
56
+ *
57
+ * It covers what {@link computeModel3DBakeHash} covers, through the same
58
+ * record, with two differences. The style is narrowed to the camera and the
59
+ * animation, because the lighting and the background of a reference are fixed
60
+ * by {@link model3dReferenceSession}. And the pass is added, because a depth
61
+ * render of an unchanged clip is a different video from a clay one.
62
+ */
63
+ export declare function computeModel3DReferenceHash(clip: TimelineClip, sequence: Model3DBakeSequence, pass: Model3DReferencePass): string;
64
+ /**
65
+ * What a take generated from a Blockout records, to tell later whether the
66
+ * blockout changed under it: the reference hash, plus the set revision when
67
+ * one is known. The hash cannot see an edit to the set, because the set is
68
+ * saved in place under the same asset id.
69
+ */
70
+ export declare function model3dBlockoutTakeKey(dependencyHash: string, assetRevision?: string): string;
71
+ /** Where a clip's reference stands against the live document. */
72
+ export type Model3DReferenceStatus = "missing" | "stale" | "current";
73
+ export interface Model3DReferenceStatusOptions {
74
+ /**
75
+ * The pass the caller wants. A stored reference in another pass reads as
76
+ * `stale`, because a render in this pass is needed.
77
+ */
78
+ pass?: Model3DReferencePass;
79
+ /**
80
+ * The set asset's `updated_at` now. The set is saved in place under the
81
+ * same id, so an edit to it changes this and nothing the hash covers. When
82
+ * it is given and differs from the revision the reference was rendered at,
83
+ * or the reference recorded none, the reference is `stale`. A caller that
84
+ * cannot read the asset leaves it out and the check is skipped.
85
+ */
86
+ assetRevision?: string;
87
+ }
88
+ /**
89
+ * `missing` when the clip stores no reference, `stale` when the stored one was
90
+ * rendered from a different set, camera, span, sequence or pass, and `current`
91
+ * otherwise.
92
+ */
93
+ export declare function model3dReferenceStatus(clip: TimelineClip, sequence: Model3DBakeSequence, options?: Model3DReferenceStatusOptions): Model3DReferenceStatus;
94
+ /** Whether the clip stores a reference that no longer shows the clip. */
95
+ export declare function isModel3DReferenceStale(clip: TimelineClip, sequence: Model3DBakeSequence, assetRevision?: string): boolean;
96
+ //# sourceMappingURL=model3dReference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model3dReference.d.ts","sourceRoot":"","sources":["../src/model3dReference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,gFAAgF;AAChF,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE/D,eAAO,MAAM,wBAAwB,sCAIe,CAAC;AAErD,eAAO,MAAM,8BAA8B,EAAE,oBAA6B,CAAC;AAE3E,8CAA8C;AAC9C,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,oBAAoB,CAE/B;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,YAAY,CAAC;AAEtD,wDAAwD;AACxD,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,oFAAoF;AACpF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAA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ference of a `model3d` clip: a grey render of the clip's span
3
+ * that a video model follows when a storyboard shot is generated.
4
+ *
5
+ * Nothing here renders. This module holds what every host has to agree on: the
6
+ * passes a reference can be drawn in, the fixed look it is drawn with, the
7
+ * size it is drawn at, and the hash that decides whether a stored reference
8
+ * still shows the clip. The per-frame sample list is
9
+ * `computeModel3DReferenceFrames` in `render/`, because it samples the clip's
10
+ * animation curves through the scene model.
11
+ */
12
+ import { model3dPictureDigest, model3dPictureInputs } from "./model3dBake.js";
13
+ import { stableSerialize } from "./stableSerialize.js";
14
+ export const MODEL3D_REFERENCE_PASSES = [
15
+ "clay",
16
+ "depth",
17
+ "normal"
18
+ ];
19
+ export const DEFAULT_MODEL3D_REFERENCE_PASS = "clay";
20
+ /** Whether a value names a reference pass. */
21
+ export function isModel3DReferencePass(value) {
22
+ return MODEL3D_REFERENCE_PASSES.some((pass) => pass === value);
23
+ }
24
+ /**
25
+ * The background every reference is drawn on. Opaque, neutral and darker than
26
+ * the lit clay grey, so a figure reads against it whatever background the clip
27
+ * itself uses.
28
+ */
29
+ export const MODEL3D_REFERENCE_BACKGROUND = "#3c3c3c";
30
+ /** The longest side of a reference frame, in pixels. */
31
+ export const MODEL3D_REFERENCE_MAX_SIDE = 1280;
32
+ /**
33
+ * The session a reference is rendered with. The lighting and the background
34
+ * are constants: the clip's own lighting, intensity and background are look
35
+ * choices for the timeline picture and must not change what the video model
36
+ * is shown. Only the animation selection comes from the clip.
37
+ */
38
+ export function model3dReferenceSession(style) {
39
+ return {
40
+ lighting: "studio",
41
+ lightIntensity: 1,
42
+ background: { transparent: false, color: MODEL3D_REFERENCE_BACKGROUND },
43
+ animation: { ...style.animation }
44
+ };
45
+ }
46
+ /**
47
+ * The pixel size of a reference frame: the sequence's aspect ratio, scaled
48
+ * down so the longest side is at most {@link MODEL3D_REFERENCE_MAX_SIDE}, with
49
+ * both sides even because H.264 4:2:0 needs that.
50
+ */
51
+ export function model3dReferenceSize(sequence) {
52
+ const width = Math.max(2, sequence.width);
53
+ const height = Math.max(2, sequence.height);
54
+ const scale = Math.min(1, MODEL3D_REFERENCE_MAX_SIDE / Math.max(width, height));
55
+ const even = (value) => Math.max(2, Math.round((value * scale) / 2) * 2);
56
+ return { width: even(width), height: even(height) };
57
+ }
58
+ const MODEL3D_REFERENCE_HASH_VERSION_PREFIX = "model3d-reference-v1:";
59
+ /**
60
+ * The hash a reference is stored under.
61
+ *
62
+ * It covers what {@link computeModel3DBakeHash} covers, through the same
63
+ * record, with two differences. The style is narrowed to the camera and the
64
+ * animation, because the lighting and the background of a reference are fixed
65
+ * by {@link model3dReferenceSession}. And the pass is added, because a depth
66
+ * render of an unchanged clip is a different video from a clay one.
67
+ */
68
+ export function computeModel3DReferenceHash(clip, sequence, pass) {
69
+ const style = clip.model3dStyle;
70
+ const picture = style
71
+ ? { camera: style.camera, animation: style.animation }
72
+ : {};
73
+ const payload = `${MODEL3D_REFERENCE_HASH_VERSION_PREFIX}${stableSerialize({
74
+ ...model3dPictureInputs(clip, sequence, picture),
75
+ pass
76
+ })}`;
77
+ return model3dPictureDigest(payload);
78
+ }
79
+ /**
80
+ * What a take generated from a Blockout records, to tell later whether the
81
+ * blockout changed under it: the reference hash, plus the set revision when
82
+ * one is known. The hash cannot see an edit to the set, because the set is
83
+ * saved in place under the same asset id.
84
+ */
85
+ export function model3dBlockoutTakeKey(dependencyHash, assetRevision) {
86
+ return assetRevision ? `${dependencyHash}@${assetRevision}` : dependencyHash;
87
+ }
88
+ /**
89
+ * `missing` when the clip stores no reference, `stale` when the stored one was
90
+ * rendered from a different set, camera, span, sequence or pass, and `current`
91
+ * otherwise.
92
+ */
93
+ export function model3dReferenceStatus(clip, sequence, options = {}) {
94
+ const reference = clip.model3dStyle?.reference;
95
+ if (!reference)
96
+ return "missing";
97
+ if (options.pass !== undefined && options.pass !== reference.pass) {
98
+ return "stale";
99
+ }
100
+ if (options.assetRevision !== undefined &&
101
+ options.assetRevision !== reference.assetRevision) {
102
+ return "stale";
103
+ }
104
+ return reference.dependencyHash ===
105
+ computeModel3DReferenceHash(clip, sequence, reference.pass)
106
+ ? "current"
107
+ : "stale";
108
+ }
109
+ /** Whether the clip stores a reference that no longer shows the clip. */
110
+ export function isModel3DReferenceStale(clip, sequence, assetRevision) {
111
+ return model3dReferenceStatus(clip, sequence, { assetRevision }) === "stale";
112
+ }
113
+ //# sourceMappingURL=model3dReference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model3dReference.js","sourceRoot":"","sources":["../src/model3dReference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAUvD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,MAAM;IACN,OAAO;IACP,QAAQ;CAC0C,CAAC;AAErD,MAAM,CAAC,MAAM,8BAA8B,GAAyB,MAAM,CAAC;AAE3E,8CAA8C;AAC9C,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,wBAAwB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,SAAS,CAAC;AAEtD,wDAAwD;AACxD,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAU/C;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAA0C;IAE1C,OAAO;QACL,QAAQ,EAAE,QAAQ;QAClB,cAAc,EAAE,CAAC;QACjB,UAAU,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,4BAA4B,EAAE;QACvE,SAAS,EAAE,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE;KAClC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAuD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aAAsB;IAEtB,OAAO,aAAa,CAAC,CAAC,CAAC,GAAG,cAAc,IAAI,aAAa,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC;AAC/E,CAAC;AAqBD;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAkB,EAClB,QAA6B,EAC7B,OAAO,GAAkC,EAAE;IAE3C,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAC/C,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;QAClE,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IACE,OAAO,CAAC,aAAa,KAAK,SAAS;QACnC,OAAO,CAAC,aAAa,KAAK,SAAS,CAAC,aAAa,EACjD,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,SAAS,CAAC,cAAc;QAC7B,2BAA2B,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC;QAC3D,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,OAAO,CAAC;AACd,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,uBAAuB,CACrC,IAAkB,EAClB,QAA6B,EAC7B,aAAsB;IAEtB,OAAO,sBAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,aAAa,EAAE,CAAC,KAAK,OAAO,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Grid offset and tempo deviation of a generated window (MUSIC-MODE.md
3
+ * section 11, AL-2 and AL-4).
4
+ *
5
+ * The window is reduced to an onset-strength envelope with the existing
6
+ * spectral-flux detector ({@link magnitudeSpectrum}, {@link spectralFlux}),
7
+ * then correlated with a pulse train at the project's beat period, shifted by
8
+ * the position of the first beat. The lag with the highest correlation within
9
+ * half a beat either way is the offset, and the peak over the mean
10
+ * correlation is its confidence. The same correlation over beat periods from
11
+ * 97% to 103% of the project's gives the tempo deviation.
12
+ *
13
+ * PCM is interleaved stereo at 48 kHz, as in {@link cutFrames}.
14
+ */
15
+ /**
16
+ * FFT window of the envelope. Shorter than the onset detector's 1024 so an
17
+ * onset is located within a few milliseconds: the normalized flux of a hit
18
+ * peaks as the hit enters the window, at most one window from its start.
19
+ */
20
+ export declare const ALIGN_FFT_SIZE = 128;
21
+ /** Envelope hop: 0.5 ms at 48 kHz. */
22
+ export declare const ALIGN_HOP_FRAMES = 24;
23
+ /**
24
+ * Least confidence at which a measured offset is applied, and at which a
25
+ * tempo measurement may badge a take as drifting.
26
+ *
27
+ * Confidence is the peak correlation over the mean correlation across all
28
+ * lags. On the fixtures in `tests/music.align.test.ts`, white noise scores
29
+ * 1.7 to 2.3 and noise-burst click tracks score 14 or more with a noise floor
30
+ * 10 dB under the clicks. 3 keeps a margin over noise. MM3 sets the final
31
+ * value from real backend output (MR9).
32
+ */
33
+ export declare const ALIGN_MIN_CONFIDENCE = 3;
34
+ /** Last-beat error above which a take is badged as drifting (AL-4). */
35
+ export declare const DRIFT_THRESHOLD_MS = 20;
36
+ /** Beat periods searched for the tempo, as a fraction of the project's. */
37
+ export declare const TEMPO_SEARCH_MIN = 0.97;
38
+ export declare const TEMPO_SEARCH_MAX = 1.03;
39
+ /** An onset-strength curve sampled every {@link ALIGN_HOP_FRAMES}. */
40
+ export interface OnsetEnvelope {
41
+ values: Float32Array;
42
+ hopFrames: number;
43
+ /**
44
+ * Window frame of `values[0]`. Each value is stamped at the last frame of
45
+ * its FFT window, where the normalized flux of a hit peaks.
46
+ */
47
+ firstFrame: number;
48
+ }
49
+ /** The normalized spectral flux of the mono mix of `samples`. */
50
+ export declare function onsetEnvelope(samples: Float32Array): OnsetEnvelope;
51
+ /**
52
+ * Mean envelope over the beats `phase + lag + k * period` that fall inside
53
+ * the envelope, for every whole `k`.
54
+ */
55
+ export declare function pulseCorrelation(envelope: OnsetEnvelope, periodFrames: number, phaseFrames: number, lagFrames: number): number;
56
+ /** What a window's beats measure against the project grid. */
57
+ export interface MusicAlignment {
58
+ /** Frames the audio's beats fall after the grid. Negative is early. */
59
+ offsetFrames: number;
60
+ /** Whether the offset clears {@link ALIGN_MIN_CONFIDENCE}. */
61
+ confident: boolean;
62
+ /** Peak correlation over mean correlation. About 1 for no beat. */
63
+ confidence: number;
64
+ /** Measured tempo divided by project tempo. */
65
+ tempoRatio: number;
66
+ /** Whether the tempo scan clears {@link ALIGN_MIN_CONFIDENCE}. */
67
+ tempoConfident: boolean;
68
+ /** How far the last beat of the take lands off the grid. */
69
+ lastBeatErrorMs: number;
70
+ /**
71
+ * `lastBeatErrorMs` above {@link DRIFT_THRESHOLD_MS}, at a tempo the
72
+ * correlation trusts. A window with no clear beat is never badged.
73
+ */
74
+ drifting: boolean;
75
+ }
76
+ export interface MeasureAlignmentOptions {
77
+ /** Project tempo in quarter-note beats per minute. */
78
+ bpm: number;
79
+ /**
80
+ * Beat unit of the time signature. BPM counts quarter notes in every
81
+ * signature, so a beat lasts `60 / bpm * 4 / beatUnit` seconds.
82
+ */
83
+ beatUnit?: number;
84
+ /** Position of the first beat inside the window, in frames. */
85
+ beatPhaseFrames?: number;
86
+ /** Length of the take the tempo error is reported over, in frames. */
87
+ takeFrames: number;
88
+ }
89
+ /** Frames of one beat at `bpm` in quarter notes. */
90
+ export declare function beatPeriodFrames(bpm: number, beatUnit?: number): number;
91
+ /**
92
+ * Measure the grid offset and the tempo deviation of `samples`. The offset is
93
+ * measured at the project's beat period. The tempo scan does not change it.
94
+ *
95
+ * This runs to the end on the calling thread: about 1 s for a 64 s window and
96
+ * 5 s for 300 s. A server measures with {@link measureAlignmentAsync}.
97
+ */
98
+ export declare function measureAlignment(samples: Float32Array, options: MeasureAlignmentOptions): MusicAlignment;
99
+ /**
100
+ * {@link measureAlignment} in slices of about 15 ms, awaiting `yieldToHost`
101
+ * between slices so a server keeps answering other requests while it
102
+ * measures a long window (backlog M3). The result is identical.
103
+ */
104
+ export declare function measureAlignmentAsync(samples: Float32Array, options: MeasureAlignmentOptions, yieldToHost: () => Promise<void>): Promise<MusicAlignment>;
105
+ /**
106
+ * The tempo error of a measured window over one take `takeFrames` long: the
107
+ * last beat lands off the grid by the period error times the beats in it.
108
+ * A window cut into several segments is measured once and reported per take.
109
+ */
110
+ export declare function alignmentForTake(alignment: Omit<MusicAlignment, "lastBeatErrorMs" | "drifting">, takeFrames: number): MusicAlignment;
111
+ //# sourceMappingURL=align.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"align.d.ts","sourceRoot":"","sources":["../../src/music/align.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH;;;;GAIG;AACH,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,sCAAsC;AACtC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAenC;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,uEAAuE;AACvE,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,OAAO,CAAC;AACrC,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAIrC,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAgBD,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,aAAa,CAElE;AAoED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,aAAa,EACvB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,MAAM,CAYR;AA0CD,8DAA8D;AAC9D,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,SAAS,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,cAAc,EAAE,OAAO,CAAC;IACxB,4DAA4D;IAC5D,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,oDAAoD;AACpD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAGlE;AAyCD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,uBAAuB,GAC/B,cAAc,CAEhB;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,uBAAuB,EAChC,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC/B,OAAO,CAAC,cAAc,CAAC,CAOzB;AA2BD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,iBAAiB,GAAG,UAAU,CAAC,EAC/D,UAAU,EAAE,MAAM,GACjB,cAAc,CAYhB"}
@@ -0,0 +1,282 @@
1
+ /**
2
+ * Grid offset and tempo deviation of a generated window (MUSIC-MODE.md
3
+ * section 11, AL-2 and AL-4).
4
+ *
5
+ * The window is reduced to an onset-strength envelope with the existing
6
+ * spectral-flux detector ({@link magnitudeSpectrum}, {@link spectralFlux}),
7
+ * then correlated with a pulse train at the project's beat period, shifted by
8
+ * the position of the first beat. The lag with the highest correlation within
9
+ * half a beat either way is the offset, and the peak over the mean
10
+ * correlation is its confidence. The same correlation over beat periods from
11
+ * 97% to 103% of the project's gives the tempo deviation.
12
+ *
13
+ * PCM is interleaved stereo at 48 kHz, as in {@link cutFrames}.
14
+ */
15
+ import { hannWindow, magnitudeSpectrum, spectralFlux } from "../audioOnsets.js";
16
+ import { MUSIC_CHANNELS, pcmFrames } from "./cut.js";
17
+ /** Frames per second of every music buffer. */
18
+ const RATE = 48000;
19
+ /**
20
+ * FFT window of the envelope. Shorter than the onset detector's 1024 so an
21
+ * onset is located within a few milliseconds: the normalized flux of a hit
22
+ * peaks as the hit enters the window, at most one window from its start.
23
+ */
24
+ export const ALIGN_FFT_SIZE = 128;
25
+ /** Envelope hop: 0.5 ms at 48 kHz. */
26
+ export const ALIGN_HOP_FRAMES = 24;
27
+ /**
28
+ * Half-width of the running mean subtracted from the flux, in hops (25 ms).
29
+ * A stationary signal keeps a flux floor of a few percent; without the
30
+ * subtraction that floor dominates the mean correlation and hides the beat.
31
+ */
32
+ const BASELINE_HALF_WIDTH_HOPS = 50;
33
+ /**
34
+ * Lag step of the fine search around the best coarse lag, in frames. The
35
+ * envelope is read with linear interpolation between hops.
36
+ */
37
+ const FINE_LAG_STEP_FRAMES = 4;
38
+ /**
39
+ * Least confidence at which a measured offset is applied, and at which a
40
+ * tempo measurement may badge a take as drifting.
41
+ *
42
+ * Confidence is the peak correlation over the mean correlation across all
43
+ * lags. On the fixtures in `tests/music.align.test.ts`, white noise scores
44
+ * 1.7 to 2.3 and noise-burst click tracks score 14 or more with a noise floor
45
+ * 10 dB under the clicks. 3 keeps a margin over noise. MM3 sets the final
46
+ * value from real backend output (MR9).
47
+ */
48
+ export const ALIGN_MIN_CONFIDENCE = 3;
49
+ /** Last-beat error above which a take is badged as drifting (AL-4). */
50
+ export const DRIFT_THRESHOLD_MS = 20;
51
+ /** Beat periods searched for the tempo, as a fraction of the project's. */
52
+ export const TEMPO_SEARCH_MIN = 0.97;
53
+ export const TEMPO_SEARCH_MAX = 1.03;
54
+ const TEMPO_COARSE_STEP = 0.001;
55
+ const TEMPO_FINE_STEP = 0.00002;
56
+ /**
57
+ * Envelope hops computed between two yields of {@link measureAlignmentAsync}:
58
+ * about 15 ms of work on a laptop core.
59
+ */
60
+ const HOPS_PER_SLICE = 2048;
61
+ /** Run a sliced computation to its end without yielding. */
62
+ function drain(steps) {
63
+ for (;;) {
64
+ const next = steps.next();
65
+ if (next.done)
66
+ return next.value;
67
+ }
68
+ }
69
+ /** The normalized spectral flux of the mono mix of `samples`. */
70
+ export function onsetEnvelope(samples) {
71
+ return drain(onsetEnvelopeSteps(samples));
72
+ }
73
+ function* onsetEnvelopeSteps(samples) {
74
+ const frames = pcmFrames(samples);
75
+ const mono = new Float32Array(frames);
76
+ for (let frame = 0; frame < frames; frame += 1) {
77
+ mono[frame] =
78
+ ((samples[frame * MUSIC_CHANNELS] ?? 0) +
79
+ (samples[frame * MUSIC_CHANNELS + 1] ?? 0)) /
80
+ 2;
81
+ }
82
+ yield;
83
+ const window = hannWindow(ALIGN_FFT_SIZE);
84
+ const count = Math.max(0, Math.floor((frames - ALIGN_FFT_SIZE) / ALIGN_HOP_FRAMES));
85
+ const values = new Float32Array(count);
86
+ let previous = magnitudeSpectrum(mono, 0, window);
87
+ for (let index = 0; index < count; index += 1) {
88
+ const offset = (index + 1) * ALIGN_HOP_FRAMES;
89
+ const magnitude = magnitudeSpectrum(mono, offset, window);
90
+ values[index] = spectralFlux(magnitude, previous);
91
+ previous = magnitude;
92
+ if ((index + 1) % HOPS_PER_SLICE === 0)
93
+ yield;
94
+ }
95
+ return {
96
+ values: subtractBaseline(values, BASELINE_HALF_WIDTH_HOPS),
97
+ hopFrames: ALIGN_HOP_FRAMES,
98
+ firstFrame: ALIGN_HOP_FRAMES + ALIGN_FFT_SIZE - 1
99
+ };
100
+ }
101
+ /** `values` minus their running mean, half-wave rectified. */
102
+ function subtractBaseline(values, halfWidth) {
103
+ const prefix = new Float64Array(values.length + 1);
104
+ for (let index = 0; index < values.length; index += 1) {
105
+ prefix[index + 1] = prefix[index] + (values[index] ?? 0);
106
+ }
107
+ const out = new Float32Array(values.length);
108
+ for (let index = 0; index < values.length; index += 1) {
109
+ const from = Math.max(0, index - halfWidth);
110
+ const to = Math.min(values.length, index + halfWidth + 1);
111
+ const mean = (prefix[to] - prefix[from]) / (to - from);
112
+ out[index] = Math.max(0, (values[index] ?? 0) - mean);
113
+ }
114
+ return out;
115
+ }
116
+ /** The envelope at window frame `frame`, linearly interpolated. */
117
+ function envelopeAt(envelope, frame) {
118
+ const position = (frame - envelope.firstFrame) / envelope.hopFrames;
119
+ if (position < 0 || position > envelope.values.length - 1)
120
+ return 0;
121
+ const lower = Math.floor(position);
122
+ const fraction = position - lower;
123
+ const a = envelope.values[lower] ?? 0;
124
+ const b = envelope.values[lower + 1] ?? a;
125
+ return a + (b - a) * fraction;
126
+ }
127
+ /** Window frames the envelope covers, `[first, last]`. */
128
+ function envelopeSpan(envelope) {
129
+ return [
130
+ envelope.firstFrame,
131
+ envelope.firstFrame + (envelope.values.length - 1) * envelope.hopFrames
132
+ ];
133
+ }
134
+ /**
135
+ * Mean envelope over the beats `phase + lag + k * period` that fall inside
136
+ * the envelope, for every whole `k`.
137
+ */
138
+ export function pulseCorrelation(envelope, periodFrames, phaseFrames, lagFrames) {
139
+ const [first, last] = envelopeSpan(envelope);
140
+ if (envelope.values.length === 0 || !(periodFrames > 0))
141
+ return 0;
142
+ const anchor = phaseFrames + lagFrames;
143
+ const kFirst = Math.ceil((first - anchor) / periodFrames);
144
+ const kLast = Math.floor((last - anchor) / periodFrames);
145
+ if (kLast < kFirst)
146
+ return 0;
147
+ let sum = 0;
148
+ for (let k = kFirst; k <= kLast; k += 1) {
149
+ sum += envelopeAt(envelope, anchor + k * periodFrames);
150
+ }
151
+ return sum / (kLast - kFirst + 1);
152
+ }
153
+ /** The best lag within half a beat either way, coarse then fine. */
154
+ function searchLag(envelope, periodFrames, phaseFrames) {
155
+ const half = periodFrames / 2;
156
+ const coarseSteps = Math.floor(half / envelope.hopFrames);
157
+ let bestLag = 0;
158
+ let peak = Number.NEGATIVE_INFINITY;
159
+ let sum = 0;
160
+ let count = 0;
161
+ for (let step = -coarseSteps; step <= coarseSteps; step += 1) {
162
+ const lag = step * envelope.hopFrames;
163
+ const value = pulseCorrelation(envelope, periodFrames, phaseFrames, lag);
164
+ sum += value;
165
+ count += 1;
166
+ if (value > peak) {
167
+ peak = value;
168
+ bestLag = lag;
169
+ }
170
+ }
171
+ const from = Math.max(-half, bestLag - envelope.hopFrames);
172
+ const to = Math.min(half, bestLag + envelope.hopFrames);
173
+ for (let lag = Math.ceil(from); lag <= to; lag += FINE_LAG_STEP_FRAMES) {
174
+ const value = pulseCorrelation(envelope, periodFrames, phaseFrames, lag);
175
+ if (value > peak) {
176
+ peak = value;
177
+ bestLag = lag;
178
+ }
179
+ }
180
+ return { lagFrames: bestLag, peak, mean: count > 0 ? sum / count : 0 };
181
+ }
182
+ /** Frames of one beat at `bpm` in quarter notes. */
183
+ export function beatPeriodFrames(bpm, beatUnit = 4) {
184
+ if (!(bpm > 0))
185
+ throw new Error(`bpm must be positive, got ${bpm}`);
186
+ return (60 / bpm) * (4 / beatUnit) * RATE;
187
+ }
188
+ /**
189
+ * The best beat period within 97%..103% of `periodFrames`, as a scale of it.
190
+ * A coarse 0.1% pass picks the neighbourhood and a fine pass refines it.
191
+ */
192
+ function* searchTempoScale(envelope, periodFrames, phaseFrames) {
193
+ let bestScale = 1;
194
+ let best = Number.NEGATIVE_INFINITY;
195
+ let bestMean = 0;
196
+ const steps = Math.round((TEMPO_SEARCH_MAX - TEMPO_SEARCH_MIN) / TEMPO_COARSE_STEP);
197
+ for (let step = 0; step <= steps; step += 1) {
198
+ const scale = TEMPO_SEARCH_MIN + step * TEMPO_COARSE_STEP;
199
+ const { peak, mean } = searchLag(envelope, periodFrames * scale, phaseFrames);
200
+ yield;
201
+ if (peak > best) {
202
+ best = peak;
203
+ bestMean = mean;
204
+ bestScale = scale;
205
+ }
206
+ }
207
+ const from = Math.max(TEMPO_SEARCH_MIN, bestScale - TEMPO_COARSE_STEP);
208
+ const to = Math.min(TEMPO_SEARCH_MAX, bestScale + TEMPO_COARSE_STEP);
209
+ const fineSteps = Math.round((to - from) / TEMPO_FINE_STEP);
210
+ for (let step = 0; step <= fineSteps; step += 1) {
211
+ const scale = from + step * TEMPO_FINE_STEP;
212
+ const { peak, mean } = searchLag(envelope, periodFrames * scale, phaseFrames);
213
+ yield;
214
+ if (peak > best) {
215
+ best = peak;
216
+ bestMean = mean;
217
+ bestScale = scale;
218
+ }
219
+ }
220
+ return { scale: bestScale, confidence: bestMean > 0 ? best / bestMean : 0 };
221
+ }
222
+ /**
223
+ * Measure the grid offset and the tempo deviation of `samples`. The offset is
224
+ * measured at the project's beat period. The tempo scan does not change it.
225
+ *
226
+ * This runs to the end on the calling thread: about 1 s for a 64 s window and
227
+ * 5 s for 300 s. A server measures with {@link measureAlignmentAsync}.
228
+ */
229
+ export function measureAlignment(samples, options) {
230
+ return drain(measureAlignmentSteps(samples, options));
231
+ }
232
+ /**
233
+ * {@link measureAlignment} in slices of about 15 ms, awaiting `yieldToHost`
234
+ * between slices so a server keeps answering other requests while it
235
+ * measures a long window (backlog M3). The result is identical.
236
+ */
237
+ export async function measureAlignmentAsync(samples, options, yieldToHost) {
238
+ const steps = measureAlignmentSteps(samples, options);
239
+ for (;;) {
240
+ const next = steps.next();
241
+ if (next.done)
242
+ return next.value;
243
+ await yieldToHost();
244
+ }
245
+ }
246
+ function* measureAlignmentSteps(samples, options) {
247
+ const period = beatPeriodFrames(options.bpm, options.beatUnit);
248
+ const phase = options.beatPhaseFrames ?? 0;
249
+ const envelope = yield* onsetEnvelopeSteps(samples);
250
+ const lag = searchLag(envelope, period, phase);
251
+ yield;
252
+ const confidence = lag.mean > 0 && Number.isFinite(lag.peak) ? lag.peak / lag.mean : 0;
253
+ const tempo = confidence > 0
254
+ ? yield* searchTempoScale(envelope, period, phase)
255
+ : { scale: 1, confidence: 0 };
256
+ const measured = {
257
+ offsetFrames: confidence > 0 ? Math.round(lag.lagFrames) : 0,
258
+ confident: confidence >= ALIGN_MIN_CONFIDENCE,
259
+ confidence,
260
+ tempoRatio: 1 / tempo.scale,
261
+ tempoConfident: tempo.confidence >= ALIGN_MIN_CONFIDENCE
262
+ };
263
+ return alignmentForTake(measured, options.takeFrames);
264
+ }
265
+ /**
266
+ * The tempo error of a measured window over one take `takeFrames` long: the
267
+ * last beat lands off the grid by the period error times the beats in it.
268
+ * A window cut into several segments is measured once and reported per take.
269
+ */
270
+ export function alignmentForTake(alignment, takeFrames) {
271
+ const lastBeatErrorMs = (Math.abs(1 / alignment.tempoRatio - 1) * takeFrames * 1000) / RATE;
272
+ return {
273
+ offsetFrames: alignment.offsetFrames,
274
+ confident: alignment.confident,
275
+ confidence: alignment.confidence,
276
+ tempoRatio: alignment.tempoRatio,
277
+ tempoConfident: alignment.tempoConfident,
278
+ lastBeatErrorMs,
279
+ drifting: alignment.tempoConfident && lastBeatErrorMs > DRIFT_THRESHOLD_MS
280
+ };
281
+ }
282
+ //# sourceMappingURL=align.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"align.js","sourceRoot":"","sources":["../../src/music/align.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErD,+CAA+C;AAC/C,MAAM,IAAI,GAAG,KAAK,CAAC;AAEnB;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAElC,sCAAsC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAE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