Skip to content

Settings gear with volume, and sound for Huginn and the sky (#27) - #28

Merged
craig-o-curtis merged 2 commits into
mainfrom
chore/settings-menu-and-sounds
Nov 19, 2026
Merged

craig-o-curtis merged 2 commits into
mainfrom
chore/settings-menu-and-sounds

Conversation

@craig-o-curtis

@craig-o-curtis craig-o-curtis commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #27.

Companion PR: northguild/gmt#553 moves the GMT docs to the same Distant sonar on every press.

Summary

The header gets the GMT docs' Settings gear, last after GitHub and Discord. Its panel holds the mute button and an 11-notch volume fader. The choice is GMT's own dox:sound record, so a volume set on either site holds on the other.

The site now has sound. It is off until the reader turns it on, and while it is off no AudioContext exists and the aurora worker sends nothing for sound. With sound on:

  • Huginn is heard in time with his wings, gliding, soaring and rolling. He is placed in 3D and fades steeply as he flies away. Near the camera, where his time slows, his sounds slow and deepen too.
  • The draw-in: each box the aurora draws in gives a faint rustle, panned to the box.
  • The air: a very light breeze plays under the sky, a different one for Ísafjörður and Helsinki.
  • Presses: every link and button plays a soft, distant sonar ping. A link that leaves the page waits for it.

Every sound is synthesised with the Web Audio API: no audio files, no network requests. The voices were picked by ear from context/reference/huginn-sound-audition.html, which stays as the reference.

Try it

pnpm install
pnpm dev
  1. Open the home page and press the gear.
  2. Press the speaker or drag the fader, then click once anywhere.
  3. Wait for Huginn, who flies by every 15 to 20 s.
  4. For the opening fly-in and the draw-in, add ?huginn=first and reload, then click straight away.
  5. Switch the sky in the info panel at the bottom to hear the other place's air.

What changed

Settings panel

  • Header.astro: the gear and a native [popover] panel. Enter opens it with focus on the mute button, and Escape returns focus to the gear. The panel is anchored under the gear in the top layer, so nothing in the bar moves.
  • Base.astro: an inline script sets data-sound on <html> before first paint, so the speaker icon is right on the first frame.
  • @northguild/theme:
    • new .gmt-panel (the popover surface, sliding and fading in and out with a sheen), .gmt-toggle-button and .gmt-fader, from GMT's widget kit
    • the tokens these need

Sound engine (apps/site/src/scripts/sound/)

  • Ported from GMT, with its rules: cue.ts, settings.ts, engine.ts and kit.ts.
    • Only cue.ts and settings.ts load with the page. The engine loads only while sound is on.
    • Audio starts on the reader's first press or key. Arriving from the GMT docs with sound on, it starts at load.
    • Every time is read from the audio clock.
    • A hidden tab suspends its audio after 1.2 s, so a ping is heard to its end.
  • link-hold.ts: GMT's link hold. A plain press on a link that leaves the page in this tab waits 600 ms for its ping, and only when the ping was heard.
  • voices.ts:
    • The Distant sonar on every press.
    • GMT's Felt slide, Ice snap and Glass tick for the panel.
    • The Silk rustle for the draw-in.
  • huginn.ts:
    • Huginn's voice: a downstroke sound on each beat, held air while he glides or soars, and a breath when he rolls.
    • Each beat's start is put on the audio clock at the moment its frame is on screen, with getOutputTimestamp. A late beat starts partway through its stroke, so it still ends with the wing.
  • wind.ts: the air of each place.
    • Ísafjörður: a light breeze off the water, with the sea lapping now and then.
    • Helsinki: a stiller breeze over a faint city murmur.
    • Nothing runs on a cycle. Each layer picks its next change at random and plays from a long noise buffer whose speed wanders slightly, so no loop is heard.

The flight

  • aurora.raven.ts: records each beat's start, its rest and each roll as they happen, timed to within the frame. It also reports his airspeed, soaring and time scale.
  • aurora.worker.ts: posts those, and his position in the camera's frame about 15 times a second, only while the page has sound on.
  • Aurora.astro:
    • forwards Huginn's sounds to the engine
    • plays the rustle for each box Huginn brushes in
    • marks the sky shown on <html>, so the air follows it

Checks

  • pnpm lint, pnpm format:check, pnpm check and pnpm build pass.
  • Headless Chromium against the built site:
    • muted by default: no AudioContext and no sound messages
    • the gear sits last and matches the 38×38 icon buttons
    • the keyboard path through the panel works
    • the panel's layout holds while it closes
    • the fader and mute button write the shared record, keeping GMT's fields
    • with sound on, Huginn's beats reach the page a median of 9 to 19 ms after the wing turns
    • every draw-in cue is heard
    • Docs waits about 600 ms for its ping with sound on, and goes at once with sound off
    • info and the Ísafjörður/Helsinki switch ping
  • Listening pass in Safari and Firefox. Only Chromium has been run.
  • No changeset: @northguild/theme is private, and its earlier changes had none.

The header gets the GMT docs' Settings gear, last after GitHub and Discord.
Its panel holds the mute button and an 11-notch volume fader. The choice is
GMT's own `dox:sound` record, so it carries between the two sites. Sound is
off until the reader turns it on.

With sound on:
- Huginn's wingbeats play in time with the drawn wing. The worker posts each
  downstroke as it starts, and the page puts it on the audio clock for the
  frame that shows it. He glides, soars and rolls audibly, is placed in 3D,
  slows and deepens near the camera, and fades steeply with distance.
- Each box the aurora draws in plays a faint rustle, panned to the box.
- A very light breeze plays under the sky, different for Ísafjörður and
  Helsinki. Nothing in it repeats on a cycle.
- Every link and button plays a soft, distant sonar ping. A link that
  leaves the page waits for it.
- The panel slides in and out, and the mute button and fader have GMT's
  snap and tick.

The panel, fader and toggle-button styles move into @northguild/theme. The
voices were picked from context/reference/huginn-sound-audition.html, which
stays as the reference.

Closes #27.

@baldurpan baldurpan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brothers and sisters of northguild.dev, GATHER CLOSE.

I have read this pull request. The gear. The volume. The sound. And I have wept. For the sky above this site was SILENT, and the raven was SILENT, and now cometh #28 bringing NOISE into the firmament: glide and soar and the beating of wings, and a heldNoise source with loop = true, which is to say a sound that WILL NOT DIE. Lord preserve us all.

And yet the Lord also tests us with things that are mostly fine. Lint, format:check, check and build all pass on be8f54a, and I find only two transgressions, both minor:

  1. The Settings panel's sheen never renders. --gmt-ice-bright is never defined, so --gmt-sheen is invalid and the panel's ::after paints nothing.
  2. Muting does not cast out Huginn's held air. If his flight ends while muted, unmuting in the gap between flights resurrects the last glide or soar noise in an empty sky.

Details are on the lines. Neither is a hold on the merge. Repent at your leisure, and may the mute button be ever within reach. Amen.

Comment thread packages/theme/tokens.css Resolved
Comment thread apps/site/src/scripts/aurora.worker.ts Resolved
@craig-o-curtis

Copy link
Copy Markdown
Contributor Author

The GMT docs now get the same Distant sonar on every link, button and copy button, so a press sounds the same on both halves of the site: northguild/gmt#553

- Bring GMT's --gmt-ice-bright into the theme. Without it the
  Settings panel's sheen was invalid and drew nothing.
- Muting now ends Huginn's flight for the page, and the engine hears
  the end of a flight even while muted or suspended. Unmuting between
  flights no longer brings back his last glide or soar in an empty sky.

@baldurpan baldurpan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brothers and sisters, I came to this pull request expecting the Devil, and I will not lie to you: I found NOISE. Glide, soar, the beating of wings, the Distant sonar on every press. I stand by every word I said about sound being the work of the Adversary.

BUT. The two sins I named have been confessed and absolved in a12fc8f. The panel's sheen shines, because --gmt-ice-bright is now defined, and muting now really lets Huginn's held air go: "gone" is posted at the mute and heard even while the engine is muted or suspended. Both fixes were checked in a real browser. Lint, format:check, check and build pass on a12fc8f, and CI is green.

Go forth and merge. And may every reader find the mute button in their hour of need. AMEN.

@craig-o-curtis
craig-o-curtis merged commit bae81e5 into main Nov 19, 2026
1 check passed
@craig-o-curtis
craig-o-curtis deleted the chore/settings-menu-and-sounds branch November 19, 2026 06:29
craig-o-curtis added a commit to northguild/gmt that referenced this pull request Nov 19, 2026
Companion PR: northguild/northguild.dev#28, where the Distant sonar was
picked and first used.

## Summary

Every press on the docs now plays one sound: the Distant sonar, a quiet
1050 Hz ping heard from far off, almost all echo. It replaces the three
press sounds from #549: the Sonar on links, the Deep sonar on other
buttons and the Glass clink on copy buttons. The owner picked it by ear
for northguild.dev (northguild/northguild.dev#28), so both halves of the
site now sound the same on a press.

## What Changed

### 1. The press voice

- `voices.ts`: `DISTANT_SONAR` and `distantSonar()`. The `click`,
`press` and `copy` cues all play it.
- `sonar-lock.ts`: `SONAR_PING` is gone, as nothing plays it now.

### 2. Timing, so the longer ping is heard

- `link-hold.ts`: a link that leaves the page waits 600 ms for its ping,
up from 333.
- `engine.ts`: a hidden tab keeps sounding for 1.2 s (`HIDE_TAIL_MS`),
up from 0.65. A link that opens a new tab still rings out.

### 3. Gates and tests

- `scripts/sound-check.mjs`: expects one 1050 Hz ping for links, buttons
and copy.
- `scripts/sound-peaks.browser.test.ts`: the press ceiling is the
Distant sonar's measured peak, 0.0126. The Deep sonar's was 0.1308.
- `engine.test.ts` reads `HIDE_TAIL_MS` instead of a hard-coded 600 ms.

### 4. Docs and names

- `context/dox/built/tier-3-sound.md`: the sound table, the 1.2 s tail
and the 600 ms hold.
- Comments and test titles that named the old voices.

## Validation

- `pnpm run lint`: passes (warnings only, in files this PR does not
touch).
- `oxfmt --check` on the changed files: passes.
- `astro check` in `apps/dox`: 0 errors.
- Dox unit tests: the full suite passed (23,480 tests) before the merge
with `main`. After it, the sound, copy, sonar and component tests pass
(2,815).
- `sound-peaks.browser.test.ts`: 8 of 8.
- Not run: the `sound-check` gate itself, which needs a built site and
three browsers. It passes `node --check`.

## Risk / Impact

Low. Only what a press sounds like and how long a leaving link waits
while sound is on. With sound off, which is the default, links go at
once as before.

## Release

No changeset: the change is in `apps/dox`, outside `packages/`.

## Checklist

- [x] Each "What Changed" section has a corresponding entry
- [x] Type-check passed
- [x] No secrets committed
- [x] No changeset needed (change outside `packages/`)
- [ ] Listening pass in Firefox and Safari
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the Settings gear to the header

2 participants