@wildshard/sdk 0.0.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GUIDE.md +790 -0
- package/README.md +13 -5
- package/bin/wildshard.mjs +38 -0
- package/lint/declaration-config.d.mts +2 -0
- package/lint/declaration-config.mjs +19 -0
- package/lint/engine-plugin.d.mts +2 -0
- package/lint/engine-plugin.mjs +40 -0
- package/lint/host-callbacks.d.mts +6 -0
- package/lint/host-callbacks.mjs +123 -0
- package/lint/host-files.d.mts +1 -0
- package/lint/host-files.mjs +7 -0
- package/lint/layer-exports.d.mts +2 -0
- package/lint/layer-exports.mjs +21 -0
- package/lint/legacy-line-basis.json +995 -0
- package/lint/nine-tiling-baseline.json +35 -0
- package/lint/ratchet.json +11 -0
- package/lint/runtime-files.d.mts +12 -0
- package/lint/runtime-files.json +16 -0
- package/lint/runtime-files.mjs +69 -0
- package/lint/runtime-performance.d.mts +6 -0
- package/lint/runtime-performance.mjs +184 -0
- package/lint/sdk-plugin.d.mts +4 -0
- package/lint/sdk-plugin.mjs +134 -0
- package/lint/shardfile-boundaries.d.mts +10 -0
- package/lint/shardfile-boundaries.mjs +122 -0
- package/lint/tile-bake-debt.json +556 -0
- package/package.json +365 -3
- package/scripts/agent-parity.mjs +1524 -0
- package/scripts/agent-sync.mjs +518 -0
- package/scripts/apfs-clone.mjs +67 -0
- package/scripts/assert-store-layout.mjs +23 -0
- package/scripts/astc6-phone-cap.d.mts +3 -0
- package/scripts/astc6-phone-cap.mjs +137 -0
- package/scripts/audit-assets.d.mts +10 -0
- package/scripts/audit-assets.mjs +151 -0
- package/scripts/bake/coatFiles.d.mts +6 -0
- package/scripts/bake/coatFiles.mjs +37 -0
- package/scripts/bake/environment.d.mts +2 -0
- package/scripts/bake/environment.mjs +58 -0
- package/scripts/bake/far-proxies.mjs +45 -0
- package/scripts/bake/keyed-sky.d.mts +4 -0
- package/scripts/bake/keyed-sky.mjs +34 -0
- package/scripts/bake/movers.mjs +56 -0
- package/scripts/bake/nativeWorld.d.mts +6 -0
- package/scripts/bake/nativeWorld.mjs +43 -0
- package/scripts/bake/navmeshGround.ts +22 -0
- package/scripts/bake/near-placeholder.mjs +331 -0
- package/scripts/bake/placeholderShards.mjs +41 -0
- package/scripts/bake/skins.mjs +15 -0
- package/scripts/bake/template-skins.mjs +33 -0
- package/scripts/bake/viewmodelBytes.ts +26 -0
- package/scripts/bake/viewmodelPage.ts +11 -0
- package/scripts/bake/worldHost.d.mts +35 -0
- package/scripts/bake/worldHost.mjs +110 -0
- package/scripts/bake-astc6.cache.json +80 -0
- package/scripts/bake-astc6.far-reach.cache.json +23 -0
- package/scripts/bake-astc6.list.json +111 -0
- package/scripts/bake-astc6.mjs +279 -0
- package/scripts/bake-astc6.nalati-grasslands.cache.json +42 -0
- package/scripts/bake-catalogue.mjs +44 -0
- package/scripts/bake-check.mjs +54 -0
- package/scripts/bake-chunk.mjs +124 -0
- package/scripts/bake-cloud-field.mjs +24 -0
- package/scripts/bake-coats.mjs +110 -0
- package/scripts/bake-data-maps.d.mts +24 -0
- package/scripts/bake-data-maps.mjs +72 -0
- package/scripts/bake-entry-programs.mjs +117 -0
- package/scripts/bake-geometry.mjs +106 -0
- package/scripts/bake-hybrid-tiles.mjs +28 -0
- package/scripts/bake-ktx2.cache.json +276 -0
- package/scripts/bake-ktx2.list.json +365 -0
- package/scripts/bake-ktx2.mjs +477 -0
- package/scripts/bake-map-glb.mjs +127 -0
- package/scripts/bake-map-rest.d.mts +7 -0
- package/scripts/bake-map-rest.mjs +50 -0
- package/scripts/bake-maps.mjs +200 -0
- package/scripts/bake-navmesh.mjs +259 -0
- package/scripts/bake-packs.mjs +129 -0
- package/scripts/bake-pickups.mjs +102 -0
- package/scripts/bake-query-terrain.mjs +64 -0
- package/scripts/bake-recurve-pool.mjs +16 -0
- package/scripts/bake-section-schemas.d.mts +3 -0
- package/scripts/bake-template-shardfile.mjs +32 -0
- package/scripts/bake-textures.mjs +80 -0
- package/scripts/bake-viewmodel-sets.json +45 -0
- package/scripts/bake-viewmodel-sets.mjs +137 -0
- package/scripts/bake-voxel-ao.mjs +119 -0
- package/scripts/bake-water-ripples.mjs +25 -0
- package/scripts/blender/README.md +129 -0
- package/scripts/blender/build.sh +166 -0
- package/scripts/blender/lib/export-scene.mjs +129 -0
- package/scripts/blender/lib/glb-digest.mjs +188 -0
- package/scripts/blender/lib/glb.py +68 -0
- package/scripts/blender/lib/save_blend.py +17 -0
- package/scripts/blender/lib/world_fixture.py +55 -0
- package/scripts/blender/targets.json +591 -0
- package/scripts/build-sdk.mjs +95 -0
- package/scripts/build-shardfiles.d.mts +7 -0
- package/scripts/build-shardfiles.mjs +206 -0
- package/scripts/capture-hero.mjs +137 -0
- package/scripts/check-lift-review.mjs +23 -0
- package/scripts/chromium-keychain-check.mjs +139 -0
- package/scripts/chromium-keychain.d.mts +1 -0
- package/scripts/chromium-keychain.mjs +5 -0
- package/scripts/compile-script.d.mts +3 -0
- package/scripts/compile-script.mjs +8 -0
- package/scripts/creature-color.mjs +255 -0
- package/scripts/decide/calibrate.py +127 -0
- package/scripts/decide/calibration/2026-10-03/labels-s1.tsv +281 -0
- package/scripts/decide/calibration/2026-10-03/labels-s2.tsv +97 -0
- package/scripts/decide/calibration/2026-10-03/labels-s3.tsv +48 -0
- package/scripts/decide/calibration/2026-10-03/labels-s3b.tsv +26 -0
- package/scripts/decide/calibration/2026-10-03/res-capture-status-v1.jsonl +376 -0
- package/scripts/decide/calibration/2026-10-03/res-text-garbled-strings.jsonl +48 -0
- package/scripts/decide/calibration/2026-10-03/res-text-garbled-v1.jsonl +73 -0
- package/scripts/decide/decide.py +262 -0
- package/scripts/decide/decide.sh +50 -0
- package/scripts/decide/layer-purity-pilot.mjs +41 -0
- package/scripts/decide/sets/capture-status.json +46 -0
- package/scripts/decide/sets/layer-purity.json +28 -0
- package/scripts/decide/sets/text-garbled.json +17 -0
- package/scripts/decide/test_decide.py +37 -0
- package/scripts/docs.mjs +15 -0
- package/scripts/entry-reads/crawl.ts +152 -0
- package/scripts/entry-reads/tsconfig.json +25 -0
- package/scripts/gen-format-schema.d.mts +2 -0
- package/scripts/gen-format-schema.mjs +21 -0
- package/scripts/gen-host-catalogue.d.mts +14 -0
- package/scripts/gen-host-catalogue.mjs +108 -0
- package/scripts/gen-shard-layout-doc.d.mts +4 -0
- package/scripts/gen-shard-layout-doc.mjs +55 -0
- package/scripts/gen-shards.d.mts +17 -0
- package/scripts/gen-shards.mjs +311 -0
- package/scripts/goldens/capture-inputs.d.mts +4 -0
- package/scripts/goldens/capture-inputs.mjs +34 -0
- package/scripts/goldens/colour_shift.py +27 -0
- package/scripts/goldens/native-residency.d.mts +10 -0
- package/scripts/goldens/native-residency.mjs +104 -0
- package/scripts/goldens/plot-inputs.d.mts +12 -0
- package/scripts/goldens/plot-inputs.mjs +46 -0
- package/scripts/gpu-texmem.mjs +98 -0
- package/scripts/horizon-matte/config.py +24 -0
- package/scripts/horizon-matte/encode.py +91 -0
- package/scripts/horizon-matte/key.py +141 -0
- package/scripts/horizon-matte/mkjobs.py +33 -0
- package/scripts/horizon-matte/mkjobs_day2.py +11 -0
- package/scripts/horizon-matte/overlap.py +80 -0
- package/scripts/horizon-matte/run_codex.py +57 -0
- package/scripts/horizon-matte/stitch.py +133 -0
- package/scripts/img2mesh/CC0.md +105 -0
- package/scripts/img2mesh/README.md +209 -0
- package/scripts/img2mesh/ab_board.py +102 -0
- package/scripts/img2mesh/birds/birds.json +255 -0
- package/scripts/img2mesh/birds/birds_atlas.py +150 -0
- package/scripts/img2mesh/birds/birds_fix_preview.mjs +103 -0
- package/scripts/img2mesh/birds/birds_fix_render.py +75 -0
- package/scripts/img2mesh/birds/birds_pack.py +110 -0
- package/scripts/img2mesh/birds/birds_phone_b.py +112 -0
- package/scripts/img2mesh/birds/birds_post.py +550 -0
- package/scripts/img2mesh/birds/birds_render.py +125 -0
- package/scripts/img2mesh/birds/birds_sheet.py +33 -0
- package/scripts/img2mesh/birds/birds_view.py +60 -0
- package/scripts/img2mesh/board.py +100 -0
- package/scripts/img2mesh/build_cc0.sh +52 -0
- package/scripts/img2mesh/build_driftwood.sh +12 -0
- package/scripts/img2mesh/build_faces.sh +53 -0
- package/scripts/img2mesh/build_props.py +81 -0
- package/scripts/img2mesh/cc0_export.py +186 -0
- package/scripts/img2mesh/driftwood_post.py +571 -0
- package/scripts/img2mesh/e304_faces.sh +67 -0
- package/scripts/img2mesh/face_remaster.py +911 -0
- package/scripts/img2mesh/face_views.py +95 -0
- package/scripts/img2mesh/faces-e304.json +9 -0
- package/scripts/img2mesh/faces.json +30 -0
- package/scripts/img2mesh/head_cut.py +100 -0
- package/scripts/img2mesh/hi3d_paint.py +94 -0
- package/scripts/img2mesh/hi3d_refine.py +161 -0
- package/scripts/img2mesh/hunyuan_cpu_rasterizer.sh +42 -0
- package/scripts/img2mesh/pine_hollow_phone.sh +13 -0
- package/scripts/img2mesh/props/coral-arch.json +32 -0
- package/scripts/img2mesh/props/ember-furnace.json +30 -0
- package/scripts/img2mesh/props/night-market-gate.json +10 -0
- package/scripts/img2mesh/render_still.py +86 -0
- package/scripts/img2mesh/rig_strip.mjs +46 -0
- package/scripts/img2mesh/rig_transfer.mjs +104 -0
- package/scripts/img2mesh/split_sheet.py +48 -0
- package/scripts/img2mesh/trellis_batch.py +110 -0
- package/scripts/img2mesh/versus_board.py +114 -0
- package/scripts/import-bundle.d.mts +2 -0
- package/scripts/import-bundle.mjs +20 -0
- package/scripts/ktx2-ab-board.py +133 -0
- package/scripts/ktx2-ab.mjs +111 -0
- package/scripts/ktx2-settings.mjs +18 -0
- package/scripts/land.d.mts +14 -0
- package/scripts/land.mjs +809 -0
- package/scripts/lint-dispatch.mjs +14 -0
- package/scripts/map-bake-frames.d.mts +4 -0
- package/scripts/map-bake-frames.mjs +23 -0
- package/scripts/map-geometry.d.mts +9 -0
- package/scripts/map-geometry.mjs +29 -0
- package/scripts/map-world.mjs +162 -0
- package/scripts/mockup-local.sh +46 -0
- package/scripts/music/export-midi.mjs +68 -0
- package/scripts/music/gen/analyze.py +308 -0
- package/scripts/music/gen/audio_jobs.py +46 -0
- package/scripts/music/gen/briefs.json +51 -0
- package/scripts/music/gen/build_page.py +334 -0
- package/scripts/music/gen/folk.json +3187 -0
- package/scripts/music/gen/gen_ace_step.py +156 -0
- package/scripts/music/gen/gen_heartmula.py +187 -0
- package/scripts/music/gen/gen_minimax.py +143 -0
- package/scripts/music/gen/gen_sao.py +122 -0
- package/scripts/music/gen/gen_sao_small.py +104 -0
- package/scripts/music/gen/gen_sfx.py +98 -0
- package/scripts/music/gen/gen_sfx_ezaudio.py +112 -0
- package/scripts/music/gen/gen_sfx_moss.py +112 -0
- package/scripts/music/gen/models.json +61 -0
- package/scripts/music/gen/nalati-jobs.json +104 -0
- package/scripts/music/gen/nalati-score-build.json +119 -0
- package/scripts/music/gen/nalati-score.json +3448 -0
- package/scripts/music/gen/ob7-fit-decisions.json +38 -0
- package/scripts/music/gen/ob7-score-jobs.json +152 -0
- package/scripts/music/gen/ob7-sfx-jobs.json +897 -0
- package/scripts/music/gen/ob7_build.py +469 -0
- package/scripts/music/gen/ob7_generate.py +67 -0
- package/scripts/music/gen/ob7_run.sh +42 -0
- package/scripts/music/gen/orchestral.json +3187 -0
- package/scripts/music/gen/own_score.py +486 -0
- package/scripts/music/gen/ph-jobs.json +27 -0
- package/scripts/music/gen/ph_page.py +222 -0
- package/scripts/music/gen/piano.json +3175 -0
- package/scripts/music/gen/rank_v3.py +248 -0
- package/scripts/music/gen/sfx-best.json +2486 -0
- package/scripts/music/gen/sfx-ezaudio.json +4082 -0
- package/scripts/music/gen/sfx-jobs.json +57 -0
- package/scripts/music/gen/sfx-minimax-jobs.json +16 -0
- package/scripts/music/gen/sfx-minimax.json +289 -0
- package/scripts/music/gen/sfx-moss.json +4082 -0
- package/scripts/music/gen/sfx-nalati-b3-jobs.json +17 -0
- package/scripts/music/gen/sfx-nalati-jobs.json +338 -0
- package/scripts/music/gen/sfx-nalati.json +11202 -0
- package/scripts/music/gen/sfx-nd-jobs.json +57 -0
- package/scripts/music/gen/sfx-nd-moss.json +2097 -0
- package/scripts/music/gen/sfx-nd-sa3-medium.json +2097 -0
- package/scripts/music/gen/sfx-nd-summary.json +38 -0
- package/scripts/music/gen/sfx-peaks.json +7 -0
- package/scripts/music/gen/sfx-ph-jobs.json +169 -0
- package/scripts/music/gen/sfx-ph-moss.json +6564 -0
- package/scripts/music/gen/sfx-ph-sa3-medium.json +7239 -0
- package/scripts/music/gen/sfx-ph-summary.json +63 -0
- package/scripts/music/gen/sfx-sa3-medium.json +4082 -0
- package/scripts/music/gen/sfx-sa3.json +4082 -0
- package/scripts/music/gen/sfx-summary.json +107 -0
- package/scripts/music/gen/sfx_build.py +332 -0
- package/scripts/music/gen/sfx_merge.py +255 -0
- package/scripts/music/gen/sfx_minimax.py +61 -0
- package/scripts/music/gen/sfx_nalati.py +331 -0
- package/scripts/music/gen/sfx_sprite.py +424 -0
- package/scripts/music/gen/stems.py +539 -0
- package/scripts/music/gen/test_loop_meter.py +29 -0
- package/scripts/music/gen/test_ob7_provenance.py +77 -0
- package/scripts/music/gen/v3-folk-build.json +148 -0
- package/scripts/music/gen/v3-folk.json +1818 -0
- package/scripts/music/gen/v3-jobs.json +145 -0
- package/scripts/music/gen/v3-orchestral-build.json +148 -0
- package/scripts/music/gen/v3-orchestral.json +1813 -0
- package/scripts/music/gen/v3-ph-folk-build.json +94 -0
- package/scripts/music/gen/v3-ph-folk.json +1806 -0
- package/scripts/music/gen/v3-ph-orchestral-build.json +94 -0
- package/scripts/music/gen/v3-ph-orchestral.json +1824 -0
- package/scripts/music/gen/v3-ph-piano-build.json +94 -0
- package/scripts/music/gen/v3-ph-piano.json +1818 -0
- package/scripts/music/gen/v3-piano-build.json +148 -0
- package/scripts/music/gen/v3-piano.json +1813 -0
- package/scripts/music/wildshard-theme.mid +0 -0
- package/scripts/music/wildshard-trailer30.mid +0 -0
- package/scripts/named-blob-output.d.mts +8 -0
- package/scripts/named-blob-output.mjs +48 -0
- package/scripts/pack-all.mjs +15 -0
- package/scripts/pid-lock.d.mts +1 -0
- package/scripts/pid-lock.mjs +63 -0
- package/scripts/practice/bake_dummy.py +53 -0
- package/scripts/practice/build_dummies.sh +43 -0
- package/scripts/practice/dummy_parts.py +568 -0
- package/scripts/practice/dummy_rig_gate.py +139 -0
- package/scripts/practice/gate_sheet.py +36 -0
- package/scripts/practice/generate_dummy_unimate.py +132 -0
- package/scripts/practice/pack_dummy.mjs +59 -0
- package/scripts/practice/repair_dummy_weights.mjs +68 -0
- package/scripts/practice/rig_dummy.py +828 -0
- package/scripts/practice/verify_unimate_skin.mjs +356 -0
- package/scripts/preparation-seed.mjs +15 -0
- package/scripts/prepare-basis-tool.mjs +6 -0
- package/scripts/prepare-product.d.mts +14 -0
- package/scripts/prepare-product.mjs +101 -0
- package/scripts/product-build-tools.d.mts +3 -0
- package/scripts/product-build-tools.json +3 -0
- package/scripts/product-build-tools.mjs +31 -0
- package/scripts/publish-public.mjs +7 -0
- package/scripts/push-tables.d.mts +1 -0
- package/scripts/push-tables.mjs +28 -0
- package/scripts/record-shard-mounts.mjs +133 -0
- package/scripts/sdk-externals.d.mts +2 -0
- package/scripts/sdk-externals.mjs +2 -0
- package/scripts/section-inventory.ts +209 -0
- package/scripts/select-candidate.mjs +15 -0
- package/scripts/shard-build-pool.d.mts +4 -0
- package/scripts/shard-build-pool.mjs +53 -0
- package/scripts/shard-line-baseline.json +17 -0
- package/scripts/shard-milestones.d.mts +15 -0
- package/scripts/shard-milestones.mjs +105 -0
- package/scripts/shard-output-report.d.mts +9 -0
- package/scripts/shard-output-report.mjs +85 -0
- package/scripts/shard-platform-cli.mjs +93 -0
- package/scripts/shard-progress.mjs +212 -0
- package/scripts/shard-timelapse.py +102 -0
- package/scripts/shardfile-cold-boot.mjs +79 -0
- package/scripts/shardfile-vite.d.mts +4 -0
- package/scripts/shardfile-vite.mjs +20 -0
- package/scripts/simplify-models.mjs +24 -0
- package/scripts/site-facts.mjs +88 -0
- package/scripts/test-template-gate.mjs +44 -0
- package/scripts/test_golden_compare.py +68 -0
- package/scripts/tex-tiers.cache.json +181 -0
- package/scripts/tex-tiers.mjs +240 -0
- package/scripts/texmem-probe.mjs +184 -0
- package/scripts/unused-assets.mjs +173 -0
- package/scripts/vite-tmp.d.mts +23 -0
- package/scripts/vite-tmp.mjs +157 -0
- package/scripts/wave-line-baselines.json +32 -0
- package/scripts/wildshard.d.mts +4 -0
- package/scripts/wildshard.mjs +105 -0
- package/scripts/witness-checkpoints.d.mts +10 -0
- package/scripts/witness-checkpoints.mjs +84 -0
- package/scripts/witness-generation.d.mts +10 -0
- package/scripts/witness-generation.mjs +45 -0
- package/scripts/witness-manifests.d.mts +8 -0
- package/scripts/witness-manifests.mjs +157 -0
- package/scripts/worktree-ignore.d.mts +4 -0
- package/scripts/worktree-ignore.mjs +36 -0
- package/scripts/worktree-reap.mjs +214 -0
- package/scripts/worktree.mjs +396 -0
- package/scripts/worldclaw/capture-front.sh +28 -0
- package/scripts/worldclaw/design-template.md +62 -0
- package/scripts/worldclaw/spec-map.py +92 -0
- package/scripts/worldclaw/spec.ts +96 -0
- package/skills/wildshard/SKILL.md +50 -0
- package/skills/wildshard-goldens/SKILL.md +54 -0
- package/skills/wildshard-mockup-to-model/SKILL.md +56 -0
- package/skills/wildshard-upgrade/SKILL.md +46 -0
- package/src/.oxfmtrc.json +50 -0
- package/src/.oxlintrc.json +173 -0
- package/src/cli/account/account.ts +199 -0
- package/src/cli/account/command.ts +193 -0
- package/src/cli/account/key.ts +154 -0
- package/src/cli/args.ts +97 -0
- package/src/cli/audio/audio.ts +24 -0
- package/src/cli/bin.mjs +8 -0
- package/src/cli/delete/delete.ts +258 -0
- package/src/cli/help.ts +196 -0
- package/src/cli/hero/adopt.ts +103 -0
- package/src/cli/hero/hero.ts +112 -0
- package/src/cli/hero/stamp.ts +298 -0
- package/src/cli/main.ts +292 -0
- package/src/cli/report.ts +16 -0
- package/src/cli/shardfile/command.ts +50 -0
- package/src/cli/shardfile/shardfile.ts +192 -0
- package/src/cli/upload/api.ts +246 -0
- package/src/cli/upload/compress.ts +55 -0
- package/src/cli/upload/hero.ts +62 -0
- package/src/cli/upload/placement.ts +115 -0
- package/src/cli/upload/provenance.ts +192 -0
- package/src/cli/upload/signature.ts +30 -0
- package/src/cli/upload/upload.ts +269 -0
- package/src/cli/upload/validate.ts +74 -0
- package/src/cli/upload/wire.ts +147 -0
- package/src/cli/version.ts +63 -0
- package/src/commons/bake/portableMath.ts +187 -0
- package/src/commons/catalogue.ts +10 -0
- package/src/commons/courseProgram.ts +32 -0
- package/src/commons/practiceCourse.ts +16 -0
- package/src/commons/scripts/abi.as +14 -0
- package/src/commons/scripts/bridge.as +14 -0
- package/src/commons/scripts/course.as +63 -0
- package/src/scripts/ask-new.sh +29 -0
- package/src/scripts/asks.mjs +141 -0
- package/src/scripts/herdr-prompt.sh +34 -0
- package/src/scripts/herdr-question-open.sh +67 -0
- package/src/scripts/md-wrap.mjs +229 -0
- package/src/server/app.ts +19 -0
- package/src/server/serve.ts +49 -0
- package/src/sharddev/admission.ts +7 -0
- package/src/sharddev/arenaView.ts +15 -0
- package/src/sharddev/as/groupBankV2.ts +36 -0
- package/src/sharddev/as/groupStepV2.ts +13 -0
- package/src/sharddev/as/ws.ts +30 -0
- package/src/sharddev/as/wsV2.ts +180 -0
- package/src/sharddev/assemblyscriptCompiler.d.mts +5 -0
- package/src/sharddev/assemblyscriptCompiler.mjs +14 -0
- package/src/sharddev/assetHandle.ts +84 -0
- package/src/sharddev/assetOwner.ts +70 -0
- package/src/sharddev/assetScope.ts +30 -0
- package/src/sharddev/assets.ts +21 -0
- package/src/sharddev/audio.ts +9 -0
- package/src/sharddev/audioEncode.ts +211 -0
- package/src/sharddev/author.ts +3 -0
- package/src/sharddev/authorError.ts +28 -0
- package/src/sharddev/authorManifest.ts +39 -0
- package/src/sharddev/bake/annulus.ts +19 -0
- package/src/sharddev/bake/assemblyscriptMemo.ts +76 -0
- package/src/sharddev/bake/assemblyscriptMemoPort.ts +4 -0
- package/src/sharddev/bake/authoredWorld.ts +201 -0
- package/src/sharddev/bake/basisEncoder.ts +95 -0
- package/src/sharddev/bake/basisGlb.ts +85 -0
- package/src/sharddev/bake/basisTool.ts +74 -0
- package/src/sharddev/bake/basisToolInputs.ts +476 -0
- package/src/sharddev/bake/byteCodec.ts +33 -0
- package/src/sharddev/bake/canvasAtlas.ts +406 -0
- package/src/sharddev/bake/coarseCopy.ts +59 -0
- package/src/sharddev/bake/colliders.ts +87 -0
- package/src/sharddev/bake/compactGlb.ts +224 -0
- package/src/sharddev/bake/compileScript.ts +119 -0
- package/src/sharddev/bake/compileScriptV2.ts +75 -0
- package/src/sharddev/bake/contactRows.ts +84 -0
- package/src/sharddev/bake/creaturePlacement.ts +117 -0
- package/src/sharddev/bake/export.ts +67 -0
- package/src/sharddev/bake/facetedGeometry.ts +379 -0
- package/src/sharddev/bake/farImpostor.ts +120 -0
- package/src/sharddev/bake/forest.ts +100 -0
- package/src/sharddev/bake/format-hook.mjs +2 -0
- package/src/sharddev/bake/generatorGlb.ts +23 -0
- package/src/sharddev/bake/geometryBounds.ts +77 -0
- package/src/sharddev/bake/geometryError.ts +48 -0
- package/src/sharddev/bake/glb.ts +355 -0
- package/src/sharddev/bake/glbCompression.ts +143 -0
- package/src/sharddev/bake/gltfSource.ts +59 -0
- package/src/sharddev/bake/groundMap.ts +142 -0
- package/src/sharddev/bake/image.ts +20 -0
- package/src/sharddev/bake/isleMap.ts +64 -0
- package/src/sharddev/bake/json.mjs +84 -0
- package/src/sharddev/bake/keyedSky.ts +47 -0
- package/src/sharddev/bake/keyedSkyMemo.ts +39 -0
- package/src/sharddev/bake/kinds.ts +137 -0
- package/src/sharddev/bake/lightSources.ts +31 -0
- package/src/sharddev/bake/mapAssembly.ts +84 -0
- package/src/sharddev/bake/mapRaster.ts +173 -0
- package/src/sharddev/bake/mapRest.ts +57 -0
- package/src/sharddev/bake/mapScenes.ts +234 -0
- package/src/sharddev/bake/materialGraph.ts +32 -0
- package/src/sharddev/bake/meadow.ts +27 -0
- package/src/sharddev/bake/meshoptChoiceMemo.ts +34 -0
- package/src/sharddev/bake/nativeInteractionFacts.ts +5 -0
- package/src/sharddev/bake/nativeLattice.ts +178 -0
- package/src/sharddev/bake/nativeRaster.ts +106 -0
- package/src/sharddev/bake/nativeTerrainField.ts +11 -0
- package/src/sharddev/bake/navigation-json.mjs +38 -0
- package/src/sharddev/bake/navigation.ts +113 -0
- package/src/sharddev/bake/navigationAsset.ts +18 -0
- package/src/sharddev/bake/nearPlaceholder.ts +206 -0
- package/src/sharddev/bake/normalizeRig.ts +80 -0
- package/src/sharddev/bake/phoneAstc.ts +93 -0
- package/src/sharddev/bake/placeholders.ts +581 -0
- package/src/sharddev/bake/placement.ts +80 -0
- package/src/sharddev/bake/portableBytes.ts +18 -0
- package/src/sharddev/bake/portableBytesMemo.ts +50 -0
- package/src/sharddev/bake/practiceCourse.ts +49 -0
- package/src/sharddev/bake/primitives.ts +96 -0
- package/src/sharddev/bake/props.ts +443 -0
- package/src/sharddev/bake/questPlacement.ts +98 -0
- package/src/sharddev/bake/rawTexture.ts +26 -0
- package/src/sharddev/bake/riderArms.ts +97 -0
- package/src/sharddev/bake/rig.ts +95 -0
- package/src/sharddev/bake/riggedHullRecipes.ts +40 -0
- package/src/sharddev/bake/signPlacements.ts +25 -0
- package/src/sharddev/bake/simplifier.ts +52 -0
- package/src/sharddev/bake/skinned.ts +312 -0
- package/src/sharddev/bake/slabChunks.ts +149 -0
- package/src/sharddev/bake/slabs.ts +263 -0
- package/src/sharddev/bake/source-loader.mjs +55 -0
- package/src/sharddev/bake/sourceMetadata.ts +54 -0
- package/src/sharddev/bake/species.ts +368 -0
- package/src/sharddev/bake/specimenCatalogue.ts +47 -0
- package/src/sharddev/bake/splatGround.ts +141 -0
- package/src/sharddev/bake/staticMaterials.ts +171 -0
- package/src/sharddev/bake/terrain.ts +195 -0
- package/src/sharddev/bake/texture.ts +33 -0
- package/src/sharddev/bake/textureWasm.ts +81 -0
- package/src/sharddev/bake/tileEncoder.ts +11 -0
- package/src/sharddev/bake/tileGrid.ts +62 -0
- package/src/sharddev/bake/v2Finite.ts +160 -0
- package/src/sharddev/bake/v2Fuel.ts +71 -0
- package/src/sharddev/bake/wholePartition.ts +74 -0
- package/src/sharddev/bake/wholePieceJoin.ts +147 -0
- package/src/sharddev/bake/world.ts +173 -0
- package/src/sharddev/bake/worldCollision.ts +128 -0
- package/src/sharddev/bake/worldGeometry.ts +237 -0
- package/src/sharddev/bake/worldGlb.ts +123 -0
- package/src/sharddev/bake/worldImage.ts +12 -0
- package/src/sharddev/bake/worldLod.ts +128 -0
- package/src/sharddev/bake/worldRows.ts +102 -0
- package/src/sharddev/bake/worldTextureMemo.ts +63 -0
- package/src/sharddev/bake/zstdBytesMemo.ts +52 -0
- package/src/sharddev/bake.ts +193 -0
- package/src/sharddev/bakePublication.ts +31 -0
- package/src/sharddev/behaviourSource.ts +94 -0
- package/src/sharddev/bin/wildshard.mjs +7 -0
- package/src/sharddev/blobBytes.ts +65 -0
- package/src/sharddev/blobs.ts +138 -0
- package/src/sharddev/bootInventory.ts +129 -0
- package/src/sharddev/bossProfiles.ts +18 -0
- package/src/sharddev/buildBehaviour.ts +77 -0
- package/src/sharddev/buildCacheMetrics.ts +17 -0
- package/src/sharddev/buildDecisionScripts.ts +122 -0
- package/src/sharddev/check.ts +117 -0
- package/src/sharddev/checkProject.ts +126 -0
- package/src/sharddev/cli.ts +191 -0
- package/src/sharddev/clientChannels.ts +169 -0
- package/src/sharddev/clientScripts.ts +10 -0
- package/src/sharddev/commons.ts +77 -0
- package/src/sharddev/commonsCosts.ts +11 -0
- package/src/sharddev/compileMovers.ts +11 -0
- package/src/sharddev/configBoundary.ts +6 -0
- package/src/sharddev/cookInput.ts +40 -0
- package/src/sharddev/crowds.ts +6 -0
- package/src/sharddev/decisionBindingMap.ts +11 -0
- package/src/sharddev/decisionScriptBindings.ts +117 -0
- package/src/sharddev/decisionScripts.ts +28 -0
- package/src/sharddev/decisionSource.ts +51 -0
- package/src/sharddev/dev.ts +113 -0
- package/src/sharddev/director.ts +26 -0
- package/src/sharddev/directorAbi.ts +77 -0
- package/src/sharddev/discoveryDocument.ts +97 -0
- package/src/sharddev/draft.ts +11 -0
- package/src/sharddev/eliteEntryRows.ts +29 -0
- package/src/sharddev/entries.ts +76 -0
- package/src/sharddev/entryReads.ts +73 -0
- package/src/sharddev/executeBundle.ts +55 -0
- package/src/sharddev/finds.ts +5 -0
- package/src/sharddev/formatJsonSchema.ts +3 -0
- package/src/sharddev/generationCache.ts +257 -0
- package/src/sharddev/generationRecipe.ts +94 -0
- package/src/sharddev/handwritten.ts +110 -0
- package/src/sharddev/immutable.ts +14 -0
- package/src/sharddev/interactions.ts +38 -0
- package/src/sharddev/kit/bakedGeometry.ts +16 -0
- package/src/sharddev/kit/geometryPack.ts +110 -0
- package/src/sharddev/ledger.ts +13 -0
- package/src/sharddev/looks/tileField.ts +67 -0
- package/src/sharddev/materialGraphFiles.ts +57 -0
- package/src/sharddev/materials.ts +574 -0
- package/src/sharddev/measure.ts +18 -0
- package/src/sharddev/modes.ts +115 -0
- package/src/sharddev/moverPrograms.ts +213 -0
- package/src/sharddev/movers.ts +75 -0
- package/src/sharddev/nativePopulationRows.ts +46 -0
- package/src/sharddev/newProject.ts +247 -0
- package/src/sharddev/noise.ts +54 -0
- package/src/sharddev/outputProduct.ts +188 -0
- package/src/sharddev/outputRuntime.ts +66 -0
- package/src/sharddev/performancePolicy.ts +18 -0
- package/src/sharddev/phasedBoss.ts +34 -0
- package/src/sharddev/physics.ts +194 -0
- package/src/sharddev/platformSections.ts +42 -0
- package/src/sharddev/plumbing.ts +8 -0
- package/src/sharddev/productOutput.ts +128 -0
- package/src/sharddev/project.ts +337 -0
- package/src/sharddev/projectCompilerIdentity.ts +94 -0
- package/src/sharddev/projectDecisions.ts +66 -0
- package/src/sharddev/projectEntryProof.ts +32 -0
- package/src/sharddev/projectGeneration.ts +219 -0
- package/src/sharddev/projectInputFiles.ts +47 -0
- package/src/sharddev/projectManifest.ts +108 -0
- package/src/sharddev/projectMap.ts +35 -0
- package/src/sharddev/projectOutput.ts +242 -0
- package/src/sharddev/projectPolicy.ts +17 -0
- package/src/sharddev/projectSections.ts +27 -0
- package/src/sharddev/questGraph.ts +25 -0
- package/src/sharddev/quests.ts +65 -0
- package/src/sharddev/random.ts +61 -0
- package/src/sharddev/refusals.ts +234 -0
- package/src/sharddev/reportCard.ts +13 -0
- package/src/sharddev/returnProjectionV2.ts +81 -0
- package/src/sharddev/rows.ts +192 -0
- package/src/sharddev/runtimeImports.ts +38 -0
- package/src/sharddev/runtimeMirrors.ts +39 -0
- package/src/sharddev/runtimePerformance.ts +38 -0
- package/src/sharddev/scene.ts +321 -0
- package/src/sharddev/sceneAnimation.ts +54 -0
- package/src/sharddev/sceneAudio.ts +64 -0
- package/src/sharddev/sceneDeclarations.ts +100 -0
- package/src/sharddev/sceneGraph.ts +139 -0
- package/src/sharddev/sceneTransform.ts +12 -0
- package/src/sharddev/schemaValidation.ts +61 -0
- package/src/sharddev/sections.ts +47 -0
- package/src/sharddev/shardSource.ts +59 -0
- package/src/sharddev/sourceReader.ts +26 -0
- package/src/sharddev/spawns.ts +38 -0
- package/src/sharddev/species/clips.ts +24 -0
- package/src/sharddev/species.ts +29 -0
- package/src/sharddev/speciesBrains.ts +19 -0
- package/src/sharddev/synth.ts +66 -0
- package/src/sharddev/test/compileDualScriptV2.ts +71 -0
- package/src/sharddev/test/compileSimV2.ts +21 -0
- package/src/sharddev/test/diskScriptScenario.ts +86 -0
- package/src/sharddev/test/scriptScenario.ts +249 -0
- package/src/sharddev/test/scriptSource.ts +12 -0
- package/src/sharddev/version.ts +4 -0
- package/src/sharddev/weapons/bowProfile.ts +20 -0
- package/src/sharddev/weapons/firearmRows.ts +11 -0
- package/src/sharddev/weapons/meleeProfile.ts +71 -0
- package/src/sharddev/weapons/thrownProfile.ts +10 -0
- package/src/sharddev/worldScenes.ts +308 -0
- package/src/sharddev/worldSource.ts +82 -0
- package/src/shards/_template/README.md +78 -0
- package/src/shards/_template/assets/2bf489fdb15f1734ddb4c4f32d500ec6da85c765ec7a4eb28dc6781160e7ec8c +0 -0
- package/src/shards/_template/assets/97ec4d8f75f5fa6239ee919444d6dc19fd35896bb305930c1f050ac6e0e0e6a6 +1 -0
- package/src/shards/_template/assets/a6a587a31327f936b1b04c05ade818c73fc8964260918662db43539465e27586 +0 -0
- package/src/shards/_template/assets/b4fbde0422e125b498c3dc8b9a5cc2516c8598f09e9d0e5f6b639b32f98179e6 +0 -0
- package/src/shards/_template/assets/bfa4dfc9c18979f904557ee8deab0058b8a399be10266f5fb1578b403f482fd4 +1 -0
- package/src/shards/_template/assets/ef3b7ff4fd22715771cb7d68a3977a903c5e7c3dc293542687d04b3ef3ace2cb +0 -0
- package/src/shards/_template/assets/f2db05998615ce1cb79ea96be32c168842eb6a2b34ec01feb86d36404603ee54 +0 -0
- package/src/shards/_template/assets/fef98ebb7fce6f66b26e78ac699e5c90f9bdcfaf8cabeb2b58125347eea8b4ab +0 -0
- package/src/shards/_template/behaviour/boss.as +39 -0
- package/src/shards/_template/behaviour/door.as +32 -0
- package/src/shards/_template/behaviour/hooks.json +129 -0
- package/src/shards/_template/behaviour/idle.as +75 -0
- package/src/shards/_template/behaviour/items.as +22 -0
- package/src/shards/_template/card/landscape.jpg +0 -0
- package/src/shards/_template/card/portrait.jpg +0 -0
- package/src/shards/_template/card/thumb.jpg +0 -0
- package/src/shards/_template/data/audio.json +45 -0
- package/src/shards/_template/data/bossDecision.json +83 -0
- package/src/shards/_template/data/budgets.json +70 -0
- package/src/shards/_template/data/card.json +281 -0
- package/src/shards/_template/data/clientScripts.json +987 -0
- package/src/shards/_template/data/creatures.json +65 -0
- package/src/shards/_template/data/director.json +39 -0
- package/src/shards/_template/data/encounters.json +96 -0
- package/src/shards/_template/data/items.json +172 -0
- package/src/shards/_template/data/layout.json +66 -0
- package/src/shards/_template/data/ledger.json +32 -0
- package/src/shards/_template/data/look.json +521 -0
- package/src/shards/_template/data/map.json +64 -0
- package/src/shards/_template/data/moves.json +16 -0
- package/src/shards/_template/data/placeholder.json +8 -0
- package/src/shards/_template/data/plumbing.json +32 -0
- package/src/shards/_template/data/quests.json +223 -0
- package/src/shards/_template/data/rows.json +423 -0
- package/src/shards/_template/data/skins.json +66 -0
- package/src/shards/_template/data/spawn.json +6 -0
- package/src/shards/_template/data/targets.json +150 -0
- package/src/shards/_template/data/text.json +12 -0
- package/src/shards/_template/data/ui.json +33 -0
- package/src/shards/_template/data/water.json +13 -0
- package/src/shards/_template/generators/behaviour.ts +34 -0
- package/src/shards/_template/generators/boss.ts +29 -0
- package/src/shards/_template/generators/buildOptions.ts +2 -0
- package/src/shards/_template/generators/cell.ts +224 -0
- package/src/shards/_template/generators/districts.ts +215 -0
- package/src/shards/_template/generators/farLook.ts +15 -0
- package/src/shards/_template/generators/generate.ts +27 -0
- package/src/shards/_template/generators/ground.ts +15 -0
- package/src/shards/_template/generators/kit.ts +69 -0
- package/src/shards/_template/generators/landscape.ts +59 -0
- package/src/shards/_template/generators/landscapeNoise.ts +62 -0
- package/src/shards/_template/generators/mapInputs.ts +10 -0
- package/src/shards/_template/generators/product.ts +100 -0
- package/src/shards/_template/generators/productOutput.ts +18 -0
- package/src/shards/_template/generators/props.ts +9 -0
- package/src/shards/_template/generators/templatePropsSource.ts +58 -0
- package/src/shards/_template/generators/terrain.ts +17 -0
- package/src/shards/_template/generators/world.ts +630 -0
- package/src/shards/_template/hero.json +10 -0
- package/src/shards/_template/look/entry-reads.json +20 -0
- package/src/shards/_template/manifest.json +281 -0
- package/src/shards/_template/shard.config.ts +10 -0
- package/src/shared/health.ts +10 -0
- package/src/tools/build-web.ts +59 -0
- package/src/tsconfig.json +30 -0
- package/src/web/app.tsx +53 -0
- package/src/web/index.html +12 -0
- package/src/web/main.tsx +10 -0
- package/src/web/tsconfig.json +13 -0
- package/tsconfig.author.json +23 -0
- package/tsconfig.commons.json +21 -0
- package/tsconfig.json +47 -0
- package/tsconfig.sharddev.json +20 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
"""OB7 measurement, model comparison and bounded AAC publication.
|
|
2
|
+
|
|
3
|
+
`measure` and `publish` load no neural model. `clap` and `vocals` each
|
|
4
|
+
load one model and must run in separate shared-lock turns. No command
|
|
5
|
+
claims an in-game playback pass or an ear-reviewed taste decision.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import difflib
|
|
11
|
+
import hashlib
|
|
12
|
+
import html
|
|
13
|
+
import json
|
|
14
|
+
import re
|
|
15
|
+
import shutil
|
|
16
|
+
import subprocess
|
|
17
|
+
import tempfile
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
HERE = Path(__file__).resolve().parent
|
|
21
|
+
REPO = HERE.parents[2]
|
|
22
|
+
SCORE = json.loads((HERE / "ob7-score-jobs.json").read_text())
|
|
23
|
+
SFX = json.loads((HERE / "ob7-sfx-jobs.json").read_text())["families"]
|
|
24
|
+
FOILS = ["music with melody and instruments", "a person speaking", "silence"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def write(path: Path, value: dict) -> None:
|
|
28
|
+
path.write_text(json.dumps(value, indent=2, allow_nan=False) + "\n")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def read_compared_take(wav: Path, comparison: dict) -> dict:
|
|
32
|
+
"""Keep publication and rejection records bound to the measured source."""
|
|
33
|
+
source = wav.with_suffix(".json")
|
|
34
|
+
wave_hash = hashlib.sha256(wav.read_bytes()).hexdigest()
|
|
35
|
+
metadata_hash = hashlib.sha256(source.read_bytes()).hexdigest()
|
|
36
|
+
if comparison.get("sourceWaveSha256") != wave_hash or comparison.get("sourceMetadataSha256") != metadata_hash:
|
|
37
|
+
raise ValueError(f"{wav}: source changed or comparison lacks source hashes")
|
|
38
|
+
return {"sourceWaveSha256": wave_hash, "sourceMetadataSha256": metadata_hash,
|
|
39
|
+
"source": json.loads(source.read_text())}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def publication_fit(family: str, engine: str, match: dict, decisions: dict) -> dict | None:
|
|
44
|
+
"""Keep the top-five bar unless a reviewed decision binds this exact measured take."""
|
|
45
|
+
if match["rank"] <= 5:
|
|
46
|
+
return None
|
|
47
|
+
binding = {"engine": engine, **{key: match.get(key) for key in
|
|
48
|
+
("rank", "p", "seed", "sourceWaveSha256", "sourceMetadataSha256")}}
|
|
49
|
+
accepted = decisions.get("families", {}).get(family)
|
|
50
|
+
if (accepted != binding or decisions.get("label") != "best measured, below top-5"
|
|
51
|
+
or not isinstance(decisions.get("ruling"), str) or not decisions["ruling"].startswith("G872 ")):
|
|
52
|
+
raise ValueError(f"{family}: neither engine meets the existing CLAP top-five bar; no exact fit decision")
|
|
53
|
+
return {"label": decisions["label"], "ruling": decisions["ruling"], "family": family, **binding}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def shared_bed(reference: dict) -> tuple[dict, dict, int]:
|
|
57
|
+
"""Reuse only an existing qualified catalogue body, never a copied take."""
|
|
58
|
+
source_set, key = reference.get("set"), reference.get("bed")
|
|
59
|
+
if not isinstance(source_set, str) or re.fullmatch(r"[a-z0-9]+(?:-[a-z0-9]+)*", source_set) is None:
|
|
60
|
+
raise ValueError("Shared bed requires a confined catalogue")
|
|
61
|
+
path = REPO / "public/assets/sfx" / source_set / "sfx.json"
|
|
62
|
+
source = json.loads(path.read_text())
|
|
63
|
+
bed = source.get("beds", {}).get(key)
|
|
64
|
+
if not isinstance(bed, dict) or not isinstance(bed.get("file"), str) or Path(bed["file"]).name != bed["file"]:
|
|
65
|
+
raise ValueError("Shared bed requires a direct existing recording")
|
|
66
|
+
provenance = [row for row in source.get("provenance", []) if row.get("file") == bed["file"]]
|
|
67
|
+
if len(provenance) != 1:
|
|
68
|
+
raise ValueError("Shared bed requires exact source provenance")
|
|
69
|
+
proof = provenance[0]
|
|
70
|
+
pair = proof.get("comparison", {})
|
|
71
|
+
if set(pair) != {"moss", "medium"} or proof.get("winner") not in pair or pair[proof["winner"]]["rank"] > 5:
|
|
72
|
+
raise ValueError("Shared bed requires its original qualified paired comparison")
|
|
73
|
+
asset = path.parent / bed["file"]
|
|
74
|
+
data = asset.read_bytes()
|
|
75
|
+
if not 0 < len(data) <= 1_000_000:
|
|
76
|
+
raise ValueError("Shared bed exceeds the existing blob bound")
|
|
77
|
+
if not 0 <= bed["loopStart"] < bed["loopEnd"] <= bed["duration"]:
|
|
78
|
+
raise ValueError("Shared bed has invalid original loop bounds")
|
|
79
|
+
file = {"set": source_set, "file": bed["file"]}
|
|
80
|
+
return {**bed, "file": file}, {**proof, "file": file, "reuse": {
|
|
81
|
+
"catalogue": str(path.relative_to(REPO)), "catalogueSha256": hashlib.sha256(path.read_bytes()).hexdigest(),
|
|
82
|
+
"bed": key, "recordingSha256": hashlib.sha256(data).hexdigest(), "bytes": len(data),
|
|
83
|
+
"credit": source["credit"], "licence": source["licence"], "gap": reference["gap"],
|
|
84
|
+
}}, len(data)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def replace_output_row(source: str, plot: str, row: dict) -> str:
|
|
88
|
+
"""Keep every peer's literal JSON, including duplicate-key author WIP."""
|
|
89
|
+
matches = []
|
|
90
|
+
decoder = json.JSONDecoder()
|
|
91
|
+
for match in re.finditer(r'(?m)^ \{', source):
|
|
92
|
+
start = match.start() + 4
|
|
93
|
+
value, end = decoder.raw_decode(source, start)
|
|
94
|
+
if isinstance(value, dict) and value.get('idea') == plot:
|
|
95
|
+
matches.append((start, end))
|
|
96
|
+
if len(matches) != 1:
|
|
97
|
+
raise ValueError('Activation requires one literal output row')
|
|
98
|
+
start, end = matches[0]
|
|
99
|
+
rendered = json.dumps(row, indent=2, ensure_ascii=False).replace('\n', '\n ')
|
|
100
|
+
return source[:start] + rendered + source[end:]
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def score_files(raw: Path, plot: str) -> list[Path]:
|
|
104
|
+
files = [raw / f"ob7-{plot}" / f"minimax3-{seed}.wav" for seed in (701, 702)]
|
|
105
|
+
if any(not file.is_file() for file in files):
|
|
106
|
+
raise ValueError(f"{plot}: both score takes are required")
|
|
107
|
+
return files
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def sfx_files(raw: Path, plot: str) -> list[Path]:
|
|
111
|
+
files = []
|
|
112
|
+
for family, row in SFX.items():
|
|
113
|
+
if row["into"] != plot:
|
|
114
|
+
continue
|
|
115
|
+
for model in ("moss", "medium"):
|
|
116
|
+
takes = sorted((raw / model / family).glob("*.wav"))
|
|
117
|
+
if not takes:
|
|
118
|
+
raise ValueError(f"{plot}: both engines for every sound are required")
|
|
119
|
+
files.extend(takes)
|
|
120
|
+
return files
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def measure(raw: Path, plot: str) -> None:
|
|
124
|
+
from analyze import analyze
|
|
125
|
+
job = SCORE["jobs"][f"ob7/{plot}"]
|
|
126
|
+
for wav in score_files(raw, plot):
|
|
127
|
+
side = json.loads(wav.with_suffix(".json").read_text())
|
|
128
|
+
path = wav.with_suffix(".metrics.json")
|
|
129
|
+
prior = json.loads(path.read_text()) if path.exists() else {}
|
|
130
|
+
write(path, {**prior, **analyze(wav, side, job, None, None)})
|
|
131
|
+
print(f"measured {wav.name}", flush=True)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def vocals(raw: Path, plot: str) -> None:
|
|
135
|
+
import soundfile as sf
|
|
136
|
+
from analyze import Vocals
|
|
137
|
+
model = Vocals()
|
|
138
|
+
for wav in score_files(raw, plot):
|
|
139
|
+
path = wav.with_suffix(".metrics.json")
|
|
140
|
+
metrics = json.loads(path.read_text())
|
|
141
|
+
samples, sr = sf.read(str(wav), always_2d=True)
|
|
142
|
+
metrics["vocals"] = model.score(samples, sr)
|
|
143
|
+
write(path, metrics)
|
|
144
|
+
print(f"vocals {wav.name}: {metrics['vocals']}", flush=True)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def clap(raw: Path, plot: str) -> None:
|
|
148
|
+
import librosa
|
|
149
|
+
import numpy as np
|
|
150
|
+
import soundfile as sf
|
|
151
|
+
import torch
|
|
152
|
+
from transformers import ClapModel, ClapProcessor
|
|
153
|
+
from analyze import CLAP_DIR, _tensor
|
|
154
|
+
|
|
155
|
+
model = ClapModel.from_pretrained(str(CLAP_DIR)).eval()
|
|
156
|
+
processor = ClapProcessor.from_pretrained(str(CLAP_DIR))
|
|
157
|
+
descriptions = [row["desc"] for row in SFX.values()] + FOILS
|
|
158
|
+
score_keys = list(SCORE["jobs"])
|
|
159
|
+
music_texts = [SCORE["jobs"][key]["prompt"] for key in score_keys] + FOILS
|
|
160
|
+
|
|
161
|
+
def compare(wav: Path, texts: list[str], own: int) -> dict:
|
|
162
|
+
samples, sr = sf.read(str(wav), always_2d=True)
|
|
163
|
+
mono = librosa.resample(samples.mean(1).astype(np.float32), orig_sr=sr, target_sr=48000)
|
|
164
|
+
chunks = [mono[i:i + 480000] for i in range(0, max(len(mono) - 240000, 1), 480000)]
|
|
165
|
+
with torch.no_grad():
|
|
166
|
+
text = torch.nn.functional.normalize(_tensor(model.get_text_features(**processor(text=texts, return_tensors="pt", padding=True))), dim=-1)
|
|
167
|
+
audio = torch.nn.functional.normalize(_tensor(model.get_audio_features(**processor(audio=chunks, sampling_rate=48000, return_tensors="pt"))), dim=-1).mean(0, keepdim=True)
|
|
168
|
+
similarity = (torch.nn.functional.normalize(audio, dim=-1) @ text.T)[0]
|
|
169
|
+
probability = torch.softmax(similarity * model.logit_scale_a.detach().exp(), 0)
|
|
170
|
+
return {"rank": int((similarity > similarity[own]).sum()) + 1,
|
|
171
|
+
"p": round(float(probability[own]), 6), "best": texts[int(similarity.argmax())]}
|
|
172
|
+
|
|
173
|
+
result = {"model": "laion/clap-htsat-fused", "sfx": {}, "sfxTakes": {}, "score": {}}
|
|
174
|
+
families = list(SFX)
|
|
175
|
+
for wav in sfx_files(raw, plot):
|
|
176
|
+
family = wav.parent.name
|
|
177
|
+
model_name = wav.parent.parent.name
|
|
178
|
+
match = {**compare(wav, descriptions, families.index(family)), "seed": wav.stem,
|
|
179
|
+
"sourceWaveSha256": hashlib.sha256(wav.read_bytes()).hexdigest(),
|
|
180
|
+
"sourceMetadataSha256": hashlib.sha256(wav.with_suffix(".json").read_bytes()).hexdigest()}
|
|
181
|
+
result["sfxTakes"].setdefault(family, []).append({"engine": model_name, **match})
|
|
182
|
+
family_rows = result["sfx"].setdefault(family, {})
|
|
183
|
+
old = family_rows.get(model_name)
|
|
184
|
+
if old is None or (match["rank"], -match["p"]) < (old["rank"], -old["p"]):
|
|
185
|
+
family_rows[model_name] = match
|
|
186
|
+
for wav in score_files(raw, plot):
|
|
187
|
+
result["score"][wav.stem] = compare(wav, music_texts, score_keys.index(f"ob7/{plot}"))
|
|
188
|
+
write(raw / f"{plot}-clap.json", result)
|
|
189
|
+
print(json.dumps(result), flush=True)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def encode_loop(wav: Path, target: Path, lufs: float, kbps: int, scratch: Path, music_metrics: dict | None = None) -> dict:
|
|
193
|
+
import librosa
|
|
194
|
+
import numpy as np
|
|
195
|
+
import soundfile as sf
|
|
196
|
+
from analyze import loop_seam
|
|
197
|
+
from stems import decode_offset, seam
|
|
198
|
+
|
|
199
|
+
samples, sr = sf.read(str(wav), always_2d=True)
|
|
200
|
+
mono = librosa.resample(samples.mean(1).astype(np.float32), orig_sr=sr, target_sr=22050)
|
|
201
|
+
loop = music_metrics["loop"] if music_metrics else loop_seam(mono, 22050, 240, len(samples) / sr)
|
|
202
|
+
if loop.get("score", -1) <= 0 or loop.get("end_s", 0) <= loop.get("start_s", 0):
|
|
203
|
+
raise ValueError(f"{wav}: no measured loop seam")
|
|
204
|
+
start, end = loop["start_s"], loop["end_s"]
|
|
205
|
+
# A one-second transition is bounded by the real pre-loop source audio.
|
|
206
|
+
crossfade = min(1.0, start / 2)
|
|
207
|
+
source, _ = seam(samples.T, sr, {"loopStart": start, "loopEnd": end}, crossfade)
|
|
208
|
+
intermediate = scratch / "loop.wav"
|
|
209
|
+
sf.write(str(intermediate), source.T, sr, subtype="FLOAT")
|
|
210
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
211
|
+
subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-i", str(intermediate),
|
|
212
|
+
"-af", f"loudnorm=I={lufs}:TP=-2:LRA=8,aresample=48000,asetpts=N/SR/TB", "-ar", "48000", "-c:a", "aac",
|
|
213
|
+
"-b:a", f"{kbps}k", "-movflags", "+faststart", str(target)], check=True)
|
|
214
|
+
# Refuse unsupported packets before any public copy or catalogue activation.
|
|
215
|
+
subprocess.run(["node", "--experimental-transform-types", "--input-type=module", "-e",
|
|
216
|
+
"import {readFileSync} from 'node:fs'; "
|
|
217
|
+
"import {indexRecordingAac} from './src/format/aacIndex.ts'; "
|
|
218
|
+
"indexRecordingAac(new Uint8Array(readFileSync(process.argv[1])));", str(target)],
|
|
219
|
+
cwd=REPO, check=True)
|
|
220
|
+
lag, duration = decode_offset(target, source, sr)
|
|
221
|
+
if not 0 <= start + lag < end + lag <= duration:
|
|
222
|
+
raise ValueError(f"{target}: loop is outside the decoded AAC")
|
|
223
|
+
intermediate.unlink()
|
|
224
|
+
digest = hashlib.sha256(target.read_bytes()).hexdigest()[:12]
|
|
225
|
+
addressed = target.with_name(f"{target.stem}-{digest}{target.suffix}")
|
|
226
|
+
target.rename(addressed)
|
|
227
|
+
return {"file": addressed.name, "loopStart": round(start + lag, 6), "loopEnd": round(end + lag, 6),
|
|
228
|
+
"duration": round(duration, 6), "gain": 1, "seamScore": loop["score"]}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def publish(raw: Path, plot: str) -> None:
|
|
232
|
+
with tempfile.TemporaryDirectory(prefix=f'encode-{plot}-', dir=raw) as folder:
|
|
233
|
+
publish_checked(raw, plot, Path(folder))
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def publish_checked(raw: Path, plot: str, scratch: Path) -> None:
|
|
237
|
+
comparisons = json.loads((raw / f"{plot}-clap.json").read_text())
|
|
238
|
+
decisions = json.loads((HERE / "ob7-fit-decisions.json").read_text())
|
|
239
|
+
music = scratch / 'music'
|
|
240
|
+
sfx = scratch / 'sfx'
|
|
241
|
+
music.mkdir()
|
|
242
|
+
sfx.mkdir()
|
|
243
|
+
candidates = []
|
|
244
|
+
for index, wav in enumerate(score_files(raw, plot)):
|
|
245
|
+
metrics = json.loads(wav.with_suffix(".metrics.json").read_text())
|
|
246
|
+
voice = metrics["vocals"]["vocal_energy_share"]
|
|
247
|
+
# Mosslight explicitly calls for a wordless low choir pad.
|
|
248
|
+
voice_limit = 0.6 if plot == "mosslight-ruins" else 0.1
|
|
249
|
+
failed = []
|
|
250
|
+
if metrics["duration_s"] < 25:
|
|
251
|
+
failed.append('duration below 25 seconds')
|
|
252
|
+
if voice > voice_limit:
|
|
253
|
+
failed.append(f'vocal check {voice:.1%} exceeds {voice_limit:.0%}')
|
|
254
|
+
if metrics["clipping"]["clipped_frac"] > 0.0001:
|
|
255
|
+
failed.append('clipping check')
|
|
256
|
+
if metrics["silence"]["longest_internal_gap_s"] > 2:
|
|
257
|
+
failed.append('internal silence check')
|
|
258
|
+
match = comparisons["score"][wav.stem]
|
|
259
|
+
rank = 0.5 * match["p"] + 0.35 * max(metrics["loop"]["score"], 0) + 0.15 * min(metrics["duration_s"] / 60, 1)
|
|
260
|
+
encoded = encode_loop(wav, music / f"take-{'ab'[index]}.m4a", -20, 64, scratch, metrics)
|
|
261
|
+
candidates.append({"id": wav.stem, "recommendationScore": rank, "metrics": metrics,
|
|
262
|
+
"qualified": not failed, "failedChecks": failed, "clap": match, "encoded": encoded,
|
|
263
|
+
"provenance": json.loads(wav.with_suffix(".json").read_text())})
|
|
264
|
+
qualified = [row for row in candidates if row['qualified']]
|
|
265
|
+
if not qualified:
|
|
266
|
+
raise ValueError(f'{plot}: neither score take passes the shipping checks')
|
|
267
|
+
winner = max(qualified, key=lambda row: row["recommendationScore"])
|
|
268
|
+
slot = {**winner["encoded"], "calm": winner["encoded"]["file"], "bpm": winner["metrics"]["loop"]["grid_bpm"],
|
|
269
|
+
"beatsPerBar": SCORE["jobs"][f"ob7/{plot}"].get("beatsPerBar", 4)}
|
|
270
|
+
write(music / "music.json", {"genre": plot, "model": "MiniMax Music 3", "credit": "Music: MiniMax-Music3",
|
|
271
|
+
"licence": "MiniMax-Music3 Community License",
|
|
272
|
+
"slots": {"score": slot}, "stings": {}, "recommendation": winner["id"], "takes": candidates})
|
|
273
|
+
manifest = {"model": "MOSS-SoundEffect v2 · Stable Audio 3 Medium", "credit": "Sound effects: MOSS-SoundEffect v2 · Stable Audio 3 Medium — Powered by Stability AI",
|
|
274
|
+
"licence": "MOSS: Apache-2.0; Stable Audio 3 Medium: Stability AI Community License and Gemma terms",
|
|
275
|
+
"beds": {}, "hums": {}, "oneshots": {}, "provenance": [], "rejected": []}
|
|
276
|
+
shared_bytes = 0
|
|
277
|
+
for family, row in SFX.items():
|
|
278
|
+
if row["into"] != plot:
|
|
279
|
+
continue
|
|
280
|
+
if "reuse" in row:
|
|
281
|
+
if row["kind"] != "bed":
|
|
282
|
+
raise ValueError("Only an ambience bed may reuse a catalogue recording")
|
|
283
|
+
entry, proof, shared_bytes = shared_bed(row["reuse"])
|
|
284
|
+
manifest["beds"][f"{plot}.ambience"] = entry
|
|
285
|
+
manifest["provenance"].append(proof)
|
|
286
|
+
manifest["credit"] += f"; shared bed from {row['reuse']['set']}"
|
|
287
|
+
takes = comparisons.get("sfxTakes", {}).get(family, [])
|
|
288
|
+
if {take["engine"] for take in takes} != {"moss", "medium"} or any(take["rank"] <= 5 for take in takes):
|
|
289
|
+
raise ValueError("Replaced bed requires the retained failing paired comparisons")
|
|
290
|
+
expected = {(engine, wav.stem) for engine in ("moss", "medium") for wav in (raw / engine / family).glob("*.wav")}
|
|
291
|
+
if {(take["engine"], take["seed"]) for take in takes} != expected or len(takes) != len(expected):
|
|
292
|
+
raise ValueError("Replaced bed has missing or duplicate source comparisons")
|
|
293
|
+
manifest["rejected"].append({"family": family, "reason": "Own bed failed; canonical qualified bed reused",
|
|
294
|
+
"takes": [{"comparison": take, **read_compared_take(raw / take["engine"] / family / f"{take['seed']}.wav", take)} for take in takes]})
|
|
295
|
+
continue
|
|
296
|
+
if row.get("shipping", True) is False:
|
|
297
|
+
takes = comparisons.get("sfxTakes", {}).get(family, [])
|
|
298
|
+
if {take["engine"] for take in takes} != {"moss", "medium"} or ("omission" not in row and any(take["rank"] <= 5 for take in takes)):
|
|
299
|
+
raise ValueError(f"{family}: rejected takes need complete failing engine comparisons")
|
|
300
|
+
expected = {(engine, wav.stem) for engine in ("moss", "medium") for wav in (raw / engine / family).glob("*.wav")}
|
|
301
|
+
actual = {(take["engine"], take["seed"]) for take in takes}
|
|
302
|
+
if actual != expected or len(takes) != len(expected):
|
|
303
|
+
raise ValueError(f"{family}: missing or duplicate rejected take comparison")
|
|
304
|
+
rejected = []
|
|
305
|
+
for take in takes:
|
|
306
|
+
wav = raw / take["engine"] / family / f"{take['seed']}.wav"
|
|
307
|
+
rejected.append({"comparison": take, **read_compared_take(wav, take)})
|
|
308
|
+
manifest["rejected"].append({"family": family, "reason": row.get("omission", row.get("rejection")), "takes": rejected})
|
|
309
|
+
continue
|
|
310
|
+
pair = comparisons["sfx"][family]
|
|
311
|
+
engine = min(pair, key=lambda key: (pair[key]["rank"], -pair[key]["p"]))
|
|
312
|
+
fit = publication_fit(family, engine, pair[engine], decisions)
|
|
313
|
+
wav = raw / engine / family / f"{pair[engine]['seed']}.wav"
|
|
314
|
+
source = read_compared_take(wav, pair[engine])
|
|
315
|
+
ident = family.removeprefix("bed.").removeprefix("hum.")
|
|
316
|
+
name = family.rsplit(".", 1)[1]
|
|
317
|
+
entry = encode_loop(wav, sfx / f"{name}.m4a", -24 if row["kind"] == "bed" else -26, 64, scratch)
|
|
318
|
+
manifest["beds" if row["kind"] == "bed" else "hums"][ident] = entry
|
|
319
|
+
manifest["provenance"].append({"file": entry["file"], "winner": engine, "comparison": pair, **source,
|
|
320
|
+
**({"fitDecision": fit} if fit is not None else {})})
|
|
321
|
+
write(sfx / "sfx.json", manifest)
|
|
322
|
+
total = shared_bytes + sum(path.stat().st_size for folder in (music, sfx) for path in folder.iterdir() if path.is_file())
|
|
323
|
+
if total > 3_000_000 or any(path.stat().st_size > 1_000_000 for folder in (music, sfx) for path in folder.iterdir()):
|
|
324
|
+
raise ValueError(f"{plot}: audio byte budget refused ({total})")
|
|
325
|
+
for staged, destination in [(music, REPO / 'public/assets/music' / plot), (sfx, REPO / 'public/assets/sfx' / plot)]:
|
|
326
|
+
destination.mkdir(parents=True, exist_ok=True)
|
|
327
|
+
for path in staged.iterdir():
|
|
328
|
+
shutil.copyfile(path, destination / path.name)
|
|
329
|
+
print(f"{plot}: {total} bytes, recommended {winner['id']}; native playback bar still open", flush=True)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def listening_list() -> None:
|
|
333
|
+
"""One small phone-friendly list; recordings stay in their plot folders."""
|
|
334
|
+
sections = []
|
|
335
|
+
for job in SCORE["jobs"].values():
|
|
336
|
+
plot = job["slot"]
|
|
337
|
+
path = REPO / "public/assets/music" / plot / "music.json"
|
|
338
|
+
if not path.exists():
|
|
339
|
+
continue
|
|
340
|
+
manifest = json.loads(path.read_text())
|
|
341
|
+
takes = []
|
|
342
|
+
for index, take in enumerate(manifest["takes"]):
|
|
343
|
+
label = "AB"[index]
|
|
344
|
+
recommendation = " · Recommended / shipping" if take["id"] == manifest["recommendation"] else ""
|
|
345
|
+
if not take['qualified']:
|
|
346
|
+
recommendation += ' · Comparison only: ' + html.escape('; '.join(take['failedChecks']))
|
|
347
|
+
source = html.escape(f"{plot}/{take['encoded']['file']}", quote=True)
|
|
348
|
+
takes.append(f'<p><strong>Take {label}{recommendation}</strong> · seed {take["provenance"]["seed"]}</p>'
|
|
349
|
+
f'<audio controls preload="none" src="{source}"></audio>')
|
|
350
|
+
sfx_path = REPO / "public/assets/sfx" / plot / "sfx.json"
|
|
351
|
+
if sfx_path.exists():
|
|
352
|
+
sfx = json.loads(sfx_path.read_text())
|
|
353
|
+
for bed in sfx["beds"].values():
|
|
354
|
+
recording = bed["file"]
|
|
355
|
+
source_set = recording["set"] if isinstance(recording, dict) else plot
|
|
356
|
+
filename = recording["file"] if isinstance(recording, dict) else recording
|
|
357
|
+
if re.fullmatch(r"[a-z0-9]+(?:-[a-z0-9]+)*", source_set) is None or Path(filename).name != filename:
|
|
358
|
+
raise ValueError("Listening bed requires a confined catalogue recording")
|
|
359
|
+
if not (REPO / "public/assets/sfx" / source_set / filename).is_file():
|
|
360
|
+
raise ValueError("Listening bed recording is missing")
|
|
361
|
+
source = html.escape(f"../sfx/{source_set}/{filename}", quote=True)
|
|
362
|
+
takes.append(f'<p><strong>Ambience bed</strong></p><audio controls preload="none" src="{source}"></audio>')
|
|
363
|
+
notes = ''.join(f'<p>{html.escape(row["reuse"]["gap"])}</p>'
|
|
364
|
+
for row in sfx["provenance"] if "reuse" in row)
|
|
365
|
+
takes.append('<details><summary>Sound credits and fit notes</summary>'
|
|
366
|
+
f'<p>{html.escape(sfx["credit"])}</p><p>{html.escape(sfx["licence"])}</p>{notes}</details>')
|
|
367
|
+
sections.append(f'<section><h2>{html.escape(plot.replace("-", " ").title())}</h2>{"".join(takes)}</section>')
|
|
368
|
+
if not sections:
|
|
369
|
+
raise ValueError("No real OB7 score recordings have been published")
|
|
370
|
+
page = ('<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">'
|
|
371
|
+
'<title>Open plots · morning listening batch</title><style>body{max-width:440px;margin:24px auto;padding:0 18px;background:#101820;color:#e7eef2;'
|
|
372
|
+
'font:16px/1.5 system-ui}h1{font-size:26px}h2{font-size:21px}section{border-top:1px solid #43505a;padding:16px 0}audio{width:100%}p{color:#c6d3dc}</style>'
|
|
373
|
+
'<h1>Open plots · morning listening batch</h1><p>Two MiniMax Music 3 takes per plot. The measured recommendation ships; your listening steers the pick. '
|
|
374
|
+
'Recommendations use theme match, loop seam, duration and vocal checks; they are not ear-reviewed verdicts.</p>'
|
|
375
|
+
+ ''.join(sections) + '<p>Music: MiniMax-Music3</p></html>')
|
|
376
|
+
(REPO / "public/assets/music/ob7-listening.html").write_text(page)
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
def activation(raw: Path, plot: str) -> None:
|
|
380
|
+
"""Emit an exact HEAD patch; peer loose JSON never enters this landing."""
|
|
381
|
+
music_dir = REPO / "public/assets/music" / plot
|
|
382
|
+
sfx_dir = REPO / "public/assets/sfx" / plot
|
|
383
|
+
music = json.loads((music_dir / "music.json").read_text())
|
|
384
|
+
sfx = json.loads((sfx_dir / "sfx.json").read_text())
|
|
385
|
+
if len(music["takes"]) != 2 or music["credit"] != "Music: MiniMax-Music3" or "Powered by Stability AI" not in sfx["credit"]:
|
|
386
|
+
raise ValueError("Both score candidates and required credits must exist before activation")
|
|
387
|
+
selected = [row for row in music['takes'] if row['id'] == music['recommendation'] and row['qualified']]
|
|
388
|
+
if len(selected) != 1 or music['slots']['score']['calm'] != selected[0]['encoded']['file']:
|
|
389
|
+
raise ValueError('Only the qualified recommended score may be activated')
|
|
390
|
+
anchors = json.loads((REPO / "src/shards/open-plots/data/audioAnchors.json").read_text())[plot]
|
|
391
|
+
if len(sfx["provenance"]) != len(anchors) + 1 or any(set(row["comparison"]) != {"moss", "medium"} for row in sfx["provenance"]):
|
|
392
|
+
raise ValueError("Both engines must be compared for the bed and every spot")
|
|
393
|
+
files = {"score": music["slots"]["score"]["calm"], "ambience": sfx["beds"][f"{plot}.ambience"]["file"],
|
|
394
|
+
**{row["id"]: sfx["hums"][f"{plot}.{row['id']}"]["file"] for row in anchors}}
|
|
395
|
+
for key, file in files.items():
|
|
396
|
+
folder = music_dir if key == "score" else sfx_dir
|
|
397
|
+
if isinstance(file, dict):
|
|
398
|
+
if key != "ambience":
|
|
399
|
+
raise ValueError("Only ambience may reference a shared catalogue")
|
|
400
|
+
_, proof, _ = shared_bed({"set": file["set"], "bed": sfx["provenance"][0]["reuse"]["bed"], "gap": sfx["provenance"][0]["reuse"]["gap"]})
|
|
401
|
+
folder = REPO / "public/assets/sfx" / file["set"]
|
|
402
|
+
if proof["reuse"]["recordingSha256"] != sfx["provenance"][0]["reuse"]["recordingSha256"]:
|
|
403
|
+
raise ValueError("Shared bed changed since publication")
|
|
404
|
+
files[key] = {**file, "dir": f"/assets/sfx/{file['set']}/"}
|
|
405
|
+
file = file["file"]
|
|
406
|
+
if Path(file).name != file or not (folder / file).is_file():
|
|
407
|
+
raise ValueError(f"Missing or unconfined recording: {file}")
|
|
408
|
+
binding = {"idea": plot, "source": {"dir": f"/assets/music/{plot}/", "manifestKey": plot},
|
|
409
|
+
"sfxDir": f"/assets/sfx/{plot}/", "files": files, "spots": anchors}
|
|
410
|
+
patches = []
|
|
411
|
+
|
|
412
|
+
def edit(name: str, mutate) -> None:
|
|
413
|
+
before = subprocess.run(["git", "show", f"HEAD:{name}"], cwd=REPO, check=True, capture_output=True, text=True).stdout
|
|
414
|
+
data = json.loads(before)
|
|
415
|
+
mutate(data)
|
|
416
|
+
after = (replace_output_row(before, plot, next(row for row in data['outputs'] if row['idea'] == plot))
|
|
417
|
+
if name == 'src/shards/open-plots/outputs.json'
|
|
418
|
+
else json.dumps(data, indent=2, ensure_ascii=False) + "\n")
|
|
419
|
+
patches.append(f"diff --git a/{name} b/{name}\n" + ''.join(difflib.unified_diff(
|
|
420
|
+
before.splitlines(keepends=True), after.splitlines(keepends=True), fromfile=f"a/{name}", tofile=f"b/{name}")))
|
|
421
|
+
|
|
422
|
+
edit("src/shards/open-plots/data/audioBindings.json", lambda data: data.update({plot: binding}))
|
|
423
|
+
base = json.loads((REPO / "src/shards/open-plots/manifest.json").read_text())
|
|
424
|
+
|
|
425
|
+
def manifest(row: dict) -> None:
|
|
426
|
+
metadata = row["manifest"]
|
|
427
|
+
metadata["audio"] = {"catalogue": True, "ambience": f"ambience.{plot}", "score": f"score.{plot}", "bed": "none"}
|
|
428
|
+
metadata["assetGlobs"] = list(dict.fromkeys([*metadata.get("assetGlobs", base["assetGlobs"]),
|
|
429
|
+
f"public/assets/music/{plot}/**", f"public/assets/sfx/{plot}/**"]))
|
|
430
|
+
shared = files["ambience"]
|
|
431
|
+
if isinstance(shared, dict):
|
|
432
|
+
metadata["assetGlobs"].append(f"public/assets/sfx/{shared['set']}/{shared['file']}")
|
|
433
|
+
|
|
434
|
+
def output(data: dict) -> None:
|
|
435
|
+
rows = [row for row in data["outputs"] if row["idea"] == plot]
|
|
436
|
+
if len(rows) != 1:
|
|
437
|
+
raise ValueError("Plot activation requires exactly its own output row")
|
|
438
|
+
manifest(rows[0])
|
|
439
|
+
|
|
440
|
+
edit("src/shards/open-plots/outputs.json", output)
|
|
441
|
+
template = f"src/shards/open-plots/data/templates/{plot}.json"
|
|
442
|
+
# The original Night Market pilot is authored directly in outputs.json.
|
|
443
|
+
if (REPO / template).is_file():
|
|
444
|
+
edit(template, lambda data: manifest(data["output"]))
|
|
445
|
+
destination = raw / f"{plot}-activation.patch"
|
|
446
|
+
destination.write_text(''.join(patches))
|
|
447
|
+
print(f"Exact activation patch: {destination}; native playback bar remains open")
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
def main() -> None:
|
|
451
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
452
|
+
parser.add_argument("command", choices=["measure", "vocals", "clap", "publish", "listening", "activate"])
|
|
453
|
+
parser.add_argument("raw", type=Path, nargs="?")
|
|
454
|
+
parser.add_argument("--plot")
|
|
455
|
+
args = parser.parse_args()
|
|
456
|
+
if args.command in ("clap", "vocals") and (REPO / '.git/quiet').exists():
|
|
457
|
+
raise SystemExit('Official Simulator quiet window is open; no model loaded')
|
|
458
|
+
if args.command == "listening":
|
|
459
|
+
listening_list()
|
|
460
|
+
return
|
|
461
|
+
if args.raw is None:
|
|
462
|
+
parser.error("raw directory is required")
|
|
463
|
+
if f"ob7/{args.plot}" not in SCORE["jobs"]:
|
|
464
|
+
parser.error("unknown plot")
|
|
465
|
+
{"measure": measure, "vocals": vocals, "clap": clap, "publish": publish, "activate": activation}[args.command](args.raw.resolve(), args.plot)
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
if __name__ == "__main__":
|
|
469
|
+
main()
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""Run one OB7 plot/model batch through the established patched generators.
|
|
2
|
+
|
|
3
|
+
The caller must hold the shared model lock and receive the coordinator's
|
|
4
|
+
START. Each invocation loads exactly one model and exits after one plot.
|
|
5
|
+
The finite run-locked.sh wrapper owns admission and the 30-minute deadline.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
import subprocess
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
HERE = Path(__file__).resolve().parent
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main() -> None:
|
|
20
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
21
|
+
parser.add_argument("model", choices=["score", "moss", "medium"])
|
|
22
|
+
parser.add_argument("plot")
|
|
23
|
+
parser.add_argument("--out", required=True)
|
|
24
|
+
parser.add_argument("--seeds", default="701", help="SFX retake seeds; score always renders 701 and 702")
|
|
25
|
+
parser.add_argument("--families", default="", help="Optional exact SFX families from this plot")
|
|
26
|
+
args = parser.parse_args()
|
|
27
|
+
if (HERE.parents[2] / '.git/quiet').exists():
|
|
28
|
+
raise SystemExit('Official Simulator quiet window is open; no model loaded')
|
|
29
|
+
score = json.loads((HERE / "ob7-score-jobs.json").read_text())
|
|
30
|
+
if f"ob7/{args.plot}" not in score["jobs"]:
|
|
31
|
+
parser.error("unknown OB7 plot")
|
|
32
|
+
if args.model == "score":
|
|
33
|
+
import gen_minimax
|
|
34
|
+
|
|
35
|
+
sys.argv = ["gen_minimax", "--jobs", "ob7-score-jobs.json",
|
|
36
|
+
"--keys", f"ob7/{args.plot}", "--seeds", "701,702",
|
|
37
|
+
"--out", args.out]
|
|
38
|
+
gen_minimax.main()
|
|
39
|
+
return
|
|
40
|
+
families = json.loads((HERE / "ob7-sfx-jobs.json").read_text())["families"]
|
|
41
|
+
keys = [key for key, row in families.items() if row["into"] == args.plot]
|
|
42
|
+
if args.families:
|
|
43
|
+
selected = args.families.split(',')
|
|
44
|
+
if not set(selected) <= set(keys):
|
|
45
|
+
parser.error('retakes must name this plot\'s declared SFX families')
|
|
46
|
+
keys = selected
|
|
47
|
+
sys.argv = ["gen_sfx", "--jobs", "ob7-sfx-jobs.json", "--families",
|
|
48
|
+
",".join(keys), "--seeds", args.seeds, "--out", args.out]
|
|
49
|
+
if args.model == "moss":
|
|
50
|
+
import gen_sfx_moss
|
|
51
|
+
|
|
52
|
+
# Retain the per-take memory refusal without its unbounded sleep.
|
|
53
|
+
def check_memory() -> None:
|
|
54
|
+
subprocess.run(["bash", str(gen_sfx_moss.GATE)], check=True,
|
|
55
|
+
env={**os.environ, "EXCLUDE_PID": str(os.getpid())})
|
|
56
|
+
|
|
57
|
+
gen_sfx_moss.wait_for_memory = check_memory
|
|
58
|
+
gen_sfx_moss.main()
|
|
59
|
+
else:
|
|
60
|
+
import gen_sfx
|
|
61
|
+
|
|
62
|
+
sys.argv += ["--model", "medium"]
|
|
63
|
+
gen_sfx.main()
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if __name__ == "__main__":
|
|
67
|
+
main()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# One model, one plot, one finite shared-lock batch. Honour any booked
|
|
3
|
+
# official window; no global eviction and no automatic retry.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)
|
|
6
|
+
model=${1:?model required: score, moss, medium, clap or vocals}
|
|
7
|
+
plot=${2:?plot required}
|
|
8
|
+
case "$plot" in
|
|
9
|
+
lantern-bayou|frostline-peaks|ember-forge|mosslight-ruins|coral-drift|night-market|jungle-ziggurat|patchwork-fairground|saltwind-lighthouse|fossil-badlands|sky-harbor|starfall-observatory|thin-ice|alien-plain|clockwork-canyon|desert-ruin|sky-race|showcase-template) ;;
|
|
10
|
+
*) echo "Unknown OB7 plot: $plot" >&2; exit 2 ;;
|
|
11
|
+
esac
|
|
12
|
+
shift 2
|
|
13
|
+
if [ -e "$repo/.git/quiet" ]; then
|
|
14
|
+
echo 'Official Simulator quiet window is open; no model loaded' >&2
|
|
15
|
+
exit 75
|
|
16
|
+
fi
|
|
17
|
+
raw="$repo/tmp/ob7-audio/raw"
|
|
18
|
+
mkdir -p "$raw"
|
|
19
|
+
log="$repo/tmp/ob7-audio/$plot-$model.log"
|
|
20
|
+
export HF_HUB_OFFLINE=1 MODEL_RUN_SECONDS=1800
|
|
21
|
+
runner="$HOME/projects/localai/bin/img2mesh/run-locked.sh"
|
|
22
|
+
case "$model" in
|
|
23
|
+
score)
|
|
24
|
+
cd "$HOME/ml/music/minimax-music3"
|
|
25
|
+
"$runner" "$log" .venv/bin/python "$repo/scripts/music/gen/ob7_generate.py" score "$plot" --out "$raw" "$@"
|
|
26
|
+
;;
|
|
27
|
+
moss)
|
|
28
|
+
cd "$HOME/ml/music/sfx/MOSS-TTS/moss_soundeffect_v2"
|
|
29
|
+
"$runner" "$log" env TORCHDYNAMO_DISABLE=1 PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.5 PYTORCH_MPS_LOW_WATERMARK_RATIO=0.4 \
|
|
30
|
+
.venv/bin/python "$repo/scripts/music/gen/ob7_generate.py" moss "$plot" --out "$raw" "$@"
|
|
31
|
+
;;
|
|
32
|
+
medium)
|
|
33
|
+
cd "$HOME/ml/music/sfx/stable-audio-3"
|
|
34
|
+
"$runner" "$log" .venv/bin/python "$repo/scripts/music/gen/ob7_generate.py" medium "$plot" --out "$raw" "$@"
|
|
35
|
+
;;
|
|
36
|
+
clap|vocals)
|
|
37
|
+
cd "$repo"
|
|
38
|
+
"$runner" "$log" "$HOME/ml/music/analysis/.venv/bin/python" scripts/music/gen/ob7_build.py "$model" "$raw" --plot "$plot" "$@"
|
|
39
|
+
;;
|
|
40
|
+
*) echo "Unknown OB7 model: $model" >&2; exit 2 ;;
|
|
41
|
+
esac
|
|
42
|
+
echo "OB7 $plot $model finished; $log"
|