sera-code 0.1.2 → 0.1.4
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/README.md +9 -1
- package/bin/sera.mjs +31 -0
- package/dist/bundle/chunks/{chunk-LOMPDCMP.js → chunk-DFRGGJWV.js} +1 -1
- package/dist/bundle/chunks/{chunk-AZC5WTED.js → chunk-EMXTNOOJ.js} +5 -5
- package/dist/bundle/chunks/{chunk-KXU77PUU.js → chunk-ET2ARYK4.js} +1 -1
- package/dist/bundle/chunks/{chunk-ZNCN2NGY.js → chunk-G5BGS7HZ.js} +2 -2
- package/dist/bundle/chunks/{chunk-HODJBMOY.js → chunk-GSGPISRE.js} +3 -4
- package/dist/bundle/chunks/{chunk-46WGNYIE.js → chunk-NMUS7OCP.js} +1 -1
- package/dist/bundle/chunks/{chunk-HQBQWHLD.js → chunk-RCQXVPCE.js} +1 -1
- package/dist/bundle/chunks/{cli-MML2DU4A.js → cli-NOCFT7AL.js} +1 -1
- package/dist/bundle/chunks/{execute-HXDNZ26B.js → execute-S2O3RL6V.js} +1 -1
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{runtime-JAH75CB5.js → runtime-BRT7AUXY.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-Z2V3PTLI.js → virtual-modules-QR2XYBMY.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/lib/postinstall.js +16 -0
- package/lib/update.js +85 -0
- package/lib/win-setup.js +96 -0
- package/package.json +4 -1
- package/sera-core/skills/ambalaj-tasarim/NOTICE +1 -0
- package/sera-core/skills/ambalaj-tasarim/SKILL.md +34 -0
- package/sera-core/skills/ambalaj-tasarim/dieline.mjs +17 -0
- package/sera-core/skills/ambalaj-tasarim/sera-pack.js +535 -0
- package/sera-core/skills/animasyonlu-site/NOTICE +1 -0
- package/sera-core/skills/animasyonlu-site/SKILL.md +26 -0
- package/sera-core/skills/animasyonlu-site/sera-motion.js +310 -0
- package/sera-core/skills/animate/LICENSE +21 -0
- package/sera-core/skills/animate/NOTICE +2 -0
- package/sera-core/skills/animate/RECIPES.md +324 -0
- package/sera-core/skills/animate/SKILL.md +209 -0
- package/sera-core/skills/astryx-ui/SKILL.md +37 -0
- package/sera-core/skills/awwwards/LICENSE +21 -0
- package/sera-core/skills/awwwards/NOTICE +5 -0
- package/sera-core/skills/awwwards/SKILL.md +357 -0
- package/sera-core/skills/awwwards/references/anatomy.md +103 -0
- package/sera-core/skills/awwwards/references/art-direction.md +114 -0
- package/sera-core/skills/awwwards/references/astro.md +235 -0
- package/sera-core/skills/awwwards/references/concepts.md +110 -0
- package/sera-core/skills/awwwards/references/content.md +88 -0
- package/sera-core/skills/awwwards/references/engine.md +751 -0
- package/sera-core/skills/awwwards/references/layout.md +81 -0
- package/sera-core/skills/awwwards/references/motion.md +463 -0
- package/sera-core/skills/awwwards/references/nextjs.md +386 -0
- package/sera-core/skills/awwwards/references/patterns.md +123 -0
- package/sera-core/skills/awwwards/references/quality-bar.md +151 -0
- package/sera-core/skills/awwwards/references/quality.md +91 -0
- package/sera-core/skills/awwwards/references/ship.md +36 -0
- package/sera-core/skills/awwwards/references/typography.md +135 -0
- package/sera-core/skills/awwwards/references/webgl.md +430 -0
- package/sera-core/skills/awwwards/scripts/audit.mjs +243 -0
- package/sera-core/skills/awwwards/scripts/browser.mjs +54 -0
- package/sera-core/skills/awwwards/scripts/font.mjs +87 -0
- package/sera-core/skills/awwwards/scripts/og.mjs +20 -0
- package/sera-core/skills/awwwards/scripts/photos.mjs +65 -0
- package/sera-core/skills/awwwards/scripts/serve.mjs +48 -0
- package/sera-core/skills/awwwards/scripts/shoot.mjs +675 -0
- package/sera-core/skills/beceri-yaz/SKILL.md +39 -0
- package/sera-core/skills/brag-slim/LICENSE +21 -0
- package/sera-core/skills/brag-slim/NOTICE +2 -0
- package/sera-core/skills/brag-slim/SKILL.md +108 -0
- package/sera-core/skills/brainstorming/LICENSE +21 -0
- package/sera-core/skills/brainstorming/NOTICE +5 -0
- package/sera-core/skills/brainstorming/SKILL.md +298 -0
- package/sera-core/skills/brainstorming/builder-check-prompt.md +23 -0
- package/sera-core/skills/copywriting/LICENSE +21 -0
- package/sera-core/skills/copywriting/NOTICE +5 -0
- package/sera-core/skills/copywriting/SKILL.md +343 -0
- package/sera-core/skills/copywriting/references/ai-tells.md +309 -0
- package/sera-core/skills/copywriting/references/copy-frameworks.md +432 -0
- package/sera-core/skills/copywriting/references/natural-transitions.md +256 -0
- package/sera-core/skills/cro/LICENSE +21 -0
- package/sera-core/skills/cro/NOTICE +5 -0
- package/sera-core/skills/cro/SKILL.md +198 -0
- package/sera-core/skills/cro/references/experiments.md +248 -0
- package/sera-core/skills/cro/references/form.md +422 -0
- package/sera-core/skills/derin-arastirma/referanslar/arastirma-yontem.md +11 -0
- package/sera-core/skills/emil-design-eng/LICENSE +21 -0
- package/sera-core/skills/emil-design-eng/NOTICE +2 -0
- package/sera-core/skills/emil-design-eng/SKILL.md +684 -0
- package/sera-core/skills/frontend-design/LICENSE.txt +177 -0
- package/sera-core/skills/frontend-design/NOTICE +2 -0
- package/sera-core/skills/frontend-design/SKILL.md +71 -0
- package/sera-core/skills/gorsel-denetim/SKILL.md +30 -0
- package/sera-core/skills/hallmark/LICENSE +21 -0
- package/sera-core/skills/hallmark/NOTICE +5 -0
- package/sera-core/skills/hallmark/SKILL.md +154 -0
- package/sera-core/skills/hallmark/references/anatomy.md +71 -0
- package/sera-core/skills/hallmark/references/brand-truth.md +40 -0
- package/sera-core/skills/hallmark/references/comp.md +104 -0
- package/sera-core/skills/hallmark/references/craft.md +116 -0
- package/sera-core/skills/hallmark/references/dark-mode.md +49 -0
- package/sera-core/skills/hallmark/references/data-viz.md +48 -0
- package/sera-core/skills/hallmark/references/design-md.md +53 -0
- package/sera-core/skills/hallmark/references/direction.md +52 -0
- package/sera-core/skills/hallmark/references/export-formats.md +80 -0
- package/sera-core/skills/hallmark/references/flow.md +131 -0
- package/sera-core/skills/hallmark/references/fonts.md +58 -0
- package/sera-core/skills/hallmark/references/gates.md +243 -0
- package/sera-core/skills/hallmark/references/genres/atmospheric.md +24 -0
- package/sera-core/skills/hallmark/references/genres/editorial.md +24 -0
- package/sera-core/skills/hallmark/references/genres/modern-minimal.md +24 -0
- package/sera-core/skills/hallmark/references/genres/playful.md +24 -0
- package/sera-core/skills/hallmark/references/imagery.md +99 -0
- package/sera-core/skills/hallmark/references/interaction-and-states.md +89 -0
- package/sera-core/skills/hallmark/references/layout.md +104 -0
- package/sera-core/skills/hallmark/references/macrostructures/01-bento-grid.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/02-long-document.md +35 -0
- package/sera-core/skills/hallmark/references/macrostructures/03-marquee-hero.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/04-stat-led.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/05-workbench.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/06-conversational-faq.md +28 -0
- package/sera-core/skills/hallmark/references/macrostructures/07-manifesto.md +28 -0
- package/sera-core/skills/hallmark/references/macrostructures/08-photographic.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/09-quote-led.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/10-specimen.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/11-catalogue.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/12-letter.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/13-index-first.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/14-narrative-workflow.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/15-split-studio.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/16-feature-stack.md +23 -0
- package/sera-core/skills/hallmark/references/macrostructures/17-type-specimen.md +19 -0
- package/sera-core/skills/hallmark/references/macrostructures/18-portfolio-grid.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/19-map-diagram.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures/20-ecosystem-index.md +19 -0
- package/sera-core/skills/hallmark/references/macrostructures/21-component-playground.md +21 -0
- package/sera-core/skills/hallmark/references/macrostructures.md +119 -0
- package/sera-core/skills/hallmark/references/microinteractions.md +80 -0
- package/sera-core/skills/hallmark/references/patterns.md +202 -0
- package/sera-core/skills/hallmark/references/redesign.md +88 -0
- package/sera-core/skills/hallmark/references/responsive.md +46 -0
- package/sera-core/skills/hallmark/references/review-finish.md +19 -0
- package/sera-core/skills/hallmark/references/review-hero.md +20 -0
- package/sera-core/skills/hallmark/references/scroll-choreography.md +110 -0
- package/sera-core/skills/hallmark/references/texture.md +90 -0
- package/sera-core/skills/hallmark/references/themes/README.md +58 -0
- package/sera-core/skills/hallmark/references/themes/almanac.md +103 -0
- package/sera-core/skills/hallmark/references/themes/arcade.md +102 -0
- package/sera-core/skills/hallmark/references/themes/atelier.md +98 -0
- package/sera-core/skills/hallmark/references/themes/bloom.md +102 -0
- package/sera-core/skills/hallmark/references/themes/blueprint.md +103 -0
- package/sera-core/skills/hallmark/references/themes/broadside.md +108 -0
- package/sera-core/skills/hallmark/references/themes/brutal.md +95 -0
- package/sera-core/skills/hallmark/references/themes/carnival.md +104 -0
- package/sera-core/skills/hallmark/references/themes/cobalt.md +101 -0
- package/sera-core/skills/hallmark/references/themes/console.md +99 -0
- package/sera-core/skills/hallmark/references/themes/coral.md +102 -0
- package/sera-core/skills/hallmark/references/themes/darkroom.md +99 -0
- package/sera-core/skills/hallmark/references/themes/dose.md +98 -0
- package/sera-core/skills/hallmark/references/themes/dusk.md +105 -0
- package/sera-core/skills/hallmark/references/themes/editorial.md +97 -0
- package/sera-core/skills/hallmark/references/themes/formwork.md +107 -0
- package/sera-core/skills/hallmark/references/themes/furrow.md +98 -0
- package/sera-core/skills/hallmark/references/themes/garden.md +97 -0
- package/sera-core/skills/hallmark/references/themes/grid.md +101 -0
- package/sera-core/skills/hallmark/references/themes/halftone.md +106 -0
- package/sera-core/skills/hallmark/references/themes/hedgerow.md +104 -0
- package/sera-core/skills/hallmark/references/themes/hum.md +99 -0
- package/sera-core/skills/hallmark/references/themes/ink.md +106 -0
- package/sera-core/skills/hallmark/references/themes/kiln.md +108 -0
- package/sera-core/skills/hallmark/references/themes/loom.md +106 -0
- package/sera-core/skills/hallmark/references/themes/lumen.md +103 -0
- package/sera-core/skills/hallmark/references/themes/manifesto.md +101 -0
- package/sera-core/skills/hallmark/references/themes/midnight.md +97 -0
- package/sera-core/skills/hallmark/references/themes/newsprint.md +102 -0
- package/sera-core/skills/hallmark/references/themes/overprint.md +101 -0
- package/sera-core/skills/hallmark/references/themes/pasteup.md +100 -0
- package/sera-core/skills/hallmark/references/themes/piste.md +99 -0
- package/sera-core/skills/hallmark/references/themes/refract.md +101 -0
- package/sera-core/skills/hallmark/references/themes/ribbon.md +106 -0
- package/sera-core/skills/hallmark/references/themes/rim.md +96 -0
- package/sera-core/skills/hallmark/references/themes/riso.md +98 -0
- package/sera-core/skills/hallmark/references/themes/solstice.md +104 -0
- package/sera-core/skills/hallmark/references/themes/specimen.md +100 -0
- package/sera-core/skills/hallmark/references/themes/spore.md +104 -0
- package/sera-core/skills/hallmark/references/themes/sport.md +101 -0
- package/sera-core/skills/hallmark/references/themes/squeeze.md +99 -0
- package/sera-core/skills/hallmark/references/themes/sticker.md +106 -0
- package/sera-core/skills/hallmark/references/themes/studio.md +99 -0
- package/sera-core/skills/hallmark/references/themes/terminal.md +96 -0
- package/sera-core/skills/hallmark/references/themes/terrazzo.md +106 -0
- package/sera-core/skills/hallmark/references/themes/ultraviolet.md +106 -0
- package/sera-core/skills/hallmark/references/themes/vantage.md +99 -0
- package/sera-core/skills/hallmark/references/themes/vellum.md +105 -0
- package/sera-core/skills/hallmark/references/themes/wayfind.md +105 -0
- package/sera-core/skills/hallmark/references/themes/werkstatt.md +105 -0
- package/sera-core/skills/hallmark/scripts/capture.mjs +132 -0
- package/sera-core/skills/hallmark/scripts/refcheck.mjs +405 -0
- package/sera-core/skills/hallmark/scripts/sloplint-render.mjs +1283 -0
- package/sera-core/skills/hallmark/scripts/sloplint.mjs +4426 -0
- package/sera-core/skills/hallmark/scripts/theme.mjs +660 -0
- package/sera-core/skills/kurum-ici-iletisim/SKILL.md +40 -0
- package/sera-core/skills/launch/LICENSE +21 -0
- package/sera-core/skills/launch/NOTICE +5 -0
- package/sera-core/skills/launch/SKILL.md +385 -0
- package/sera-core/skills/launch/references/shipped-changes.md +84 -0
- package/sera-core/skills/launch/references/site-launch-qa.md +57 -0
- package/sera-core/skills/marka-kimligi/SKILL.md +30 -0
- package/sera-core/skills/mcp-yaz/SKILL.md +41 -0
- package/sera-core/skills/mobil-arayuz/SKILL.md +12 -0
- package/sera-core/skills/mvp-scoping/LICENSE +21 -0
- package/sera-core/skills/mvp-scoping/NOTICE +5 -0
- package/sera-core/skills/mvp-scoping/SKILL.md +95 -0
- package/sera-core/skills/ortak-yazarlik/SKILL.md +32 -0
- package/sera-core/skills/oyun-turleri/SKILL.md +176 -0
- package/sera-core/skills/paralel-sadelestirme/SKILL.md +33 -0
- package/sera-core/skills/phaser-core/LICENSE +201 -0
- package/sera-core/skills/phaser-core/NOTICE +5 -0
- package/sera-core/skills/phaser-core/NOTICE-UPSTREAM +15 -0
- package/sera-core/skills/phaser-core/SKILL.md +245 -0
- package/sera-core/skills/phaser-core/references/scene-flow.md +177 -0
- package/sera-core/skills/pitch-deck/LICENSE +21 -0
- package/sera-core/skills/pitch-deck/NOTICE +5 -0
- package/sera-core/skills/pitch-deck/SKILL.md +103 -0
- package/sera-core/skills/sera-3d-oyun/NOTICE +1 -0
- package/sera-core/skills/sera-3d-oyun/SKILL.md +12 -0
- package/sera-core/skills/sera-3d-oyun/sera-3d.js +3697 -0
- package/sera-core/skills/sera-diyagram/SKILL.md +43 -0
- package/sera-core/skills/sera-ofis-dosya/SKILL.md +3 -0
- package/sera-core/skills/sera-ofis-dosya/referanslar/ofis-ileri.md +46 -0
- package/sera-core/skills/sera-ui-site/NOTICE +1 -0
- package/sera-core/skills/sera-ui-site/SKILL.md +10 -0
- package/sera-core/skills/sera-ui-site/sera-ui.js +83 -0
- package/sera-core/skills/sera-veri-gorsel/SKILL.md +3 -0
- package/sera-core/skills/sera-veri-gorsel/referanslar/palet-dogrula.mjs +80 -0
- package/sera-core/skills/sistem-tarama/SKILL.md +49 -0
- package/sera-core/skills/sistem-tarama/referanslar/komutlar.md +78 -0
- package/sera-core/skills/tasarim-stilleri/SKILL.md +113 -0
- package/sera-core/skills/teardown/LICENSE +22 -0
- package/sera-core/skills/teardown/NOTICE +3 -0
- package/sera-core/skills/teardown/SKILL.md +144 -0
- package/sera-core/skills/teardown/package-lock.json +545 -0
- package/sera-core/skills/teardown/package.json +18 -0
- package/sera-core/skills/teardown/paths.mjs +30 -0
- package/sera-core/skills/teardown/run_sfx.py +10 -0
- package/sera-core/skills/teardown/sfx/__init__.py +10 -0
- package/sera-core/skills/teardown/sfx/__main__.py +64 -0
- package/sera-core/skills/teardown/sfx/dsp.py +453 -0
- package/sera-core/skills/teardown/sfx/loudness.py +72 -0
- package/sera-core/skills/teardown/sfx/mix.py +111 -0
- package/sera-core/skills/teardown/sfx/samples/SOURCES.md +23 -0
- package/sera-core/skills/teardown/sfx/samples/fs-258269-mouth-pop.ogg +0 -0
- package/sera-core/skills/teardown/sfx/samples/fs-323432-typing.ogg +0 -0
- package/sera-core/skills/teardown/sfx/samples/fs-329533-room-tone-in-an-apartment-livi.ogg +0 -0
- package/sera-core/skills/teardown/sfx/samples/fs-329569-roomtone-bedroom-yew.ogg +0 -0
- package/sera-core/skills/teardown/sfx/samples/fs-339521-vhs-rewind-forward-and-eject.ogg +0 -0
- package/sera-core/skills/teardown/sfx/samples/fs-349504-triangle-open-04.ogg +0 -0
- package/sera-core/skills/teardown/sfx/samples/fs-416777-digital-typing-wav.ogg +0 -0
- package/sera-core/skills/teardown/sfx/samples/fs-426767-apartment-room-tone-wav.ogg +0 -0
- package/sera-core/skills/teardown/sfx/samples/fs-447909-keyboard-typing.ogg +0 -0
- package/sera-core/skills/teardown/sfx/samples/fs-447910-plop.ogg +0 -0
- package/sera-core/skills/teardown/sfx/samples/fs-79388-keyboard-typing-wav.ogg +0 -0
- package/sera-core/skills/teardown/sfx/samples/fs-824189-pop-in-sfx.ogg +0 -0
- package/sera-core/skills/teardown/sfx/score_kit.py +206 -0
- package/sera-core/skills/teardown/sfx/synth.py +294 -0
- package/sera-core/skills/teardown/sheet.mjs +127 -0
- package/sera-core/skills/teardown/sims/beats.py +212 -0
- package/sera-core/skills/teardown/sims/build.mjs +141 -0
- package/sera-core/skills/teardown/sims/capture.mjs +211 -0
- package/sera-core/skills/teardown/sims/cessna-film/main.js +4 -0
- package/sera-core/skills/teardown/sims/cessna-film/timeline.json +1 -0
- package/sera-core/skills/teardown/sims/cessna-live/main.js +5 -0
- package/sera-core/skills/teardown/sims/cessna-shared/console.js +288 -0
- package/sera-core/skills/teardown/sims/cessna-shared/film.js +254 -0
- package/sera-core/skills/teardown/sims/cessna-shared/flight.js +53 -0
- package/sera-core/skills/teardown/sims/cessna-shared/gear.js +364 -0
- package/sera-core/skills/teardown/sims/cessna-shared/live.js +351 -0
- package/sera-core/skills/teardown/sims/cessna-shared/score.py +41 -0
- package/sera-core/skills/teardown/sims/cessna-shared/stage.js +248 -0
- package/sera-core/skills/teardown/sims/kit/director.js +300 -0
- package/sera-core/skills/teardown/sims/kit/hud.js +194 -0
- package/sera-core/skills/teardown/sims/kit/runtime.js +168 -0
- package/sera-core/skills/teardown/sims/kit/stage3d.js +114 -0
- package/sera-core/skills/teardown/sims/kit/style.css +137 -0
- package/sera-core/skills/teardown/sims/kit/util.js +79 -0
- package/sera-core/skills/teardown/sims/kit/warm.js +66 -0
- package/sera-core/skills/teardown/sims/strandbeest-film/main.js +4 -0
- package/sera-core/skills/teardown/sims/strandbeest-film/timeline.json +1 -0
- package/sera-core/skills/teardown/sims/strandbeest-live/main.js +5 -0
- package/sera-core/skills/teardown/sims/strandbeest-shared/beast.js +419 -0
- package/sera-core/skills/teardown/sims/strandbeest-shared/console.js +375 -0
- package/sera-core/skills/teardown/sims/strandbeest-shared/film.js +352 -0
- package/sera-core/skills/teardown/sims/strandbeest-shared/jansen.js +67 -0
- package/sera-core/skills/teardown/sims/strandbeest-shared/live.js +420 -0
- package/sera-core/skills/teardown/sims/strandbeest-shared/score.py +85 -0
- package/sera-core/skills/teardown/sims/strandbeest-shared/stage.js +463 -0
- package/sera-core/skills/teardown/sims/v8-film/main.js +4 -0
- package/sera-core/skills/teardown/sims/v8-film/timeline.json +1 -0
- package/sera-core/skills/teardown/sims/v8-live/main.js +5 -0
- package/sera-core/skills/teardown/sims/v8-shared/console.js +339 -0
- package/sera-core/skills/teardown/sims/v8-shared/engine.js +624 -0
- package/sera-core/skills/teardown/sims/v8-shared/film.js +239 -0
- package/sera-core/skills/teardown/sims/v8-shared/kin.js +86 -0
- package/sera-core/skills/teardown/sims/v8-shared/live.js +374 -0
- package/sera-core/skills/teardown/sims/v8-shared/score.py +60 -0
- package/sera-core/skills/teardown/sims/v8-shared/stage.js +173 -0
- package/sera-core/skills/teardown/wave.mjs +67 -0
- package/sera-core/skills/toplu-degisiklik/SKILL.md +39 -0
- package/sera-core/skills/ui-ux-pro-max/LICENSE +21 -0
- package/sera-core/skills/ui-ux-pro-max/NOTICE +5 -0
- package/sera-core/skills/ui-ux-pro-max/SKILL.md +13 -0
- package/sera-core/skills/ui-ux-pro-max/references/pro-rules.md +117 -0
- package/sera-core/skills/ui-ux-pro-max/references/quick-reference.md +266 -0
- package/sera-core/skills/unslop/LICENSE.md +410 -0
- package/sera-core/skills/unslop/SKILL.md +217 -0
- package/sera-core/skills/unslop/references/effects.md +113 -0
- package/sera-core/skills/unslop/references/refs/unslop-dashboard-after.webp +0 -0
- package/sera-core/skills/unslop/references/refs/unslop-hero-after.webp +0 -0
- package/sera-core/skills/unslop/references/refs.md +16 -0
- package/sera-core/skills/unslop/references/rtl.md +72 -0
- package/sera-core/skills/unslop/references/signs.md +125 -0
- package/sera-core/skills/unslop/references/tokens.md +137 -0
- package/sera-core/skills/unslop/references/visuals.md +84 -0
- package/sera-core/skills/unslop/scripts/snapshot.mjs +197 -0
- package/sera-core/skills/uretken-sanat/SKILL.md +42 -0
- package/sera-core/skills/verification-before-completion/LICENSE +21 -0
- package/sera-core/skills/verification-before-completion/NOTICE +5 -0
- package/sera-core/skills/verification-before-completion/SKILL.md +120 -0
- package/sera-core/skills/web-yayin-listesi/SKILL.md +3 -0
- package/sera-core/src/app-master.ts +2 -2
- package/sera-core/src/app-verify.ts +33 -0
- package/sera-core/src/auto-memory.ts +249 -0
- package/sera-core/src/extension.ts +69 -3
- package/sera-core/src/generated/build-rules.ts +81 -17
- package/sera-core/src/generated/quality-probe.ts +2 -0
- package/sera-core/src/generated/zero-knowledge.ts +36 -9
- package/sera-core/src/image-tool.ts +124 -7
- package/sera-core/src/link-data-tools.ts +411 -0
- package/sera-core/src/skills.ts +54 -18
- package/sera-core/src/video-tool.ts +51 -0
- package/sera-core/src/zk.ts +7 -3
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
"""DSP building blocks (oscillators, filters, delays, reverb), pure Python stdlib at 48 kHz.
|
|
2
|
+
|
|
3
|
+
Used by sound scripts that need more than the one-shot generators in synth.py,
|
|
4
|
+
e.g. sims/engine/sound.py.
|
|
5
|
+
|
|
6
|
+
Signals are plain lists of floats. Speed comes from two tricks:
|
|
7
|
+
|
|
8
|
+
- A Python per-sample loop costs about 0.3 µs/sample and a list comprehension
|
|
9
|
+
about 0.05 µs. So constant-pitch oscillators are one comprehension (the naive
|
|
10
|
+
ramp) plus a sparse PolyBLEP fix-up at each wrap. Feedback delays and the
|
|
11
|
+
reverb combs/allpasses run one block at a time, where the block is no longer
|
|
12
|
+
than the delay, so every block depends only on earlier blocks and is a single
|
|
13
|
+
comprehension.
|
|
14
|
+
- Filters whose state really is sequential (SVF, biquad, ladder) are tight
|
|
15
|
+
loops, run only on short one-shots or on the few full-length buses that need
|
|
16
|
+
them.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import math
|
|
20
|
+
|
|
21
|
+
from .synth import SR
|
|
22
|
+
|
|
23
|
+
TAU = 2.0 * math.pi
|
|
24
|
+
_tanh = math.tanh
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# ---------------------------------------------------------------- buffers
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def zeros(n):
|
|
31
|
+
return [0.0] * n
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def add(dst, src, at=0, gain=1.0):
|
|
35
|
+
"""dst[at:] += gain * src, in place, clipped to dst."""
|
|
36
|
+
if at < 0:
|
|
37
|
+
src = src[-at:]
|
|
38
|
+
at = 0
|
|
39
|
+
end = min(len(dst), at + len(src))
|
|
40
|
+
if end <= at:
|
|
41
|
+
return
|
|
42
|
+
seg = dst[at:end]
|
|
43
|
+
if gain == 1.0:
|
|
44
|
+
dst[at:end] = [a + b for a, b in zip(seg, src)]
|
|
45
|
+
else:
|
|
46
|
+
dst[at:end] = [a + b * gain for a, b in zip(seg, src)]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def scaled(x, g):
|
|
50
|
+
return [v * g for v in x]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def mul(x, y):
|
|
54
|
+
return [a * b for a, b in zip(x, y)]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def summed(a, b):
|
|
58
|
+
return [p + q for p, q in zip(a, b)]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def rms(x):
|
|
62
|
+
return math.sqrt(sum(v * v for v in x) / len(x)) if x else 0.0
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def peak(x):
|
|
66
|
+
return max(max(x), -min(x)) if x else 0.0
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def pan_gains(pan):
|
|
70
|
+
"""Equal-power pan, -1 left .. +1 right."""
|
|
71
|
+
ang = (pan + 1.0) * math.pi / 4.0
|
|
72
|
+
return math.cos(ang), math.sin(ang)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def fade(x, fin=0, fout=0):
|
|
76
|
+
"""Linear fade in/out over fin/fout samples, in place."""
|
|
77
|
+
n = len(x)
|
|
78
|
+
fin, fout = min(fin, n), min(fout, n)
|
|
79
|
+
for i in range(fin):
|
|
80
|
+
x[i] *= i / fin
|
|
81
|
+
for i in range(fout):
|
|
82
|
+
x[n - 1 - i] *= i / fout
|
|
83
|
+
return x
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# ------------------------------------------------------------ oscillators
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _blep(out, phase, dt, n, h=1.0):
|
|
90
|
+
"""Subtract the PolyBLEP residual at every wrap of the ramp phase + i*dt (downward jump 2h)."""
|
|
91
|
+
k = 1
|
|
92
|
+
while True:
|
|
93
|
+
j = math.ceil((k - phase) / dt)
|
|
94
|
+
# float guard: make j the first sample whose wrapped phase is small
|
|
95
|
+
if j < n and (phase + j * dt) % 1.0 > 0.5:
|
|
96
|
+
j += 1
|
|
97
|
+
if j >= 1 and (phase + (j - 1) * dt) % 1.0 < 0.5:
|
|
98
|
+
j -= 1
|
|
99
|
+
if j - 1 >= n:
|
|
100
|
+
break
|
|
101
|
+
if 0 <= j < n:
|
|
102
|
+
u = ((phase + j * dt) % 1.0) / dt
|
|
103
|
+
if u < 1.0:
|
|
104
|
+
out[j] -= h * (u + u - u * u - 1.0)
|
|
105
|
+
if 1 <= j <= n:
|
|
106
|
+
u = (((phase + (j - 1) * dt) % 1.0) - 1.0) / dt
|
|
107
|
+
if u > -1.0:
|
|
108
|
+
out[j - 1] -= h * (u * u + u + u + 1.0)
|
|
109
|
+
k += 1
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def saw(freq, n, phase=0.0):
|
|
113
|
+
"""Band-limited sawtooth (PolyBLEP) at constant freq, -1..1."""
|
|
114
|
+
dt = freq / SR
|
|
115
|
+
phase %= 1.0
|
|
116
|
+
out = [2.0 * ((phase + i * dt) % 1.0) - 1.0 for i in range(n)]
|
|
117
|
+
if 0.0 < dt < 0.5:
|
|
118
|
+
_blep(out, phase, dt, n)
|
|
119
|
+
return out
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def pulse(freq, n, width=0.5, phase=0.0):
|
|
123
|
+
"""Band-limited pulse as the difference of two PolyBLEP saws; zero mean."""
|
|
124
|
+
a = saw(freq, n, phase)
|
|
125
|
+
b = saw(freq, n, phase + width)
|
|
126
|
+
return [p - q for p, q in zip(a, b)]
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def sine(freq, n, phase=0.0):
|
|
130
|
+
w = TAU * freq / SR
|
|
131
|
+
ph = TAU * phase
|
|
132
|
+
sin = math.sin
|
|
133
|
+
return [sin(ph + w * i) for i in range(n)]
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def noise(rng, n):
|
|
137
|
+
r = rng.random
|
|
138
|
+
return [2.0 * r() - 1.0 for _ in range(n)]
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
# ---------------------------------------------------------------- filters
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _norm(b0, b1, b2, a0, a1, a2):
|
|
145
|
+
return (b0 / a0, b1 / a0, b2 / a0, a1 / a0, a2 / a0)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def lp(fc, q=0.7071):
|
|
149
|
+
w = TAU * min(fc, 0.45 * SR) / SR
|
|
150
|
+
c, al = math.cos(w), math.sin(w) / (2 * q)
|
|
151
|
+
return _norm((1 - c) / 2, 1 - c, (1 - c) / 2, 1 + al, -2 * c, 1 - al)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def hp(fc, q=0.7071):
|
|
155
|
+
w = TAU * min(fc, 0.45 * SR) / SR
|
|
156
|
+
c, al = math.cos(w), math.sin(w) / (2 * q)
|
|
157
|
+
return _norm((1 + c) / 2, -(1 + c), (1 + c) / 2, 1 + al, -2 * c, 1 - al)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def bp(fc, q=1.0):
|
|
161
|
+
w = TAU * min(fc, 0.45 * SR) / SR
|
|
162
|
+
c, al = math.cos(w), math.sin(w) / (2 * q)
|
|
163
|
+
return _norm(al, 0.0, -al, 1 + al, -2 * c, 1 - al)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def peaking(fc, q, db):
|
|
167
|
+
a = 10 ** (db / 40)
|
|
168
|
+
w = TAU * min(fc, 0.45 * SR) / SR
|
|
169
|
+
c, al = math.cos(w), math.sin(w) / (2 * q)
|
|
170
|
+
return _norm(1 + al * a, -2 * c, 1 - al * a, 1 + al / a, -2 * c, 1 - al / a)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def shelf(fc, db, high=True):
|
|
174
|
+
a = 10 ** (db / 40)
|
|
175
|
+
w = TAU * min(fc, 0.45 * SR) / SR
|
|
176
|
+
c, s = math.cos(w), math.sin(w)
|
|
177
|
+
al = s / 2 * math.sqrt(2)
|
|
178
|
+
sa = 2 * math.sqrt(a) * al
|
|
179
|
+
if high:
|
|
180
|
+
return _norm(
|
|
181
|
+
a * ((a + 1) + (a - 1) * c + sa), -2 * a * ((a - 1) + (a + 1) * c), a * ((a + 1) + (a - 1) * c - sa),
|
|
182
|
+
(a + 1) - (a - 1) * c + sa, 2 * ((a - 1) - (a + 1) * c), (a + 1) - (a - 1) * c - sa,
|
|
183
|
+
)
|
|
184
|
+
return _norm(
|
|
185
|
+
a * ((a + 1) - (a - 1) * c + sa), 2 * a * ((a - 1) - (a + 1) * c), a * ((a + 1) - (a - 1) * c - sa),
|
|
186
|
+
(a + 1) + (a - 1) * c + sa, -2 * ((a - 1) + (a + 1) * c), (a + 1) + (a - 1) * c - sa,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def biquad(x, c):
|
|
191
|
+
"""Static biquad (transposed direct form II); c from lp/hp/bp/peaking/shelf."""
|
|
192
|
+
b0, b1, b2, a1, a2 = c
|
|
193
|
+
z1 = z2 = 0.0
|
|
194
|
+
out = [0.0] * len(x)
|
|
195
|
+
i = 0
|
|
196
|
+
for v in x:
|
|
197
|
+
y = b0 * v + z1
|
|
198
|
+
z1 = b1 * v - a1 * y + z2
|
|
199
|
+
z2 = b2 * v - a2 * y
|
|
200
|
+
out[i] = y
|
|
201
|
+
i += 1
|
|
202
|
+
return out
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def svf(x, fc, q=0.7071, mode="lp", ctrl=32):
|
|
206
|
+
"""Zero-delay-feedback state-variable filter (Cytomic/Simper), stable under fast modulation.
|
|
207
|
+
|
|
208
|
+
fc: Hz, or a function of the sample index evaluated every `ctrl` samples.
|
|
209
|
+
mode: 'lp', 'bp' or 'hp'.
|
|
210
|
+
"""
|
|
211
|
+
n = len(x)
|
|
212
|
+
out = [0.0] * n
|
|
213
|
+
k = 1.0 / q
|
|
214
|
+
ic1 = ic2 = 0.0
|
|
215
|
+
const = not callable(fc)
|
|
216
|
+
if const:
|
|
217
|
+
ctrl = max(n, 1)
|
|
218
|
+
tan = math.tan
|
|
219
|
+
pis = math.pi / SR
|
|
220
|
+
for s in range(0, n, ctrl):
|
|
221
|
+
f = fc if const else fc(s)
|
|
222
|
+
f = 10.0 if f < 10.0 else 20000.0 if f > 20000.0 else f
|
|
223
|
+
g = tan(pis * f)
|
|
224
|
+
a1 = 1.0 / (1.0 + g * (g + k))
|
|
225
|
+
a2 = g * a1
|
|
226
|
+
a3 = g * a2
|
|
227
|
+
e = s + ctrl if s + ctrl < n else n
|
|
228
|
+
if mode == "lp":
|
|
229
|
+
for i in range(s, e):
|
|
230
|
+
v3 = x[i] - ic2
|
|
231
|
+
v1 = a1 * ic1 + a2 * v3
|
|
232
|
+
v2 = ic2 + a2 * ic1 + a3 * v3
|
|
233
|
+
ic1 = v1 + v1 - ic1
|
|
234
|
+
ic2 = v2 + v2 - ic2
|
|
235
|
+
out[i] = v2
|
|
236
|
+
elif mode == "bp":
|
|
237
|
+
for i in range(s, e):
|
|
238
|
+
v3 = x[i] - ic2
|
|
239
|
+
v1 = a1 * ic1 + a2 * v3
|
|
240
|
+
v2 = ic2 + a2 * ic1 + a3 * v3
|
|
241
|
+
ic1 = v1 + v1 - ic1
|
|
242
|
+
ic2 = v2 + v2 - ic2
|
|
243
|
+
out[i] = v1
|
|
244
|
+
else:
|
|
245
|
+
for i in range(s, e):
|
|
246
|
+
xi = x[i]
|
|
247
|
+
v3 = xi - ic2
|
|
248
|
+
v1 = a1 * ic1 + a2 * v3
|
|
249
|
+
v2 = ic2 + a2 * ic1 + a3 * v3
|
|
250
|
+
ic1 = v1 + v1 - ic1
|
|
251
|
+
ic2 = v2 + v2 - ic2
|
|
252
|
+
out[i] = xi - k * v1 - v2
|
|
253
|
+
return out
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def onepole_hp(x, fc):
|
|
257
|
+
"""Gentle 6 dB/oct high-pass; used as a DC blocker."""
|
|
258
|
+
a = math.exp(-TAU * fc / SR)
|
|
259
|
+
out = [0.0] * len(x)
|
|
260
|
+
px = py = 0.0
|
|
261
|
+
i = 0
|
|
262
|
+
for v in x:
|
|
263
|
+
py = a * (py + v - px)
|
|
264
|
+
px = v
|
|
265
|
+
out[i] = py
|
|
266
|
+
i += 1
|
|
267
|
+
return out
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def sweep(x, start, end, f0, f1, mode="lp", q=0.9, wet_in=0.0, wet_out=0.0):
|
|
271
|
+
"""Filter x[start:end] in place, cutoff gliding exponentially f0 -> f1.
|
|
272
|
+
|
|
273
|
+
wet_in / wet_out (fractions of the region) crossfade from / back to the
|
|
274
|
+
dry signal, so the region's edges are seamless.
|
|
275
|
+
"""
|
|
276
|
+
start, end = max(0, start), min(len(x), end)
|
|
277
|
+
n = end - start
|
|
278
|
+
if n <= 0:
|
|
279
|
+
return
|
|
280
|
+
seg = x[start:end]
|
|
281
|
+
r = f1 / f0
|
|
282
|
+
y = svf(seg, lambda i: f0 * r ** (i / n), q, mode, 32)
|
|
283
|
+
a = max(1, int(wet_in * n))
|
|
284
|
+
b = max(1, int(wet_out * n))
|
|
285
|
+
out = []
|
|
286
|
+
for i in range(n):
|
|
287
|
+
w = 1.0
|
|
288
|
+
if wet_in and i < a:
|
|
289
|
+
w = i / a
|
|
290
|
+
if wet_out and i > n - b:
|
|
291
|
+
w = min(w, (n - i) / b)
|
|
292
|
+
out.append(seg[i] + (y[i] - seg[i]) * w)
|
|
293
|
+
x[start:end] = out
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
# ------------------------------------------------------- delay and reverb
|
|
297
|
+
|
|
298
|
+
_COMBS = (1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617)
|
|
299
|
+
_ALLPASSES = (556, 441, 341, 225)
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def _comb(x, m, fb, damp):
|
|
303
|
+
"""Freeverb comb, block-vectorized; the in-loop damping is a 2-tap low-pass."""
|
|
304
|
+
n = len(x)
|
|
305
|
+
a = fb * (1.0 - damp)
|
|
306
|
+
b = fb * damp
|
|
307
|
+
w = [0.0] * (n + m + 1) # w[i + m + 1] = W(i)
|
|
308
|
+
for s in range(0, n, m):
|
|
309
|
+
e = min(s + m, n)
|
|
310
|
+
w[s + m + 1:e + m + 1] = [xi + a * p + b * q for xi, p, q in zip(x[s:e], w[s + 1:e + 1], w[s:e])]
|
|
311
|
+
return w[1:n + 1]
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
def _allpass(x, m, g=0.5):
|
|
315
|
+
n = len(x)
|
|
316
|
+
v = [0.0] * (n + m) # v[i + m] = V(i)
|
|
317
|
+
for s in range(0, n, m):
|
|
318
|
+
e = min(s + m, n)
|
|
319
|
+
v[s + m:e + m] = [xi + g * p for xi, p in zip(x[s:e], v[s:e])]
|
|
320
|
+
return [p - xi for xi, p in zip(x, v)]
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def reverb(x, size=0.7, damp=0.45, scale=1.0, spread=23):
|
|
324
|
+
"""Freeverb (8 combs + 4 allpasses per side): mono in, (left, right) wet out.
|
|
325
|
+
|
|
326
|
+
size 0..1 maps to comb feedback 0.7..0.98; scale stretches every delay
|
|
327
|
+
(0.3 = small room, 1.5 = hall). Output is roughly level-matched to input.
|
|
328
|
+
"""
|
|
329
|
+
fb = 0.7 + 0.28 * size
|
|
330
|
+
r = SR / 44100 * scale
|
|
331
|
+
outs = []
|
|
332
|
+
for off in (0, spread):
|
|
333
|
+
acc = None
|
|
334
|
+
for m in _COMBS:
|
|
335
|
+
c = _comb(x, max(8, int((m + off) * r)), fb, damp)
|
|
336
|
+
acc = c if acc is None else [p + q for p, q in zip(acc, c)]
|
|
337
|
+
for m in _ALLPASSES:
|
|
338
|
+
acc = _allpass(acc, max(8, int((m + off) * r)))
|
|
339
|
+
outs.append(acc)
|
|
340
|
+
g = math.sqrt((1 - fb * fb) / 8.0) * 1.4
|
|
341
|
+
return [v * g for v in outs[0]], [v * g for v in outs[1]]
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
def pingpong(x, d, fb=0.5, damp=0.35):
|
|
345
|
+
"""Ping-pong delay, mono in -> (left, right) wet; first echo left at d samples, then alternating."""
|
|
346
|
+
n = len(x)
|
|
347
|
+
xp = [0.0] * d + x
|
|
348
|
+
a = [0.0] * (n + d + 1) # a[i + d + 1] = A(i)
|
|
349
|
+
b = [0.0] * (n + d + 1)
|
|
350
|
+
c0 = fb * (1.0 - damp)
|
|
351
|
+
c1 = fb * damp
|
|
352
|
+
for s in range(0, n, d):
|
|
353
|
+
e = min(s + d, n)
|
|
354
|
+
av = [xi + c0 * p + c1 * q for xi, p, q in zip(xp[s:e], b[s + 1:e + 1], b[s:e])]
|
|
355
|
+
bv = [c0 * p + c1 * q for p, q in zip(a[s + 1:e + 1], a[s:e])]
|
|
356
|
+
a[s + d + 1:e + d + 1] = av
|
|
357
|
+
b[s + d + 1:e + d + 1] = bv
|
|
358
|
+
return a[d + 1:], b[d + 1:]
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
# --------------------------------------------------------------- dynamics
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def softclip(x, drive=1.5):
|
|
365
|
+
norm = 1.0 / _tanh(drive)
|
|
366
|
+
return [_tanh(drive * v) * norm for v in x]
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
def compress(left, right, thresh_db=-12.0, ratio=2.0, attack=0.01, release=0.15, knee_db=6.0, block=64):
|
|
370
|
+
"""Stereo-linked RMS bus compressor at control rate (one gain per block, interpolated)."""
|
|
371
|
+
n = len(left)
|
|
372
|
+
pw = [a * a + b * b for a, b in zip(left, right)]
|
|
373
|
+
ca = math.exp(-block / (attack * SR))
|
|
374
|
+
cr = math.exp(-block / (release * SR))
|
|
375
|
+
slope = 1.0 / ratio - 1.0
|
|
376
|
+
half = knee_db / 2
|
|
377
|
+
gr = 0.0
|
|
378
|
+
gains = []
|
|
379
|
+
# warm the detector on the first second so the start isn't uncompressed
|
|
380
|
+
for warm in (True, False):
|
|
381
|
+
for s in range(0, n if not warm else min(n, SR), block):
|
|
382
|
+
p = sum(pw[s:s + block]) / (2 * block)
|
|
383
|
+
db = 10 * math.log10(p + 1e-12)
|
|
384
|
+
over = db - thresh_db
|
|
385
|
+
if over <= -half:
|
|
386
|
+
want = 0.0
|
|
387
|
+
elif over < half:
|
|
388
|
+
want = slope * (over + half) ** 2 / (2 * knee_db)
|
|
389
|
+
else:
|
|
390
|
+
want = slope * over
|
|
391
|
+
c = ca if want < gr else cr
|
|
392
|
+
gr = c * gr + (1 - c) * want
|
|
393
|
+
if not warm:
|
|
394
|
+
gains.append(10 ** (gr / 20))
|
|
395
|
+
ramp = [k / block for k in range(block)]
|
|
396
|
+
g = []
|
|
397
|
+
prev = gains[0]
|
|
398
|
+
for cur in gains:
|
|
399
|
+
d = cur - prev
|
|
400
|
+
g.extend([prev + d * r for r in ramp])
|
|
401
|
+
prev = cur
|
|
402
|
+
return [a * b for a, b in zip(left, g)], [a * b for a, b in zip(right, g)]
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def mono_below(left, right, fc=120.0):
|
|
406
|
+
"""Collapse the side signal below fc (24 dB/oct), so the low end is mono."""
|
|
407
|
+
mid = [(a + b) * 0.5 for a, b in zip(left, right)]
|
|
408
|
+
side = [(a - b) * 0.5 for a, b in zip(left, right)]
|
|
409
|
+
c = hp(fc)
|
|
410
|
+
side = biquad(biquad(side, c), c)
|
|
411
|
+
return [m + s for m, s in zip(mid, side)], [m - s for m, s in zip(mid, side)]
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
# --------------------------------------------------------- glitch effects
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
def crush(x, bits=8, hold=2):
|
|
418
|
+
"""Bit and sample-rate reduction (intentionally aliasing)."""
|
|
419
|
+
q = float(2 ** (bits - 1))
|
|
420
|
+
return [round(x[i - i % hold] * q) / q for i in range(len(x))]
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
def stutter(x, start, slice_n, repeats, decay=0.9, edge=48):
|
|
424
|
+
"""Beat-repeat in place: x[start:start+slice_n] repeated `repeats` times."""
|
|
425
|
+
sl = x[start:start + slice_n]
|
|
426
|
+
if len(sl) < slice_n:
|
|
427
|
+
return
|
|
428
|
+
sl = fade(sl[:], edge, edge)
|
|
429
|
+
for r in range(repeats):
|
|
430
|
+
a = start + r * slice_n
|
|
431
|
+
if a + slice_n > len(x):
|
|
432
|
+
break
|
|
433
|
+
x[a:a + slice_n] = [v * decay ** r for v in sl]
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
def tapestop(x, start, n, curve=1.6):
|
|
437
|
+
"""Tape stop in place over x[start:start+n]: playback slows to zero."""
|
|
438
|
+
seg = x[start:start + n]
|
|
439
|
+
n = len(seg)
|
|
440
|
+
if n < 2:
|
|
441
|
+
return
|
|
442
|
+
out = []
|
|
443
|
+
pos = 0.0
|
|
444
|
+
for i in range(n):
|
|
445
|
+
j = int(pos)
|
|
446
|
+
if j + 1 >= n:
|
|
447
|
+
out.append(0.0)
|
|
448
|
+
else:
|
|
449
|
+
f = pos - j
|
|
450
|
+
out.append(seg[j] + (seg[j + 1] - seg[j]) * f)
|
|
451
|
+
pos += (1 - i / n) ** curve
|
|
452
|
+
fade(out, 0, min(n, 480))
|
|
453
|
+
x[start:start + n] = out
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""Integrated loudness (ITU-R BS.1770-4, EBU R128 gating) for 48 kHz stereo."""
|
|
2
|
+
|
|
3
|
+
import math
|
|
4
|
+
|
|
5
|
+
# K-weighting at 48 kHz: high shelf, then high-pass (coefficients from BS.1770).
|
|
6
|
+
_SHELF = ((1.53512485958697, -2.69169618940638, 1.19839281085285), (-1.69065929318241, 0.73248077421585))
|
|
7
|
+
_HIGHPASS = ((1.0, -2.0, 1.0), (-1.99004745483398, 0.99007225036621))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _biquad(x, coeffs):
|
|
11
|
+
(b0, b1, b2), (a1, a2) = coeffs
|
|
12
|
+
y = [0.0] * len(x)
|
|
13
|
+
x1 = x2 = y1 = y2 = 0.0
|
|
14
|
+
for i, xi in enumerate(x):
|
|
15
|
+
yi = b0 * xi + b1 * x1 + b2 * x2 - a1 * y1 - a2 * y2
|
|
16
|
+
x2, x1, y2, y1 = x1, xi, y1, yi
|
|
17
|
+
y[i] = yi
|
|
18
|
+
return y
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _kernels(taps=8):
|
|
22
|
+
out = []
|
|
23
|
+
for frac in (0.25, 0.5, 0.75):
|
|
24
|
+
k = []
|
|
25
|
+
for j in range(-taps + 1, taps + 1):
|
|
26
|
+
d = j - frac
|
|
27
|
+
k.append((j, math.sin(math.pi * d) / (math.pi * d) * 0.5 * (1 + math.cos(math.pi * d / taps))))
|
|
28
|
+
out.append(k)
|
|
29
|
+
return out
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
_TP_KERNELS = _kernels()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def true_peak(x, near=0.7):
|
|
36
|
+
"""Linear true peak: 4x windowed-sinc interpolation around samples above near × sample peak."""
|
|
37
|
+
peak = max(map(abs, x)) or 0.0
|
|
38
|
+
lim = near * peak
|
|
39
|
+
tp = peak
|
|
40
|
+
for i in range(8, len(x) - 8):
|
|
41
|
+
if abs(x[i]) < lim and abs(x[i + 1]) < lim:
|
|
42
|
+
continue
|
|
43
|
+
for kernel in _TP_KERNELS:
|
|
44
|
+
v = abs(sum(c * x[i + j] for j, c in kernel))
|
|
45
|
+
if v > tp:
|
|
46
|
+
tp = v
|
|
47
|
+
return tp
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def integrated_lufs(left, right, sr=48000):
|
|
51
|
+
"""Integrated loudness in LUFS; -inf for silence."""
|
|
52
|
+
if sr != 48000:
|
|
53
|
+
raise ValueError("K-weighting coefficients here are for 48 kHz")
|
|
54
|
+
kl = _biquad(_biquad(left, _SHELF), _HIGHPASS)
|
|
55
|
+
kr = _biquad(_biquad(right, _SHELF), _HIGHPASS)
|
|
56
|
+
|
|
57
|
+
cs = [0.0]
|
|
58
|
+
acc = 0.0
|
|
59
|
+
for a, b in zip(kl, kr):
|
|
60
|
+
acc += a * a + b * b
|
|
61
|
+
cs.append(acc)
|
|
62
|
+
|
|
63
|
+
block, hop = int(0.4 * sr), int(0.1 * sr)
|
|
64
|
+
z = [(cs[i + block] - cs[i]) / block for i in range(0, len(kl) - block + 1, hop)]
|
|
65
|
+
lufs = lambda power: -0.691 + 10 * math.log10(power)
|
|
66
|
+
|
|
67
|
+
above_abs = [p for p in z if p > 0 and lufs(p) > -70]
|
|
68
|
+
if not above_abs:
|
|
69
|
+
return float("-inf")
|
|
70
|
+
relative = lufs(sum(above_abs) / len(above_abs)) - 10
|
|
71
|
+
gated = [p for p in above_abs if lufs(p) > relative]
|
|
72
|
+
return lufs(sum(gated) / len(gated))
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""Mixer: place sounds in time, master to a loudness target, write a WAV."""
|
|
2
|
+
|
|
3
|
+
import math
|
|
4
|
+
import os
|
|
5
|
+
import random
|
|
6
|
+
import struct
|
|
7
|
+
import wave
|
|
8
|
+
|
|
9
|
+
from .loudness import integrated_lufs, true_peak
|
|
10
|
+
from .synth import SR, key
|
|
11
|
+
|
|
12
|
+
DRIVES = (1.2, 1.5, 1.8, 2.0, 2.2, 2.5, 3.0, 4.0)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Mix:
|
|
16
|
+
def __init__(self, duration, seed=11):
|
|
17
|
+
random.seed(seed)
|
|
18
|
+
self.duration = duration
|
|
19
|
+
self.n = int(SR * duration)
|
|
20
|
+
self.left = [0.0] * self.n
|
|
21
|
+
self.right = [0.0] * self.n
|
|
22
|
+
self.count = 0
|
|
23
|
+
self._out = None
|
|
24
|
+
|
|
25
|
+
def put(self, t, samples, gain=1.0, pan=0.0):
|
|
26
|
+
"""Place mono samples at t seconds. pan: -1 left, 0 centre, +1 right (equal power)."""
|
|
27
|
+
ang = (pan + 1) * math.pi / 4
|
|
28
|
+
gl, gr = gain * math.cos(ang), gain * math.sin(ang)
|
|
29
|
+
i0 = int(t * SR)
|
|
30
|
+
for k, s in enumerate(samples):
|
|
31
|
+
i = i0 + k
|
|
32
|
+
if 0 <= i < self.n:
|
|
33
|
+
self.left[i] += s * gl
|
|
34
|
+
self.right[i] += s * gr
|
|
35
|
+
self.count += 1
|
|
36
|
+
|
|
37
|
+
def put_stereo(self, t, left, right, gain=1.0):
|
|
38
|
+
"""Place a stereo pair (e.g. from synth.pad) at t seconds."""
|
|
39
|
+
i0 = int(t * SR)
|
|
40
|
+
for k, (a, b) in enumerate(zip(left, right)):
|
|
41
|
+
i = i0 + k
|
|
42
|
+
if 0 <= i < self.n:
|
|
43
|
+
self.left[i] += a * gain
|
|
44
|
+
self.right[i] += b * gain
|
|
45
|
+
self.count += 1
|
|
46
|
+
|
|
47
|
+
def typing(self, start, end, chars, gain=(0.16, 0.26), jitter=0.006, spread=0.3):
|
|
48
|
+
"""One keystroke per character, evenly spaced from start to end, humanized."""
|
|
49
|
+
for k in range(chars):
|
|
50
|
+
tk = start + (end - start) * k / chars
|
|
51
|
+
self.put(tk + random.uniform(-jitter, jitter), key(), random.uniform(*gain), random.uniform(-spread, spread))
|
|
52
|
+
|
|
53
|
+
def master(self, target_lufs=-14.0, ceiling_db=-2.0, fade_out=0.25):
|
|
54
|
+
"""Soft-clip and set gain so the mix hits target_lufs with true peak <= ceiling_db.
|
|
55
|
+
|
|
56
|
+
Drive only rises when the ceiling would otherwise be crossed. The ceiling
|
|
57
|
+
leaves room for AAC overshoot, so the muxed MP4 stays under -1 dBTP. If no
|
|
58
|
+
drive reaches the target within the ceiling, the mix comes out quieter
|
|
59
|
+
rather than crushed.
|
|
60
|
+
"""
|
|
61
|
+
peak = max(max(map(abs, self.left)), max(map(abs, self.right))) or 1.0
|
|
62
|
+
fade_n = int(fade_out * SR)
|
|
63
|
+
fade = [1.0 if i < self.n - fade_n else (self.n - i) / fade_n for i in range(self.n)]
|
|
64
|
+
ceiling = 10 ** (ceiling_db / 20)
|
|
65
|
+
|
|
66
|
+
best = None
|
|
67
|
+
for drive in DRIVES:
|
|
68
|
+
norm = math.tanh(drive)
|
|
69
|
+
left = [math.tanh(drive * x / peak) / norm * f for x, f in zip(self.left, fade)]
|
|
70
|
+
right = [math.tanh(drive * x / peak) / norm * f for x, f in zip(self.right, fade)]
|
|
71
|
+
gain = 10 ** ((target_lufs - integrated_lufs(left, right)) / 20)
|
|
72
|
+
if gain > ceiling:
|
|
73
|
+
continue
|
|
74
|
+
tp = max(true_peak(left), true_peak(right))
|
|
75
|
+
fit = min(gain, ceiling / tp)
|
|
76
|
+
if best is None or fit / gain > best[0]:
|
|
77
|
+
best = (fit / gain, drive, left, right, fit, tp)
|
|
78
|
+
if gain * tp <= ceiling:
|
|
79
|
+
break
|
|
80
|
+
if best is None:
|
|
81
|
+
drive = DRIVES[0]
|
|
82
|
+
norm = math.tanh(drive)
|
|
83
|
+
left = [math.tanh(drive * x / peak) / norm * f for x, f in zip(self.left, fade)]
|
|
84
|
+
right = [math.tanh(drive * x / peak) / norm * f for x, f in zip(self.right, fade)]
|
|
85
|
+
tp = max(true_peak(left), true_peak(right))
|
|
86
|
+
best = (0, drive, left, right, ceiling / tp, tp)
|
|
87
|
+
_, drive, left, right, gain, tp = best
|
|
88
|
+
|
|
89
|
+
self._out = ([x * gain for x in left], [x * gain for x in right])
|
|
90
|
+
lufs = integrated_lufs(*self._out)
|
|
91
|
+
if lufs < target_lufs - 0.5:
|
|
92
|
+
print(
|
|
93
|
+
f"warning: {lufs:.1f} LUFS, short of {target_lufs}: the mix is too sparse to get louder "
|
|
94
|
+
"without clipping. Add sustained sound (a pad, longer tails) or accept it quieter."
|
|
95
|
+
)
|
|
96
|
+
return {"lufs": lufs, "peak_db": 20 * math.log10(gain * tp), "drive": drive}
|
|
97
|
+
|
|
98
|
+
def write(self, path):
|
|
99
|
+
"""Write 16-bit stereo WAV; masters with defaults first if master() wasn't called."""
|
|
100
|
+
if self._out is None:
|
|
101
|
+
self.master()
|
|
102
|
+
os.makedirs(os.path.dirname(path) or ".", exist_ok=True)
|
|
103
|
+
left, right = self._out
|
|
104
|
+
with wave.open(path, "wb") as wf:
|
|
105
|
+
wf.setnchannels(2)
|
|
106
|
+
wf.setsampwidth(2)
|
|
107
|
+
wf.setframerate(SR)
|
|
108
|
+
frames = bytearray()
|
|
109
|
+
for a, b in zip(left, right):
|
|
110
|
+
frames += struct.pack("<hh", int(a * 32767), int(b * 32767))
|
|
111
|
+
wf.writeframes(bytes(frames))
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Recorded samples
|
|
2
|
+
|
|
3
|
+
Real recordings for what synthesis does badly: keyboards, room tone, a mouth pop, a tape eject.
|
|
4
|
+
All 12 are CC0 1.0. Each Freesound page was checked for the CC0 licence on 2026-10-18.
|
|
5
|
+
Taken from the `sound-effects` skill of github.com/Barty-Bart/motion-graphics (MIT), which had already trimmed them, normalised them (one-shots to -3 dBFS peak, ambience to -35 LUFS) and encoded them as OGG.
|
|
6
|
+
|
|
7
|
+
Load one in a cue sheet with `sample("<file>")` from `sfx.synth`.
|
|
8
|
+
|
|
9
|
+
| File | Use | Author | Source |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| fs-447909-keyboard-typing.ogg | keyboard, 3.8 s | Breviceps | https://freesound.org/people/Breviceps/sounds/447909/ |
|
|
12
|
+
| fs-323432-typing.ogg | keyboard, 4 s | Alivvie | https://freesound.org/people/Alivvie/sounds/323432/ |
|
|
13
|
+
| fs-79388-keyboard-typing-wav.ogg | keyboard, 4 s | j1987 | https://freesound.org/people/j1987/sounds/79388/ |
|
|
14
|
+
| fs-416777-digital-typing-wav.ogg | digital typing, 1 s | Sky_Motion | https://freesound.org/people/Sky_Motion/sounds/416777/ |
|
|
15
|
+
| fs-329533-room-tone-in-an-apartment-livi.ogg | room tone, 17 s | leonelmail | https://freesound.org/people/leonelmail/sounds/329533/ |
|
|
16
|
+
| fs-426767-apartment-room-tone-wav.ogg | room tone, 20 s | cMilan | https://freesound.org/people/cMilan/sounds/426767/ |
|
|
17
|
+
| fs-329569-roomtone-bedroom-yew.ogg | room tone, 20 s | leonelmail | https://freesound.org/people/leonelmail/sounds/329569/ |
|
|
18
|
+
| fs-258269-mouth-pop.ogg | mouth pop | jcallison | https://freesound.org/people/jcallison/sounds/258269/ |
|
|
19
|
+
| fs-447910-plop.ogg | plop | Breviceps | https://freesound.org/people/Breviceps/sounds/447910/ |
|
|
20
|
+
| fs-824189-pop-in-sfx.ogg | pop-in | Sadiquecat | https://freesound.org/people/Sadiquecat/sounds/824189/ |
|
|
21
|
+
| fs-349504-triangle-open-04.ogg | triangle ding, 4 s | cabled_mess | https://freesound.org/people/cabled_mess/sounds/349504/ |
|
|
22
|
+
| fs-339521-vhs-rewind-forward-and-eject.ogg | VHS rewind and eject, 4 s | lucaslima | https://freesound.org/people/lucaslima/sounds/339521/ |
|
|
23
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|