hyperframes 0.8.206 → 0.8.208

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 (240) hide show
  1. package/bin/hyperframes.mjs +1 -0
  2. package/dist/{add-FFMNAJXJ.js → add-XMWRBMBR.js} +22 -20
  3. package/dist/{agentPromptGenerator-KYO5MKTW.js → agentPromptGenerator-4NJ252MR.js} +6 -2
  4. package/dist/{animatedGifPrep-BIIIIVWL.js → animatedGifPrep-6XURJIPV.js} +14 -13
  5. package/dist/api.js +33 -32
  6. package/dist/{appHistory-QVCSAOI4.js → appHistory-HIBH6XZW.js} +3 -1
  7. package/dist/{asset-IPUHGZSL.js → asset-I5GGEOB2.js} +2 -2
  8. package/dist/{assetCataloger-M5FWXLAJ.js → assetCataloger-YBPXUNUP.js} +17 -14
  9. package/dist/{audio-VYWWM4DB.js → audio-GFJCHH5W.js} +420 -138
  10. package/dist/{auth-GZQZCUPL.js → auth-QOA55RYR.js} +4 -4
  11. package/dist/{autoUpdate-GJUDDLLO.js → autoUpdate-SPS4QPJU.js} +4 -4
  12. package/dist/{backgroundChecks-BTMSW34Z.js → backgroundChecks-HRJO7YK7.js} +5 -5
  13. package/dist/backgroundChecksWorker.js +5 -5
  14. package/dist/{batchRender-LI2BJRGO.js → batchRender-FBP3RKUF.js} +11 -10
  15. package/dist/{beats-H73CSYT4.js → beats-VNGJ7F6W.js} +32 -25
  16. package/dist/{benchmark-XT3A5REC.js → benchmark-NZ3N3MIV.js} +16 -16
  17. package/dist/{browser-VIOK66YK.js → browser-BD5BKRJ5.js} +9 -9
  18. package/dist/{bundleWithLocalizedFonts-PFRVWYOO.js → bundleWithLocalizedFonts-WXVNPAWD.js} +3 -3
  19. package/dist/{capture-KKD5GMAF.js → capture-CXWXKWS5.js} +120 -54
  20. package/dist/{capture-252WNPCD.js → capture-LMJ4TQRL.js} +63 -17
  21. package/dist/{captureCompositionFrame-YLYVGNN2.js → captureCompositionFrame-ZKVCRYYU.js} +21 -20
  22. package/dist/{captureFile-LYOJOUIE.js → captureFile-VIVGKFY4.js} +2 -1
  23. package/dist/{catalog-6IJGNN3T.js → catalog-WRXQSCAU.js} +28 -26
  24. package/dist/{catch-up-BFW7Z35W.js → catch-up-MDSPABFC.js} +7 -7
  25. package/dist/{check-XUWBZASR.js → check-SIBBK5HA.js} +53 -52
  26. package/dist/{checkAudio-2NRR3VHQ.js → checkAudio-QQBR4HR7.js} +19 -18
  27. package/dist/{checkBrowser-JW74KWTF.js → checkBrowser-4EBJLLIH.js} +45 -44
  28. package/dist/{chunk-XDMZY3H7.js → chunk-3O2E4Q66.js} +15 -20
  29. package/dist/{chunk-VEA7Z4PZ.js → chunk-43MW4SY7.js} +15 -7
  30. package/dist/{chunk-HJAJ6W4V.js → chunk-4F5NRJ6M.js} +2 -2
  31. package/dist/{chunk-2RT7MXFL.js → chunk-4HT2L6W2.js} +1 -1
  32. package/dist/{chunk-QVTCXN42.js → chunk-4KG3ESVO.js} +30 -4
  33. package/dist/{chunk-42KN6I6A.js → chunk-4LTBQEPD.js} +2 -2
  34. package/dist/{chunk-C6KE4AFW.js → chunk-56ANHX5U.js} +1 -1
  35. package/dist/{chunk-NVLPW3DG.js → chunk-5HB4JM7H.js} +2 -2
  36. package/dist/{chunk-2ST4WAFY.js → chunk-5PCALX6G.js} +13 -1
  37. package/dist/{chunk-AYH5ANVS.js → chunk-5YHQBCWH.js} +52 -3
  38. package/dist/{chunk-X5HHHFTX.js → chunk-6CWKORZO.js} +3 -3
  39. package/dist/{chunk-ZF3R2IPC.js → chunk-6DSYBW7Z.js} +1 -0
  40. package/dist/{chunk-VHVSBOZH.js → chunk-6JNSYFOH.js} +4 -4
  41. package/dist/{chunk-AJSU6KGS.js → chunk-6N7D2GUV.js} +15 -15
  42. package/dist/{chunk-F2ASNL2K.js → chunk-6PWQH77E.js} +1 -1
  43. package/dist/{chunk-ZNAOBFU5.js → chunk-6WRN4WC6.js} +1 -1
  44. package/dist/{chunk-GAV56VJL.js → chunk-7CPI2DWL.js} +2 -2
  45. package/dist/{chunk-CMDVJP4T.js → chunk-7PAK7LZ5.js} +11 -11
  46. package/dist/{chunk-3CISA3OS.js → chunk-AF3L5JJX.js} +1 -1
  47. package/dist/{chunk-X7RXXBYM.js → chunk-B5MPMIKQ.js} +2 -2
  48. package/dist/{chunk-RW4DMP2Y.js → chunk-BKDQFOKK.js} +4 -4
  49. package/dist/{chunk-DZG565OO.js → chunk-BLCKQPBE.js} +1 -1
  50. package/dist/chunk-BQMAPNDA.js +4830 -0
  51. package/dist/{chunk-CPSGXAYD.js → chunk-CP225S5H.js} +3 -3
  52. package/dist/{chunk-3R6SXPHD.js → chunk-CSWCZA6V.js} +3 -3
  53. package/dist/{chunk-4CY5RXXC.js → chunk-D2CE2J2A.js} +4 -4
  54. package/dist/{chunk-FMWACL3L.js → chunk-DHQSDCWD.js} +6 -2
  55. package/dist/chunk-DROFHVQD.js +240 -0
  56. package/dist/{chunk-OZUAVHFE.js → chunk-DXACKQ3F.js} +3 -3
  57. package/dist/{chunk-5QKJPCQ4.js → chunk-EGOXYG3M.js} +2 -2
  58. package/dist/{chunk-QL4ZYSIB.js → chunk-ENRFKCI6.js} +5 -71
  59. package/dist/{chunk-MRF4AMKD.js → chunk-EQBDKYXR.js} +5 -10
  60. package/dist/{chunk-4UMPIPCQ.js → chunk-ERUQ3S6D.js} +2 -2
  61. package/dist/{chunk-T2EUWCJE.js → chunk-EU7MVORF.js} +13 -1
  62. package/dist/{chunk-FULMZCDW.js → chunk-EYEEZXLI.js} +11 -11
  63. package/dist/{chunk-2MLMO25E.js → chunk-FC4WT5FX.js} +105 -7
  64. package/dist/{chunk-PLGGKTCB.js → chunk-FFDYRJBE.js} +37 -21
  65. package/dist/{chunk-7SXL476O.js → chunk-G2A6RC5R.js} +72 -28
  66. package/dist/{chunk-HTIUNMTP.js → chunk-GDZA4ALG.js} +8 -2
  67. package/dist/{chunk-CZYS6UKP.js → chunk-GEO6THL3.js} +61 -30
  68. package/dist/{chunk-MFHYBSJC.js → chunk-GHSO62LK.js} +3 -3
  69. package/dist/{chunk-P2I4RLJE.js → chunk-HTZJNQYI.js} +1 -1
  70. package/dist/{chunk-4DGLKB2H.js → chunk-HUKQW4YE.js} +1 -1
  71. package/dist/{chunk-WYB3VKLK.js → chunk-HZN7ICAF.js} +8 -8
  72. package/dist/{chunk-6ZFDNEMY.js → chunk-IIJVSCSH.js} +16 -16
  73. package/dist/{chunk-VDVVQNTK.js → chunk-IL2TMC6F.js} +5 -5
  74. package/dist/{chunk-L5MFWGGU.js → chunk-J67FSI3Q.js} +623 -376
  75. package/dist/chunk-JLCAHJUO.js +91 -0
  76. package/dist/{chunk-N7ZMDVAK.js → chunk-JLGVBK5M.js} +1 -1
  77. package/dist/{chunk-SFYLZX5C.js → chunk-K4PHB3YQ.js} +59 -15
  78. package/dist/{chunk-G6W55MTX.js → chunk-KTWGVEN6.js} +40 -11
  79. package/dist/{chunk-FNNGQ3DB.js → chunk-LSMFOZ4F.js} +2 -2
  80. package/dist/{chunk-ELP5QZWL.js → chunk-M4QZFUMW.js} +1 -1
  81. package/dist/{chunk-PNKLOMHQ.js → chunk-MBGM26P5.js} +17 -22
  82. package/dist/{chunk-ZTEKVSZ6.js → chunk-MMJAHBH2.js} +1 -1
  83. package/dist/{chunk-RDDVQSNQ.js → chunk-MPO25DQW.js} +451 -208
  84. package/dist/{chunk-E2ZZSDDQ.js → chunk-MW2NQQ6Z.js} +2 -2
  85. package/dist/{chunk-TSJVPPXT.js → chunk-MYO77JWR.js} +1 -1
  86. package/dist/{chunk-PSX5SF2N.js → chunk-NEASABW6.js} +1 -1
  87. package/dist/{chunk-OFRRUYBA.js → chunk-NHA4NRBE.js} +135 -24
  88. package/dist/{chunk-NNLQTG3M.js → chunk-NZ6G5YWZ.js} +2 -2
  89. package/dist/{chunk-WHD5IAHI.js → chunk-ORFRUZPB.js} +2 -2
  90. package/dist/{chunk-Z3XXLTVB.js → chunk-OTXXDONS.js} +3 -3
  91. package/dist/{chunk-2S263R6D.js → chunk-P7WGVXR7.js} +9 -9
  92. package/dist/{chunk-AXEEZKIL.js → chunk-PKVA6MPV.js} +6 -6
  93. package/dist/{chunk-FJW757TF.js → chunk-PSOAGSNO.js} +2 -2
  94. package/dist/{chunk-AEC4T4IF.js → chunk-PWEOSJ3E.js} +12 -12
  95. package/dist/{chunk-X7A7C4JS.js → chunk-Q43YUROE.js} +3 -3
  96. package/dist/{chunk-PQYWYBEQ.js → chunk-QP2MJYTJ.js} +1 -1
  97. package/dist/{chunk-VW2LVMKB.js → chunk-QWBVPWUI.js} +47 -55
  98. package/dist/{chunk-AAX2A7LQ.js → chunk-S2OLTAEL.js} +2 -2
  99. package/dist/{chunk-CNVHMLPI.js → chunk-S4KHJERB.js} +1 -1
  100. package/dist/{chunk-2BGOB2QK.js → chunk-SE2MXV2N.js} +136 -25
  101. package/dist/{chunk-3CS6QYL7.js → chunk-SI7QCT2J.js} +8 -8
  102. package/dist/{chunk-CIHW6VM2.js → chunk-SKKQMW5X.js} +1 -1
  103. package/dist/{chunk-3B2DBUQX.js → chunk-TNTGGDSD.js} +1 -1
  104. package/dist/chunk-TSYRN646.js +84 -0
  105. package/dist/{chunk-XOM3XTJ4.js → chunk-U6KN6OIP.js} +2 -2
  106. package/dist/{chunk-63DGZRZP.js → chunk-ULL3U6PV.js} +1 -1
  107. package/dist/{chunk-IXXVS2Z4.js → chunk-VQB7G5BM.js} +1 -1
  108. package/dist/{chunk-UMUVGNOH.js → chunk-VR3JLTZD.js} +3 -3
  109. package/dist/{chunk-DEVZJ4AL.js → chunk-VS4SK7BN.js} +17 -11
  110. package/dist/{chunk-6N65ZMC5.js → chunk-VYRJAQGC.js} +1 -1
  111. package/dist/{chunk-FLREUEHW.js → chunk-W4DMQZL5.js} +1 -1
  112. package/dist/chunk-WABB4LZS.js +62 -0
  113. package/dist/{chunk-RXATE6FZ.js → chunk-WC4MTXGN.js} +22 -0
  114. package/dist/{chunk-36QE3P6B.js → chunk-WNMVC3IT.js} +1 -1
  115. package/dist/{chunk-T6SD37JZ.js → chunk-X6MCIK7L.js} +103 -16
  116. package/dist/chunk-XFMO3BEN.js +71 -0
  117. package/dist/{chunk-BBUK6A7Q.js → chunk-XG3IZV62.js} +7 -7
  118. package/dist/chunk-XMRA7CQG.js +22 -0
  119. package/dist/{chunk-G6QDFWDN.js → chunk-XOFBXLMG.js} +2 -2
  120. package/dist/{chunk-H4JO7VSI.js → chunk-XUQYC5DD.js} +12 -12
  121. package/dist/chunk-Z5J67X44.js +40 -0
  122. package/dist/{chunk-HEP5XMXV.js → chunk-Z5TGBEPJ.js} +9 -2
  123. package/dist/{chunk-7JAD4MEW.js → chunk-ZA5TNF4R.js} +1 -0
  124. package/dist/{clean-N5VSKUVS.js → clean-6GX7WAEC.js} +32 -31
  125. package/dist/cli.js +58 -58
  126. package/dist/{cloud-74NF5FXC.js → cloud-6PFJKLNL.js} +4 -4
  127. package/dist/{cloudrun-7UOH335V.js → cloudrun-UGG3ZFH7.js} +13 -12
  128. package/dist/commands/layout-audit.browser.js +3 -15
  129. package/dist/{compare-AY2LS2TZ.js → compare-P4EBOP4B.js} +46 -45
  130. package/dist/{compiler-4MHMC777.js → compiler-PG4RKX6K.js} +8 -8
  131. package/dist/{component-CFWQOAZI.js → component-SQPMI3W7.js} +3 -3
  132. package/dist/{compositions-DXLJTDSP.js → compositions-KRIHY3IY.js} +20 -19
  133. package/dist/{contactSheet-5APX35L3.js → contactSheet-RYAE7Y5D.js} +3 -2
  134. package/dist/{delete-GB4MS7LM.js → delete-T5TO4SV6.js} +7 -7
  135. package/dist/{deploy-NXD3Q3KD.js → deploy-AO6LQR5G.js} +6 -6
  136. package/dist/{deterministicFonts-775YXAQ2.js → deterministicFonts-LKAGUNE5.js} +3 -3
  137. package/dist/{dist-3ZJMZU75.js → dist-23AAB5X2.js} +36 -36
  138. package/dist/{dist-ZY6IFESG.js → dist-6IMEDVMC.js} +6 -3
  139. package/dist/docker/Dockerfile.render +1 -1
  140. package/dist/docs/rendering.md +3 -0
  141. package/dist/{doctor-CVY2XXKS.js → doctor-QBUJQ655.js} +23 -22
  142. package/dist/{events-RYQYEWBV.js → events-J7CESLKQ.js} +4 -4
  143. package/dist/{events-T3CLIYRG.js → events-SIZO7YHI.js} +5 -5
  144. package/dist/{feedback-K5ZMMLTA.js → feedback-74WOJ5PN.js} +22 -22
  145. package/dist/{ffmpeg-UNDAJ2IC.js → ffmpeg-AKUP6U2S.js} +17 -16
  146. package/dist/{figma-MYYCX635.js → figma-GGMYRR4Q.js} +3 -3
  147. package/dist/fontLocalizeCli.js +21 -19
  148. package/dist/{get-JVIDYMVP.js → get-PLKAI6JM.js} +7 -7
  149. package/dist/{gpuPolicy-KEX7GDRJ.js → gpuPolicy-EYDAAPJF.js} +14 -13
  150. package/dist/{grade-compare-QEF6VASJ.js → grade-compare-UADJP4AV.js} +44 -43
  151. package/dist/{gsapParserAcorn-LZJKCFQI.js → gsapParserAcorn-5YD4N6HQ.js} +2 -2
  152. package/dist/hangReport.js +47 -0
  153. package/dist/{heifImagePrep-A3ZPVQGU.js → heifImagePrep-KDF3OPOK.js} +15 -14
  154. package/dist/{help-XPPSLIRY.js → help-WSQQ555Q.js} +1 -1
  155. package/dist/{history-OFOPRD27.js → history-VSQ2DQ3V.js} +110 -62
  156. package/dist/hyperframe.manifest.json +1 -1
  157. package/dist/hyperframe.runtime.iife.js +76 -71
  158. package/dist/hyperframes-player.global.js +3 -3
  159. package/dist/{info-7RF6FQX5.js → info-MOQ4LRC3.js} +18 -18
  160. package/dist/{init-NTIXWA3D.js → init-EONQSZJG.js} +62 -60
  161. package/dist/{inspect-MYMCV5E7.js → inspect-OLCVLHOU.js} +43 -42
  162. package/dist/{installer-PYJIJ3PJ.js → installer-GHISA75B.js} +10 -10
  163. package/dist/{keyframes-UJ52PYE4.js → keyframes-DGQYCY24.js} +13 -13
  164. package/dist/{lambda-SBNUYEQE.js → lambda-AMMWF2YH.js} +35 -15
  165. package/dist/{layout-IOMCOABO.js → layout-R6CAPGRO.js} +43 -42
  166. package/dist/{lint-AQWHHMPS.js → lint-QZJEYPHD.js} +14 -11
  167. package/dist/{lintProject-5A4SCW3S.js → lintProject-W3YVHAGP.js} +6 -3
  168. package/dist/{list-WKAJ5SP3.js → list-KCJID4SP.js} +7 -7
  169. package/dist/localPage-V3HBGM3Z.js +27 -0
  170. package/dist/{login-3ZDK5JOA.js → login-7HKBEPJS.js} +7 -7
  171. package/dist/{logout-JYFWWUGK.js → logout-3IID4KXD.js} +3 -3
  172. package/dist/{manager-QYFYWZOK.js → manager-6YSKJMVD.js} +19 -18
  173. package/dist/{manager-F2YREC5X.js → manager-Z7W4GQGF.js} +9 -5
  174. package/dist/{media-treatment-4OLWVHUY.js → media-treatment-E3DL6LEZ.js} +34 -31
  175. package/dist/{models-MR55FAUX.js → models-URWI7YEG.js} +30 -29
  176. package/dist/{motionShot-DC47S7BT.js → motionShot-27IXMDJK.js} +25 -24
  177. package/dist/{normalize-audio-M2TK4NG5.js → normalize-audio-WGRLPR3P.js} +16 -16
  178. package/dist/{open-YXWBWTKL.js → open-LQ35PLEN.js} +21 -21
  179. package/dist/{parakeetRunner-J6QR3GTG.js → parakeetRunner-XASVIDTI.js} +27 -26
  180. package/dist/{pipeline-7MJ5H4SW.js → pipeline-GA7QVCHS.js} +18 -17
  181. package/dist/{play-S562STR4.js → play-RYZP77CI.js} +31 -31
  182. package/dist/{policies-GHVXA5PE.js → policies-PKLD4UW5.js} +1 -1
  183. package/dist/{preflight-QWGXMISC.js → preflight-HJFSJXXF.js} +19 -18
  184. package/dist/{present-PGOHZT3L.js → present-YBMLOWZV.js} +26 -26
  185. package/dist/{preview-JU75H4QN.js → preview-QIRKJCRV.js} +52 -39
  186. package/dist/{producer-H66OMZLW.js → producer-524FDOLX.js} +1 -1
  187. package/dist/{projectConfig-COSP24YT.js → projectConfig-IDQN5ZRW.js} +14 -13
  188. package/dist/{publication-J3XYHPGB.js → publication-3X3IGSDO.js} +8 -8
  189. package/dist/{publish-7GCCEPJZ.js → publish-2BF7K6HX.js} +21 -20
  190. package/dist/{refresh-USSFPJAU.js → refresh-3IRHJEQA.js} +3 -3
  191. package/dist/{remove-background-WRCGIU32.js → remove-background-EZBCEFT6.js} +22 -21
  192. package/dist/{render-QS3YJCBR.js → render-EFUA2A6A.js} +15 -11
  193. package/dist/{render-VUVTK2JM.js → render-JFMTAXHD.js} +87 -53
  194. package/dist/{render-5J5PP3UK.js → render-TEEBI2UT.js} +49 -43
  195. package/dist/{render-batch-Q2LQ3D4P.js → render-batch-XTYNXVSW.js} +16 -12
  196. package/dist/renderSetupWorker.js +12 -9
  197. package/dist/{resolver-QCBWPRSC.js → resolver-FZS6TN6B.js} +10 -10
  198. package/dist/{screenshotCapture-I5EDCITF.js → screenshotCapture-HOW4VSV6.js} +3 -2
  199. package/dist/{sherpa-IZ22SC5W.js → sherpa-TQIAIKTH.js} +26 -25
  200. package/dist/skills/hyperframes/SKILL.md +1 -1
  201. package/dist/skills/hyperframes/references/format.md +1 -0
  202. package/dist/skills/hyperframes-cli/references/beats.md +2 -0
  203. package/dist/skills/hyperframes-cli/references/init-and-scaffold.md +1 -0
  204. package/dist/skills/hyperframes-cli/references/lambda.md +3 -0
  205. package/dist/skills/hyperframes-cli/references/preview-render.md +3 -0
  206. package/dist/skills/media-use/references/grading.md +2 -0
  207. package/dist/skills/media-use/references/local.md +1 -0
  208. package/dist/{skills-3RFMPMJA.js → skills-S6ZG5KKH.js} +10 -10
  209. package/dist/{skillsUpdateCheck-DWBFVUBT.js → skillsUpdateCheck-XC7JQL3F.js} +5 -5
  210. package/dist/{snapshot-5PHA43DK.js → snapshot-ERYZIM32.js} +152 -80
  211. package/dist/{src-4YJKYMNF.js → src-6XOMREMS.js} +21 -12
  212. package/dist/{src-36BQVJL3.js → src-OL6RHPE4.js} +22 -20
  213. package/dist/{staticProjectServer-3XFB76XS.js → staticProjectServer-JYDDGPAH.js} +26 -26
  214. package/dist/{status-LR7VXITS.js → status-DTP6ZYDU.js} +3 -3
  215. package/dist/studio/assets/hyperframes-player-5dRdMVOq.js +478 -0
  216. package/dist/studio/assets/{index-CwreIGoq.js → index-Bu3mJUU2.js} +131 -131
  217. package/dist/studio/assets/{index-BNuxGFZK.js → index-ZqyQ91pm.js} +1 -1
  218. package/dist/studio/index.html +1 -1
  219. package/dist/{studio-api-WL6EZ4KE.js → studio-api-GRU4SHKD.js} +18 -18
  220. package/dist/{studioServer-ZS5RA6U3.js → studioServer-OYPBEI5B.js} +76 -73
  221. package/dist/{synthesize-QCRP3NI7.js → synthesize-QZHRXGRY.js} +26 -4
  222. package/dist/{telemetry-IHU4HL3R.js → telemetry-6BPSGY5W.js} +2 -2
  223. package/dist/{telemetry-W3LRO3TB.js → telemetry-CPYINR63.js} +5 -5
  224. package/dist/{timeline-BDO5DYWP.js → timeline-RGK5BMPD.js} +34 -33
  225. package/dist/{tokens-47CEMYFV.js → tokens-EX4BOWRW.js} +2 -2
  226. package/dist/{transcribe-XF3NL6JI.js → transcribe-MK367I6A.js} +24 -23
  227. package/dist/{transcribe-GEPVJO3A.js → transcribe-RI52JMVW.js} +35 -34
  228. package/dist/{tts-QM4RFE7U.js → tts-AY4JO5NQ.js} +2 -2
  229. package/dist/{updateCheck-BON6ZFYP.js → updateCheck-BIEJKQI4.js} +4 -4
  230. package/dist/{upgrade-KIF5Z4J3.js → upgrade-ES3UUI7O.js} +4 -4
  231. package/dist/upstreamProxy-W5FWAT5Z.js +17 -0
  232. package/dist/{urlDownloader-UDRHVUWR.js → urlDownloader-XAGYSTAG.js} +13 -12
  233. package/dist/{validate-2OPSQT3W.js → validate-A6GZHNEI.js} +36 -35
  234. package/dist/{video-ECWXMY4F.js → video-OEMGR3MN.js} +19 -15
  235. package/dist/warmCheck.js +53 -52
  236. package/package.json +2 -1
  237. package/dist/chunk-4YYJOFKS.js +0 -28
  238. package/dist/chunk-KLIPVNCO.js +0 -4824
  239. package/dist/studio/assets/hyperframes-player-lCVwx9d3.js +0 -478
  240. package/dist/{destroy-SSPAKADI.js → destroy-CGAZIL2C.js} +4 -4
@@ -12,12 +12,13 @@ import {
12
12
  } from "./chunk-6A45RKAK.js";
13
13
  import {
14
14
  describeProject
15
- } from "./chunk-H4JO7VSI.js";
15
+ } from "./chunk-XUQYC5DD.js";
16
16
  import "./chunk-LLMSX6V6.js";
17
17
  import {
18
18
  bandFramesOf,
19
19
  decodeAudio,
20
20
  envelope,
21
+ loudness,
21
22
  medianInterval,
22
23
  probeAudio,
23
24
  rhythm,
@@ -26,18 +27,18 @@ import {
26
27
  signalProvider,
27
28
  snapper,
28
29
  tempoOf
29
- } from "./chunk-ZF3R2IPC.js";
30
+ } from "./chunk-6DSYBW7Z.js";
31
+ import {
32
+ ensureDOMParser
33
+ } from "./chunk-ZBAF6L74.js";
30
34
  import {
31
35
  refreshIfNeeded,
32
36
  resolveCloudBaseUrl
33
- } from "./chunk-6N65ZMC5.js";
37
+ } from "./chunk-VYRJAQGC.js";
34
38
  import {
35
39
  buildAuthHeaders,
36
40
  tryResolveCredential
37
- } from "./chunk-ELP5QZWL.js";
38
- import {
39
- ensureDOMParser
40
- } from "./chunk-ZBAF6L74.js";
41
+ } from "./chunk-M4QZFUMW.js";
41
42
  import {
42
43
  downloadToFile
43
44
  } from "./chunk-CZUAX3BV.js";
@@ -46,17 +47,17 @@ import {
46
47
  } from "./chunk-6MUI2H6P.js";
47
48
  import {
48
49
  resolveProject
49
- } from "./chunk-HEP5XMXV.js";
50
- import "./chunk-IXXVS2Z4.js";
51
- import "./chunk-PQYWYBEQ.js";
50
+ } from "./chunk-Z5TGBEPJ.js";
51
+ import "./chunk-VQB7G5BM.js";
52
+ import "./chunk-QP2MJYTJ.js";
52
53
  import "./chunk-K2FLNJVB.js";
53
54
  import "./chunk-EOVYQ3IG.js";
54
- import "./chunk-FMWACL3L.js";
55
- import "./chunk-FJW757TF.js";
55
+ import "./chunk-DHQSDCWD.js";
56
+ import "./chunk-PSOAGSNO.js";
56
57
  import "./chunk-VWG7OQKU.js";
57
58
  import {
58
59
  assertKnownFlags
59
- } from "./chunk-HTIUNMTP.js";
60
+ } from "./chunk-GDZA4ALG.js";
60
61
  import {
61
62
  defineCommand
62
63
  } from "./chunk-S3S4TGEH.js";
@@ -65,25 +66,23 @@ import {
65
66
  CliUsageError
66
67
  } from "./chunk-JVBRJMOP.js";
67
68
  import "./chunk-ZTZA4UWZ.js";
68
- import "./chunk-RDDVQSNQ.js";
69
+ import "./chunk-MPO25DQW.js";
70
+ import "./chunk-Z5J67X44.js";
69
71
  import "./chunk-5S7W3TUO.js";
70
- import "./chunk-VW2LVMKB.js";
71
- import "./chunk-RQVDTPGD.js";
72
- import "./chunk-MFHYBSJC.js";
73
- import "./chunk-KLIPVNCO.js";
72
+ import "./chunk-GHSO62LK.js";
73
+ import "./chunk-QWBVPWUI.js";
74
+ import "./chunk-BQMAPNDA.js";
74
75
  import "./chunk-VC76R6W2.js";
75
- import "./chunk-OFRRUYBA.js";
76
- import "./chunk-FR7YBU3H.js";
77
76
  import "./chunk-OFQWTKPW.js";
78
- import "./chunk-DPVXBVLL.js";
77
+ import "./chunk-RQVDTPGD.js";
79
78
  import "./chunk-3GXQPCJC.js";
80
79
  import "./chunk-634HSJ3J.js";
81
80
  import "./chunk-FXMKHHPO.js";
82
81
  import "./chunk-QSFWGZG6.js";
83
82
  import "./chunk-XT6MXC7A.js";
84
83
  import "./chunk-K4MJX7SR.js";
85
- import "./chunk-4UMPIPCQ.js";
86
- import "./chunk-2MLMO25E.js";
84
+ import "./chunk-ERUQ3S6D.js";
85
+ import "./chunk-FC4WT5FX.js";
87
86
  import "./chunk-CZGHFATT.js";
88
87
  import {
89
88
  findFfBinary
@@ -91,21 +90,24 @@ import {
91
90
  import {
92
91
  resolveAuthoredAssetFile
93
92
  } from "./chunk-PBNWRWKA.js";
94
- import "./chunk-2BGOB2QK.js";
93
+ import "./chunk-SE2MXV2N.js";
94
+ import "./chunk-NHA4NRBE.js";
95
+ import "./chunk-FR7YBU3H.js";
96
+ import "./chunk-DPVXBVLL.js";
95
97
  import "./chunk-GWTIFRF5.js";
96
98
  import "./chunk-2RY2LWAA.js";
97
99
  import "./chunk-3422KMTD.js";
98
- import "./chunk-RXATE6FZ.js";
100
+ import "./chunk-WC4MTXGN.js";
99
101
  import "./chunk-UIOZIIB7.js";
100
102
  import {
101
103
  withMeta
102
- } from "./chunk-XOM3XTJ4.js";
104
+ } from "./chunk-U6KN6OIP.js";
103
105
  import "./chunk-K4WIOZFP.js";
104
- import "./chunk-PSX5SF2N.js";
106
+ import "./chunk-NEASABW6.js";
105
107
  import "./chunk-WERLJGIC.js";
106
108
  import "./chunk-ISN5GRYI.js";
107
- import "./chunk-E2ZZSDDQ.js";
108
- import "./chunk-T2EUWCJE.js";
109
+ import "./chunk-MW2NQQ6Z.js";
110
+ import "./chunk-EU7MVORF.js";
109
111
  import "./chunk-M2WBOQ2Q.js";
110
112
 
111
113
  // src/commands/audio.ts
@@ -834,11 +836,11 @@ function hitsLine(onsets, at) {
834
836
  const more = onsets.events.length - shown.length;
835
837
  return ` hits ${shown.join(" ")}${more > 0 ? ` +${more}` : ""}`;
836
838
  }
837
- function loudnessLine(loudness, at) {
838
- const lufs = loudness.lufsIntegrated === null ? "below gate" : `${loudness.lufsIntegrated} LUFS`;
839
- const { count, firstAt } = loudness.clipping;
839
+ function loudnessLine(loudness2, at) {
840
+ const lufs2 = loudness2.lufsIntegrated === null ? "below gate" : `${loudness2.lufsIntegrated} LUFS`;
841
+ const { count, firstAt } = loudness2.clipping;
840
842
  const clip = count && firstAt !== null ? `, clips ${count}\xD7 from ${at(firstAt)}` : "";
841
- return ` loudness ${lufs}, true peak ${loudness.truePeakDb} dBTP${clip}`;
843
+ return ` loudness ${lufs2}, true peak ${loudness2.truePeakDb} dBTP${clip}`;
842
844
  }
843
845
  function silenceLine(silence, at) {
844
846
  return silence.length ? ` silent ${silence.map((g) => `${at(g.start)}\u2013${at(g.end)}`).join(" ")}` : null;
@@ -1035,10 +1037,14 @@ async function analyzeTargets(targets, request, full = false) {
1035
1037
  var READ_RATE = 22050;
1036
1038
  var PITCH_RATE = 8e3;
1037
1039
  var SILENT_DB = -120;
1040
+ var ABSENT_DB = -55;
1038
1041
  async function decodeMono(path, sampleRate = READ_RATE) {
1039
1042
  const decoded = await decodeAudio(path, {}, void 0, { sampleRate, mono: true });
1040
1043
  if (!decoded) throw new Error(`${path} has no audio stream`);
1041
- return decoded.signal.channels[0];
1044
+ const samples = decoded.signal.channels[0];
1045
+ if (samples.some((sample) => !Number.isFinite(sample)))
1046
+ throw new Error(`${path} contains non-finite audio samples`);
1047
+ return samples;
1042
1048
  }
1043
1049
  var asSignal = (samples, sampleRate = READ_RATE) => ({
1044
1050
  sampleRate,
@@ -1066,6 +1072,16 @@ function levels(samples, sampleRate, hop, window = hop * 2) {
1066
1072
  }
1067
1073
  return out;
1068
1074
  }
1075
+ function levelWhileHeardDb(samples, sampleRate) {
1076
+ let sum = 0;
1077
+ let heard = 0;
1078
+ for (const db of levels(samples, sampleRate, 0.1, 0.4))
1079
+ if (db >= ABSENT_DB) {
1080
+ sum += 10 ** (db / 10);
1081
+ heard++;
1082
+ }
1083
+ return heard ? Math.round(10 * Math.log10(sum / heard)) : null;
1084
+ }
1069
1085
  function quantile(values, q) {
1070
1086
  if (!values.length) return NaN;
1071
1087
  const sorted = Float64Array.from(values).sort();
@@ -1076,6 +1092,13 @@ var round6 = (n, places = 2) => {
1076
1092
  const k = 10 ** places;
1077
1093
  return Math.round(n * k) / k;
1078
1094
  };
1095
+ function spanDb(samples, sampleRate, start, end) {
1096
+ const a = Math.max(0, Math.round(start * sampleRate));
1097
+ const b = Math.min(samples.length, Math.round(end * sampleRate));
1098
+ let sum = 0;
1099
+ for (let i = a; i < b; i++) sum += samples[i] ** 2;
1100
+ return b > a && sum > 0 ? Math.max(SILENT_DB, 10 * Math.log10(sum / (b - a))) : SILENT_DB;
1101
+ }
1079
1102
 
1080
1103
  // src/audio/read/pitch.ts
1081
1104
  var FRAME = 320;
@@ -1139,12 +1162,27 @@ var semitones = (a, b) => 12 * Math.log2(a / b);
1139
1162
 
1140
1163
  // src/audio/read/format.ts
1141
1164
  var PITCH_NOTE_SEMITONES = 3;
1142
- var KIND_WIDTH = 7;
1165
+ var KIND_WIDTH = 8;
1166
+ var QUIET_DB = -45;
1167
+ var SILENT_DB2 = -55;
1168
+ var LEVEL_DB = 0.5;
1143
1169
  var s2 = (t) => t.toFixed(1);
1144
1170
  var signed = (db) => `${db >= 0 ? "+" : ""}${db} dB`;
1171
+ var dbfs = (db) => `${db} dBFS`;
1172
+ var lufs = (db) => `${Math.round(db)} LUFS`;
1145
1173
  function when(line) {
1146
1174
  return line.end === null ? s2(line.start) : `${s2(line.start)}\u2013${s2(line.end)}`;
1147
1175
  }
1176
+ function marginOf({ voiceLufs, musicLufs }) {
1177
+ const margin = voiceLufs - musicLufs;
1178
+ const apart = Math.max(1, Math.abs(Math.round(voiceLufs) - Math.round(musicLufs)));
1179
+ const verdict = Math.abs(margin) < LEVEL_DB ? "level with each other" : margin > 0 ? `voice ${apart} dB over music` : `music ${apart} dB over voice`;
1180
+ return `voice ${lufs(voiceLufs)}, music ${lufs(musicLufs)}: ${verdict}`;
1181
+ }
1182
+ function closing(sentence) {
1183
+ const parts = sentence.ending && sentence.ending !== "level" ? [`${sentence.ending} end`] : [];
1184
+ return sentence.againstMusic ? [...parts, marginOf(sentence.againstMusic)] : parts;
1185
+ }
1148
1186
  function voiceLine(sentence, voice) {
1149
1187
  const { unit, meanRate, medianPitchHz } = voice;
1150
1188
  const parts = [sentence.text === null ? "(no transcript)" : `"${sentence.text}"`];
@@ -1152,23 +1190,25 @@ function voiceLine(sentence, voice) {
1152
1190
  parts.push(`${sentence.rate} ${unit}/s${meanRate !== null ? ` (mean ${meanRate})` : ""}`);
1153
1191
  if (sentence.pitchHz !== null && medianPitchHz !== null && Math.abs(semitones(sentence.pitchHz, medianPitchHz)) >= PITCH_NOTE_SEMITONES)
1154
1192
  parts.push(`pitch ${sentence.pitchHz} Hz (median ${medianPitchHz})`);
1155
- if (sentence.ending && sentence.ending !== "level") parts.push(`${sentence.ending} end`);
1193
+ parts.push(...closing(sentence));
1156
1194
  return { start: sentence.start, end: sentence.end, kind: "voice", text: parts.join(" ") };
1157
1195
  }
1158
1196
  function placeOf(t, pauses) {
1159
1197
  const pause = pauses.find((p) => t >= p.start && t < p.end);
1160
1198
  return pause ? `${(t - pause.start).toFixed(1)} s into the pause` : null;
1161
1199
  }
1162
- function standing(effect, musicRead) {
1163
- if (effect.overMusicDb !== null) return `${signed(effect.overMusicDb)} over music`;
1164
- return musicRead ? "while the music is out" : `${signed(effect.riseDb)} over what played before`;
1200
+ function standing(effect) {
1201
+ const peak = `peak ${dbfs(effect.peakDb)}`;
1202
+ if (effect.overMusicDb !== null) return `${peak}, ${signed(effect.overMusicDb)} over music`;
1203
+ if (effect.riseDb === null) return `${peak}, out of silence`;
1204
+ return `${peak}, ${signed(effect.riseDb)} over what played before`;
1165
1205
  }
1166
- function effectLine(effect, pauses, musicRead) {
1206
+ function effectLine(effect, pauses) {
1167
1207
  const parts = [
1168
1208
  `${effect.kind}${effect.count > 1 ? ` \xD7${effect.count}` : ""} (${effect.group}): ${effect.band}`,
1169
1209
  `attack ${effect.attackMs} ms`,
1170
1210
  `tail ${effect.tail.toFixed(1)} s`,
1171
- standing(effect, musicRead)
1211
+ standing(effect)
1172
1212
  ];
1173
1213
  const place = placeOf(effect.t, pauses);
1174
1214
  if (place) parts.push(place);
@@ -1176,64 +1216,100 @@ function effectLine(effect, pauses, musicRead) {
1176
1216
  }
1177
1217
  var ENTRY = {
1178
1218
  start: "",
1179
- new: ", first appearance after a break",
1180
- resumes: ", resumes after a break",
1219
+ new: ", first appearance",
1220
+ resumes: ", resumes",
1181
1221
  returns: ", returns"
1182
1222
  };
1183
1223
  function musicLine(segment, analysis) {
1184
1224
  const piece = analysis.music.pieces.find((p) => p.id === segment.piece);
1185
1225
  const about = [piece.instruments.join(", "), segment.bpm ? `${segment.bpm} BPM` : null].filter(Boolean).join(" \xB7 ");
1226
+ const afterBreak = (segment.entry === "new" || segment.entry === "resumes") && analysis.music.breaks.some((gap) => gap.end === segment.start) ? " after a break" : "";
1186
1227
  const fade = segment.fadeFrom !== null ? `, fades from ${s2(segment.fadeFrom)}` : "";
1187
1228
  return {
1188
1229
  start: segment.start,
1189
1230
  end: segment.end,
1190
1231
  kind: "music",
1191
- text: `piece ${piece.id}${about ? ` (${about})` : ""}${ENTRY[segment.entry]}${fade}`
1232
+ text: `piece ${piece.id}${about ? ` (${about})` : ""}${ENTRY[segment.entry]}${afterBreak}${fade}`
1233
+ };
1234
+ }
1235
+ function effectsIn(events) {
1236
+ if (!events.length) return null;
1237
+ const counts = /* @__PURE__ */ new Map();
1238
+ for (const e of events) counts.set(e.kind, (counts.get(e.kind) ?? 0) + e.count);
1239
+ const kinds = [...counts].map(([kind, n]) => n > 1 ? `${kind} \xD7${n}` : kind).join(", ");
1240
+ const total = events.reduce((n, e) => n + e.count, 0);
1241
+ return `${total} ${total === 1 ? "effect" : "effects"} (${kinds})`;
1242
+ }
1243
+ function pauseLine(pause, analysis) {
1244
+ const inside = (start, end) => start < pause.end && end > pause.start;
1245
+ const clip = (start, end) => `${s2(Math.max(start, pause.start))}\u2013${s2(Math.min(end, pause.end))}`;
1246
+ const beds = [
1247
+ ...analysis.music?.segments.filter((m) => inside(m.start, m.end)).map((m) => `music ${clip(m.start, m.end)}`) ?? [],
1248
+ ...analysis.ambience?.filter((a) => inside(a.start, a.end)).map((a) => `ambience ${clip(a.start, a.end)}`) ?? []
1249
+ ];
1250
+ if (!beds.length && pause.recordingDb >= SILENT_DB2)
1251
+ beds.push(`sound continues at ${dbfs(pause.recordingDb)}`);
1252
+ const effects = effectsIn(
1253
+ analysis.effects?.events.filter((e) => e.t >= pause.start && e.t < pause.end) ?? []
1254
+ );
1255
+ const heard = [...effects ? [effects] : [], ...beds];
1256
+ const length = `${(pause.end - pause.start).toFixed(1)} s`;
1257
+ const text = heard.length ? `${length}; during it: ${heard.join(", ")}` : `${length}, silent`;
1258
+ return { start: pause.start, end: pause.end, kind: "pause", text };
1259
+ }
1260
+ function ambienceLine(ambience) {
1261
+ const level = `${ambience.db} dBFS`;
1262
+ return {
1263
+ start: ambience.start,
1264
+ end: ambience.end,
1265
+ kind: "ambience",
1266
+ text: ambience.db < QUIET_DB ? `quiet, ${level}` : level
1192
1267
  };
1193
1268
  }
1194
1269
  function overlaps(line, range) {
1195
1270
  if (!range) return true;
1196
1271
  return line.start < range[1] && (line.end ?? line.start) >= range[0];
1197
1272
  }
1273
+ function separation(analysis) {
1274
+ if (analysis.separation !== "stems") return "not separated";
1275
+ const heard = analysis.stems.map((stem) => `${stem.name} ${stem.db} dB`).join(", ");
1276
+ return `stems: ${heard || "all silent"}`;
1277
+ }
1278
+ function voiceSummary(voice) {
1279
+ const rate = voice.meanRate !== null ? `mean ${voice.meanRate} ${voice.unit}/s` : null;
1280
+ const pitch = voice.medianPitchHz !== null ? `median pitch ${voice.medianPitchHz} Hz` : null;
1281
+ return `voice: ${voice.sentences.length} lines, ${voice.pauses.length} pauses${[rate, pitch].filter(Boolean).map((p) => `, ${p}`).join("")}`;
1282
+ }
1283
+ function effectsSummary(effects) {
1284
+ const top = effects.groups.slice(0, 6).map((g) => `${g.id} ${g.kind} \xD7${g.count}`).join(", ");
1285
+ return `effects: ${effects.events.length} in ${effects.groups.length} sounds${top ? ` (${top})` : ""}${effects.drumHits ? `; ${effects.drumHits} drum hits on the beat left out` : ""}`;
1286
+ }
1287
+ var musicSummary = (music) => music.pieces.length ? `music: ${music.pieces.length} pieces, ${music.breaks.length} breaks` : "music: none";
1198
1288
  function header(analysis) {
1199
- const { voice, effects, music } = analysis;
1200
- const separated2 = analysis.separation === "stems" ? `stems: ${analysis.stems.join(", ")}` : "not separated";
1201
- const lines = [`${analysis.file} \xB7 ${s2(analysis.duration)} s \xB7 ${separated2}`];
1202
- if (voice) {
1203
- const rate = voice.meanRate !== null ? `mean ${voice.meanRate} ${voice.unit}/s` : null;
1204
- const pitch = voice.medianPitchHz !== null ? `median pitch ${voice.medianPitchHz} Hz` : null;
1205
- lines.push(
1206
- `voice: ${voice.sentences.length} lines, ${voice.pauses.length} pauses${[rate, pitch].filter(Boolean).map((p) => `, ${p}`).join("")}`
1207
- );
1208
- }
1209
- if (effects) {
1210
- const top = effects.groups.slice(0, 6).map((g) => `${g.id} ${g.kind} \xD7${g.count}`).join(", ");
1211
- lines.push(
1212
- `effects: ${effects.events.length} in ${effects.groups.length} sounds${top ? ` (${top})` : ""}${effects.drumHits ? `; ${effects.drumHits} drum hits on the beat left out` : ""}`
1213
- );
1214
- }
1215
- if (music) lines.push(`music: ${music.pieces.length} pieces, ${music.breaks.length} breaks`);
1216
- return lines;
1289
+ const { voice, effects, music, ambience } = analysis;
1290
+ return [
1291
+ `${analysis.file} \xB7 ${s2(analysis.duration)} s \xB7 ${separation(analysis)}`,
1292
+ voice && voiceSummary(voice),
1293
+ effects && effectsSummary(effects),
1294
+ music && musicSummary(music),
1295
+ ambience?.length && `ambience: ${ambience.length} stretches`
1296
+ ].filter((line) => typeof line === "string");
1217
1297
  }
1218
1298
  function formatRead(analysis, range) {
1219
1299
  const { voice, effects } = analysis;
1220
1300
  const pauses = voice?.pauses ?? [];
1221
1301
  const lines = [
1222
1302
  ...voice?.sentences.map((x) => voiceLine(x, voice)) ?? [],
1223
- ...pauses.map((p) => ({
1224
- start: p.start,
1225
- end: p.end,
1226
- kind: "pause",
1227
- text: `${(p.end - p.start).toFixed(1)} s`
1228
- })),
1229
- ...effects?.events.map((e) => effectLine(e, pauses, analysis.music !== null)) ?? [],
1303
+ ...pauses.map((p) => pauseLine(p, analysis)),
1304
+ ...effects?.events.map((e) => effectLine(e, pauses)) ?? [],
1230
1305
  ...analysis.music?.segments.map((m) => musicLine(m, analysis)) ?? [],
1231
1306
  ...analysis.music?.breaks.map((b) => ({
1232
1307
  start: b.start,
1233
1308
  end: b.end,
1234
1309
  kind: "music",
1235
1310
  text: `break ${(b.end - b.start).toFixed(1)} s`
1236
- })) ?? []
1311
+ })) ?? [],
1312
+ ...analysis.ambience?.map(ambienceLine) ?? []
1237
1313
  ].filter((line) => overlaps(line, range)).sort((a, b) => a.start - b.start || (a.end ?? a.start) - (b.end ?? b.start));
1238
1314
  const width = Math.max(0, ...lines.map((l) => when(l).length));
1239
1315
  const body = lines.map((l) => `${when(l).padEnd(width)} ${l.kind.padEnd(KIND_WIDTH)} ${l.text}`);
@@ -1263,7 +1339,6 @@ var RISE_DB = 20;
1263
1339
  var STEP_DB = 6;
1264
1340
  var AUDIBLE_DB = -60;
1265
1341
  var MASKED_DB = 20;
1266
- var MUSIC_OUT_DB = -60;
1267
1342
  var TAIL_DB = 30;
1268
1343
  var LONGEST = 4;
1269
1344
  var SAME_SOUND = 0.95;
@@ -1273,6 +1348,14 @@ var ON_BEAT_SHARE = 0.7;
1273
1348
  var DRUM_GROUP_MIN = 8;
1274
1349
  var LOW_HZ2 = 150;
1275
1350
  var BAND_FPS = 100;
1351
+ var SETTLE_FRAMES = 5;
1352
+ var PEAK_SLACK = 0.05;
1353
+ var BEFORE = 0.5;
1354
+ var MUSIC_BEFORE = 1;
1355
+ var GAP = 0.03;
1356
+ var SHORTEST_REFERENCE = 0.2;
1357
+ var SAME_ONSET = 0.03;
1358
+ var SPEECH_SLACK = 0.1;
1276
1359
  function floors(db) {
1277
1360
  const out = new Float32Array(db.length);
1278
1361
  let current = db[0] ?? -120;
@@ -1295,19 +1378,31 @@ function refined(samples, sampleRate, frame2, floorDb) {
1295
1378
  }
1296
1379
  return frame2 * HOP2;
1297
1380
  }
1298
- function extent(db, f, floor) {
1381
+ function onsetOf(db, f, base2, from) {
1299
1382
  let onset = f;
1300
- while (onset > Math.max(0, f - 50) && db[onset - 1] > floor + STEP_DB) onset--;
1383
+ while (onset > Math.max(from, f - 50) && db[onset - 1] > base2 + STEP_DB && db[onset - 1] < db[onset])
1384
+ onset--;
1385
+ return onset;
1386
+ }
1387
+ function extent(db, f, floor, from) {
1388
+ const base2 = floor[f];
1389
+ const onset = onsetOf(db, f, base2, from);
1301
1390
  let peak = f;
1302
1391
  let end = f;
1303
1392
  const last = Math.min(db.length - 1, f + LONGEST / HOP2);
1304
1393
  for (let g = f; g <= last; g++) {
1394
+ if (g >= f + SETTLE_FRAMES && startsAgain(db, g, f + 1, floor[g])) break;
1305
1395
  if (db[g] > db[peak]) peak = g;
1306
1396
  end = g;
1307
- if (g > peak && (db[g] < db[peak] - TAIL_DB || db[g] < floor + 3)) break;
1397
+ if (g > peak && (db[g] < db[peak] - TAIL_DB || db[g] < base2 + 3)) break;
1308
1398
  }
1309
1399
  return { onset, peak, end };
1310
1400
  }
1401
+ function startsAgain(db, g, from, floor) {
1402
+ let before = Infinity;
1403
+ for (let k = Math.max(from, g - SETTLE_FRAMES); k < g; k++) before = Math.min(before, db[k]);
1404
+ return db[g] - floor >= RISE_DB / 2 && db[g] - before >= STEP_DB;
1405
+ }
1311
1406
  function startsHere(db, f, floor) {
1312
1407
  const level = db[f];
1313
1408
  if (level < AUDIBLE_DB || level - floor < RISE_DB) return false;
@@ -1316,18 +1411,13 @@ function startsHere(db, f, floor) {
1316
1411
  function detect(db, samples, sampleRate, skip) {
1317
1412
  const floor = floors(db);
1318
1413
  const found = [];
1414
+ let from = 0;
1319
1415
  for (let f = 5; f < db.length; f++) {
1320
1416
  if (!startsHere(db, f, floor[f])) continue;
1321
- const { onset, peak, end } = extent(db, f, floor[f]);
1322
- const t = refined(samples, sampleRate, onset, floor[f]);
1323
- if (!skip(t))
1324
- found.push({
1325
- t,
1326
- peak: peak * HOP2,
1327
- end: end * HOP2,
1328
- peakDb: db[peak],
1329
- riseDb: db[peak] - floor[f]
1330
- });
1417
+ const { onset, peak, end } = extent(db, f, floor, from);
1418
+ const t = refined(samples, sampleRate, onset, Math.max(floor[f], db[onset - 1] ?? -120));
1419
+ if (!skip(t)) found.push({ t, peak: peak * HOP2, end: end * HOP2, peakDb: db[peak] });
1420
+ from = end + 1;
1331
1421
  f = Math.max(end, onset + 8);
1332
1422
  }
1333
1423
  return found;
@@ -1455,23 +1545,59 @@ function majority(kinds) {
1455
1545
  for (const k of kinds) counts.set(k, (counts.get(k) ?? 0) + 1);
1456
1546
  return [...counts].sort((a, b) => b[1] - a[1])[0][0];
1457
1547
  }
1458
- function measured2(input) {
1459
- const db = levels(input.source, input.sampleRate, HOP2);
1460
- const inSpeech = (t) => input.speech.some((s3) => t >= s3.start && t < s3.end);
1461
- const heardDb = input.heard ? levels(input.heard, input.sampleRate, HOP2, 0.5) : null;
1462
- const masked = (f) => {
1463
- const level = heardDb?.[Math.round(f.peak / HOP2)];
1464
- return level !== void 0 && f.peakDb < level - MASKED_DB;
1465
- };
1466
- const found = detect(db, input.source, input.sampleRate, inSpeech).filter((f) => !masked(f));
1467
- const bands = found.length ? bandFramesOf(asSignal(input.source, input.sampleRate)).bands : [];
1468
- const out = found.map((f) => {
1548
+ function foundIn({ samples: source, heldBy = [] }, input, mixDb) {
1549
+ const db = source === input.mix ? mixDb : levels(source, input.sampleRate, HOP2);
1550
+ const inSpeech = (t) => input.speech.some((s3) => t >= s3.start - SPEECH_SLACK && t < s3.end);
1551
+ const masked = (f) => f.peakDb < (mixDb[Math.round(f.peak / HOP2)] ?? -120) - MASKED_DB;
1552
+ const held = (f) => heldBy.some((span) => f.t < span.end && f.peak >= span.start);
1553
+ const found = detect(db, source, input.sampleRate, inSpeech).filter(
1554
+ (f) => !masked(f) && !held(f)
1555
+ );
1556
+ const bands = found.length ? bandFramesOf(asSignal(source, input.sampleRate)).bands : [];
1557
+ return found.map((f) => {
1469
1558
  const power = shape(bands, f.t, Math.min(f.end, f.t + 0.4));
1470
- return { ...f, ...kindOf(f, power), print: printOf(power), group: -1 };
1559
+ return { ...f, ...kindOf(f, power), print: printOf(power) };
1471
1560
  });
1561
+ }
1562
+ function measured2(input, mixDb) {
1563
+ const all = input.sources.flatMap((source) => foundIn(source, input, mixDb)).sort((a, b) => a.t - b.t);
1564
+ const out = [];
1565
+ for (const sound of all) {
1566
+ const previous = out[out.length - 1];
1567
+ if (previous && sound.t - previous.t < SAME_ONSET) {
1568
+ if (sound.peakDb > previous.peakDb) out[out.length - 1] = { ...sound, group: -1 };
1569
+ } else out.push({ ...sound, group: -1 });
1570
+ }
1472
1571
  grouped(out);
1473
1572
  return out;
1474
1573
  }
1574
+ function peakInMix(mixDb, m) {
1575
+ const a = Math.max(0, Math.round((m.peak - PEAK_SLACK) / HOP2));
1576
+ const b = Math.min(mixDb.length - 1, Math.round((m.peak + PEAK_SLACK) / HOP2));
1577
+ let peak = -120;
1578
+ for (let f = a; f <= b; f++) peak = Math.max(peak, mixDb[f]);
1579
+ return peak;
1580
+ }
1581
+ function musicNear(input, m, segment) {
1582
+ const { music, sampleRate } = input;
1583
+ const before = Math.max(segment.start, m.t - MUSIC_BEFORE);
1584
+ if (m.t - GAP - before >= SHORTEST_REFERENCE)
1585
+ return spanDb(music, sampleRate, before, m.t - GAP);
1586
+ return spanDb(music, sampleRate, m.end + GAP, Math.min(segment.end, m.end + MUSIC_BEFORE));
1587
+ }
1588
+ function levelsOf(input, mixDb, m) {
1589
+ const peakDb = peakInMix(mixDb, m);
1590
+ const a = Math.max(0, Math.round((m.t - BEFORE) / HOP2));
1591
+ const b = Math.max(a, Math.round((m.t - GAP) / HOP2));
1592
+ const beforeDb = b > a ? quantile(mixDb.subarray(a, b), 0.5) : -120;
1593
+ const segment = input.music ? input.musicSegments?.find((span) => m.t >= span.start && m.t < span.end) : void 0;
1594
+ const musicDb = segment ? musicNear(input, m, segment) : null;
1595
+ return {
1596
+ peakDb: Math.round(peakDb),
1597
+ riseDb: beforeDb < ABSENT_DB ? null : Math.round(peakDb - beforeDb),
1598
+ overMusicDb: musicDb !== null && musicDb >= ABSENT_DB ? Math.round(peakDb - musicDb) : null
1599
+ };
1600
+ }
1475
1601
  function drumGroups(members, beats) {
1476
1602
  const drums = /* @__PURE__ */ new Set();
1477
1603
  if (!beats.length) return drums;
@@ -1481,9 +1607,7 @@ function drumGroups(members, beats) {
1481
1607
  }
1482
1608
  return drums;
1483
1609
  }
1484
- function effectOf(m, group, kind, musicDb) {
1485
- const musicLevel = musicDb?.[Math.round(m.peak / HOP2)];
1486
- const musicPlays = musicLevel !== void 0 && musicLevel > MUSIC_OUT_DB;
1610
+ function effectOf(m, group, kind, levels2) {
1487
1611
  return {
1488
1612
  t: round6(m.t),
1489
1613
  end: round6(m.end),
@@ -1492,13 +1616,13 @@ function effectOf(m, group, kind, musicDb) {
1492
1616
  band: m.band,
1493
1617
  attackMs: Math.round((m.peak - m.t) * 1e3),
1494
1618
  tail: round6(m.end - m.peak),
1495
- riseDb: Math.round(m.riseDb),
1496
- overMusicDb: musicPlays ? Math.round(m.peakDb - musicLevel) : null,
1619
+ ...levels2,
1497
1620
  count: 1
1498
1621
  };
1499
1622
  }
1500
1623
  function findEffects(input) {
1501
- const sounds = measured2(input);
1624
+ const mixDb = levels(input.mix, input.sampleRate, HOP2);
1625
+ const sounds = measured2(input, mixDb);
1502
1626
  const members = /* @__PURE__ */ new Map();
1503
1627
  for (const m of sounds) members.set(m.group, [...members.get(m.group) ?? [], m]);
1504
1628
  const drums = drumGroups(members, input.beats);
@@ -1510,7 +1634,6 @@ function findEffects(input) {
1510
1634
  count: list.length
1511
1635
  }));
1512
1636
  const kindOfGroup = new Map(groups.map((g) => [g.id, g.kind]));
1513
- const musicDb = input.music ? levels(input.music, input.sampleRate, HOP2, 0.5) : null;
1514
1637
  const events = [];
1515
1638
  for (const m of sounds) {
1516
1639
  if (drums.has(m.group)) continue;
@@ -1519,7 +1642,8 @@ function findEffects(input) {
1519
1642
  if (previous?.group === group && m.t - previous.end <= TRAIN_GAP) {
1520
1643
  previous.end = round6(m.end);
1521
1644
  previous.count++;
1522
- } else events.push(effectOf(m, group, kindOfGroup.get(group) ?? m.kind, musicDb));
1645
+ } else
1646
+ events.push(effectOf(m, group, kindOfGroup.get(group) ?? m.kind, levelsOf(input, mixDb, m)));
1523
1647
  }
1524
1648
  const drumHits = [...drums].reduce((n, id) => n + members.get(id).length, 0);
1525
1649
  return { events, groups, drumHits };
@@ -1527,7 +1651,6 @@ function findEffects(input) {
1527
1651
 
1528
1652
  // src/audio/read/music.ts
1529
1653
  var HOP3 = 0.1;
1530
- var ABSENT_DB = -55;
1531
1654
  var CUT_DB = 25;
1532
1655
  var RUNNING_FRAMES = 200;
1533
1656
  var LEVEL_WINDOW = 0.4;
@@ -1545,6 +1668,10 @@ var FADE_DB = 10;
1545
1668
  var FADE_WINDOW = 3;
1546
1669
  var ENERGY_WINDOW = 30;
1547
1670
  var LEADING_SHARE = 0.2;
1671
+ var TONAL_SHARE = 0.4;
1672
+ var DENSE_WINDOW = 2;
1673
+ var DENSE_SHARE = 0.5;
1674
+ var STEADY = 0.5;
1548
1675
  function joined(spans, tooShort2) {
1549
1676
  const out = [];
1550
1677
  for (const span of spans) {
@@ -1608,6 +1735,48 @@ function runs(db) {
1608
1735
  breaks: settled.filter((s3) => s3.quiet && s3.start > 0 && s3.end < db.length * HOP3)
1609
1736
  };
1610
1737
  }
1738
+ function soundShare(fine, run) {
1739
+ const a = Math.round(run.start / HOP3);
1740
+ const b = Math.min(fine.length, Math.round(run.end / HOP3));
1741
+ const heard = new Float64Array(b - a + 1);
1742
+ for (let f = a; f < b; f++) heard[f - a + 1] = heard[f - a] + (fine[f] >= ABSENT_DB ? 1 : 0);
1743
+ const half = Math.round(DENSE_WINDOW / 2 / HOP3);
1744
+ const out = new Float32Array(b - a);
1745
+ for (let f = a; f < b; f++) {
1746
+ const lo = Math.max(a, f - half);
1747
+ const hi = Math.min(b, f + half + 1);
1748
+ out[f - a] = (heard[hi - a] - heard[lo - a]) / (hi - lo);
1749
+ }
1750
+ return out;
1751
+ }
1752
+ function steadyEdges(fine, part) {
1753
+ const steady = Math.round(STEADY / HOP3);
1754
+ const a = Math.round(part.start / HOP3);
1755
+ const b = Math.min(fine.length, Math.round(part.end / HOP3));
1756
+ const holds = (f) => {
1757
+ for (let k = f; k < f + steady; k++) if (k >= b || fine[k] < ABSENT_DB) return false;
1758
+ return true;
1759
+ };
1760
+ let start = a;
1761
+ while (start < b && !holds(start)) start++;
1762
+ let end = b;
1763
+ while (end > start && !holds(end - steady)) end--;
1764
+ return start < end ? { ...part, start: start * HOP3, end: end * HOP3 } : part;
1765
+ }
1766
+ function sustainedParts(fine, run) {
1767
+ if (run.end - run.start <= DENSE_WINDOW) {
1768
+ const a2 = Math.round(run.start / HOP3);
1769
+ const b = Math.max(a2 + 1, Math.min(fine.length, Math.round(run.end / HOP3)));
1770
+ let heard = 0;
1771
+ for (let f = a2; f < b; f++) if (fine[f] >= ABSENT_DB) heard++;
1772
+ return heard / (b - a2) >= DENSE_SHARE ? [run] : [];
1773
+ }
1774
+ const dense = soundShare(fine, run);
1775
+ const a = Math.round(run.start / HOP3);
1776
+ const sparse = new Uint8Array(fine.length);
1777
+ dense.forEach((share, i) => sparse[a + i] = share < DENSE_SHARE ? 1 : 0);
1778
+ return candidates(sparse, a, a + dense.length).filter((part) => !part.quiet).map((part) => steadyEdges(fine, part)).map(({ start, end }) => ({ start, end: Math.min(end, run.end) }));
1779
+ }
1611
1780
  function chromaOf(chroma, fps, run) {
1612
1781
  const a = Math.floor(run.start * fps);
1613
1782
  const b = Math.max(a + 1, Math.min(chroma.length, Math.ceil(run.end * fps)));
@@ -1616,6 +1785,17 @@ function chromaOf(chroma, fps, run) {
1616
1785
  const norm = Math.hypot(...sum);
1617
1786
  return norm ? sum.map((v) => v / norm) : sum;
1618
1787
  }
1788
+ function medianTopThreePitchShare(chroma, fps, run) {
1789
+ const a = Math.floor(run.start * fps);
1790
+ const b = Math.min(chroma.length, Math.ceil(run.end * fps));
1791
+ const held = [];
1792
+ for (let f = a; f < b; f++) {
1793
+ const sorted = [...chroma[f]].sort((x, y) => y - x);
1794
+ const total = sorted.reduce((n, v) => n + v, 0);
1795
+ if (total > 0) held.push((sorted[0] + sorted[1] + sorted[2]) / total);
1796
+ }
1797
+ return median(held);
1798
+ }
1619
1799
  var dot = (a, b) => a.reduce((n, v, k) => n + v * b[k], 0);
1620
1800
  function energyOf(samples, sampleRate, run) {
1621
1801
  const a = Math.floor(run.start * sampleRate);
@@ -1639,6 +1819,16 @@ function bpmOf(beats, run) {
1639
1819
  const interval = inside.length >= 4 ? medianInterval(inside) : null;
1640
1820
  return interval ? Math.round(60 / interval) : null;
1641
1821
  }
1822
+ function beatsInRun(signal, run) {
1823
+ const samples = signal.channels[0];
1824
+ if (run.start === 0 && run.end === samples.length / signal.sampleRate)
1825
+ return rhythm(signal).beats.times;
1826
+ const excerpt2 = samples.subarray(
1827
+ Math.floor(run.start * signal.sampleRate),
1828
+ Math.ceil(run.end * signal.sampleRate)
1829
+ );
1830
+ return rhythm(asSignal(excerpt2, signal.sampleRate)).beats.times;
1831
+ }
1642
1832
  var sameTempo = (a, b) => a === null || b === null || Math.abs(a - b) / Math.max(a, b) <= SAME_TEMPO;
1643
1833
  function fadeFrom(db, run) {
1644
1834
  const a = Math.floor(run.start / HOP3);
@@ -1650,6 +1840,8 @@ function fadeFrom(db, run) {
1650
1840
  if (db[f] < body - 3) return round6(f * HOP3, 1);
1651
1841
  return null;
1652
1842
  }
1843
+ var leading = (mix) => Object.entries(mix).filter(([, share]) => share >= LEADING_SHARE).sort((a, b) => b[1] - a[1]).map(([name]) => name);
1844
+ var isMusic = (heard) => heard.bpm !== null || heard.tonality >= TONAL_SHARE || leading(heard.mix).length > 1;
1653
1845
  var alike = (p, heard, piece, mix) => dot(p.print, heard.print) >= piece && mixDistance(p.mix, heard.mix) <= mix && sameTempo(p.bpm, heard.bpm);
1654
1846
  function pieceOf(pieces, previous, heard) {
1655
1847
  const last = previous && pieces.find((p) => p.id === previous.piece);
@@ -1660,21 +1852,30 @@ function pieceOf(pieces, previous, heard) {
1660
1852
  function newPiece(id, heard) {
1661
1853
  return {
1662
1854
  id,
1663
- instruments: Object.entries(heard.mix).filter(([, share]) => share >= LEADING_SHARE).sort((a, b) => b[1] - a[1]).map(([name]) => name),
1855
+ instruments: leading(heard.mix),
1664
1856
  bpm: heard.bpm,
1665
1857
  firstAt: round6(heard.run.start),
1666
1858
  print: heard.print,
1667
1859
  mix: heard.mix
1668
1860
  };
1669
1861
  }
1670
- function energyCurve(melodic, sampleRate, duration) {
1862
+ function liesBetweenMusic(found, gap, musical) {
1863
+ const after = found.findIndex((run) => run.start >= gap.end);
1864
+ return after > 0 && musical.has(found[after - 1]) && musical.has(found[after]);
1865
+ }
1866
+ function energyCurve(melodic, sampleRate, duration, musical) {
1671
1867
  const energy = [];
1672
1868
  for (let start = 0; start < duration; start += ENERGY_WINDOW) {
1673
1869
  const end = Math.min(duration, start + ENERGY_WINDOW);
1674
- const power = energyOf(melodic, sampleRate, { start, end });
1870
+ const overlaps2 = [...musical].map((run) => ({ start: Math.max(start, run.start), end: Math.min(end, run.end) })).filter((run) => run.end > run.start);
1871
+ if (!overlaps2.length) continue;
1872
+ const power = overlaps2.reduce(
1873
+ (sum, run) => sum + energyOf(melodic, sampleRate, run) * (run.end - run.start),
1874
+ 0
1875
+ ) / (end - start);
1675
1876
  energy.push({
1676
1877
  start,
1677
- end: round6(end),
1878
+ end: Math.min(round6(end), round6(duration, 3)),
1678
1879
  db: power > 0 ? Math.round(10 * Math.log10(power)) : -120
1679
1880
  });
1680
1881
  }
@@ -1683,20 +1884,38 @@ function energyCurve(melodic, sampleRate, duration) {
1683
1884
  function readMusic(input) {
1684
1885
  const melodic = mixed(Object.values(input.stems));
1685
1886
  const db = levels(melodic, input.sampleRate, HOP3, LEVEL_WINDOW);
1686
- const { segments: found, breaks } = runs(db);
1887
+ const duration = melodic.length / input.sampleRate;
1888
+ const fine = levels(melodic, input.sampleRate, HOP3, HOP3);
1889
+ const { segments: whole, breaks } = runs(db);
1890
+ for (const run of whole) run.end = Math.min(run.end, duration);
1891
+ const found = whole.flatMap((run) => sustainedParts(fine, run));
1687
1892
  const frames = bandFramesOf(asSignal(melodic, input.sampleRate));
1688
- const beats = rhythm(
1689
- asSignal(input.drums ? mixed([melodic, input.drums]) : melodic, input.sampleRate)
1690
- ).beats.times;
1893
+ const rhythmic = asSignal(
1894
+ input.drums ? mixed([melodic, input.drums]) : melodic,
1895
+ input.sampleRate
1896
+ );
1897
+ const beats = rhythm(rhythmic).beats.times;
1691
1898
  const pieces = [];
1692
1899
  const segments = [];
1900
+ const ambience = [];
1901
+ const musical = /* @__PURE__ */ new Set();
1693
1902
  for (const run of found) {
1694
1903
  const heard = {
1695
1904
  run,
1696
1905
  print: chromaOf(frames.chroma, frames.chromaFps, run),
1697
1906
  mix: shares(input, run),
1698
- bpm: bpmOf(beats, run)
1907
+ bpm: bpmOf(beatsInRun(rhythmic, run), { start: 0, end: run.end - run.start }),
1908
+ tonality: medianTopThreePitchShare(frames.chroma, frames.chromaFps, run)
1699
1909
  };
1910
+ if (!isMusic(heard)) {
1911
+ ambience.push({
1912
+ start: round6(run.start),
1913
+ end: Math.min(round6(run.end), round6(duration, 3)),
1914
+ db: Math.round(10 * Math.log10(Math.max(1e-12, energyOf(melodic, input.sampleRate, run))))
1915
+ });
1916
+ continue;
1917
+ }
1918
+ musical.add(run);
1700
1919
  const previous = segments[segments.length - 1];
1701
1920
  let piece = pieceOf(pieces, previous, heard);
1702
1921
  let entry;
@@ -1708,7 +1927,7 @@ function readMusic(input) {
1708
1927
  }
1709
1928
  segments.push({
1710
1929
  start: round6(run.start),
1711
- end: round6(run.end),
1930
+ end: Math.min(round6(run.end), round6(duration, 3)),
1712
1931
  piece: piece.id,
1713
1932
  entry,
1714
1933
  bpm: heard.bpm,
@@ -1719,9 +1938,10 @@ function readMusic(input) {
1719
1938
  music: {
1720
1939
  segments,
1721
1940
  pieces: pieces.map(({ print: _print, mix: _mix, ...piece }) => piece),
1722
- breaks: breaks.map((b) => ({ start: round6(b.start), end: round6(b.end) })),
1723
- energy: energyCurve(melodic, input.sampleRate, db.length * HOP3)
1941
+ breaks: breaks.filter((b) => liesBetweenMusic(found, b, musical)).map((b) => ({ start: round6(b.start), end: round6(b.end) })),
1942
+ energy: energyCurve(melodic, input.sampleRate, duration, musical)
1724
1943
  },
1944
+ ambience,
1725
1945
  beats
1726
1946
  };
1727
1947
  }
@@ -1853,7 +2073,7 @@ async function fetchStems(path, dir, { url, headers, timeoutMs }) {
1853
2073
  }
1854
2074
 
1855
2075
  // src/audio/read/types.ts
1856
- var READ_VERSION = 2;
2076
+ var READ_VERSION = 4;
1857
2077
 
1858
2078
  // src/audio/read/voice.ts
1859
2079
  var SENTENCE_END = /[。!?!?…;;.]["'”’」』)]*$/;
@@ -1916,7 +2136,7 @@ function summary(sentences, pauses, track2) {
1916
2136
  medianPitchHz: track2.length ? Math.round(median(track2.map((p) => p.hz))) : null
1917
2137
  };
1918
2138
  }
1919
- function voiceFromWords(words, track2) {
2139
+ function voiceFromWords(words, track2, levelOf) {
1920
2140
  const ordered = words.filter((w) => w.end > w.start).sort((a, b) => a.start - b.start);
1921
2141
  const unit = rateUnit(ordered);
1922
2142
  const sentences = sentenceGroups(ordered).map((group) => {
@@ -1929,20 +2149,23 @@ function voiceFromWords(words, track2) {
1929
2149
  text: joined2(group, unit),
1930
2150
  rate: count && end > start ? round6(count / (end - start), 1) : null,
1931
2151
  pitchHz: pitchOf(track2, start, end),
1932
- ending: ending(track2, start, end)
2152
+ ending: ending(track2, start, end),
2153
+ againstMusic: null
1933
2154
  };
1934
2155
  });
1935
2156
  const pauses = [];
1936
2157
  for (let i = 1; i < ordered.length; i++) {
1937
2158
  const gap = ordered[i].start - ordered[i - 1].end;
1938
- if (gap >= PAUSE_SECONDS)
1939
- pauses.push({ start: round6(ordered[i - 1].end), end: round6(ordered[i].start) });
2159
+ if (gap >= PAUSE_SECONDS) {
2160
+ const span = { start: round6(ordered[i - 1].end), end: round6(ordered[i].start) };
2161
+ pauses.push({ ...span, recordingDb: Math.round(levelOf(span)) });
2162
+ }
1940
2163
  }
1941
2164
  return { source: "transcript", unit, ...summary(sentences, pauses, track2) };
1942
2165
  }
1943
2166
  var ACTIVITY_HOP = 0.05;
1944
2167
  var SHORTEST_SPEECH = 0.3;
1945
- function voiceFromActivity(vocals, sampleRate, track2) {
2168
+ function voiceFromActivity(vocals, sampleRate, track2, levelOf) {
1946
2169
  const db = levels(vocals, sampleRate, ACTIVITY_HOP);
1947
2170
  const threshold = Math.max(-45, quantile(db, 0.9) - 30);
1948
2171
  const spans = [];
@@ -1972,10 +2195,14 @@ function voiceFromActivity(vocals, sampleRate, track2) {
1972
2195
  text: null,
1973
2196
  rate: null,
1974
2197
  pitchHz: pitchOf(track2, s3.start, s3.end),
1975
- ending: ending(track2, s3.start, s3.end)
2198
+ ending: ending(track2, s3.start, s3.end),
2199
+ againstMusic: null
1976
2200
  })
1977
2201
  );
1978
- const pauses = spans.slice(1).map((s3, i) => ({ start: round6(spans[i].end), end: round6(s3.start) }));
2202
+ const pauses = spans.slice(1).map((s3, i) => {
2203
+ const span = { start: round6(spans[i].end), end: round6(s3.start) };
2204
+ return { ...span, recordingDb: Math.round(levelOf(span)) };
2205
+ });
1979
2206
  return { source: "activity", unit: "chars", ...summary(sentences, pauses, track2) };
1980
2207
  }
1981
2208
 
@@ -2020,22 +2247,74 @@ async function stemsFor(path, dir, quality, warnings) {
2020
2247
  return null;
2021
2248
  }
2022
2249
  }
2023
- async function fromStems(path, stemPaths) {
2250
+ function heardStems(tracks) {
2251
+ return Object.entries(tracks).map(([name, samples]) => ({ name, db: levelWhileHeardDb(samples, READ_RATE) })).filter((stem) => stem.db !== null).sort((a, b) => b.db - a.db || a.name.localeCompare(b.name));
2252
+ }
2253
+ async function decodedStems(stemPaths) {
2024
2254
  const pitched = {};
2025
2255
  for (const [name, stemPath] of Object.entries(stemPaths))
2026
2256
  if (name !== VOICE_STEM && name !== DRUM_STEM) pitched[name] = await decodeMono(stemPath);
2027
2257
  const drums = stemPaths[DRUM_STEM] ? await decodeMono(stemPaths[DRUM_STEM]) : null;
2258
+ return { pitched, drums };
2259
+ }
2260
+ var present = (tracks) => tracks.filter((t) => t !== null);
2261
+ function musicOf(pitched, drums, bed) {
2262
+ return bed ? readMusic({ stems: pitched, drums, sampleRate: READ_RATE }) : { music: null, ambience: null, beats: [] };
2263
+ }
2264
+ function separatedStems(stemPaths, pitched, drums, vocals) {
2265
+ return heardStems({
2266
+ ...pitched,
2267
+ ...drums ? { [DRUM_STEM]: drums } : {},
2268
+ ...stemPaths[VOICE_STEM] ? { [VOICE_STEM]: vocals } : {}
2269
+ });
2270
+ }
2271
+ var recording = (path, separated2, voiceSamples) => separated2 ? decodeMono(path) : Promise.resolve(voiceSamples);
2272
+ function excerpt(samples, spans) {
2273
+ const parts = spans.map(
2274
+ (span) => samples.subarray(Math.round(span.start * READ_RATE), Math.round(span.end * READ_RATE))
2275
+ );
2276
+ const out = new Float32Array(parts.reduce((n, p) => n + p.length, 0));
2277
+ let at = 0;
2278
+ for (const part of parts) {
2279
+ out.set(part, at);
2280
+ at += part.length;
2281
+ }
2282
+ return out;
2283
+ }
2284
+ function againstMusic(voice, vocals, music, segments) {
2285
+ const sentences = voice.sentences.map((sentence) => {
2286
+ const under = segments.map((m) => ({
2287
+ start: Math.max(m.start, sentence.start),
2288
+ end: Math.min(m.end, sentence.end)
2289
+ })).filter((span) => span.end > span.start);
2290
+ if (!under.length) return sentence;
2291
+ const voiceLufs = loudness(asSignal(excerpt(vocals, under))).lufsIntegrated;
2292
+ const musicLufs = loudness(asSignal(excerpt(music, under))).lufsIntegrated;
2293
+ return voiceLufs === null || musicLufs === null ? sentence : { ...sentence, againstMusic: { voiceLufs, musicLufs } };
2294
+ });
2295
+ return { ...voice, sentences };
2296
+ }
2297
+ async function fromStems(stemPaths, voice, vocals, mix) {
2298
+ const { pitched, drums } = await decodedStems(stemPaths);
2028
2299
  const bed = Object.keys(pitched).length ? mixed(Object.values(pitched)) : null;
2029
- const { music, beats } = bed ? readMusic({ stems: pitched, drums, sampleRate: READ_RATE }) : { music: null, beats: [] };
2300
+ const { music, ambience, beats } = musicOf(pitched, drums, bed);
2301
+ const segments = music?.segments ?? [];
2302
+ const everythingElse = mixed(present([bed, drums]));
2030
2303
  const effects = findEffects({
2031
- source: drums ?? bed ?? new Float32Array(0),
2304
+ sources: [
2305
+ ...drums ? [{ samples: drums }] : [],
2306
+ ...bed ? [{ samples: bed, heldBy: [...segments, ...ambience ?? []] }] : []
2307
+ ],
2032
2308
  sampleRate: READ_RATE,
2033
- music: bed,
2034
- heard: await decodeMono(path),
2309
+ mix,
2310
+ music: bed && everythingElse,
2311
+ musicSegments: segments,
2035
2312
  beats,
2036
2313
  speech: []
2037
2314
  });
2038
- return { effects, music };
2315
+ const stems = separatedStems(stemPaths, pitched, drums, vocals);
2316
+ const read2 = music ? againstMusic(voice, vocals, everythingElse, music.segments) : voice;
2317
+ return { voice: read2, stems, effects, music, ambience };
2039
2318
  }
2040
2319
  var transcribeHint = (file) => `run hyperframes transcribe ${file} and pass --transcript`;
2041
2320
  async function analyze(path, file, sha, transcript, stemDir, quality) {
@@ -2049,23 +2328,26 @@ async function analyze(path, file, sha, transcript, stemDir, quality) {
2049
2328
  warnings.push(
2050
2329
  `no transcript and no stems: voice and effects are not read, because the mix alone does not tell speech from music; ${transcribeHint(file)}`
2051
2330
  );
2052
- return { ...about, voice: null, effects: null, music: null, warnings };
2331
+ return { ...about, voice: null, effects: null, music: null, ambience: null, warnings };
2053
2332
  }
2054
2333
  if (!words.length)
2055
2334
  warnings.push(`no transcript: voice lines carry no words; ${transcribeHint(file)}`);
2056
2335
  const pitch = pitchTrack(await decodeMono(voicePath, PITCH_RATE));
2057
- const voice = words.length ? voiceFromWords(words, pitch) : voiceFromActivity(voiceSamples, READ_RATE, pitch);
2058
- if (stemPaths) return { ...about, voice, ...await fromStems(path, stemPaths), warnings };
2336
+ const mix = await recording(path, stemPaths !== null, voiceSamples);
2337
+ const levelOf = (span) => spanDb(mix, READ_RATE, span.start, span.end);
2338
+ const voice = words.length ? voiceFromWords(words, pitch, levelOf) : voiceFromActivity(voiceSamples, READ_RATE, pitch, levelOf);
2339
+ if (stemPaths)
2340
+ return { ...about, ...await fromStems(stemPaths, voice, voiceSamples, mix), warnings };
2059
2341
  warnings.push("without stems, effects under speech are not found and music is not read");
2060
2342
  const effects = findEffects({
2061
- source: voiceSamples,
2343
+ sources: [{ samples: voiceSamples }],
2062
2344
  sampleRate: READ_RATE,
2345
+ mix,
2063
2346
  music: null,
2064
- heard: null,
2065
2347
  beats: [],
2066
2348
  speech: voice.sentences
2067
2349
  });
2068
- return { ...about, voice, effects, music: null, warnings };
2350
+ return { ...about, voice, effects, music: null, ambience: null, warnings };
2069
2351
  }
2070
2352
  function base(file, sha, duration, stemPaths, transcript) {
2071
2353
  return {
@@ -2074,7 +2356,7 @@ function base(file, sha, duration, stemPaths, transcript) {
2074
2356
  sha256: sha,
2075
2357
  duration,
2076
2358
  separation: stemPaths ? "stems" : "mix",
2077
- stems: stemPaths ? Object.keys(stemPaths).sort() : [],
2359
+ stems: [],
2078
2360
  transcript: transcript ? basename(transcript) : null
2079
2361
  };
2080
2362
  }