Compare commits
5
.gitattributes
vendored
|
|
@ -1,5 +0,0 @@
|
|||
# The ridge bake is addressed by its bytes (bake_id covers the manifest text and the tile files): public/ridge is checked out exactly as committed, whatever
|
||||
# core.autocrlf says, so a Windows working tree serves the bytes its directory name was hashed from.
|
||||
public/ridge/** -text
|
||||
# The baker's inputs and schema are text, read the same everywhere.
|
||||
scripts/ridge-bake/**/*.json text eol=lf
|
||||
6
.github/workflows/build-pull-request.yml
vendored
|
|
@ -18,14 +18,10 @@ jobs:
|
|||
- name: Setup node
|
||||
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
node-version-file: ".node-version"
|
||||
package-manager-cache: false
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Ridge asset gate
|
||||
run: |
|
||||
npx vitest run src/app/features/scene/ridge/ridgeAssets.test.ts
|
||||
echo "ridge assets: $(find public/ridge -type f | wc -l) files, $(du -sb public/ridge | cut -f1) bytes"
|
||||
- name: Build app
|
||||
env:
|
||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
# Third-party notices
|
||||
|
||||
## d3-celestial (constellation lines)
|
||||
|
||||
The constellation line chains in `src/app/features/scene/ridge/nightSkyData.ts` are derived from
|
||||
`data/constellations.lines.json` of d3-celestial, https://github.com/ofrohn/d3-celestial,
|
||||
under the licence below.
|
||||
|
||||
```
|
||||
Copyright (c) 2015, Olaf Frohn
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.```
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
"enabled": false
|
||||
},
|
||||
"fileZoneShare": {
|
||||
"enabled": true
|
||||
"enabled": false
|
||||
},
|
||||
"push": {
|
||||
"vapidPublicKey": "",
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
schema = "gamecult.idunn.target_declaration.v1"
|
||||
target = "ratatoskr"
|
||||
# Idunn stamps the source commit into the build environment under this name. The release is not built from source: the
|
||||
# dist tarball below is built by scripts the release owner runs (build-prod-dist.sh) and enters pinned by sha256, so
|
||||
# each release is a recipe commit whose pin is its provenance. The stamp the served index carries is the commit the
|
||||
# tarball was built from, which is not this commit.
|
||||
source_stamp_environment = "RATATOSKR_BUILD_COMMIT"
|
||||
|
||||
# Release dist f1172b5becb392cc690ddf671d70367e391fd392: the output of build-prod-dist.sh (live config check passed), packed
|
||||
# as dist/ at the top of one gzip tar. The tree carries the repo's own config.json; what is served is the operator's
|
||||
# carried file, which Idunn copies beside dist/ and the vhost aliases over the tree's (a vhost without that alias would
|
||||
# serve the repo config).
|
||||
[[external_inputs]]
|
||||
id = "dist-tarball"
|
||||
url = "https://eureka.gamecult.org/forge/GameCult/Ratatoskr/releases/download/dist-f1172b5b/ratatoskr-f1172b5b-dist.tar.gz"
|
||||
sha256 = "014a6ff68686b5af0b323b115c2f33dc655749f59495b6f62671a0e4c881141b"
|
||||
runner = "unpack"
|
||||
destination = "release/dist.tar.gz"
|
||||
|
||||
[[steps]]
|
||||
id = "unpack-dist"
|
||||
phase = "prepare"
|
||||
runner = "unpack"
|
||||
argv = ["tar", "-xzf", "release/dist.tar.gz", "-C", "release"]
|
||||
|
||||
[[artifacts]]
|
||||
id = "dist"
|
||||
source_kind = "runner-output"
|
||||
runner = "unpack"
|
||||
source = "release/dist"
|
||||
destination = "dist"
|
||||
|
||||
[static_release]
|
||||
artifact = "dist"
|
||||
|
|
@ -21,7 +21,7 @@ Read from this repo at dev `8ba407cd`:
|
|||
|
||||
- **Zone = a room** whose `m.room.create` type is `org.gamecult.file_zone` (`isFileZone.ts`), or one listed in config `fileZoneRooms`. One per Mind, `#<mind>-files:<server>`, found by alias or by the carried id in the root Space's `org.gamecult.stewardships` (`mediaRoom.ts`, `MediaRow.tsx`); rendered as the Media row of each Mind's group.
|
||||
- **Album = a thread root** (a text event; its `body`, or its latest `m.replace` edit, is the title); **file = a thread reply** with `msgtype` `m.audio|m.image|m.video|m.file` (`buildAlbums.ts`). A redacted event or an `m.replace` is never a file. Loose room messages are not shown.
|
||||
- **Read** = `GET /rooms/{id}/threads` and `/relations/{root}/m.thread`, every page, 100 per request, at most 20 pages per endpoint (`useAlbums.ts`, `readPages.ts`; a capped read shows a note in the list). Unencrypted rooms only.
|
||||
- **Read** = `GET /rooms/{id}/threads` and `/relations/{root}/m.thread`, one page of 100 each (`useAlbums.ts`; pagination is a known gap). Unencrypted rooms only.
|
||||
- **Write** = `sendShareSet` (`shareSet.ts`, behind `fileZoneShare.enabled`): a root, then one thread reply per file, content from `getMsgContent` with `info.sha256`.
|
||||
- **Media** = authenticated Matrix media fetched to a blob (`downloadMedia` in `FileContent.tsx`): so the "media element cannot send a header" problem that Option B needed a ticket for is already solved this way, at the cost that a file is fully downloaded before it plays.
|
||||
- **Receipts** = `org.gamecult.file_received` from a Mind's mouth after it fetches and verifies the sha256 (`docs/file-zone-mind-contract.md`); the mouth enforces the Mind's membership in the room.
|
||||
|
|
@ -82,7 +82,7 @@ What it buys: one identity, one audience, one audit trail, immutable files, exis
|
|||
- **When it posts.** Handoff documents are edited in place, so mirroring every save would spam the room with drafts. The rule (Eureka's lean, adopted): **post once, when the document is marked final**; a later final version posts again with a `replaces` relation to the earlier event. "Final" is a sibling `NAME.final` holding the document's sha256 (answered Q-E2); the client must not know.
|
||||
- **Allowlist.** Lives on the publisher: a list of source roots and patterns, read by the publisher only. `handoff-private` is not on it and the publisher never lists, reads or posts from it. The client holds no path to anything on disk.
|
||||
- **The event.** A file event in the thread of the folder's album, built the way `getMsgContent` builds them (`msgtype`, `body`, `filename`, `url` from the media repo, `info.mimetype|size|sha256`), plus one extra key `org.gamecult.publish`: `{ source, sha256, replaces? }` where `source` is a path relative to the allowlisted root, never absolute, and `replaces` is the event id of the version it supersedes.
|
||||
- **`replaces`, not `m.replace`.** `m.replace` is the stock edit relation, but Ratatoskr's `buildAlbums` deliberately never treats an edit as a file, several clients do not render an edited file, and an edit hides the earlier version. A custom key keeps both events as files; the view shows the latest of a chain and a "N earlier versions" row under it, and other Matrix clients see two ordinary file posts. A chain is read from the events themselves (each carries its `replaces`), not from a table, and a `replaces` counts only when its event has the same sender as the event it names, so nobody else in the thread can fold a file away.
|
||||
- **`replaces`, not `m.replace`.** `m.replace` is the stock edit relation, but Ratatoskr's `buildAlbums` deliberately never treats an edit as a file, several clients do not render an edited file, and an edit hides the earlier version. A custom key keeps both events as files; the view shows the latest of a chain and a "N earlier versions" row under it, and other Matrix clients see two ordinary file posts. A chain is read from the events themselves (each carries its `replaces`), not from a table.
|
||||
- **Idempotence.** The publisher's own state (a typed CultCache document of `source`, `sha256`, `event_id`) says what it posted; if that is lost, it rebuilds by reading its own events back from the room (`org.gamecult.publish.source` plus `sha256`) rather than guessing. The same `sha256` never posts twice.
|
||||
- **Receipts and fetch** work unchanged: the event is an ordinary file event in a file-zone room, so a Mind's mouth can fetch it by room id and event id (5 MiB cap there) and tick `fetched for`.
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ What A adds to `ShareSet`: sharing into an existing album ("add files", listed a
|
|||
|
||||
Under both, the phone design is the same shape (one column, rows 56 px or more, hidden controls, in-place preview; see the Option B sections below, which are written against the host but whose layout applies).
|
||||
|
||||
- **A, new cost:** the Commons room is one more room in sync and it must be muted; albums and files are read to a cap of 20 pages of 100 per endpoint (a Commons past that shows a truncation note); a folder tree is a title-path grouping, so a deep tree is a long list of albums with breadcrumbs, not true directories; a file plays after a full download (small audio and images are fine; a 40 MB clip is not).
|
||||
- **A, new cost:** the Commons room is one more room in sync and it must be muted; albums and files are one page of 100 each until pagination exists (a Commons of hundreds of documents needs it first); a folder tree is a title-path grouping, so a deep tree is a long list of albums with breadcrumbs, not true directories; a file plays after a full download (small audio and images are fine; a 40 MB clip is not).
|
||||
- **A, no cost:** no second sign-in, no ticket, no CORS, no new fetch layer, no host-unreachable state beyond the homeserver's own. The album list, album view, share panel and receipts exist and are tested; the view is their extension.
|
||||
- **B, new cost:** every screen is a second client against a second service with its own errors, token refresh and unreachable state; media needs the ticket or the blob; the tree and preview are new UI.
|
||||
- **B, benefit:** a tree that is live and complete, ranges, and no Matrix size limit.
|
||||
|
|
@ -118,13 +118,13 @@ Under A the paused service is not built, and most of its list disappears:
|
|||
|
||||
## Cuts under A
|
||||
|
||||
Status 2026-11-14 (dev da822e9e plus the size-refusal cut): built: folders by album title path with navigation and breadcrumb (#147), pagination (#148), version folding (#149), add-to-album with named refusals (#150), Stop for a send in flight, replaces loops shown, freshest last event on add (#151), and the pre-send size refusal: a file larger than the server's `m.upload.size` is named and left unsent before any upload or album root, and a server stating no cap refuses nothing. The Commons entry row is built (item 1): `useCommons` in `MediaRow.tsx` finds the room by the alias `#commons:<server>` (provisioning records no id for it), through `lookupZoneRoom` (the one lookup `lookupMediaRoom` also uses); `EstateNavigator` shows it above the tiers as a Commons link when joined, a join row when invited or not joined, and nothing when the room is absent, the lookup failed or is out. It is gated on the existing `fileZoneShare.enabled`, not a new `filesDesk.enabled` flag. The album view and ShareSet work there because provisioning creates the Commons with the `org.gamecult.file_zone` create type. Members can share only once the room's power levels let them post: provisioning gives the poster level to the Minds alone.
|
||||
Status 2026-11-13: cut 1 merged to dev as bb615570 (PR #147); cuts 2-5 follow. Cut 1's shape was: a pure `albumFolders` view (folders from `/`-separated album titles, leaf name, counts), folder navigation and breadcrumb in `AlbumView` through a presentational list component tested by static render, `ShareSet` sending into the current folder by prefixing the album title, and a quiet `Commons` row (alias `#commons:gamecult.org` or the carried `media.commons` id, through `lookupMediaRoom`, hidden while unset or looking, behind a dark `filesDesk.enabled` flag, and filtered out of the tiers so it is not listed twice). Muting is provisioning's (Q-E3), not the client's.
|
||||
|
||||
1. **Commons entry**: a Commons row in the navigator (like `MediaRow`, found by alias), opening the room's album view. Flagged, no new data layer.
|
||||
2. **Pagination** of albums and files in `useAlbums` (done, PR #148).
|
||||
1. **Commons entry**: a Commons row in the navigator (like `MediaRow`, found by alias or carried id), opening the room's album view. Flagged, no new data layer.
|
||||
2. **Pagination** of albums and files in `useAlbums` (a prerequisite for a Commons of any size).
|
||||
3. **Folders by title path** and the album list grouped by it.
|
||||
4. **Versions**: read `org.gamecult.publish.replaces`, show the latest of a chain with the earlier versions folded under it (done, PR #149).
|
||||
5. **Add files to an existing album**, with per-file progress, cancel and the refusal messages above (the upload flow). Done: adding to an open album and the three refusal messages (PR #150); Stop for a send in flight is in too (PR for follow-up `files-desk-release-146-and-send-cancel`): it cancels the running upload through `onPromise` and `mx.cancelUpload`.
|
||||
4. **Versions**: read `org.gamecult.publish.replaces`, show the latest of a chain with the earlier versions folded under it.
|
||||
5. **Add files to an existing album**, with per-file progress, cancel and the refusal messages above (the upload flow).
|
||||
|
||||
PR #143 (Option B cut 1: contract types, host client, fake host) is **held**; under A it is not needed and would be closed. Its Soul pass found, and a revived B would have to close, an unvalidated `host` that could send the bearer to the wrong origin, hostile-looking entry names beyond separators, loose numeric checks and missing CSP and `Content-Disposition` headers in the fake.
|
||||
|
||||
|
|
|
|||
|
|
@ -120,4 +120,4 @@ Client, `src/app/features/albums`:
|
|||
|
||||
Flag: `fileZoneShare.enabled` in `config.json`, default `false`. With it off nothing mounts.
|
||||
|
||||
Not built: a Mind's own path into the zone (outbox, Persona decision, mouth post) belongs to gamecult-ops / Huginn / the mouth, not this client; Built since: Stop for a send in flight (aborts the running upload, leaves it and the rest picked as "stopped"), pagination to 20 pages of 100 per endpoint (PR #148), adding files to an open album with named refusals (`M_TOO_LARGE`, `M_FORBIDDEN`, `M_LIMIT_EXCEEDED`).
|
||||
Not built: a Mind's own path into the zone (outbox, Persona decision, mouth post) belongs to gamecult-ops / Huginn / the mouth, not this client; sharing into an existing album ("add files"); upload cancel; pagination beyond 100 albums/files.
|
||||
|
|
|
|||
|
|
@ -113,8 +113,9 @@ Hard-refresh to clear `sw.js`. Do not delete the failed release; leave it for di
|
|||
|
||||
## Open
|
||||
|
||||
- Release a5 (2026-11-20, dist `a1fdfee3`, receipt `/opt/commons/handoff/rat146-a5-receipt-20261120.md`)
|
||||
replaced the carried config with the repo's `config.json` (ridge, `fileZoneShare` on; ruling
|
||||
`ratatoskr:ruling:ridge-only-scene-terrain-cut`). The carried file and the build pin are equal, so a
|
||||
handoff build passes its live check without `ALLOW_CONFIG_DRIFT=1`. A release that changes
|
||||
`config.json` changes the carried file deliberately, as a5's `carry.sh` did.
|
||||
- The served config (checked 2026-11-12) is not the repo's: it says `backgroundScene.style`
|
||||
`terrain` where the repo says `ridge` (#106, Meta 2026-11-11), lacks the repo's `dings`,
|
||||
`fileZoneShare` and `registration` blocks (all off in the repo), and has no trailing newline.
|
||||
The new keys default off or inert when absent, so only the style is a decision. Meta says which
|
||||
style ships. Until the served file is replaced, every handoff build stops at the live check
|
||||
unless `ALLOW_CONFIG_DRIFT=1` is set (section 1).
|
||||
|
|
|
|||
|
|
@ -97,11 +97,9 @@ Probes run by Imagination on 2026-10-31, session `self-2026-10-29-eureka`.
|
|||
events from the Minds' stewardship documents; each project room's alias is
|
||||
`#<repo lowercased>` (runbook 146-150). This is the only place the client
|
||||
can learn a not-yet-joined room's steward today: hierarchy `canonical_alias`
|
||||
joined to the root `org.gamecult.stewardships`. The
|
||||
projection now also names room ids under `@rooms.projects` and
|
||||
`@rooms.file_zones` (gamecult-ops #111); the client reads `file_zones` for
|
||||
the Media row (`mediaRoom.ts`) and still joins projects by alias, since
|
||||
nothing yet consumes `@rooms.projects`.
|
||||
joined to the root `org.gamecult.stewardships`. Follow-up
|
||||
`ratatoskr:follow_up:stewardships-carry-room-ids` asks the projection to
|
||||
name room ids so the client stops leaning on the alias convention.
|
||||
5. **Sync and storage** (`src/client/initMatrix.ts`). The client uses
|
||||
matrix-js-sdk 41.7.0 with `IndexedDBStore` (`web-sync-store`, 15-19) and the
|
||||
Rust crypto store, and `startClient({ lazyLoadMembers: true })` (43-47): v2
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
# Ridge backdrop target
|
||||
|
||||
The scene's bottom silhouette is replaced by baked A+D ridge planes. The baker is Python and offline; the browser composes pre-lit planes over the live physical sky. Typed state for this campaign (ideas, questions, rulings, cuts) lives in the instance mind `nibu`, campaign `ratatoskr-backdrop`; this file keeps only the ends.
|
||||
|
||||
## Why
|
||||
The live noise ridge is nearly invisible on a phone (about 1.35:1 against the darkest sky) because every ridge pixel is lifted to the text-contrast floor, and the star dots show between nav and header glyphs because the shell is transparent. Meta, 2026-11-13: do not polish the old backdrop; ship the A+D ridge pipeline (round 2 mockup: https://minds.gamecult.org/nibu/ridge-mockups-ad/).
|
||||
|
||||
## Ends
|
||||
- One owner per decision: the baker owns ridge geometry and shading; the runtime owns only the ring's residency, the camera's pose against its heading, blending and compositing. No ridge geometry is computed in the browser.
|
||||
- The ground under the authored 500 m near clip is the place's own DEM from 1 m, drawn by card 0 inside the silhouette of the terrain at the clip and riding card 0's slide; everything that bounds the view reads terrain at or beyond the clip: `r_max` is where the linear slide holds for the nearest solid terrain each card draws in each tile (a tile of near ground only binds at the clip, 500 m, where it is slid), and every bake keeps 150 rows under the horizon so the plane reaches the bottom of every viewport.
|
||||
- Nothing from the scene paints above app content: the scene is one stacking context at the back of the app, and nothing it creates has its own z-index or lives outside it.
|
||||
- Phone cost is bounded: no per-frame script for the ridge (one exception: while a finger or the mouse is down in the scene view, pointer events turn the heading and the heading owner re-issues the rig; the twinkle is the other), decoded size and fetched size gated in CI.
|
||||
- The ring is the bake and the heading is unbounded: the whole 360 degrees ships as azimuth tiles, the client holds only the arc it is about to need and fetches more as the view turns, and nothing caps the heading: it is unwrapped within a stretch of motion and `ridge/heading.ts` `normalize` brings it into [0, 360) before each one, so no angle or pixel position grows with uptime, while `ridge/ring.ts` is the one place that reasons about the wrap at 0 / 360.
|
||||
- Motion is derived, not authored: a card's scale and shift come each second from the heading, the camera's angle on its circle and the viewer's offset (one pose, one owner: `ridge/heading.ts`, whose every change starts a segment from the pose the view has, and whose eases keep each pose inside the baked bound) and the card's distance (`ridge/view.ts` `cardPose`), and ride the compositor as one animation per card.
|
||||
- The baker has fixtures with known right answers (the far-plateau spike, chain-end taper, slot union, seam) and a mutation runner that must kill each re-introduced cause.
|
||||
- A baked asset names its baker version, DEM source and licence in a validated manifest; the terrain credit shown in the scene view's Place submenu comes from the manifest.
|
||||
|
||||
## Not in scope
|
||||
Button size (Void's). Patching the old noise-ridge path. Cone sampling. Live DEM access from the browser.
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
# Symphony grammar harvest: Mimir's bioacoustic research
|
||||
|
||||
Follow-up: `ratatoskr:follow_up:symphony-grammar-harvest-mimir`. Source: GameCult/Mimir at
|
||||
commit c6f4541eea61 (exists; read at that ref, not main), read-only through the forge API.
|
||||
Paths below are Mimir paths. Written for Aqua (AquaSynth) before the generative activity grammar. It lives here because the symphony is a Ratatoskr cut (dings, then orbiting personas) and this repo is where its spec will be read; the follow-up named AquaSynth, where void holds no push right, so move it there if Aqua prefers.
|
||||
|
||||
## 1. The problem
|
||||
|
||||
One Mind's identity has to be a timbre plus a contour that stays recognisable after it is mixed with
|
||||
the other Minds and passed through a lossy path. The symphony adds harmony (several Minds sounding
|
||||
together as music), which Mimir never needed: Mimir emits one voice at a time, a low-gain song per speaker.
|
||||
|
||||
## 2. What Mimir found that transfers
|
||||
|
||||
Confidence: A = measured number in a receipt, B = measured but synthetic or single run,
|
||||
C = design claim or authored opinion with no measurement behind it.
|
||||
|
||||
| Claim | Evidence | Conf. |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
|
||||
| Tidy lab beeps are the wrong signal for a room; a birdsong-like motif replaced them. | `docs/bioacoustic-timeline-watermark.md` L3-10 (stated as a decision, no listening test). | C |
|
||||
| Identity is carried redundantly: contour survives pitch shift, rhythm survives bad frequency response, formant envelope survives a dead band, speaker variants expose room asymmetry. | same doc L82-95. Argument, not an ablation. | C |
|
||||
| A word needs no sequence grammar: one heard word identifies its event directly (128 words x 2 speaker variants, 4 syllables each), in an event slot that repeats about every 41 s (derived, not reported: 128 words x 2 speakers = 256 events at 0.16 s spacing = 40.96 s, from `MimirBioacousticTimeline.cs` L34-39 and `SymbolForEvent` L735-739; no receipt or doc states it). No de Bruijn grammar. | same doc L26-33; `src/Mimir.Runtime/Synchronization/MimirBioacousticTimeline.cs` (WordCount, SymbolCount = WordCount\*SpeakerCount, BuildMotifs ~L690-730). | B |
|
||||
| Word identity survives mel-cepstral warp/blur degradation; timing does not unless fitted as one global clock/delay hypothesis. | `docs/bioacoustic-training-harness.md` L58-112: identity 0.908-0.997 on clean input only; degraded identity 0.532-0.908 and timing 0.187-0.728 for compact-fast-index across the four degraded cases in `artifacts/bioacoustic-training/bioacoustic-20260524-150729/compact-fast-index/*/summary.json` (`IdentityScore`, `TimingScore`); clean timing 0.357 before vs 0.905 after the global clock fit. | A (synthetic, clean-only range) |
|
||||
| Contestant shapes were scored against the same decoder family and damage panel; the best scorer was the six-syllable "canary-packet-trill", a hypothesis not confirmed on a physical room (two timing chips plus four payload-coloured formant notes), not the literal bird imitations. | `research/bioacoustic-contestants-2026-05-24.md` L24-38, L128-174 (honest floor 88.4 language_score, 19 bps, payload 1.000 clean), L487-489 (96 ms motif is the best tradeoff). | B |
|
||||
| Too-short or too-tight songs fail under blur: 0.100 s event spacing lost anchors to overlap; 0.105 s kept; 78 ms motif and 5-syllable finch-burst-packet collapsed (blur-light 4.358, the razor decoder; 218.368 with the sprint decoder, L453-454). | contestants doc L169-171, L446-455, L487-489. | A |
|
||||
| A 3-bit payload variant (separate band/rhythm bit) did not survive degradation (best 12.849, clean 8.084). | contestants doc L183-185. | A |
|
||||
| Real birds carry identity through redundant contour, roughness, onset statistics and cepstral envelope together; Redpoll is dense chatter with short vertical attacks, not a neat token stream; Guan is a slow broad curved phrase, good for probing the channel, poor for bitrate. The packet song was judged "still too ladder-like". | contestants doc L565-581 (two Xeno-canto mirrors via Wikimedia; Brown Thornbill file invalid, L511-513, L534-539). Flux numbers L549-562. | B (two recordings, hand reading) |
|
||||
| Positive log-mel spectral flux is a good onset/anchor surface; sustained bands recede, attacks and glides light up. | contestants doc L541-545, L577-581; but the naive flux decoder lost on speed (33.466 vs 88.129 score, clean roundtrip, L158 and L231-237). | B |
|
||||
| Once the schedule is known, the receiver only discriminates among a few local candidates; wide identity search is only for acquisition. Streaming decoder reached 1121 score at 62.6x realtime, payload 1.000 on all nine damage cases. | contestants doc L248-309. | A (synthetic damage) |
|
||||
| Polarity must be a nuisance variable; mic paths flip sign. | contestants doc L391-395. | B (physical, one capture) |
|
||||
| Physical room run: with per-channel acquisition offsets the co-streamer shotgun mic (ch1) locked 37/37 events, payload 1.000, timing 0.828; the cardioid/near mic (ch0) reached 26/37, payload 0.595, and stayed unreliable. | contestants doc L371-388. | B (physical, one capture) |
|
||||
| Speaker split: left and right vocabularies differ in root (x0.94 / x1.08) and syllable weights, so each side is separable. | `MimirBioacousticTimeline.cs` BuildMotifs ~L704-725 (read as code, no experiment isolates the benefit). | C |
|
||||
|
||||
Rendering recipe actually in code (`MimirBioacousticTimeline.cs` AddSyllable ~L610-640): each syllable is
|
||||
a log-frequency glide (exponential sweep) with a raised-cosine envelope, summed partials at
|
||||
1, 1.5, 2, 2.75 times the glide (weights 1, 0.42, 0.24, 0.10) plus 0.08 weight of a slow "air" term,
|
||||
20-32 ms long, four per word, gain 0.030 (canary profile 0.024 in `MimirBioacousticContestant.cs`).
|
||||
Word roots are log-spaced 2.6 to 9.6 kHz; syllable frequencies are clamped 2.3 to 14.6 kHz;
|
||||
word length 118 ms. Contours come from a small hand-written bank (8 contour shapes and 8 rhythm
|
||||
offset sets, chosen by hash of word and speaker).
|
||||
|
||||
## 3. Design constraints for Aqua's grammar
|
||||
|
||||
1. Identity lives in several channels at once: contour (syllable glide shapes), log-frequency position
|
||||
(root), formant envelope (the partial ratios), rhythm (inter-syllable offsets) and per-speaker
|
||||
timbre. No single channel may be load-bearing. Place Minds on a log-frequency axis, not linear.
|
||||
2. Do not build a sequence grammar for identity (de Bruijn or otherwise). The whole word is the unit;
|
||||
a hearer should identify the Mind from one short phrase. (watermark doc L31-33.) What it gives up:
|
||||
a de Bruijn code has a provable recovery property from a symbol stream; per-word identity has only
|
||||
an empirical one.
|
||||
3. Keep words short and distinct, but not so tight that they overlap: Mimir's measured edge was about
|
||||
100 to 105 ms event spacing and a 96 ms six-syllable motif; below that identity decayed. Aqua's
|
||||
events need not carry timing, so it can relax this, which is untested.
|
||||
4. Use sharp onsets for placement but avoid a ladder of evenly spaced rungs; Mimir's own verdict was
|
||||
that its packet song was still too ladder-like and real birds use irregular, redundant contour
|
||||
(contestants doc L573-576). Vary rhythm and syllable length per word as the code already does.
|
||||
5. Reject: row of tidy lab beeps (watermark doc L3-6); literal bird imitation as an end in itself (the
|
||||
prettiest contestant, nightingale-cascade, was expensive and easy to confuse under smearing, per
|
||||
`MimirBioacousticContestant.cs` profile note); a third payload bit on a second axis (measured loss).
|
||||
6. Keep the generator deterministic from a typed description (contour, root, rhythm, speaker tint),
|
||||
authored once and rendered, not regenerated in the audio callback. Contestants doc L493-496 states
|
||||
this as the AquaSynth lesson: separate authoring intent from realtime DSP.
|
||||
|
||||
## 4. What does not transfer, or is unknown
|
||||
|
||||
- Harmony. Mimir emits one voice per speaker and decodes one stream; nothing in the research tests
|
||||
simultaneous voices, intervals between Minds, consonance, or masking between concurrent songs.
|
||||
Searched for "harmon"; the only hit is the `HarmonicNotch` anchor kind (an envelope notch used as a
|
||||
timing anchor, `MimirBioacousticContestant.cs` ~L33, L231), not musical harmony.
|
||||
- Orbiting spatialisation. Mimir's left/right split is a calibration device (one vocabulary per
|
||||
speaker to learn each side of the room), not a perceptual pan or orbit. Nothing here informs it.
|
||||
- Pleasantness. There is no listening test, no psychoacoustic metric, and no loudness-weighted score
|
||||
in any file read. The only pleasantness evidence is the authored one-line verdicts on each profile in
|
||||
`MimirBioacousticContestant.cs` L52-170 ("lab bird with a clipboard", "most plausible room sound",
|
||||
"prettiest contestant") and the "wrong animal for a room" sentence. The score is
|
||||
`realtime * timing * frequency * payload_bitrate` (contestants doc L39-59): decodability only.
|
||||
Gain 0.021-0.030 is chosen for low audibility, not for pleasing anyone.
|
||||
- Mimir's numbers are synthetic damage (mel-cepstral and log-mel warp/blur) plus a few Scarlett loopback
|
||||
runs. The first physical room runs decoded mics only partially (contestants doc L355-395), and the
|
||||
later live receipt's cardioid result was retracted as noise
|
||||
(`calibration/bioacoustic/complex-contour-live-20260525-063229.md`, correction at watermark doc L225-230).
|
||||
- The pipeline decodes against a known schedule and tiny candidate set; Aqua's listener is a human
|
||||
mix, so none of the decoder scores say how distinguishable Minds are to a person.
|
||||
- Not read: `src/Mimir.BufferSmoke` (the harness executable). It does not match a "bioacoustic" path
|
||||
filter on the tree listing, so I read its documentation (`docs/bioacoustic-training-harness.md`) and
|
||||
the `MimirBioacoustic*.cs` sources instead. The `artifacts/bioacoustic-training/` receipts were listed
|
||||
but not opened beyond the summary text in the docs.
|
||||
|
||||
## 5. Open questions for Aqua
|
||||
|
||||
- What is the "decoder" for Aqua: a human listener, a classifier, or both? Constraints above only
|
||||
hold against a machine decoder.
|
||||
- Does a Mind keep one word for life, or does the grammar generate many songs sharing a timbre and root
|
||||
(activity-dependent contour over a fixed identity)? Mimir only has fixed words.
|
||||
- How many Minds, and how are roots allocated on the log axis when several sound at once? Mimir used 2
|
||||
speaker variants per word and 128 words; harmony will change the spacing rule.
|
||||
- Which dimension bends with activity (contour, rhythm density, gain) and which must stay fixed
|
||||
(timbre, root)? Mimir has no activity channel to copy.
|
||||
- Is a measured pleasantness proxy wanted (roughness, masking, loudness-weighted)? Mimir has none to reuse.
|
||||
- Spatialised orbit plus a speaker-keyed timbre: if the pan moves, does identity still rest on timbre
|
||||
alone? Mimir's per-side vocabulary is not a precedent.
|
||||
|
|
@ -20,44 +20,3 @@ directory whose ancestors hold no empty `package.json` (esbuild reads them).
|
|||
|
||||
Timings from SwiftShader are CPU time: use them for the split between passes and for before and
|
||||
after of one change, never as a phone frame time.
|
||||
|
||||
## Ridge live scene
|
||||
|
||||
`ridgeLive.html` is one live scene (tier 'full', the sky plate and the cards on the compositor) filling the window, for a driver to turn and screenshot: `?h=214&sun=232:22&speed=6` (start heading, the sun's azimuth and elevation, degrees a second of rotation),
|
||||
`?sky=night&lines=1`. `window.live` offers `hold(h)`, `pose()`, `plate()`, `left()` (the plate's left edge on the page) and `plateCost()` (ms of main thread to paint one plate here); `window.longTasks` lists the tasks over 50 ms.
|
||||
A held heading's sun lands within a tenth of a pixel of the column the heading owner says, across re-centres of the plate.
|
||||
|
||||
## Ridge look sheet
|
||||
|
||||
Renders a baked place (`?place=`, the index default otherwise) lit for six sky states (dawn 2, morning 15, noon 55, golden 6, dusk -3, night -30 degrees of sun)
|
||||
by a set of looks (`RidgeLook`, `src/app/features/scene/ridge/lightCards.ts`, the one owner of look values), one 480x270 canvas per cell, drawn by the app's own still
|
||||
path (`createRidgeScene` at tier 'still' over a `createBackdrop` of the tiles round the heading), at the rest azimuth unless `?views=` says otherwise. The sky
|
||||
behind a cell is the app's own, without clouds. Not shipped.
|
||||
|
||||
...ridgeSheet.html?views=214:0:200,0:0:200,214:90:98.2&sky=2 # one column per view heading:phi:offset (degrees, degrees, metres) at one sky (an index of SKIES)
|
||||
|
||||
`&sun=100:6` puts the sun of that sky at compass azimuth 100, 6 degrees up (the stars are those of the moment the sheet is opened): a sun at the heading's side shows where the turned sky puts it, `&sky=5&lines=1` is the night.
|
||||
|
||||
A heading of 0 or 360 is across north; a phi other than 0 is the offset-only rotation mode (the camera circling the centre, the view direction staying); the offset is
|
||||
clamped to the place's range as the app does (phi 0: `camera.r_max_forward_m`, another phi: `camera.r_max_m`).
|
||||
|
||||
npx vite --port 5199 # from the repo root; the app's vite config serves the page and public/
|
||||
http://localhost:5199/harness/scene/ridgeSheet.html # four presets x six skies
|
||||
...ridgeSheet.html?preset=swiss # one preset (physical|swiss|poster|painterly)
|
||||
...ridgeSheet.html?looks=%5B%7B%22label%22%3A%22no-ink%22%2C%22inkScale%22%3A0%7D%2C%7B%22label%22%3A%22hazy%22%2C%22hazeScale%22%3A8%7D%5D
|
||||
...?w=640 # cell width
|
||||
|
||||
`looks=` is a url-encoded or base64 JSON array of `{label, ...partial RidgeLook}` and replaces the preset rows (`inkKeep` and `reliefLight` merge by key).
|
||||
A cell costs one WebGL2 context and a card decode, so the full sheet takes tens of seconds (much longer in a background tab).
|
||||
|
||||
Presets (`PRESETS` in `ridgeSheet.ts`; swiss and poster take every key not named from `PHYSICAL_LOOK`, the rest from `DEFAULT_LOOK`, the painterly cel look), chosen by reasoning, not by eye, for Self to tune:
|
||||
|
||||
| preset | values |
|
||||
| --- | --- |
|
||||
| physical | PHYSICAL_LOOK (Lambert, no noise, sky haze, full ink) |
|
||||
| swiss | reliefLight {mix 0.7, azimuthDeg -45, elevationDeg 40}, contrastByDistance 0.9, hazeScale 6, hazeTint [0, 0.05, 0.25], nearWarm 0.5, inkScale 0.6 |
|
||||
| poster | reliefWeight 0.15, cardToneStep 0.25, cardGradient 0.5, inkKeep {edge 0.25, occlude 0.9, crease 1}, hazeScale 4 |
|
||||
| painterly | DEFAULT_LOOK: groundNoise 0.35, cloudShadows 0.5, nearWarm 0.6, hazeScale 2, inkScale 0.4, celBands 3, celSoftness 0.05, celAmbientAway 0.7 |
|
||||
| painterly-cel-2 / -3 / -4 | painterly with celBands 2 / 3 / 4 |
|
||||
|
||||
Named moments (`ridgeSheet.html?named=1`): the six moments of the Sky menu (dawn, morning, noon, golden hour, dusk, night) at the baked place on the December and June solstices, drawn from `momentFor` as the app draws them (`SKY_MOMENTS` in `ridge/skyMoment.ts` is the table tuned by eye from this sheet). Night sets (`ridgeSheet.html`): `?moments=2026-11-24T22:00Z,2026-12-09T20:00Z` pins explicit UTC moments (the sun, moon and stars are those of the moment); `?night=1` renders the next new moon, first quarter and full moon from today (`&from=YYYY-MM-DD`) at four hours each (`&hours=18,21,0,4`, UTC) plus deep dusk of the full-moon evening; `&lines=1` draws the constellation lines (the Sky menu's hidden toggle). Use `&w=300` for the 13-column set. The night look's knobs: `NIGHT_LOOK` in `ridge/nightSky.ts` (star point spread, contrast exponents, moon size, earthshine, line opacity), `NIGHT_CEILING` and `SCOTOPIC` in `ridge/toneMap.ts`, the night `Budget` (key, targets, partial adaptation).
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// Standalone page for the ridge scene: full window, no host app. `?tier=still|low|full` picks the
|
||||
// tier, `?probe=1` shows the rAF median/p95 readout. The long tasks the page saw are on `window.longTasks`
|
||||
// tier, `?probe=1` shows the rAF median/p95 readout. The bake record (each chunk's cost, from
|
||||
// the scene's `onBake`) and the long tasks the page saw are on `window.bakes` and `window.longTasks`
|
||||
// for a driver to read. Not shipped.
|
||||
import { startBackgroundScene } from '../../src/app/features/scene';
|
||||
import type { SceneTier } from '../../src/app/features/scene';
|
||||
|
|
@ -7,7 +8,8 @@ import type { SceneTier } from '../../src/app/features/scene';
|
|||
const q = new URLSearchParams(location.search);
|
||||
const tier = (q.get('tier') ?? 'full') as SceneTier;
|
||||
const canvas = document.getElementById('c') as HTMLCanvasElement;
|
||||
const w = window as unknown as { scene: unknown; longTasks: number[]; firstViewMs: number };
|
||||
const w = window as unknown as { scene: unknown; bakes: unknown[]; longTasks: number[]; firstViewMs: number };
|
||||
w.bakes = [];
|
||||
w.longTasks = [];
|
||||
try {
|
||||
new PerformanceObserver((l) => l.getEntries().forEach((e) => w.longTasks.push(e.duration))).observe({
|
||||
|
|
@ -19,6 +21,7 @@ try {
|
|||
const t0 = performance.now();
|
||||
startBackgroundScene({ tier }, {}, {
|
||||
canvas,
|
||||
onBake: (b: unknown) => w.bakes.push(b),
|
||||
} as never).then((scene) => {
|
||||
w.firstViewMs = performance.now() - t0;
|
||||
w.scene = scene;
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<title>Ridge live scene</title>
|
||||
<body style="margin:0;background:#111">
|
||||
<div id="host" style="position:fixed;inset:0;overflow:hidden"><canvas id="c" style="position:absolute;left:0;top:0;width:100%;height:100%"></canvas></div>
|
||||
<script type="module" src="./ridgeLive.ts"></script>
|
||||
</body>
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
// One live ridge scene (tier 'full': the sky plate and the cards on the compositor) filling the window, for a driver to turn and screenshot. Not shipped.
|
||||
// `?h=214` the heading the scene starts at; `?sun=232:22` the sun's compass azimuth and elevation (degrees); `?sky=night` the stars of now (sun below the horizon); `?lines=1` the constellation lines.
|
||||
// `?speed=6` degrees a second the view turns (rotation mode 'both'); 0 holds it. The page offers `window.live`: `hold(h)` turns the view by hand, `pose()` is the heading owner's pose now,
|
||||
// `plate()` the sky plate's element and `left()` its left edge and width on the page.
|
||||
import { parseManifest } from '../../src/app/features/scene/ridge/manifest';
|
||||
import { makePhysicalSky } from '../../src/app/features/scene/ridge/physicalSky';
|
||||
import { createBackdrop } from '../../src/app/features/scene/ridge/Backdrop';
|
||||
import { createRidgeScene } from '../../src/app/features/scene/ridge/Ridge';
|
||||
import { anchor, hold, poseAt } from '../../src/app/features/scene/ridge/heading';
|
||||
import { setCamera } from '../../src/app/features/scene/cameraState';
|
||||
import { HFOV_MAX_DEG, windowFor } from '../../src/app/features/scene/ridge/view';
|
||||
import { paintSky } from '../../src/app/features/scene/ridge/physicalSky';
|
||||
import { nightBodies } from '../../src/app/features/scene/ridge/nightBodies';
|
||||
import { plateCamera, plateSize, SLACK_MIN_DEG } from '../../src/app/features/scene/ridge/skyTurn';
|
||||
|
||||
const q = new URLSearchParams(location.search);
|
||||
/** The main-thread tasks over 50 ms the page saw, ms: `window.longTasks`. */
|
||||
const longTasks: number[] = [];
|
||||
(window as unknown as { longTasks: number[] }).longTasks = longTasks;
|
||||
try {
|
||||
new PerformanceObserver((l) => l.getEntries().forEach((e) => longTasks.push(e.duration))).observe({ entryTypes: ['longtask'] });
|
||||
} catch {
|
||||
// No long-task entries in this browser.
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const index = await (await fetch('/public/ridge/index.json')).json();
|
||||
const dir = `/public/ridge/${index.places[q.get('place') ?? index.default]}/`;
|
||||
const manifest = parseManifest(await (await fetch(`${dir}manifest.json`)).json(), dir);
|
||||
const { view } = manifest;
|
||||
const [az, el] = (q.get('sun') ?? '232:22').split(':').map(Number);
|
||||
const time = new Date();
|
||||
const sun = q.get('sky') === 'night' ? { azimuth: 0, elevation: -30, time } : { azimuth: az, elevation: el, time };
|
||||
const physical = makePhysicalSky(sun, 0, view);
|
||||
const h0 = Number(q.get('h') ?? view.lookAzDeg);
|
||||
anchor(view.place.id, h0, performance.now());
|
||||
setCamera({ mode: 'both', speedDegPerS: Number(q.get('speed') ?? 0), offsetM: 200 });
|
||||
const backdrop = createBackdrop(manifest, physical);
|
||||
await backdrop.ensure({ fromDeg: h0 - HFOV_MAX_DEG, toDeg: h0 + HFOV_MAX_DEG });
|
||||
const canvas = document.getElementById('c') as HTMLCanvasElement;
|
||||
const scene = createRidgeScene({ canvas, tier: 'full', sky: { ...physical.stops, physical }, backdrop, lines: q.get('lines') === '1' });
|
||||
const host = document.getElementById('host') as HTMLElement;
|
||||
// The plate is the host's div whose first child is a canvas (the rig's first child is a div, the rain's has none).
|
||||
const plate = () => [...host.children].find((c) => c.tagName === 'DIV' && c.firstElementChild?.tagName === 'CANVAS');
|
||||
(window as unknown as { live: unknown }).live = {
|
||||
scene,
|
||||
hold: (h: number) => hold(h, performance.now()),
|
||||
pose: () => poseAt(performance.now()),
|
||||
plate,
|
||||
/** Mean ms of the main-thread part of painting one plate here (the dome, its pixels and the bodies, not the canvas upscale), over `n` runs. */
|
||||
plateCost: (n = 10) => {
|
||||
const w = innerWidth;
|
||||
const h = innerHeight;
|
||||
const win = windowFor(view, w, h);
|
||||
const { cssW } = plateSize(win, w, h, devicePixelRatio >= 2 ? 2 : 1, SLACK_MIN_DEG);
|
||||
const t0 = performance.now();
|
||||
for (let i = 0; i < n; i += 1) nightBodies(physical, paintSky(physical, cssW, h, plateCamera(win, 214 + i, SLACK_MIN_DEG)), true);
|
||||
return (performance.now() - t0) / n;
|
||||
},
|
||||
left: () => {
|
||||
const r = plate()?.getBoundingClientRect();
|
||||
return r && { left: r.left, width: r.width };
|
||||
},
|
||||
};
|
||||
document.title = 'ridge live: done';
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
console.error(e);
|
||||
document.title = `ridge live: failed ${e}`;
|
||||
});
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<title>Ridge look sheet</title>
|
||||
<body style="margin:0;background:#111;color:#ddd;font:12px monospace">
|
||||
<div id="sheet" style="padding:8px"></div>
|
||||
<script type="module" src="./ridgeSheet.ts"></script>
|
||||
</body>
|
||||
|
|
@ -1,279 +0,0 @@
|
|||
// Look sheet for the lit ridge cards: a baked place lit for a grid of sky states (or pinned moments) x looks, each cell a small canvas drawn by the app's own still path
|
||||
// (`createRidgeScene` at tier 'still', the tiles of the arc round the heading, each card at `cardPose`). Not shipped.
|
||||
// `?views=214:0:200,0:0:200,100:0:200,214:90:98.2` one column per view `heading:phi:offset` (degrees, degrees, metres) at one sky (`?sky=2`, an index of SKIES, noon by default); a heading
|
||||
// of 360 or 0 is across north. `&sun=100:6` puts the sun of that sky at azimuth 100, 6 degrees up (the stars are always those of the moment the sheet is opened). The offset is clamped to the place's range as the app does (phi 0: the bake's forward bound, any other phi: the worst-case bound), and a phi other than 0 is the offset-only rotation mode, the camera circling the centre.
|
||||
// `?place=vienna` the baked place (index.json's default if absent)
|
||||
// `?preset=all|physical|swiss|poster|painterly|painterly-cel-2|painterly-cel-3|painterly-cel-4` (default all: one row each; painterly is DEFAULT_LOOK); `?looks=<JSON array, url-encoded or base64>` replaces the rows with
|
||||
// the given `{label, ...partial RidgeLook}` entries (inkKeep and reliefLight merge by key). `?w=480` sets the cell width, 16:9 unless `?h=` gives the height (`?w=375&h=812` is a phone).
|
||||
// The sky behind a cell is the app's own: `makePhysicalSky` + `paintSky` upscaled smoothly, with the real stars and the moon (`nightBodies`),
|
||||
// without the sun disc or clouds. Columns are the SKIES below (a sun elevation each, the stars and moon of the moment the sheet was opened), or:
|
||||
// `?moments=2026-11-24T22:00Z,2026-12-09T20:00Z` explicit UTC moments: the sun, moon and stars are those of the moment, the state follows the sun's elevation
|
||||
// `?night=1` the night set: the next new moon, first quarter and full moon from today (or from `?from=YYYY-MM-DD`), each at four night hours
|
||||
// (`?hours=18,21,0,4` UTC), plus deep dusk (sun at -10 degrees) of the evening of the full moon
|
||||
// `?labels=1` DEBUG: label each constellation chain in frame with its d3-celestial abbreviation (fetched from the source repository at run time; not shipped)
|
||||
// `?lines=1` constellation lines over the stars, as the Sky menu's hidden toggle does (night cells only)
|
||||
import { DEFAULT_LOOK, PHYSICAL_LOOK, createLighter } from '../../src/app/features/scene/ridge/lightCards';
|
||||
import type { RidgeLook } from '../../src/app/features/scene/ridge/lightCards';
|
||||
import { parseIndex, parseManifest } from '../../src/app/features/scene/ridge/manifest';
|
||||
import { makePhysicalSky } from '../../src/app/features/scene/ridge/physicalSky';
|
||||
import { HFOV_MAX_DEG, windowFor } from '../../src/app/features/scene/ridge/view';
|
||||
import { onScreen } from '../../src/app/features/scene/ridge/nightBodies';
|
||||
import { createBackdrop } from '../../src/app/features/scene/ridge/Backdrop';
|
||||
import { createRidgeScene } from '../../src/app/features/scene/ridge/Ridge';
|
||||
import { anchor, hold } from '../../src/app/features/scene/ridge/heading';
|
||||
import { setCamera } from '../../src/app/features/scene/cameraState';
|
||||
import { sunAt } from '../../src/app/features/scene/ridge/sunAt';
|
||||
import { linesAt } from '../../src/app/features/scene/ridge/starCatalogue';
|
||||
import { moonPhase } from '../../src/sky/moon.js';
|
||||
import { MOMENT_IDS, momentFor } from '../../src/app/features/scene/ridge/skyMoment';
|
||||
|
||||
|
||||
type Override = Partial<Omit<RidgeLook, 'inkKeep' | 'reliefLight'>> & {
|
||||
label: string;
|
||||
/** The look the unnamed keys come from (DEFAULT_LOOK, the painterly cel look, if absent). */
|
||||
base?: 'physical';
|
||||
inkKeep?: Partial<RidgeLook['inkKeep']>;
|
||||
reliefLight?: Partial<RidgeLook['reliefLight']>;
|
||||
};
|
||||
|
||||
interface Column {
|
||||
label: string;
|
||||
elevation?: number;
|
||||
azimuth?: number;
|
||||
/** A moment: the sun is the real one of it. */
|
||||
time?: Date;
|
||||
/** Where the view faces and the camera stands: heading and phi in degrees, offset in metres. Absent: the rest azimuth, phi 0, the app's default offset. */
|
||||
view?: { h: number; phi: number; r: number };
|
||||
}
|
||||
|
||||
/** Sun elevation and compass azimuth of each column; the cards look at 214 +- 36. The band of the elevation (`skyBand`) picks the display budget. */
|
||||
const SKIES: Column[] = [
|
||||
{ label: 'dawn 2 deg', elevation: 2, azimuth: 100 },
|
||||
{ label: 'morning 15 deg', elevation: 15, azimuth: 135 },
|
||||
{ label: 'noon 55 deg', elevation: 55, azimuth: 190 },
|
||||
{ label: 'golden 6 deg', elevation: 6, azimuth: 244 },
|
||||
{ label: 'dusk -3 deg', elevation: -3, azimuth: 262 },
|
||||
{ label: 'night -30 deg', elevation: -30, azimuth: 0 },
|
||||
];
|
||||
|
||||
/** The art directions, chosen by reasoning, not by eye: Self tunes them (values listed in harness/scene/README.md). */
|
||||
const PRESETS: Record<string, Override> = {
|
||||
physical: { label: 'physical', base: 'physical' },
|
||||
swiss: {
|
||||
label: 'swiss',
|
||||
base: 'physical',
|
||||
reliefLight: { mix: 0.7, azimuthDeg: -45, elevationDeg: 40 },
|
||||
contrastByDistance: 0.9,
|
||||
hazeScale: 6,
|
||||
hazeTint: [0, 0.05, 0.25],
|
||||
nearWarm: 0.5,
|
||||
inkScale: 0.6,
|
||||
},
|
||||
poster: {
|
||||
label: 'poster',
|
||||
base: 'physical',
|
||||
reliefWeight: 0.15,
|
||||
cardToneStep: 0.25,
|
||||
cardGradient: 0.5,
|
||||
inkKeep: { edge: 0.25, occlude: 0.9, crease: 1 },
|
||||
hazeScale: 4,
|
||||
},
|
||||
painterly: { label: 'painterly (default, cel 3)' },
|
||||
'painterly-cel-2': { label: 'painterly-cel-2', celBands: 2 },
|
||||
'painterly-cel-3': { label: 'painterly-cel-3', celBands: 3 },
|
||||
'painterly-cel-4': { label: 'painterly-cel-4', celBands: 4 },
|
||||
};
|
||||
|
||||
const merge = (o: Override): { label: string; look: RidgeLook } => {
|
||||
const { label, base: baseName, inkKeep, reliefLight, ...rest } = o;
|
||||
const base = baseName === 'physical' ? PHYSICAL_LOOK : DEFAULT_LOOK;
|
||||
return {
|
||||
label,
|
||||
look: {
|
||||
...base,
|
||||
...rest,
|
||||
inkKeep: { ...base.inkKeep, ...inkKeep },
|
||||
reliefLight: { ...base.reliefLight, ...reliefLight },
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
function parseLooks(raw: string): Override[] {
|
||||
const tries = [() => decodeURIComponent(raw), () => atob(raw.replace(/-/g, '+').replace(/_/g, '/'))];
|
||||
for (const t of tries) {
|
||||
try {
|
||||
const v = JSON.parse(t());
|
||||
if (Array.isArray(v)) return v.map((e, i) => ({ label: `look ${i + 1}`, ...e }));
|
||||
} catch {
|
||||
// try the next encoding
|
||||
}
|
||||
}
|
||||
throw new Error('looks= is neither a url-encoded nor a base64 JSON array');
|
||||
}
|
||||
|
||||
const q = new URLSearchParams(location.search);
|
||||
|
||||
const HOUR = 3_600_000;
|
||||
/** The first moment at or after `from` the moon's elongation passes `target` degrees (new 0, first quarter 90, full 180). */
|
||||
function nextPhase(from: Date, target: number): Date {
|
||||
const err = (t: number) => ((moonPhase(t).elongationDeg - target + 540) % 360) - 180;
|
||||
let t = from.getTime();
|
||||
while (!(err(t) < 0 && err(t + HOUR) >= 0)) t += HOUR;
|
||||
let a = t;
|
||||
let b = t + HOUR;
|
||||
for (let i = 0; i < 20; i += 1) {
|
||||
const m = (a + b) / 2;
|
||||
if (err(m) < 0) a = m;
|
||||
else b = m;
|
||||
}
|
||||
return new Date(b);
|
||||
}
|
||||
|
||||
/** The first evening moment (UTC hour steps of 10 minutes from `day`) the sun is at `deg` below the horizon, going down. */
|
||||
function sunDownTo(place: Parameters<typeof sunAt>[0], day: Date, deg: number): Date {
|
||||
let t = Date.UTC(day.getUTCFullYear(), day.getUTCMonth(), day.getUTCDate(), 12);
|
||||
while (sunAt(place, new Date(t)).elevation > -deg) t += 10 * 60_000;
|
||||
return new Date(t);
|
||||
}
|
||||
|
||||
const fmt = (d: Date) => d.toISOString().slice(0, 16).replace('T', ' ') + 'Z';
|
||||
|
||||
function momentsFrom(params: URLSearchParams, place: Parameters<typeof sunAt>[0]): Column[] | undefined {
|
||||
const list = params.get('moments');
|
||||
if (list)
|
||||
return list.split(',').map((iso) => {
|
||||
const time = new Date(iso.trim());
|
||||
if (Number.isNaN(time.getTime())) throw new Error(`moments=: ${iso} is not a date`);
|
||||
return { label: fmt(time), time };
|
||||
});
|
||||
// `named=1`: the six named moments of the sky menu (`momentFor`, as the app draws them) on both solstices at the place: the look sheet the elevation table is tuned from.
|
||||
if (params.get('named'))
|
||||
return ['2026-12-21', '2026-06-21'].flatMap((day) =>
|
||||
MOMENT_IDS.map((id) => {
|
||||
const time = momentFor({ kind: 'named', id }, place, new Date(`${day}T12:00:00Z`));
|
||||
return { label: `${id} ${day.slice(5)} ${fmt(time)}`, time };
|
||||
})
|
||||
);
|
||||
if (!params.get('night')) return undefined;
|
||||
const from = params.get('from') ? new Date(`${params.get('from')}T00:00:00Z`) : new Date();
|
||||
const hours = (params.get('hours') ?? '18,21,0,4').split(',').map(Number);
|
||||
const cols: Column[] = [];
|
||||
const phases: [string, number][] = [['new', 0], ['first quarter', 90], ['full', 180]];
|
||||
phases.forEach(([name, deg]) => {
|
||||
const peak = nextPhase(from, deg);
|
||||
const day = Date.UTC(peak.getUTCFullYear(), peak.getUTCMonth(), peak.getUTCDate());
|
||||
hours.forEach((h) => {
|
||||
// Hours before 12 belong to the night that ends the day of the phase, so the hours run on from the evening.
|
||||
const time = new Date(day + (h < 12 ? 24 + h : h) * HOUR);
|
||||
cols.push({ label: `${name} ${fmt(time)}`, time });
|
||||
});
|
||||
if (deg === 180) cols.push({ label: `deep dusk, full moon ${fmt(sunDownTo(place, peak, 10))}`, time: sunDownTo(place, peak, 10) });
|
||||
});
|
||||
return cols;
|
||||
}
|
||||
/** `?views=h:phi:r,...`: one column per view, all at the sky `?sky=` (default noon), whose sun `?sun=az:el` may put elsewhere (compass degrees, degrees above the horizon). */
|
||||
function viewsFrom(params: URLSearchParams): Column[] | undefined {
|
||||
const list = params.get('views');
|
||||
if (!list) return undefined;
|
||||
const [az, el] = (params.get('sun') ?? '').split(':').map(Number);
|
||||
const sky = { ...SKIES[Number(params.get('sky') ?? 2)], ...(Number.isFinite(az) && Number.isFinite(el) ? { azimuth: az, elevation: el } : {}) };
|
||||
return list.split(',').map((v) => {
|
||||
const [h, phi, r] = v.split(':').map(Number);
|
||||
return { ...sky, label: `h ${h} phi ${phi} r ${r}`, view: { h, phi, r } };
|
||||
});
|
||||
}
|
||||
const preset = q.get('preset');
|
||||
const pinned = q.get('moments') || q.get('night');
|
||||
const rows = (q.get('looks')
|
||||
? parseLooks(q.get('looks') as string)
|
||||
: preset && preset !== 'all'
|
||||
? [PRESETS[preset] ?? PRESETS.physical]
|
||||
: pinned
|
||||
? [PRESETS.painterly] // a night set is read in the default look unless a preset or looks say otherwise
|
||||
: Object.values(PRESETS)
|
||||
).map(merge);
|
||||
const withLines = q.get('lines') === '1';
|
||||
const LINES_JSON = 'https://raw.githubusercontent.com/ofrohn/d3-celestial/master/data/constellations.lines.json';
|
||||
/** Debug: the constellation id of each packed chain, in the generator's order (feature by feature, chain by chain). */
|
||||
async function chainIds(): Promise<string[]> {
|
||||
const gj = await (await fetch(LINES_JSON)).json();
|
||||
return gj.features.flatMap((f: { id: string; geometry: { coordinates: unknown[] } }) => f.geometry.coordinates.map(() => f.id));
|
||||
}
|
||||
const W = Number(q.get('w') ?? 480);
|
||||
const H = q.get('h') ? Number(q.get('h')) : Math.round((W * 9) / 16);
|
||||
const root = document.getElementById('sheet') as HTMLElement;
|
||||
|
||||
async function main() {
|
||||
const index = parseIndex(await (await fetch('/public/ridge/index.json')).json());
|
||||
const DIR = `/public/ridge/${index.places[q.get('place') ?? index.default] ?? index.places[index.default]}/`;
|
||||
const manifest = parseManifest(await (await fetch(`${DIR}manifest.json`)).json(), DIR);
|
||||
const { view } = manifest;
|
||||
const win = windowFor(view, W, H);
|
||||
const now = new Date();
|
||||
const columns = viewsFrom(q) ?? momentsFrom(q, view.place) ?? SKIES;
|
||||
const ids = q.get('labels') === '1' ? await chainIds() : undefined;
|
||||
|
||||
const table = document.createElement('table');
|
||||
table.style.borderSpacing = '4px';
|
||||
root.append(table);
|
||||
const head = table.insertRow();
|
||||
head.insertCell();
|
||||
columns.forEach((c) => (head.insertCell().textContent = c.label));
|
||||
const tr = rows.map((r) => {
|
||||
const row = table.insertRow();
|
||||
row.insertCell().textContent = r.label;
|
||||
return row;
|
||||
});
|
||||
|
||||
for (const col of columns) {
|
||||
const time = col.time ?? now;
|
||||
const sun =
|
||||
col.time !== undefined
|
||||
? sunAt(view.place, col.time)
|
||||
: { elevation: col.elevation as number, azimuth: col.azimuth as number, time };
|
||||
const physical = makePhysicalSky(sun, 0, view);
|
||||
const sky = { ...physical.stops, physical };
|
||||
const v = col.view ?? { h: view.lookAzDeg, phi: 0, r: 200 };
|
||||
|
||||
for (let r = 0; r < rows.length; r += 1) {
|
||||
// A host as the page has one: a positioned box of the cell's size holding the canvas the scene paints.
|
||||
const host = document.createElement('div');
|
||||
Object.assign(host.style, { position: 'relative', width: `${W}px`, height: `${H}px`, overflow: 'hidden' });
|
||||
const cell = document.createElement('canvas');
|
||||
Object.assign(cell.style, { position: 'absolute', left: '0', top: '0', width: '100%', height: '100%' });
|
||||
host.append(cell);
|
||||
tr[r].insertCell().append(host);
|
||||
|
||||
// The heading owner as the app leaves it: this view's heading, the camera on its circle at phi (offset-only rotation), the offset the viewer chose.
|
||||
const t0 = performance.now() - 3_600_000;
|
||||
anchor(`sheet-${manifest.bakeId}-${columns.indexOf(col)}-${r}`, v.h, t0); // a key of its own: every cell starts from phi 0
|
||||
setCamera({ mode: 'offset', speedDegPerS: 1, offsetM: v.r }, t0); // the offset-only rotation mode for phi seconds at 1 degree per second ...
|
||||
hold(v.h, t0 + v.phi * 1000); // ... then the view is held at h: the mode is still, the camera stays at phi (phi 0 is the camera on its heading)
|
||||
|
||||
const backdrop = createBackdrop(manifest, physical, { lighter: (m, s) => createLighter(m, s, rows[r].look) });
|
||||
await backdrop.ensure({ fromDeg: v.h - HFOV_MAX_DEG, toDeg: v.h + HFOV_MAX_DEG });
|
||||
const scene = createRidgeScene({ canvas: cell, tier: 'still', sky, backdrop, lines: withLines });
|
||||
scene?.dispose();
|
||||
|
||||
if (ids) {
|
||||
// Debug labels: each chain's id at the mean of its vertices that lie in the frame.
|
||||
const ctx = cell.getContext('2d') as CanvasRenderingContext2D;
|
||||
ctx.font = '11px monospace';
|
||||
ctx.fillStyle = '#ffd24a';
|
||||
linesAt(physical.sun.time, view.place.lat, view.place.lon).forEach((chain, i) => {
|
||||
const pts = chain.map((p) => onScreen(win.camera, p.azimuth, p.elevation)).filter((a) => a.x >= 0 && a.x <= 1 && a.y >= 0 && a.y <= 1);
|
||||
if (!pts.length) return;
|
||||
const mx = pts.reduce((a, p) => a + p.x, 0) / pts.length;
|
||||
const my = pts.reduce((a, p) => a + p.y, 0) / pts.length;
|
||||
ctx.fillText(`${ids[i]} ${pts.length}/${chain.length}`, mx * W, my * H);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
document.title = 'ridge look sheet: done';
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
console.error(e);
|
||||
root.textContent = `ridge look sheet failed: ${e}`;
|
||||
});
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 490 B |
|
Before Width: | Height: | Size: 328 B |
|
Before Width: | Height: | Size: 540 B |
|
Before Width: | Height: | Size: 732 B |
|
Before Width: | Height: | Size: 370 B |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 638 B |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 678 B |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 522 B |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 688 B |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 644 B |
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 546 B |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 988 B |
|
Before Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 932 B |
|
Before Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 838 B |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 974 B |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 974 B |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 962 B |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 852 B |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 914 B |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 558 B |
|
Before Width: | Height: | Size: 326 B |
|
Before Width: | Height: | Size: 550 B |
|
Before Width: | Height: | Size: 282 B |
|
Before Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |